25# include "levelSetKernel.hpp"
27# include "bitpit_CG.hpp"
62 initializeCommunicator();
122 bool isDirty =
false;
124 if( adaptionInfo.entity != adaption::Entity::ENTITY_CELL){
133 if (isMeshPartitioned) {
134 MPI_Allreduce(MPI_IN_PLACE, &isDirty, 1, MPI_C_BOOL, MPI_LOR,
getCommunicator());
148 initializeCommunicator();
166 std::array<double,3> minPoint;
167 std::array<double,3> maxPoint;
196 std::array<double,3> cellBoxMin;
197 std::array<double,3> cellBoxMax;
203# if BITPIT_ENABLE_MPI
208void LevelSetKernel::initializeCommunicator()
212 if (communicator == MPI_COMM_NULL) {
213 throw std::runtime_error (
"Levelset communicator is not valid");
220 if (comparison == MPI_IDENT || comparison == MPI_CONGRUENT) {
223 throw std::runtime_error (
"Levelset communicator cannot be modified.");
234void LevelSetKernel::freeCommunicator() {
241 MPI_Finalized(&finalizedCalled);
242 if (finalizedCalled) {
276 std::unique_ptr<DataCommunicator> dataCommunicator;
281 return dataCommunicator;
312 if (!cacheItem.hasCache()) {
317 cacheItem.destroyCache();
319 cacheItem.getCache()->clear();
364 if (adaptionInfo.entity != adaption::Entity::ENTITY_CELL) {
369 if (!cacheItem.hasCache()) {
374 cache->
erase(adaptionInfo.previous);
379 if (!cacheItem.hasCache()) {
387 cache->shrink_to_fit();
The DataCommunicator class provides the infrastructure needed to exchange data among processes.
The class ElementCacheCollection allows to store a collection of caches for the elements of a mesh.
The class LevelSetCache is the base class for defining caches.
std::size_t erase(const Keys &keys)
LevelSetCachedKernel(VolumeKernel *, LevelSetFillIn fillIn)
bool update(const std::vector< adaption::Info > &) override
CellCacheCollection & getCellCacheCollection()
void clearCaches(bool release=false)
std::unique_ptr< CellCacheCollection > m_cellCacheCollection
Mesh specific implementation to calculate the levelset function.
bool isCommunicatorSet() const
virtual ~LevelSetKernel()
virtual VolumeKernel * getMesh() const
LevelSetFillIn getExpectedFillIn() const
virtual bool update(const std::vector< adaption::Info > &)
double getDistanceTolerance() const
double isCellInsideBoundingBox(long, const std::array< double BITPIT_COMMA 3 > &, const std::array< double, 3 > &) const
virtual bool intersectCellPlane(long, const std::array< double, 3 > &, const std::array< double, 3 > &, double)
MPI_Comm getCommunicator() const
bool isPointInCell(long, const std::array< double, 3 > &) const
std::unique_ptr< DataCommunicator > createDataCommunicator() const
LevelSetFillIn m_expectedFillIn
PiercedVector< Cell > & getCells()
virtual void evalCellBoundingBox(long id, std::array< double, 3 > *minPoint, std::array< double, 3 > *maxPoint) const
const MPI_Comm & getCommunicator() const
bool isPartitioned() const
The VolumeKernel class provides an interface for defining volume patches.
bool isPointInside(double x, double y, double z) const
bool intersectPlaneBox(array3D const &, array3D const &, array3D const &, array3D const &, int dim=3, const double distanceTolerance=DEFAULT_DISTANCE_TOLERANCE)
bool intersectBoxBox(array3D const &, array3D const &, array3D const &, array3D const &, int dim=3, const double distanceTolerance=DEFAULT_DISTANCE_TOLERANCE)
The Info struct defines the information associated to an adaption.