From 5eb416d0c4d212872fc9c5f9b14516b9d97c0b2d Mon Sep 17 00:00:00 2001 From: Andrea Iob Date: Fri, 3 Feb 2023 11:42:36 +0100 Subject: [PATCH 1/5] lineunstructured: avoid duplicating base class functions --- src/lineunstructured/lineunstructured.cpp | 14 -------------- src/lineunstructured/lineunstructured.hpp | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/lineunstructured/lineunstructured.cpp b/src/lineunstructured/lineunstructured.cpp index 5748711fe8..aefd88e5fd 100644 --- a/src/lineunstructured/lineunstructured.cpp +++ b/src/lineunstructured/lineunstructured.cpp @@ -152,20 +152,6 @@ std::unique_ptr LineUnstructured::clone() const return std::unique_ptr(new LineUnstructured(*this)); } -/*! - * Enables or disables expert mode. - * - * When expert mode is enabled, it will be possible to change the - * patch using low level functions (e.g., it will be possible to - * add individual cells, add vertices, delete cells, ...). - * - * \param expert if true, the expert mode will be enabled - */ -void LineUnstructured::setExpert(bool expert) -{ - LineKernel::setExpert(expert); -} - /*! * Get the version associated to the binary dumps. * diff --git a/src/lineunstructured/lineunstructured.hpp b/src/lineunstructured/lineunstructured.hpp index c3b9516022..a98a22bad8 100644 --- a/src/lineunstructured/lineunstructured.hpp +++ b/src/lineunstructured/lineunstructured.hpp @@ -55,7 +55,7 @@ class LineUnstructured : public LineKernel { std::unique_ptr clone() const override; // Setters - void setExpert(bool expert); + using LineKernel::setExpert; // Search algorithms long locatePoint(const std::array &point) const override; From 62541d33315a0ab6a37ee7e7eba45672a0be813d Mon Sep 17 00:00:00 2001 From: Andrea Iob Date: Fri, 3 Feb 2023 11:42:48 +0100 Subject: [PATCH 2/5] surfunstructured: avoid duplicating base class functions --- src/surfunstructured/surfunstructured.cpp | 14 -------------- src/surfunstructured/surfunstructured.hpp | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/surfunstructured/surfunstructured.cpp b/src/surfunstructured/surfunstructured.cpp index b3eea69d36..e0377180be 100644 --- a/src/surfunstructured/surfunstructured.cpp +++ b/src/surfunstructured/surfunstructured.cpp @@ -161,20 +161,6 @@ std::unique_ptr SurfUnstructured::clone() const return std::unique_ptr(new SurfUnstructured(*this)); } -/*! - * Enables or disables expert mode. - * - * When expert mode is enabled, it will be possible to change the - * patch using low level functions (e.g., it will be possible to - * add individual cells, add vertices, delete cells, ...). - * - * \param expert if true, the expert mode will be enabled - */ -void SurfUnstructured::setExpert(bool expert) -{ - SurfaceKernel::setExpert(expert); -} - /*! * Get the version associated to the binary dumps. * diff --git a/src/surfunstructured/surfunstructured.hpp b/src/surfunstructured/surfunstructured.hpp index 749344cd0b..f72b4b0c03 100644 --- a/src/surfunstructured/surfunstructured.hpp +++ b/src/surfunstructured/surfunstructured.hpp @@ -55,7 +55,7 @@ class SurfUnstructured : public SurfaceKernel { std::unique_ptr clone() const override; // Setters - void setExpert(bool expert); + using SurfaceKernel::setExpert; // Search algorithms long locatePoint(const std::array &point) const override; From fceca7545ce51c81924777dc469df0336b79ed52 Mon Sep 17 00:00:00 2001 From: Andrea Iob Date: Fri, 3 Feb 2023 11:43:01 +0100 Subject: [PATCH 3/5] volunstructured: avoid duplicating base class functions --- src/volunstructured/volunstructured.cpp | 14 -------------- src/volunstructured/volunstructured.hpp | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/volunstructured/volunstructured.cpp b/src/volunstructured/volunstructured.cpp index b55f4037b6..c59708d16a 100644 --- a/src/volunstructured/volunstructured.cpp +++ b/src/volunstructured/volunstructured.cpp @@ -135,20 +135,6 @@ std::unique_ptr VolUnstructured::clone() const return std::unique_ptr(new VolUnstructured(*this)); } -/*! - * Enables or disables expert mode. - * - * When expert mode is enabled, it will be possible to change the - * patch using low level functions (e.g., it will be possible to - * add individual cells, add vertices, delete cells, ...). - * - * \param expert if true, the expert mode will be enabled - */ -void VolUnstructured::setExpert(bool expert) -{ - VolumeKernel::setExpert(expert); -} - /*! Evaluates the volume of the specified cell. diff --git a/src/volunstructured/volunstructured.hpp b/src/volunstructured/volunstructured.hpp index ab04346738..4e85137e22 100644 --- a/src/volunstructured/volunstructured.hpp +++ b/src/volunstructured/volunstructured.hpp @@ -50,7 +50,7 @@ class VolUnstructured : public VolumeKernel { std::unique_ptr clone() const override; - void setExpert(bool expert); + using VolumeKernel::setExpert; double evalCellVolume(long id) const override; double evalCellSize(long id) const override; From 8a06cbed8479501d967d5bcbc39fd915aa6db082 Mon Sep 17 00:00:00 2001 From: Andrea Iob Date: Wed, 10 Apr 2024 15:25:36 +0200 Subject: [PATCH 4/5] patchkernel: explicitly define the adaption mode Adaption mode tells if the patch can be adapted and which strategies can be used to adapt the patch. The following adaption modes are supported: - disabled, no adaption can be performed; - automatic, adaption is performed specifying which cells should be refined/coarsen and then the patch will perform all the alterations needed to fulfill the adaption requests; - manual, this mode allows to use low level function to add and delete individual cells and vertices. It's up to the user to guarantee the consistency of the patch. --- src/lineunstructured/lineunstructured.cpp | 16 +- src/patchkernel/line_kernel.cpp | 36 +-- src/patchkernel/line_kernel.hpp | 12 +- src/patchkernel/patch_kernel.cpp | 222 +++++++++++------- src/patchkernel/patch_kernel.hpp | 35 ++- src/patchkernel/patch_kernel.tpp | 6 +- src/patchkernel/patch_kernel_parallel.cpp | 14 +- src/patchkernel/point_kernel.cpp | 36 +-- src/patchkernel/point_kernel.hpp | 12 +- src/patchkernel/surface_kernel.cpp | 36 +-- src/patchkernel/surface_kernel.hpp | 12 +- src/patchkernel/volume_kernel.cpp | 36 +-- src/patchkernel/volume_kernel.hpp | 12 +- src/pointcloud/pointcloud.cpp | 30 +-- src/pointcloud/pointcloud.hpp | 2 +- src/surfunstructured/surfunstructured.cpp | 16 +- src/volcartesian/volcartesian.cpp | 38 +-- src/voloctree/voloctree.cpp | 37 ++- src/volunstructured/volunstructured.cpp | 8 +- .../test_surfunstructured_00001.cpp | 32 --- .../test_surfunstructured_00002.cpp | 11 - .../test_surfunstructured_00003.cpp | 22 -- .../test_surfunstructured_00004.cpp | 23 -- .../test_surfunstructured_00007.cpp | 1 - .../test_surfunstructured_00008.cpp | 1 - .../test_surfunstructured_00009.cpp | 1 - .../test_surfunstructured_parallel_00001.cpp | 12 - .../test_surfunstructured_parallel_00006.cpp | 1 - .../test_surfunstructured_parallel_00007.cpp | 2 - 29 files changed, 339 insertions(+), 383 deletions(-) diff --git a/src/lineunstructured/lineunstructured.cpp b/src/lineunstructured/lineunstructured.cpp index aefd88e5fd..0c712faa39 100644 --- a/src/lineunstructured/lineunstructured.cpp +++ b/src/lineunstructured/lineunstructured.cpp @@ -50,13 +50,13 @@ namespace bitpit { among the processes */ LineUnstructured::LineUnstructured(MPI_Comm communicator) - : LineKernel(communicator, 1, true) + : LineKernel(communicator, 1, ADAPTION_MANUAL) #else /*! Creates an uninitialized serial patch. */ LineUnstructured::LineUnstructured() - : LineKernel(true) + : LineKernel(ADAPTION_MANUAL) #endif { } @@ -74,7 +74,7 @@ LineUnstructured::LineUnstructured() among the processes */ LineUnstructured::LineUnstructured(int dimension, MPI_Comm communicator) - : LineKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, 1, true) + : LineKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, 1, ADAPTION_MANUAL) #else /*! Creates a patch. @@ -82,7 +82,7 @@ LineUnstructured::LineUnstructured(int dimension, MPI_Comm communicator) \param dimension is the dimension of the patch */ LineUnstructured::LineUnstructured(int dimension) - : LineKernel(PatchManager::AUTOMATIC_ID, dimension, true) + : LineKernel(PatchManager::AUTOMATIC_ID, dimension, ADAPTION_MANUAL) #endif { } @@ -101,7 +101,7 @@ LineUnstructured::LineUnstructured(int dimension) among the processes */ LineUnstructured::LineUnstructured(int id, int dimension, MPI_Comm communicator) - : LineKernel(id, dimension, communicator, 1, true) + : LineKernel(id, dimension, communicator, 1, ADAPTION_MANUAL) #else /*! Creates a patch. @@ -110,7 +110,7 @@ LineUnstructured::LineUnstructured(int id, int dimension, MPI_Comm communicator) \param dimension is the dimension of the patch */ LineUnstructured::LineUnstructured(int id, int dimension) - : LineKernel(id, dimension, true) + : LineKernel(id, dimension, ADAPTION_MANUAL) #endif { } @@ -127,7 +127,7 @@ LineUnstructured::LineUnstructured(int id, int dimension) among the processes */ LineUnstructured::LineUnstructured(std::istream &stream, MPI_Comm communicator) - : LineKernel(communicator, 1, false) + : LineKernel(communicator, 1, ADAPTION_MANUAL) #else /*! Creates a patch restoring the patch saved in the specified stream. @@ -135,7 +135,7 @@ LineUnstructured::LineUnstructured(std::istream &stream, MPI_Comm communicator) \param stream is the stream to read from */ LineUnstructured::LineUnstructured(std::istream &stream) - : LineKernel(false) + : LineKernel(ADAPTION_MANUAL) #endif { // Restore the patch diff --git a/src/patchkernel/line_kernel.cpp b/src/patchkernel/line_kernel.cpp index 2faee59b66..436d6c6e71 100644 --- a/src/patchkernel/line_kernel.cpp +++ b/src/patchkernel/line_kernel.cpp @@ -40,18 +40,18 @@ namespace bitpit { will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -LineKernel::LineKernel(MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(communicator, haloSize, expert) +LineKernel::LineKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(communicator, haloSize, adaptionMode) #else /*! Creates a patch. - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -LineKernel::LineKernel(bool expert) - : PatchKernel(expert) +LineKernel::LineKernel(AdaptionMode adaptionMode) + : PatchKernel(adaptionMode) #endif { initialize(); @@ -71,19 +71,19 @@ LineKernel::LineKernel(bool expert) will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -LineKernel::LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(dimension, communicator, haloSize, expert) +LineKernel::LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(dimension, communicator, haloSize, adaptionMode) #else /*! Creates a patch. \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -LineKernel::LineKernel(int dimension, bool expert) - : PatchKernel(dimension, expert) +LineKernel::LineKernel(int dimension, AdaptionMode adaptionMode) + : PatchKernel(dimension, adaptionMode) #endif { initialize(); @@ -104,20 +104,20 @@ LineKernel::LineKernel(int dimension, bool expert) will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -LineKernel::LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(id, dimension, communicator, haloSize, expert) +LineKernel::LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(id, dimension, communicator, haloSize, adaptionMode) #else /*! Creates a patch. \param id is the id that will be assigned to the patch \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -LineKernel::LineKernel(int id, int dimension, bool expert) - : PatchKernel(id, dimension, expert) +LineKernel::LineKernel(int id, int dimension, AdaptionMode adaptionMode) + : PatchKernel(id, dimension, adaptionMode) #endif { } diff --git a/src/patchkernel/line_kernel.hpp b/src/patchkernel/line_kernel.hpp index afbaf2a68f..79c8f68ed0 100644 --- a/src/patchkernel/line_kernel.hpp +++ b/src/patchkernel/line_kernel.hpp @@ -49,13 +49,13 @@ class LineKernel : public PatchKernel { protected: #if BITPIT_ENABLE_MPI==1 - LineKernel(MPI_Comm communicator, std::size_t haloSize, bool expert); - LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert); - LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert); + LineKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); #else - LineKernel(bool expert); - LineKernel(int dimension, bool expert); - LineKernel(int id, int dimension, bool expert); + LineKernel(AdaptionMode adaptionMode); + LineKernel(int dimension, AdaptionMode adaptionMode); + LineKernel(int id, int dimension, AdaptionMode adaptionMode); #endif }; diff --git a/src/patchkernel/patch_kernel.cpp b/src/patchkernel/patch_kernel.cpp index d6cca8f0cd..7c8e28c930 100644 --- a/src/patchkernel/patch_kernel.cpp +++ b/src/patchkernel/patch_kernel.cpp @@ -65,18 +65,18 @@ namespace bitpit { will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PatchKernel::PatchKernel(MPI_Comm communicator, std::size_t haloSize, bool expert) +PatchKernel::PatchKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) #else /*! Creates a patch. - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PatchKernel::PatchKernel(bool expert) +PatchKernel::PatchKernel(AdaptionMode adaptionMode) #endif - : m_expert(expert) + : m_adaptionMode(adaptionMode) { // Initialize the patch #if BITPIT_ENABLE_MPI==1 @@ -107,19 +107,19 @@ PatchKernel::PatchKernel(bool expert) will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PatchKernel::PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert) +PatchKernel::PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) #else /*! Creates a patch. \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PatchKernel::PatchKernel(int dimension, bool expert) +PatchKernel::PatchKernel(int dimension, AdaptionMode adaptionMode) #endif - : m_expert(expert) + : m_adaptionMode(adaptionMode) { // Initialize the patch #if BITPIT_ENABLE_MPI==1 @@ -154,20 +154,20 @@ PatchKernel::PatchKernel(int dimension, bool expert) will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PatchKernel::PatchKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert) +PatchKernel::PatchKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) #else /*! Creates a patch. \param id is the id that will be assigned to the patch \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PatchKernel::PatchKernel(int id, int dimension, bool expert) +PatchKernel::PatchKernel(int id, int dimension, AdaptionMode adaptionMode) #endif - : m_expert(expert) + : m_adaptionMode(adaptionMode) { // Initialize the patch #if BITPIT_ENABLE_MPI==1 @@ -226,8 +226,8 @@ PatchKernel::PatchKernel(const PatchKernel &other) m_adjacenciesBuildStrategy(other.m_adjacenciesBuildStrategy), m_interfacesBuildStrategy(other.m_interfacesBuildStrategy), m_spawnStatus(other.m_spawnStatus), + m_adaptionMode(other.m_adaptionMode), m_adaptionStatus(other.m_adaptionStatus), - m_expert(other.m_expert), m_dimension(other.m_dimension), m_toleranceCustom(other.m_toleranceCustom), m_tolerance(other.m_tolerance) @@ -312,8 +312,8 @@ PatchKernel::PatchKernel(PatchKernel &&other) m_adjacenciesBuildStrategy(std::move(other.m_adjacenciesBuildStrategy)), m_interfacesBuildStrategy(std::move(other.m_interfacesBuildStrategy)), m_spawnStatus(std::move(other.m_spawnStatus)), + m_adaptionMode(std::move(other.m_adaptionMode)), m_adaptionStatus(std::move(other.m_adaptionStatus)), - m_expert(std::move(other.m_expert)), m_id(std::move(other.m_id)), m_dimension(std::move(other.m_dimension)), m_toleranceCustom(std::move(other.m_toleranceCustom)), @@ -401,8 +401,8 @@ PatchKernel & PatchKernel::operator=(PatchKernel &&other) m_adjacenciesBuildStrategy = std::move(other.m_adjacenciesBuildStrategy); m_interfacesBuildStrategy = std::move(other.m_interfacesBuildStrategy); m_spawnStatus = std::move(other.m_spawnStatus); + m_adaptionMode = std::move(other.m_adaptionMode); m_adaptionStatus = std::move(other.m_adaptionStatus); - m_expert = std::move(other.m_expert); m_id = std::move(other.m_id); m_dimension = std::move(other.m_dimension); m_toleranceCustom = std::move(other.m_toleranceCustom); @@ -509,11 +509,8 @@ void PatchKernel::initialize() // initialization. setSpawnStatus(SPAWN_UNNEEDED); - // Set the adaption as unsupported - // - // Specific implementation will set the appropriate status during their - // initialization. - setAdaptionStatus(ADAPTION_UNSUPPORTED); + // Set the adaption as clean + setAdaptionStatus(ADAPTION_CLEAN); #if BITPIT_ENABLE_MPI==1 // Initialize communicator @@ -719,14 +716,20 @@ std::vector PatchKernel::adaption(bool trackAdaption, bool squee { std::vector adaptionInfo; - // Check adaption status + // Early return if adaption cannot be performed + AdaptionMode adaptionMode = getAdaptionMode(); + if (adaptionMode == ADAPTION_DISABLED) { + return adaptionInfo; + } + AdaptionStatus adaptionStatus = getAdaptionStatus(true); - if (adaptionStatus == ADAPTION_UNSUPPORTED || adaptionStatus == ADAPTION_CLEAN) { + if (adaptionStatus == ADAPTION_CLEAN) { return adaptionInfo; } else if (adaptionStatus != ADAPTION_DIRTY) { throw std::runtime_error ("An adaption is already in progress."); } + // Run adaption adaptionPrepare(false); adaptionInfo = adaptionAlter(trackAdaption, squeezeStorage); @@ -753,9 +756,14 @@ std::vector PatchKernel::adaptionPrepare(bool trackAdaption) { std::vector adaptionInfo; - // Check adaption status + // Early return if adaption cannot be performed + AdaptionMode adaptionMode = getAdaptionMode(); + if (adaptionMode == ADAPTION_DISABLED) { + return adaptionInfo; + } + AdaptionStatus adaptionStatus = getAdaptionStatus(true); - if (adaptionStatus == ADAPTION_UNSUPPORTED || adaptionStatus == ADAPTION_CLEAN) { + if (adaptionStatus == ADAPTION_CLEAN) { return adaptionInfo; } else if (adaptionStatus != ADAPTION_DIRTY) { throw std::runtime_error ("An adaption is already in progress."); @@ -789,9 +797,14 @@ std::vector PatchKernel::adaptionAlter(bool trackAdaption, bool { std::vector adaptionInfo; - // Check adaption status + // Early return if adaption cannot be performed + AdaptionMode adaptionMode = getAdaptionMode(); + if (adaptionMode == ADAPTION_DISABLED) { + return adaptionInfo; + } + AdaptionStatus adaptionStatus = getAdaptionStatus(); - if (adaptionStatus == ADAPTION_UNSUPPORTED || adaptionStatus == ADAPTION_CLEAN) { + if (adaptionStatus == ADAPTION_CLEAN) { return adaptionInfo; } else if (adaptionStatus != ADAPTION_PREPARED) { throw std::runtime_error ("The prepare function has not been called."); @@ -816,8 +829,14 @@ std::vector PatchKernel::adaptionAlter(bool trackAdaption, bool */ void PatchKernel::adaptionCleanup() { + // Early return if adaption cannot be performed + AdaptionMode adaptionMode = getAdaptionMode(); + if (adaptionMode == ADAPTION_DISABLED) { + return; + } + AdaptionStatus adaptionStatus = getAdaptionStatus(); - if (adaptionStatus == ADAPTION_UNSUPPORTED || adaptionStatus == ADAPTION_CLEAN) { + if (adaptionStatus == ADAPTION_CLEAN) { return; } else if (adaptionStatus == ADAPTION_PREPARED) { throw std::runtime_error ("It is not yet possible to abort an adaption."); @@ -1100,7 +1119,7 @@ void PatchKernel::_resetInterfaces(bool release) */ bool PatchKernel::reserveVertices(size_t nVertices) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -1123,7 +1142,7 @@ bool PatchKernel::reserveVertices(size_t nVertices) */ bool PatchKernel::reserveCells(size_t nCells) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -1148,7 +1167,7 @@ bool PatchKernel::reserveCells(size_t nCells) */ bool PatchKernel::reserveInterfaces(size_t nInterfaces) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -1302,6 +1321,9 @@ void PatchKernel::_writeFinalize() /*! Returns the current spawn status. + Span functionality is obsolete. The patch dosn't need to be spawned + anymore. + \return The current spawn status. */ PatchKernel::SpawnStatus PatchKernel::getSpawnStatus() const @@ -1330,12 +1352,48 @@ void PatchKernel::setSpawnStatus(SpawnStatus status) */ bool PatchKernel::isAdaptionSupported() const { - return (getAdaptionStatus() != ADAPTION_UNSUPPORTED); + return (getAdaptionMode() != ADAPTION_DISABLED); +} + +/*! + Returns the adaption mode. + + Adaption mode tells if the patch can be adapted and which strategies can + be used to adapt the patch. + + The following adaption modes are supported: + - disabled, no adaption can be performed; + - automatic, adaption is performed specifying which cells should be + refiend/coarsen and then the patch will perform all the alterations + needed to fulfill the adaption requests; + - manual, this modes allows to use low level function to add and delete + individual cells and vertices. It's up to the user to guarantee the + consistency of the patch. + + \return The adaption mode. +*/ +PatchKernel::AdaptionMode PatchKernel::getAdaptionMode() const +{ + return m_adaptionMode; +} + +/*! + Set the adaption mode. + + See PatchKernel::getAdaptionMode() for a list of supported adaption modes. + + \param mode is the adaption mode that will be set +*/ +void PatchKernel::setAdaptionMode(AdaptionMode mode) +{ + m_adaptionMode = mode; } /*! Returns the current adaption status. + Adaption mode tells which stage of the adaption process + \param global if set to true, the adaption status will be evaluated globally across all the partitions \return The current adaption status. @@ -1447,11 +1505,13 @@ bool PatchKernel::isDirty(bool global) const */ void PatchKernel::setExpert(bool expert) { - if (isExpert() == expert) { - return; + static AdaptionMode initialAdaptionMode; + if (!expert) { + initialAdaptionMode = m_adaptionMode; + m_adaptionMode = ADAPTION_MANUAL; + } else { + m_adaptionMode = initialAdaptionMode; } - - m_expert = expert; } /*! @@ -1466,7 +1526,7 @@ void PatchKernel::setExpert(bool expert) */ bool PatchKernel::isExpert() const { - return m_expert; + return (m_adaptionMode == ADAPTION_MANUAL); } /*! @@ -1927,7 +1987,7 @@ PatchKernel::VertexIterator PatchKernel::addVertex(Vertex &&source, long id) */ PatchKernel::VertexIterator PatchKernel::addVertex(const std::array &coords, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return vertexEnd(); } @@ -2017,7 +2077,7 @@ PatchKernel::VertexIterator PatchKernel::_addInternalVertex(const std::array &coords, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return vertexEnd(); } @@ -2059,7 +2119,7 @@ void PatchKernel::_restoreInternalVertex(const VertexIterator &iterator, const s */ bool PatchKernel::deleteVertex(long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -2217,7 +2277,7 @@ std::vector PatchKernel::findOrphanVertices() */ bool PatchKernel::deleteOrphanVertices() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -2237,7 +2297,7 @@ bool PatchKernel::deleteOrphanVertices() std::vector PatchKernel::collapseCoincidentVertices() { std::vector collapsedVertices; - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return collapsedVertices; } @@ -2326,7 +2386,7 @@ std::vector PatchKernel::collapseCoincidentVertices() */ bool PatchKernel::deleteCoincidentVertices() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -2911,7 +2971,7 @@ PatchKernel::CellIterator PatchKernel::addCell(ElementType type, const std::vect PatchKernel::CellIterator PatchKernel::addCell(ElementType type, std::unique_ptr &&connectStorage, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return cellEnd(); } @@ -3034,7 +3094,7 @@ void PatchKernel::setAddedCellAlterationFlags(long id) PatchKernel::CellIterator PatchKernel::restoreCell(ElementType type, std::unique_ptr &&connectStorage, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return cellEnd(); } @@ -3105,7 +3165,7 @@ void PatchKernel::setRestoredCellAlterationFlags(long id) */ bool PatchKernel::deleteCell(long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -4524,7 +4584,7 @@ PatchKernel::InterfaceIterator PatchKernel::addInterface(ElementType type, std::unique_ptr &&connectStorage, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return interfaceEnd(); } @@ -4606,7 +4666,7 @@ PatchKernel::InterfaceIterator PatchKernel::restoreInterface(ElementType type, std::unique_ptr &&connectStorage, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return interfaceEnd(); } @@ -4667,7 +4727,7 @@ void PatchKernel::setRestoredInterfaceAlterationFlags(long id) */ bool PatchKernel::deleteInterface(long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -4787,7 +4847,7 @@ std::vector PatchKernel::findOrphanInterfaces() const */ bool PatchKernel::deleteOrphanInterfaces() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -4929,9 +4989,9 @@ void PatchKernel::restoreVertices(std::istream &stream) // Restore kernel m_vertices.restoreKernel(stream); - // Enable advanced editing - bool originalExpertStatus = isExpert(); - setExpert(true); + // Enable manual adaption + AdaptionMode previousAdaptionMode = getAdaptionMode(); + setAdaptionMode(ADAPTION_MANUAL); // Restore vertices long nVertices = m_vertices.size(); @@ -4970,8 +5030,8 @@ void PatchKernel::restoreVertices(std::istream &stream) utils::binary::read(stream, dummyLastInternalVertexId); #endif - // Set original advanced editing status - setExpert(originalExpertStatus); + // Restore previous adaption mode + setAdaptionMode(previousAdaptionMode); } /*! @@ -5030,9 +5090,9 @@ void PatchKernel::restoreCells(std::istream &stream) // Restore kernel m_cells.restoreKernel(stream); - // Enable advanced editing - bool originalExpertStatus = isExpert(); - setExpert(true); + // Enable manual adaption + AdaptionMode previousAdaptionMode = getAdaptionMode(); + setAdaptionMode(ADAPTION_MANUAL); // Restore cells long nCells = m_cells.size(); @@ -5091,8 +5151,8 @@ void PatchKernel::restoreCells(std::istream &stream) // Update adjacencies updateAdjacencies(); - // Set original advanced editing status - setExpert(originalExpertStatus); + // Restore previous adaption mode + setAdaptionMode(previousAdaptionMode); } /*! @@ -5145,9 +5205,9 @@ void PatchKernel::restoreInterfaces(std::istream &stream) // Restore kernel m_interfaces.restoreKernel(stream); - // Enable advanced editing - bool originalExpertStatus = isExpert(); - setExpert(true); + // Enable manual adaption + AdaptionMode previousAdaptionMode = getAdaptionMode(); + setAdaptionMode(ADAPTION_MANUAL); // Restore interfaces long nInterfaces = m_interfaces.size(); @@ -5184,8 +5244,8 @@ void PatchKernel::restoreInterfaces(std::istream &stream) unsetCellAlterationFlags(FLAG_INTERFACES_DIRTY); m_alteredInterfaces.clear(); - // Set original advanced editing status - setExpert(originalExpertStatus); + // Restore previous adaption mode + setAdaptionMode(previousAdaptionMode); } /*! @@ -5335,7 +5395,7 @@ bool PatchKernel::_enableCellBalancing(long id, bool enabled) */ bool PatchKernel::sortVertices() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -5366,7 +5426,7 @@ bool PatchKernel::sortVertices() */ bool PatchKernel::sortCells() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -5395,7 +5455,7 @@ bool PatchKernel::sortCells() */ bool PatchKernel::sortInterfaces() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -5428,7 +5488,7 @@ bool PatchKernel::sort() */ bool PatchKernel::squeezeVertices() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -5448,7 +5508,7 @@ bool PatchKernel::squeezeVertices() */ bool PatchKernel::squeezeCells() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -5468,7 +5528,7 @@ bool PatchKernel::squeezeCells() */ bool PatchKernel::squeezeInterfaces() { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -6428,9 +6488,9 @@ void PatchKernel::updateInterfaces(bool forcedUpdated) // Update interfaces if (interfacesDirty) { - // Enable advanced editing - bool originalExpertStatus = isExpert(); - setExpert(true); + // Enable manual adaption + AdaptionMode previousAdaptionMode = getAdaptionMode(); + setAdaptionMode(ADAPTION_MANUAL); // Prune stale interfaces pruneStaleInterfaces(); @@ -6442,8 +6502,8 @@ void PatchKernel::updateInterfaces(bool forcedUpdated) unsetCellAlterationFlags(FLAG_INTERFACES_DIRTY); m_alteredInterfaces.clear(); - // Set original advanced editing status - setExpert(originalExpertStatus); + // Restore previous adaption mode + setAdaptionMode(previousAdaptionMode); } else { initializeInterfaces(currentStrategy); } @@ -8271,7 +8331,8 @@ bool PatchKernel::dump(std::ostream &stream) const // Spawn status utils::binary::write(stream, m_spawnStatus); - // Adaption status + // Adaption information + utils::binary::write(stream, m_adaptionMode); utils::binary::write(stream, m_adaptionStatus); // Partition status @@ -8369,7 +8430,8 @@ void PatchKernel::restore(std::istream &stream, bool reregister) // Spawn status utils::binary::read(stream, m_spawnStatus); - // Adaption status + // Adaption information + utils::binary::read(stream, m_adaptionMode); utils::binary::read(stream, m_adaptionStatus); // Partition status diff --git a/src/patchkernel/patch_kernel.hpp b/src/patchkernel/patch_kernel.hpp index cab4daf44a..bfd5eb1637 100644 --- a/src/patchkernel/patch_kernel.hpp +++ b/src/patchkernel/patch_kernel.hpp @@ -338,11 +338,23 @@ friend class PatchManager; SPAWN_DONE }; + /*! + Adaption mode + */ + enum AdaptionMode { + ADAPTION_DISABLED = -1, //! No adaption can be performed + ADAPTION_AUTOMATIC, //! Adaption is performed specifying which cells should be + //! refined/coarsen and then the patch will perform all the + //! alterations needed to fulfill the adaption requests + ADAPTION_MANUAL, //! Allows to use low level function to add and delete individual + //! cells and vertices. It's up to the user to guarantee the + //! consistency of the patch + }; + /*! Adaption status */ enum AdaptionStatus { - ADAPTION_UNSUPPORTED = -1, ADAPTION_CLEAN, ADAPTION_DIRTY, ADAPTION_PREPARED, @@ -388,6 +400,7 @@ friend class PatchManager; std::vector spawn(bool trackSpawn); bool isAdaptionSupported() const; + AdaptionMode getAdaptionMode() const; AdaptionStatus getAdaptionStatus(bool global = false) const; std::vector adaption(bool trackAdaption = true, bool squeezeStorage = false); std::vector adaptionPrepare(bool trackAdaption = true); @@ -403,7 +416,7 @@ friend class PatchManager; void enableCellBalancing(long id, bool enabled); bool isDirty(bool global = false) const; - bool isExpert() const; + BITPIT_DEPRECATED(bool isExpert() const); int getId() const; int getDimension() const; @@ -801,13 +814,13 @@ friend class PatchManager; AlterationFlagsStorage m_alteredInterfaces; #if BITPIT_ENABLE_MPI==1 - PatchKernel(MPI_Comm communicator, std::size_t haloSize, bool expert); - PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert); - PatchKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert); + PatchKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + PatchKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); #else - PatchKernel(bool expert); - PatchKernel(int dimension, bool expert); - PatchKernel(int id, int dimension, bool expert); + PatchKernel(AdaptionMode adaptionMode); + PatchKernel(int dimension, AdaptionMode adaptionMode); + PatchKernel(int id, int dimension, AdaptionMode adaptionMode); #endif PatchKernel(const PatchKernel &other); PatchKernel & operator=(const PatchKernel &other) = delete; @@ -899,6 +912,7 @@ friend class PatchManager; void setSpawnStatus(SpawnStatus status); virtual std::vector _spawn(bool trackAdaption); + void setAdaptionMode(AdaptionMode mode); void setAdaptionStatus(AdaptionStatus status); virtual std::vector _adaptionPrepare(bool trackAdaption); virtual std::vector _adaptionAlter(bool trackAdaption); @@ -926,7 +940,7 @@ friend class PatchManager; virtual void _writePrepare(); virtual void _writeFinalize(); - void setExpert(bool expert); + BITPIT_DEPRECATED(void setExpert(bool expert)); void extractEnvelope(PatchKernel &envelope) const; @@ -1006,10 +1020,9 @@ friend class PatchManager; SpawnStatus m_spawnStatus; + AdaptionMode m_adaptionMode; AdaptionStatus m_adaptionStatus; - bool m_expert; - int m_id; int m_dimension; diff --git a/src/patchkernel/patch_kernel.tpp b/src/patchkernel/patch_kernel.tpp index fba80ddf17..13834b6024 100644 --- a/src/patchkernel/patch_kernel.tpp +++ b/src/patchkernel/patch_kernel.tpp @@ -53,7 +53,7 @@ std::unique_ptr PatchKernel::clone(const patch_t *original) template bool PatchKernel::deleteCells(const IdStorage &ids) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -104,7 +104,7 @@ bool PatchKernel::deleteCells(const IdStorage &ids) template bool PatchKernel::deleteVertices(const IdStorage &ids) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } @@ -155,7 +155,7 @@ bool PatchKernel::deleteVertices(const IdStorage &ids) template bool PatchKernel::deleteInterfaces(const IdStorage &ids) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return false; } diff --git a/src/patchkernel/patch_kernel_parallel.cpp b/src/patchkernel/patch_kernel_parallel.cpp index f30c49f469..5ffb0fb974 100644 --- a/src/patchkernel/patch_kernel_parallel.cpp +++ b/src/patchkernel/patch_kernel_parallel.cpp @@ -349,7 +349,7 @@ void PatchKernel::_setHaloSize(std::size_t haloSize) */ PatchKernel::VertexIterator PatchKernel::internalVertex2GhostVertex(long id, int owner) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return m_vertices.end(); } @@ -390,7 +390,7 @@ PatchKernel::VertexIterator PatchKernel::internalVertex2GhostVertex(long id, int */ PatchKernel::VertexIterator PatchKernel::ghostVertex2InternalVertex(long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return m_vertices.end(); } @@ -469,7 +469,7 @@ const Vertex & PatchKernel::getFirstGhostVertex() const */ PatchKernel::VertexIterator PatchKernel::restoreVertex(const std::array &coords, int owner, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return vertexEnd(); } @@ -616,7 +616,7 @@ void PatchKernel::updateFirstGhostVertexId() */ PatchKernel::CellIterator PatchKernel::internalCell2GhostCell(long id, int owner, int haloLayer) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return m_cells.end(); } @@ -657,7 +657,7 @@ PatchKernel::CellIterator PatchKernel::internalCell2GhostCell(long id, int owner */ PatchKernel::CellIterator PatchKernel::ghostCell2InternalCell(long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return m_cells.end(); } @@ -1010,7 +1010,7 @@ PatchKernel::CellIterator PatchKernel::addCell(ElementType type, const std::vect PatchKernel::CellIterator PatchKernel::addCell(ElementType type, std::unique_ptr &&connectStorage, int owner, int haloLayer, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return cellEnd(); } @@ -1109,7 +1109,7 @@ PatchKernel::CellIterator PatchKernel::_addGhostCell(ElementType type, std::uniq PatchKernel::CellIterator PatchKernel::restoreCell(ElementType type, std::unique_ptr &&connectStorage, int owner, int haloLayer, long id) { - if (!isExpert()) { + if (getAdaptionMode() != ADAPTION_MANUAL) { return cellEnd(); } diff --git a/src/patchkernel/point_kernel.cpp b/src/patchkernel/point_kernel.cpp index cf84bd2254..b345180cad 100644 --- a/src/patchkernel/point_kernel.cpp +++ b/src/patchkernel/point_kernel.cpp @@ -37,18 +37,18 @@ namespace bitpit { \param communicator is the communicator to be used for exchanging data among the processes. If a null comunicator is provided, a serial patch will be created - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PointKernel::PointKernel(MPI_Comm communicator, bool expert) - : PatchKernel(communicator, 0, expert) +PointKernel::PointKernel(MPI_Comm communicator, AdaptionMode adaptionMode) + : PatchKernel(communicator, 0, adaptionMode) #else /*! Creates a patch. - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PointKernel::PointKernel(bool expert) - : PatchKernel(expert) +PointKernel::PointKernel(AdaptionMode adaptionMode) + : PatchKernel(adaptionMode) #endif { initialize(); @@ -66,19 +66,19 @@ PointKernel::PointKernel(bool expert) \param communicator is the communicator to be used for exchanging data among the processes. If a null comunicator is provided, a serial patch will be created - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PointKernel::PointKernel(int dimension, MPI_Comm communicator, bool expert) - : PatchKernel(dimension, communicator, 0, expert) +PointKernel::PointKernel(int dimension, MPI_Comm communicator, AdaptionMode adaptionMode) + : PatchKernel(dimension, communicator, 0, adaptionMode) #else /*! Creates a patch. \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PointKernel::PointKernel(int dimension, bool expert) - : PatchKernel(dimension, expert) +PointKernel::PointKernel(int dimension, AdaptionMode adaptionMode) + : PatchKernel(dimension, adaptionMode) #endif { initialize(); @@ -97,20 +97,20 @@ PointKernel::PointKernel(int dimension, bool expert) \param communicator is the communicator to be used for exchanging data among the processes. If a null comunicator is provided, a serial patch will be created - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PointKernel::PointKernel(int id, int dimension, MPI_Comm communicator, bool expert) - : PatchKernel(id, dimension, communicator, 0, expert) +PointKernel::PointKernel(int id, int dimension, MPI_Comm communicator, AdaptionMode adaptionMode) + : PatchKernel(id, dimension, communicator, 0, adaptionMode) #else /*! Creates a patch. \param id is the id that will be assigned to the patch \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -PointKernel::PointKernel(int id, int dimension, bool expert) - : PatchKernel(id, dimension, expert) +PointKernel::PointKernel(int id, int dimension, AdaptionMode adaptionMode) + : PatchKernel(id, dimension, adaptionMode) #endif { } diff --git a/src/patchkernel/point_kernel.hpp b/src/patchkernel/point_kernel.hpp index 6bb8e6c253..185aff4d1c 100644 --- a/src/patchkernel/point_kernel.hpp +++ b/src/patchkernel/point_kernel.hpp @@ -43,13 +43,13 @@ class PointKernel : public PatchKernel { protected: #if BITPIT_ENABLE_MPI==1 - PointKernel(MPI_Comm communicator, bool expert); - PointKernel(int dimension, MPI_Comm communicator, bool expert); - PointKernel(int id, int dimension, MPI_Comm communicator, bool expert); + PointKernel(MPI_Comm communicator, AdaptionMode adaptionMode); + PointKernel(int dimension, MPI_Comm communicator, AdaptionMode adaptionMode); + PointKernel(int id, int dimension, MPI_Comm communicator, AdaptionMode adaptionMode); #else - PointKernel(bool expert); - PointKernel(int dimension, bool expert); - PointKernel(int id, int dimension, bool expert); + PointKernel(AdaptionMode adaptionMode); + PointKernel(int dimension, AdaptionMode adaptionMode); + PointKernel(int id, int dimension, AdaptionMode adaptionMode); #endif private: diff --git a/src/patchkernel/surface_kernel.cpp b/src/patchkernel/surface_kernel.cpp index c7e6b8768a..ca03d23f80 100644 --- a/src/patchkernel/surface_kernel.cpp +++ b/src/patchkernel/surface_kernel.cpp @@ -70,18 +70,18 @@ const unsigned short SurfaceKernel::SELECT_ALL = 3; will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -SurfaceKernel::SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(communicator, haloSize, expert) +SurfaceKernel::SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(communicator, haloSize, adaptionMode) #else /*! Creates a patch. - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -SurfaceKernel::SurfaceKernel(bool expert) - : PatchKernel(expert) +SurfaceKernel::SurfaceKernel(AdaptionMode adaptionMode) + : PatchKernel(adaptionMode) #endif { initialize(); @@ -101,19 +101,19 @@ SurfaceKernel::SurfaceKernel(bool expert) will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -SurfaceKernel::SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(dimension, communicator, haloSize, expert) +SurfaceKernel::SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(dimension, communicator, haloSize, adaptionMode) #else /*! Creates a patch. \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -SurfaceKernel::SurfaceKernel(int dimension, bool expert) - : PatchKernel(dimension, expert) +SurfaceKernel::SurfaceKernel(int dimension, AdaptionMode adaptionMode) + : PatchKernel(dimension, adaptionMode) #endif { initialize(); @@ -134,20 +134,20 @@ SurfaceKernel::SurfaceKernel(int dimension, bool expert) will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -SurfaceKernel::SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(id, dimension, communicator, haloSize, expert) +SurfaceKernel::SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(id, dimension, communicator, haloSize, adaptionMode) #else /*! Creates a patch. \param id is the id that will be assigned to the patch \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -SurfaceKernel::SurfaceKernel(int id, int dimension, bool expert) - : PatchKernel(id, dimension, expert) +SurfaceKernel::SurfaceKernel(int id, int dimension, AdaptionMode adaptionMode) + : PatchKernel(id, dimension, adaptionMode) #endif { } diff --git a/src/patchkernel/surface_kernel.hpp b/src/patchkernel/surface_kernel.hpp index de40ed5bcf..09deb74f62 100644 --- a/src/patchkernel/surface_kernel.hpp +++ b/src/patchkernel/surface_kernel.hpp @@ -99,13 +99,13 @@ class SurfaceKernel : public PatchKernel { protected: #if BITPIT_ENABLE_MPI==1 - SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, bool expert); - SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert); - SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert); + SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); #else - SurfaceKernel(bool expert); - SurfaceKernel(int dimension, bool expert); - SurfaceKernel(int id, int dimension, bool expert); + SurfaceKernel(AdaptionMode adaptionMode); + SurfaceKernel(int dimension, AdaptionMode adaptionMode); + SurfaceKernel(int id, int dimension, AdaptionMode adaptionMode); #endif }; diff --git a/src/patchkernel/volume_kernel.cpp b/src/patchkernel/volume_kernel.cpp index 9d5733dc5c..ad667bf704 100644 --- a/src/patchkernel/volume_kernel.cpp +++ b/src/patchkernel/volume_kernel.cpp @@ -49,18 +49,18 @@ namespace bitpit { will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -VolumeKernel::VolumeKernel(MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(communicator, haloSize, expert) +VolumeKernel::VolumeKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(communicator, haloSize, adaptionMode) #else /*! Creates a patch. - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -VolumeKernel::VolumeKernel(bool expert) - : PatchKernel(expert) +VolumeKernel::VolumeKernel(AdaptionMode adaptionMode) + : PatchKernel(adaptionMode) #endif { } @@ -79,19 +79,19 @@ VolumeKernel::VolumeKernel(bool expert) will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -VolumeKernel::VolumeKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(dimension, communicator, haloSize, expert) +VolumeKernel::VolumeKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(dimension, communicator, haloSize, adaptionMode) #else /*! Creates a patch. \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -VolumeKernel::VolumeKernel(int dimension, bool expert) - : PatchKernel(dimension, expert) +VolumeKernel::VolumeKernel(int dimension, AdaptionMode adaptionMode) + : PatchKernel(dimension, adaptionMode) #endif { } @@ -111,20 +111,20 @@ VolumeKernel::VolumeKernel(int dimension, bool expert) will be created \param haloSize is the size, expressed in number of layers, of the ghost cells halo - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -VolumeKernel::VolumeKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert) - : PatchKernel(id, dimension, communicator, haloSize, expert) +VolumeKernel::VolumeKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) + : PatchKernel(id, dimension, communicator, haloSize, adaptionMode) #else /*! Creates a patch. \param id is the id that will be assigned to the patch \param dimension is the dimension of the patch - \param expert if true, the expert mode will be enabled + \param adaptionMode is the adaption mode that will be used for the patch */ -VolumeKernel::VolumeKernel(int id, int dimension, bool expert) - : PatchKernel(id, dimension, expert) +VolumeKernel::VolumeKernel(int id, int dimension, AdaptionMode adaptionMode) + : PatchKernel(id, dimension, adaptionMode) #endif { } diff --git a/src/patchkernel/volume_kernel.hpp b/src/patchkernel/volume_kernel.hpp index d0b596d335..66e3b6a14d 100644 --- a/src/patchkernel/volume_kernel.hpp +++ b/src/patchkernel/volume_kernel.hpp @@ -56,13 +56,13 @@ class VolumeKernel : public PatchKernel { protected: #if BITPIT_ENABLE_MPI==1 - VolumeKernel(MPI_Comm communicator, std::size_t haloSize, bool expert); - VolumeKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert); - VolumeKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert); + VolumeKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + VolumeKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + VolumeKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); #else - VolumeKernel(bool expert); - VolumeKernel(int dimension, bool expert); - VolumeKernel(int id, int dimension, bool expert); + VolumeKernel(AdaptionMode adaptionMode); + VolumeKernel(int dimension, AdaptionMode adaptionMode); + VolumeKernel(int id, int dimension, AdaptionMode adaptionMode); #endif }; diff --git a/src/pointcloud/pointcloud.cpp b/src/pointcloud/pointcloud.cpp index 7975c1dd00..9d0d8507fa 100644 --- a/src/pointcloud/pointcloud.cpp +++ b/src/pointcloud/pointcloud.cpp @@ -49,13 +49,13 @@ namespace bitpit { among the processes */ PointCloud::PointCloud(MPI_Comm communicator) - : PointKernel(communicator, true) + : PointKernel(communicator, ADAPTION_MANUAL) #else /*! Creates an uninitialized serial patch. */ PointCloud::PointCloud() - : PointKernel(true) + : PointKernel(ADAPTION_MANUAL) #endif { } @@ -73,7 +73,7 @@ PointCloud::PointCloud() among the processes */ PointCloud::PointCloud(int dimension, MPI_Comm communicator) - : PointKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, true) + : PointKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, ADAPTION_MANUAL) #else /*! Creates a patch. @@ -81,7 +81,7 @@ PointCloud::PointCloud(int dimension, MPI_Comm communicator) \param dimension is the dimension of the patch */ PointCloud::PointCloud(int dimension) - : PointKernel(PatchManager::AUTOMATIC_ID, dimension, true) + : PointKernel(PatchManager::AUTOMATIC_ID, dimension, ADAPTION_MANUAL) #endif { } @@ -100,7 +100,7 @@ PointCloud::PointCloud(int dimension) among the processes */ PointCloud::PointCloud(int id, int dimension, MPI_Comm communicator) - : PointKernel(id, dimension, communicator, true) + : PointKernel(id, dimension, communicator, ADAPTION_MANUAL) #else /*! Creates a patch. @@ -109,7 +109,7 @@ PointCloud::PointCloud(int id, int dimension, MPI_Comm communicator) \param dimension is the dimension of the patch */ PointCloud::PointCloud(int id, int dimension) - : PointKernel(id, dimension, true) + : PointKernel(id, dimension, ADAPTION_MANUAL) #endif { } @@ -126,7 +126,7 @@ PointCloud::PointCloud(int id, int dimension) among the processes */ PointCloud::PointCloud(std::istream &stream, MPI_Comm communicator) - : PointKernel(communicator, false) + : PointKernel(communicator, ADAPTION_MANUAL) #else /*! Creates a patch restoring the patch saved in the specified stream. @@ -134,7 +134,7 @@ PointCloud::PointCloud(std::istream &stream, MPI_Comm communicator) \param stream is the stream to read from */ PointCloud::PointCloud(std::istream &stream) - : PointKernel(false) + : PointKernel(ADAPTION_MANUAL) #endif { // Restore the patch @@ -151,20 +151,6 @@ std::unique_ptr PointCloud::clone() const return std::unique_ptr(new PointCloud(*this)); } -/*! - * Enables or disables expert mode. - * - * When expert mode is enabled, it will be possible to change the - * patch using low level functions (e.g., it will be possible to - * add individual cells, add vertices, delete cells, ...). - * - * \param expert if true, the expert mode will be enabled - */ -void PointCloud::setExpert(bool expert) -{ - PointKernel::setExpert(expert); -} - /*! * Get the version associated to the binary dumps. * diff --git a/src/pointcloud/pointcloud.hpp b/src/pointcloud/pointcloud.hpp index 2a258e7285..a0d5795ecc 100644 --- a/src/pointcloud/pointcloud.hpp +++ b/src/pointcloud/pointcloud.hpp @@ -53,7 +53,7 @@ class PointCloud : public PointKernel { std::unique_ptr clone() const override; // Setters - void setExpert(bool expert); + using PointKernel::setExpert; // Search algorithms long locatePoint(const std::array &point) const override; diff --git a/src/surfunstructured/surfunstructured.cpp b/src/surfunstructured/surfunstructured.cpp index e0377180be..fb1334cf00 100644 --- a/src/surfunstructured/surfunstructured.cpp +++ b/src/surfunstructured/surfunstructured.cpp @@ -53,13 +53,13 @@ namespace bitpit { cells halo */ SurfUnstructured::SurfUnstructured(MPI_Comm communicator, std::size_t haloSize) - : SurfaceKernel(communicator, haloSize, true) + : SurfaceKernel(communicator, haloSize, ADAPTION_MANUAL) #else /*! Creates an uninitialized serial patch. */ SurfUnstructured::SurfUnstructured() - : SurfaceKernel(true) + : SurfaceKernel(ADAPTION_MANUAL) #endif { } @@ -79,7 +79,7 @@ SurfUnstructured::SurfUnstructured() cells halo */ SurfUnstructured::SurfUnstructured(int dimension, MPI_Comm communicator, std::size_t haloSize) - : SurfaceKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, haloSize, true) + : SurfUnstructured(PatchManager::AUTOMATIC_ID, dimension, communicator, haloSize) #else /*! Creates a patch. @@ -87,7 +87,7 @@ SurfUnstructured::SurfUnstructured(int dimension, MPI_Comm communicator, std::si \param dimension is the dimension of the patch */ SurfUnstructured::SurfUnstructured(int dimension) - : SurfaceKernel(PatchManager::AUTOMATIC_ID, dimension, true) + : SurfUnstructured(PatchManager::AUTOMATIC_ID, dimension) #endif { } @@ -108,7 +108,7 @@ SurfUnstructured::SurfUnstructured(int dimension) cells halo */ SurfUnstructured::SurfUnstructured(int id, int dimension, MPI_Comm communicator, std::size_t haloSize) - : SurfaceKernel(id, dimension, communicator, haloSize, true) + : SurfaceKernel(id, dimension, communicator, haloSize, ADAPTION_MANUAL) #else /*! Creates a patch. @@ -117,7 +117,7 @@ SurfUnstructured::SurfUnstructured(int id, int dimension, MPI_Comm communicator, \param dimension is the dimension of the patch */ SurfUnstructured::SurfUnstructured(int id, int dimension) - : SurfaceKernel(id, dimension, true) + : SurfaceKernel(id, dimension, ADAPTION_MANUAL) #endif { } @@ -136,7 +136,7 @@ SurfUnstructured::SurfUnstructured(int id, int dimension) cells halo */ SurfUnstructured::SurfUnstructured(std::istream &stream, MPI_Comm communicator, std::size_t haloSize) - : SurfaceKernel(communicator, haloSize, false) + : SurfaceKernel(communicator, haloSize, ADAPTION_MANUAL) #else /*! Creates a patch restoring the patch saved in the specified stream. @@ -144,7 +144,7 @@ SurfUnstructured::SurfUnstructured(std::istream &stream, MPI_Comm communicator, \param stream is the stream to read from */ SurfUnstructured::SurfUnstructured(std::istream &stream) - : SurfaceKernel(false) + : SurfaceKernel(ADAPTION_MANUAL) #endif { // Restore the patch diff --git a/src/volcartesian/volcartesian.cpp b/src/volcartesian/volcartesian.cpp index 038f215209..fa7e6293f7 100644 --- a/src/volcartesian/volcartesian.cpp +++ b/src/volcartesian/volcartesian.cpp @@ -65,9 +65,9 @@ namespace bitpit { */ VolCartesian::VolCartesian() #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(MPI_COMM_NULL, 0, false) + : VolumeKernel(MPI_COMM_NULL, 0, ADAPTION_DISABLED) #else - : VolumeKernel(false) + : VolumeKernel(ADAPTION_DISABLED) #endif { initialize(); @@ -103,9 +103,9 @@ VolCartesian::VolCartesian(int id, int dimension, const std::array &lengths, const std::array &nCells) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, false) + : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED) #else - : VolumeKernel(id, dimension, false) + : VolumeKernel(id, dimension, ADAPTION_DISABLED) #endif { initialize(); @@ -144,9 +144,9 @@ VolCartesian::VolCartesian(int id, int dimension, const std::array &origin, double length, int nCells) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, false) + : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED) #else - : VolumeKernel(id, dimension, false) + : VolumeKernel(id, dimension, ADAPTION_DISABLED) #endif { initialize(); @@ -185,9 +185,9 @@ VolCartesian::VolCartesian(int id, int dimension, const std::array &origin, double length, double dh) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, false) + : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED) #else - : VolumeKernel(id, dimension, false) + : VolumeKernel(id, dimension, ADAPTION_DISABLED) #endif { initialize(); @@ -206,9 +206,9 @@ VolCartesian::VolCartesian(int id, int dimension, */ VolCartesian::VolCartesian(std::istream &stream) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(MPI_COMM_NULL, 0, false) + : VolumeKernel(MPI_COMM_NULL, 0, ADAPTION_DISABLED) #else - : VolumeKernel(false) + : VolumeKernel(ADAPTION_DISABLED) #endif { initialize(); @@ -344,8 +344,9 @@ void VolCartesian::_updateInterfaces() const ReferenceElementInfo &interfaceTypeInfo = ReferenceElementInfo::getInfo(interfaceType); const int nInterfaceVertices = interfaceTypeInfo.nVertices; - // Enable advanced editing - setExpert(true); + // Enable manual adaption + AdaptionMode previousAdaptionMode = getAdaptionMode(); + setAdaptionMode(ADAPTION_MANUAL); // Initialize interfaces for (Cell &cell : getCells()) { @@ -404,8 +405,8 @@ void VolCartesian::_updateInterfaces() } } - // Disable advanced editing - setExpert(false); + // Restore previous adaption mode + setAdaptionMode(previousAdaptionMode); } } @@ -1009,15 +1010,16 @@ std::vector VolCartesian::_spawn(bool trackSpawn) return updateInfo; } - // Enable advanced editing - setExpert(true); + // Enable manual adaption + AdaptionMode previousAdaptionMode = getAdaptionMode(); + setAdaptionMode(ADAPTION_MANUAL); // Definition of the mesh addVertices(); addCells(); - // Disable advanced editing - setExpert(false); + // Restore previous adaption mode + setAdaptionMode(previousAdaptionMode); // Adaption info if (trackSpawn) { diff --git a/src/voloctree/voloctree.cpp b/src/voloctree/voloctree.cpp index 312301fd5b..a4e79c81fb 100644 --- a/src/voloctree/voloctree.cpp +++ b/src/voloctree/voloctree.cpp @@ -74,13 +74,13 @@ namespace bitpit { cells halo */ VolOctree::VolOctree(MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(communicator, haloSize, false) + : VolumeKernel(communicator, haloSize, ADAPTION_AUTOMATIC) #else /*! Creates an uninitialized serial patch. */ VolOctree::VolOctree() - : VolumeKernel(false) + : VolumeKernel(ADAPTION_AUTOMATIC) #endif { // Create the tree @@ -169,7 +169,7 @@ VolOctree::VolOctree(int dimension, const std::array &origin, double cells halo */ VolOctree::VolOctree(int id, int dimension, const std::array &origin, double length, double dh, MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(id, dimension, communicator, haloSize, false) + : VolumeKernel(id, dimension, communicator, haloSize, ADAPTION_AUTOMATIC) #else /*! Creates a patch. @@ -181,7 +181,7 @@ VolOctree::VolOctree(int id, int dimension, const std::array &origin, \param dh is the maximum allowed cell size of the initial refinement */ VolOctree::VolOctree(int id, int dimension, const std::array &origin, double length, double dh) - : VolumeKernel(id, dimension, false) + : VolumeKernel(id, dimension, ADAPTION_AUTOMATIC) #endif { // Create the tree @@ -243,7 +243,7 @@ VolOctree::VolOctree(int id, int dimension, const std::array &origin, cells halo */ VolOctree::VolOctree(std::istream &stream, MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(communicator, haloSize, false) + : VolumeKernel(communicator, haloSize, ADAPTION_AUTOMATIC) #else /*! Creates a patch restoring the patch saved in the specified stream. @@ -251,7 +251,7 @@ VolOctree::VolOctree(std::istream &stream, MPI_Comm communicator, std::size_t ha \param stream is the stream to read from */ VolOctree::VolOctree(std::istream &stream) - : VolumeKernel(false) + : VolumeKernel(ADAPTION_AUTOMATIC) #endif { // Initialize the tree @@ -305,9 +305,9 @@ VolOctree::VolOctree(std::unique_ptr &&tree, std::unique_ptr &&tree, std::unique_ptr *adopter) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(id, tree->getDim(), tree->getComm(), tree->getNofGhostLayers(), false) + : VolumeKernel(id, tree->getDim(), tree->getComm(), tree->getNofGhostLayers(), ADAPTION_AUTOMATIC) #else - : VolumeKernel(id, tree->getDim(), false) + : VolumeKernel(id, tree->getDim(), ADAPTION_AUTOMATIC) #endif { // Associate the tree @@ -489,9 +489,6 @@ void VolOctree::initialize() // This patch need to be spawn setSpawnStatus(SPAWN_NEEDED); - // This patch supports adaption - setAdaptionStatus(ADAPTION_CLEAN); - // Initialize the tolerance // // Since the patch re-implements the function to reset the tolerance, @@ -1392,8 +1389,9 @@ std::vector VolOctree::sync(bool trackChanges) } } - // Enable advanced editing - setExpert(true); + // Enable manual adaption + AdaptionMode previousAdaptionMode = getAdaptionMode(); + setAdaptionMode(ADAPTION_MANUAL); // Renumber cells renumberCells(renumberedOctants); @@ -1502,8 +1500,8 @@ std::vector VolOctree::sync(bool trackChanges) StitchInfo().swap(stitchInfo); - // Disable advanced editing - setExpert(false); + // Restore previous adaption mode + setAdaptionMode(previousAdaptionMode); // Track mesh adaption if (trackChanges) { @@ -2344,8 +2342,9 @@ void VolOctree::_restore(std::istream &stream) // Restore kernel of cell's containers m_cells.restoreKernel(stream); - // Activate expert mode - setExpert(true); + // Enable manual adaption + AdaptionMode previousAdaptionMode = getAdaptionMode(); + setAdaptionMode(ADAPTION_MANUAL); // Restore cells size_t nOctants = m_tree->getNumOctants(); @@ -2367,8 +2366,8 @@ void VolOctree::_restore(std::istream &stream) // Restore interfaces restoreInterfaces(stream); - // De-activate expert mode - setExpert(false); + // Restore previous adaption mode + setAdaptionMode(previousAdaptionMode); // // Restore bounding box diff --git a/src/volunstructured/volunstructured.cpp b/src/volunstructured/volunstructured.cpp index c59708d16a..0ad2ae4d3f 100644 --- a/src/volunstructured/volunstructured.cpp +++ b/src/volunstructured/volunstructured.cpp @@ -54,13 +54,13 @@ namespace bitpit { cells halo */ VolUnstructured::VolUnstructured(MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(communicator, haloSize, true) + : VolumeKernel(communicator, haloSize, ADAPTION_MANUAL) #else /*! Creates an uninitialized serial patch. */ VolUnstructured::VolUnstructured() - : VolumeKernel(true) + : VolumeKernel(ADAPTION_MANUAL) #endif { } @@ -111,7 +111,7 @@ VolUnstructured::VolUnstructured(int dimension) cells halo */ VolUnstructured::VolUnstructured(int id, int dimension, MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(id, dimension, communicator, haloSize, true) + : VolumeKernel(id, dimension, communicator, haloSize, ADAPTION_MANUAL) #else /*! Creates a patch. @@ -120,7 +120,7 @@ VolUnstructured::VolUnstructured(int id, int dimension, MPI_Comm communicator, s \param dimension is the dimension of the patch */ VolUnstructured::VolUnstructured(int id, int dimension) - : VolumeKernel(id, dimension, true) + : VolumeKernel(id, dimension, ADAPTION_MANUAL) #endif { } diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_00001.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_00001.cpp index 7053fb8aa4..99c09ba397 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_00001.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_00001.cpp @@ -242,18 +242,6 @@ vector cell_list; // Counters // none -// ========================================================================== // -// INITIALIZE MESH PARAMETERS // -// ========================================================================== // -{ - // Scope variables ------------------------------------------------------ // - // none - - // Enable changes ------------------------------------------------------- // - mesh.setExpert(true); - //mesh.setParallel(1 ,0); -} - // ========================================================================== // // OUTPUT MESSAGE // // ========================================================================== // @@ -281,9 +269,6 @@ vector cell_list; #endif vector ring1, ring1_expected{6,7,8,21,22,23,30,31,32}; - // Set envelope attributes ---------------------------------------------- // - envelope.setExpert(true); - // Generate a dummy triangulation --------------------------------------- // log::cout() << "** Generating non-manifold surface triangulation" << endl; generateTestTriangulation(mesh); @@ -356,9 +341,6 @@ vector cell_list; #endif vector ring1, ring1_expected{6,8,21,22,23,30,31,32}; - // Set envelope attributes ---------------------------------------------- // - envelope.setExpert(true); - // Backup copy of cells ------------------------------------------------- // log::cout() << "** Removing cell ID 5, 7, and 17" << endl; cell_17 = mesh.getCell(17); @@ -441,9 +423,6 @@ vector cell_list; vector ring1, ring1_expected{4,6,7,19,20,21}; SurfUnstructured::CellIterator it; - // Set envelope attributes ---------------------------------------------- // - envelope.setExpert(true); - // Insert cells --------------------------------------------------------- // log::cout() << "** inserting previously deleted cells" << endl; it = mesh.addCell(cell_17); @@ -575,17 +554,6 @@ vector internal; // Counters int i; -// ========================================================================== // -// INITIALIZE MESH PARAMETERS // -// ========================================================================== // -{ - // Scope variables ------------------------------------------------------ // - // none - - // Enable changes ------------------------------------------------------- // - mesh.setExpert(true); -} - // ========================================================================== // // OUTPUT MESSAGE // // ========================================================================== // diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_00002.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_00002.cpp index be93c6a533..f98cd6665e 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_00002.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_00002.cpp @@ -97,17 +97,6 @@ SurfUnstructured mesh(2); // Counters // none -// ========================================================================== // -// INITIALIZE MESH PARAMETERS // -// ========================================================================== // -{ - // Scope variables ------------------------------------------------------ // - // none - - // Enable changes ------------------------------------------------------- // - mesh.setExpert(true); -} - // ========================================================================== // // OUTPUT MESSAGE // // ========================================================================== // diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_00003.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_00003.cpp index ff659aa7d0..ff88fde4a1 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_00003.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_00003.cpp @@ -96,17 +96,6 @@ SurfUnstructured mesh(2); // Counters // none -// ========================================================================== // -// INITIALIZE MESH PARAMETERS // -// ========================================================================== // -{ - // Scope variables ------------------------------------------------------ // - // none - - // Enable changes ------------------------------------------------------- // - mesh.setExpert(true); -} - // ========================================================================== // // OUTPUT MESSAGE // // ========================================================================== // @@ -232,17 +221,6 @@ SurfUnstructured mesh(1); // Counters // none -// ========================================================================== // -// INITIALIZE MESH PARAMETERS // -// ========================================================================== // -{ - // Scope variables ------------------------------------------------------ // - // none - - // Enable changes ------------------------------------------------------- // - mesh.setExpert(true); -} - // ========================================================================== // // OUTPUT MESSAGE // // ========================================================================== // diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_00004.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_00004.cpp index f045cf8ec4..f0b68f088e 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_00004.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_00004.cpp @@ -107,18 +107,6 @@ int nV, nE; log::cout() << endl; } -// ========================================================================== // -// SET MESH ATTRIBUTES // -// ========================================================================== // -{ - // Scope variables ------------------------------------------------------ // - // none - - // Set mesh attributes -------------------------------------------------- // - mesh.setExpert(true); - edges.setExpert(true); -} - // ========================================================================== // // STEP#1 IMPORT MESH FROM STL FILE // // ========================================================================== // @@ -345,17 +333,6 @@ int nV, nS, nE; log::cout() << endl; } -// ========================================================================== // -// SET MESH ATTRIBUTES // -// ========================================================================== // -{ - // Scope variables ------------------------------------------------------ // - // none - - // Set mesh attributes -------------------------------------------------- // - mesh.setExpert(true); -} - // ========================================================================== // // STEP#1 IMPORT MESH FROM STL FILE // // ========================================================================== // diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_00007.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_00007.cpp index 88ca91eb45..af80faaf67 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_00007.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_00007.cpp @@ -206,7 +206,6 @@ int subtest_001() #else SurfUnstructured mesh(2); #endif - mesh.setExpert(true); // Generate a Dummy Triangulation generateTestTriangulation(mesh); diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_00008.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_00008.cpp index 5ac46be99b..43f3f72940 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_00008.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_00008.cpp @@ -64,7 +64,6 @@ int subtest_001( #else SurfUnstructured *mesh = new SurfUnstructured(2); #endif - mesh->setExpert(true); std::vector> verts(5); verts[0] = {{0,0,0}}; diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_00009.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_00009.cpp index b2abf2f02d..5287242212 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_00009.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_00009.cpp @@ -53,7 +53,6 @@ int subtest_001() #else std::unique_ptr surfaceMesh(new SurfUnstructured (2)); #endif - surfaceMesh->setExpert(true); surfaceMesh->importSTL("./data/buddha.stl", STLReader::FormatUnknown, true); surfaceMesh->initializeAdjacencies(); surfaceMesh->getVTK().setName("skd_test_STL"); diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00001.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00001.cpp index 77ee598445..36143e44a2 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00001.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00001.cpp @@ -707,18 +707,6 @@ SurfUnstructured mesh(2, MPI_COMM_WORLD); // Counters // none -// ========================================================================== // -// SET MESH ATTRIBUTES // -// ========================================================================== // -{ - // Scope variables ------------------------------------------------------ // - // none - - // Set expert mode ------------------------------------------------------ // - mesh.setExpert(true); - -} - // ========================================================================== // // OUTPUT MESSAGE // // ========================================================================== // diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00006.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00006.cpp index 95303f2483..8cc2410fc6 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00006.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00006.cpp @@ -52,7 +52,6 @@ int subtest_001() int myRank = surfaceMesh->getRank(); - surfaceMesh->setExpert(true); if (myRank == 0) { surfaceMesh->importSTL("./data/buddha.stl"); surfaceMesh->deleteCoincidentVertices(); diff --git a/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00007.cpp b/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00007.cpp index bed5c25881..51b92976b5 100644 --- a/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00007.cpp +++ b/test/integration_tests/surfunstructured/test_surfunstructured_parallel_00007.cpp @@ -52,7 +52,6 @@ int subtest_001() int myRank = surfaceMesh->getRank(); - surfaceMesh->setExpert(true); if (myRank == 0) { surfaceMesh->importSTL("./data/buddha.stl"); surfaceMesh->deleteCoincidentVertices(); @@ -281,7 +280,6 @@ int subtest_002() int myRank = surfaceMesh->getRank(); - surfaceMesh->setExpert(true); if (myRank == 0) { surfaceMesh->importSTL("./data/buddha.stl"); surfaceMesh->deleteCoincidentVertices(); From eba83ac681ded6e1bcde2337ba3ab00bf8d5cb2d Mon Sep 17 00:00:00 2001 From: Andrea Iob Date: Wed, 10 Apr 2024 15:27:56 +0200 Subject: [PATCH 5/5] patchkernel: explicitly define the partitioning mode Partitioning mode tells if the patch can be partitioned across the processes. The following partitioning modes are supported: - disabled, no partitioning can be performed; - enabled, the patch can be partitioned across the processes. --- src/lineunstructured/lineunstructured.cpp | 8 ++-- src/patchkernel/line_kernel.cpp | 21 ++++++--- src/patchkernel/line_kernel.hpp | 6 +-- src/patchkernel/patch_kernel.cpp | 47 ++++++++++++++----- src/patchkernel/patch_kernel.hpp | 18 +++++-- src/patchkernel/patch_kernel_parallel.cpp | 31 +++++++++++- src/patchkernel/point_kernel.cpp | 21 ++++++--- src/patchkernel/point_kernel.hpp | 6 +-- src/patchkernel/surface_kernel.cpp | 21 ++++++--- src/patchkernel/surface_kernel.hpp | 6 +-- src/patchkernel/volume_kernel.cpp | 21 ++++++--- src/patchkernel/volume_kernel.hpp | 6 +-- src/pointcloud/pointcloud.cpp | 8 ++-- src/surfunstructured/surfunstructured.cpp | 6 +-- src/volcartesian/volcartesian.cpp | 10 ++-- src/voloctree/voloctree.cpp | 8 ++-- src/volunstructured/volunstructured.cpp | 4 +- .../levelset/test_levelset_00001.cpp | 2 +- 18 files changed, 174 insertions(+), 76 deletions(-) diff --git a/src/lineunstructured/lineunstructured.cpp b/src/lineunstructured/lineunstructured.cpp index 0c712faa39..70d5d9a5a7 100644 --- a/src/lineunstructured/lineunstructured.cpp +++ b/src/lineunstructured/lineunstructured.cpp @@ -50,7 +50,7 @@ namespace bitpit { among the processes */ LineUnstructured::LineUnstructured(MPI_Comm communicator) - : LineKernel(communicator, 1, ADAPTION_MANUAL) + : LineKernel(communicator, 1, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates an uninitialized serial patch. @@ -74,7 +74,7 @@ LineUnstructured::LineUnstructured() among the processes */ LineUnstructured::LineUnstructured(int dimension, MPI_Comm communicator) - : LineKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, 1, ADAPTION_MANUAL) + : LineKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, 1, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates a patch. @@ -101,7 +101,7 @@ LineUnstructured::LineUnstructured(int dimension) among the processes */ LineUnstructured::LineUnstructured(int id, int dimension, MPI_Comm communicator) - : LineKernel(id, dimension, communicator, 1, ADAPTION_MANUAL) + : LineKernel(id, dimension, communicator, 1, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates a patch. @@ -127,7 +127,7 @@ LineUnstructured::LineUnstructured(int id, int dimension) among the processes */ LineUnstructured::LineUnstructured(std::istream &stream, MPI_Comm communicator) - : LineKernel(communicator, 1, ADAPTION_MANUAL) + : LineKernel(communicator, 1, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates a patch restoring the patch saved in the specified stream. diff --git a/src/patchkernel/line_kernel.cpp b/src/patchkernel/line_kernel.cpp index 436d6c6e71..994287a7cb 100644 --- a/src/patchkernel/line_kernel.cpp +++ b/src/patchkernel/line_kernel.cpp @@ -41,9 +41,12 @@ namespace bitpit { \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -LineKernel::LineKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(communicator, haloSize, adaptionMode) +LineKernel::LineKernel(MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. @@ -72,9 +75,12 @@ LineKernel::LineKernel(AdaptionMode adaptionMode) \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -LineKernel::LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(dimension, communicator, haloSize, adaptionMode) +LineKernel::LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(dimension, communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. @@ -105,9 +111,12 @@ LineKernel::LineKernel(int dimension, AdaptionMode adaptionMode) \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -LineKernel::LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(id, dimension, communicator, haloSize, adaptionMode) +LineKernel::LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(id, dimension, communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. diff --git a/src/patchkernel/line_kernel.hpp b/src/patchkernel/line_kernel.hpp index 79c8f68ed0..0e77ed38ec 100644 --- a/src/patchkernel/line_kernel.hpp +++ b/src/patchkernel/line_kernel.hpp @@ -49,9 +49,9 @@ class LineKernel : public PatchKernel { protected: #if BITPIT_ENABLE_MPI==1 - LineKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); - LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); - LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + LineKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); #else LineKernel(AdaptionMode adaptionMode); LineKernel(int dimension, AdaptionMode adaptionMode); diff --git a/src/patchkernel/patch_kernel.cpp b/src/patchkernel/patch_kernel.cpp index 7c8e28c930..cbaf5ba024 100644 --- a/src/patchkernel/patch_kernel.cpp +++ b/src/patchkernel/patch_kernel.cpp @@ -66,8 +66,11 @@ namespace bitpit { \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -PatchKernel::PatchKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) +PatchKernel::PatchKernel(MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) #else /*! Creates a patch. @@ -77,6 +80,9 @@ PatchKernel::PatchKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMo PatchKernel::PatchKernel(AdaptionMode adaptionMode) #endif : m_adaptionMode(adaptionMode) +#if BITPIT_ENABLE_MPI==1 + , m_partitioningMode(partitioningMode) +#endif { // Initialize the patch #if BITPIT_ENABLE_MPI==1 @@ -108,8 +114,11 @@ PatchKernel::PatchKernel(AdaptionMode adaptionMode) \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -PatchKernel::PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) +PatchKernel::PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) #else /*! Creates a patch. @@ -120,6 +129,9 @@ PatchKernel::PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloS PatchKernel::PatchKernel(int dimension, AdaptionMode adaptionMode) #endif : m_adaptionMode(adaptionMode) +#if BITPIT_ENABLE_MPI==1 + , m_partitioningMode(partitioningMode) +#endif { // Initialize the patch #if BITPIT_ENABLE_MPI==1 @@ -155,8 +167,11 @@ PatchKernel::PatchKernel(int dimension, AdaptionMode adaptionMode) \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -PatchKernel::PatchKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) +PatchKernel::PatchKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) #else /*! Creates a patch. @@ -168,6 +183,9 @@ PatchKernel::PatchKernel(int id, int dimension, MPI_Comm communicator, std::size PatchKernel::PatchKernel(int id, int dimension, AdaptionMode adaptionMode) #endif : m_adaptionMode(adaptionMode) +#if BITPIT_ENABLE_MPI==1 + , m_partitioningMode(partitioningMode) +#endif { // Initialize the patch #if BITPIT_ENABLE_MPI==1 @@ -232,7 +250,8 @@ PatchKernel::PatchKernel(const PatchKernel &other) m_toleranceCustom(other.m_toleranceCustom), m_tolerance(other.m_tolerance) #if BITPIT_ENABLE_MPI==1 - , m_partitioningStatus(other.m_partitioningStatus), + , m_partitioningMode(other.m_partitioningMode), + m_partitioningStatus(other.m_partitioningStatus), m_owner(other.m_owner), m_haloSize(other.m_haloSize), m_partitioningCellsTag(other.m_partitioningCellsTag), @@ -322,6 +341,7 @@ PatchKernel::PatchKernel(PatchKernel &&other) m_nProcessors(std::move(other.m_nProcessors)) #if BITPIT_ENABLE_MPI==1 , m_communicator(std::move(MPI_COMM_NULL)), + m_partitioningMode(other.m_partitioningMode), m_partitioningStatus(std::move(other.m_partitioningStatus)), m_owner(std::move(other.m_owner)), m_haloSize(std::move(other.m_haloSize)), @@ -411,6 +431,7 @@ PatchKernel & PatchKernel::operator=(PatchKernel &&other) m_nProcessors = std::move(other.m_nProcessors); #if BITPIT_ENABLE_MPI==1 m_communicator = std::move(MPI_COMM_NULL); + m_partitioningMode = std::move(other.m_partitioningMode); m_partitioningStatus = std::move(other.m_partitioningStatus); m_owner = std::move(other.m_owner); m_haloSize = std::move(other.m_haloSize); @@ -520,11 +541,7 @@ void PatchKernel::initialize() initializeHaloSize(haloSize); // Mark patch as partioned - if (getCommunicator() != MPI_COMM_NULL) { - setPartitioningStatus(PARTITIONING_CLEAN); - } else { - setPartitioningStatus(PARTITIONING_UNSUPPORTED); - } + setPartitioningStatus(PARTITIONING_CLEAN); // Initialize partitioning tags m_partitioningCellsTag = -1; @@ -8335,11 +8352,13 @@ bool PatchKernel::dump(std::ostream &stream) const utils::binary::write(stream, m_adaptionMode); utils::binary::write(stream, m_adaptionStatus); - // Partition status + // Partition information #if BITPIT_ENABLE_MPI==1 + utils::binary::write(stream, m_partitioningMode); utils::binary::write(stream, m_partitioningStatus); #else - utils::binary::write(stream, PARTITIONING_UNSUPPORTED); + utils::binary::write(stream, PARTITIONING_DISABLED); + utils::binary::write(stream, PARTITIONING_CLEAN); #endif // Adjacencies build strategy @@ -8434,10 +8453,14 @@ void PatchKernel::restore(std::istream &stream, bool reregister) utils::binary::read(stream, m_adaptionMode); utils::binary::read(stream, m_adaptionStatus); - // Partition status + // Partition information #if BITPIT_ENABLE_MPI==1 + utils::binary::read(stream, m_partitioningMode); utils::binary::read(stream, m_partitioningStatus); #else + PartitioningStatus dummyPartitioningMode; + utils::binary::read(stream, dummyPartitioningMode); + PartitioningStatus dummyPartitioningStatus; utils::binary::read(stream, dummyPartitioningStatus); #endif diff --git a/src/patchkernel/patch_kernel.hpp b/src/patchkernel/patch_kernel.hpp index bfd5eb1637..03717ef9a3 100644 --- a/src/patchkernel/patch_kernel.hpp +++ b/src/patchkernel/patch_kernel.hpp @@ -361,11 +361,18 @@ friend class PatchManager; ADAPTION_ALTERED }; + /*! + Partitioning mode + */ + enum PartitioningMode { + PARTITIONING_DISABLED = -1, //! No partitioning can be performed + PARTITIONING_ENABLED //! The patch can be partitioned across the processes + }; + /*! Partitioning status */ enum PartitioningStatus { - PARTITIONING_UNSUPPORTED = -1, PARTITIONING_CLEAN, PARTITIONING_PREPARED, PARTITIONING_ALTERED @@ -750,6 +757,7 @@ friend class PatchManager; bool isPartitioned() const; bool isPartitioningSupported() const; bool arePartitioningInfoDirty(bool global = true) const; + PartitioningMode getPartitioningMode() const; PartitioningStatus getPartitioningStatus(bool global = false) const; double evalPartitioningUnbalance() const; double evalPartitioningUnbalance(const std::unordered_map &cellWeights) const; @@ -814,9 +822,9 @@ friend class PatchManager; AlterationFlagsStorage m_alteredInterfaces; #if BITPIT_ENABLE_MPI==1 - PatchKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); - PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); - PatchKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + PatchKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + PatchKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); #else PatchKernel(AdaptionMode adaptionMode); PatchKernel(int dimension, AdaptionMode adaptionMode); @@ -951,6 +959,7 @@ friend class PatchManager; virtual void _setHaloSize(std::size_t haloSize); void setPartitioned(bool partitioned); + void setPartitioningMode(PartitioningMode mode); void setPartitioningStatus(PartitioningStatus status); virtual std::vector _partitioningPrepare(const std::unordered_map &cellWeights, double defaultWeight, bool trackPartitioning); virtual std::vector _partitioningPrepare(const std::unordered_map &cellRanks, bool trackPartitioning); @@ -1033,6 +1042,7 @@ friend class PatchManager; int m_nProcessors; #if BITPIT_ENABLE_MPI==1 MPI_Comm m_communicator; + PartitioningMode m_partitioningMode; PartitioningStatus m_partitioningStatus; int m_owner; diff --git a/src/patchkernel/patch_kernel_parallel.cpp b/src/patchkernel/patch_kernel_parallel.cpp index 5ffb0fb974..88d07bf9af 100644 --- a/src/patchkernel/patch_kernel_parallel.cpp +++ b/src/patchkernel/patch_kernel_parallel.cpp @@ -1695,7 +1695,36 @@ bool PatchKernel::isPartitioned() const */ bool PatchKernel::isPartitioningSupported() const { - return (getPartitioningStatus() != PARTITIONING_UNSUPPORTED); + return (getPartitioningMode() != PARTITIONING_DISABLED); +} + +/*! + Returns the current partitioning mode. + + Partitioning mode tells if the patch can be partitioned across the processes. + + The following partitioning modes are supported: + - disabled, no partitioning can be performed; + - enabled, the patch can be partitioned across the processes. + + \return The current partitioning mode. +*/ +PatchKernel::PartitioningMode PatchKernel::getPartitioningMode() const +{ + return m_partitioningMode; +} + +/*! + Set the current partitioning mode. + + See PatchKernel::getPartitioningMode() for a list of supported partitioning + modes. + + \param mode is the partitioning mode that will be set +*/ +void PatchKernel::setPartitioningMode(PartitioningMode mode) +{ + m_partitioningMode = mode; } /*! diff --git a/src/patchkernel/point_kernel.cpp b/src/patchkernel/point_kernel.cpp index b345180cad..3ffa33d24a 100644 --- a/src/patchkernel/point_kernel.cpp +++ b/src/patchkernel/point_kernel.cpp @@ -39,8 +39,9 @@ namespace bitpit { will be created \param adaptionMode is the adaption mode that will be used for the patch */ -PointKernel::PointKernel(MPI_Comm communicator, AdaptionMode adaptionMode) - : PatchKernel(communicator, 0, adaptionMode) +PointKernel::PointKernel(MPI_Comm communicator, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(communicator, 0, adaptionMode, partitioningMode) #else /*! Creates a patch. @@ -67,15 +68,20 @@ PointKernel::PointKernel(AdaptionMode adaptionMode) among the processes. If a null comunicator is provided, a serial patch will be created \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -PointKernel::PointKernel(int dimension, MPI_Comm communicator, AdaptionMode adaptionMode) - : PatchKernel(dimension, communicator, 0, adaptionMode) +PointKernel::PointKernel(int dimension, MPI_Comm communicator, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(dimension, communicator, 0, adaptionMode, partitioningMode) #else /*! Creates a patch. \param dimension is the dimension of the patch \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ PointKernel::PointKernel(int dimension, AdaptionMode adaptionMode) : PatchKernel(dimension, adaptionMode) @@ -98,9 +104,12 @@ PointKernel::PointKernel(int dimension, AdaptionMode adaptionMode) among the processes. If a null comunicator is provided, a serial patch will be created \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -PointKernel::PointKernel(int id, int dimension, MPI_Comm communicator, AdaptionMode adaptionMode) - : PatchKernel(id, dimension, communicator, 0, adaptionMode) +PointKernel::PointKernel(int id, int dimension, MPI_Comm communicator, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(id, dimension, communicator, 0, adaptionMode, partitioningMode) #else /*! Creates a patch. diff --git a/src/patchkernel/point_kernel.hpp b/src/patchkernel/point_kernel.hpp index 185aff4d1c..d9157066b1 100644 --- a/src/patchkernel/point_kernel.hpp +++ b/src/patchkernel/point_kernel.hpp @@ -43,9 +43,9 @@ class PointKernel : public PatchKernel { protected: #if BITPIT_ENABLE_MPI==1 - PointKernel(MPI_Comm communicator, AdaptionMode adaptionMode); - PointKernel(int dimension, MPI_Comm communicator, AdaptionMode adaptionMode); - PointKernel(int id, int dimension, MPI_Comm communicator, AdaptionMode adaptionMode); + PointKernel(MPI_Comm communicator, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + PointKernel(int dimension, MPI_Comm communicator, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + PointKernel(int id, int dimension, MPI_Comm communicator, AdaptionMode adaptionMode, PartitioningMode partitioningMode); #else PointKernel(AdaptionMode adaptionMode); PointKernel(int dimension, AdaptionMode adaptionMode); diff --git a/src/patchkernel/surface_kernel.cpp b/src/patchkernel/surface_kernel.cpp index ca03d23f80..ebe37f6d1b 100644 --- a/src/patchkernel/surface_kernel.cpp +++ b/src/patchkernel/surface_kernel.cpp @@ -71,9 +71,12 @@ const unsigned short SurfaceKernel::SELECT_ALL = 3; \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -SurfaceKernel::SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(communicator, haloSize, adaptionMode) +SurfaceKernel::SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. @@ -102,9 +105,12 @@ SurfaceKernel::SurfaceKernel(AdaptionMode adaptionMode) \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -SurfaceKernel::SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(dimension, communicator, haloSize, adaptionMode) +SurfaceKernel::SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(dimension, communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. @@ -135,9 +141,12 @@ SurfaceKernel::SurfaceKernel(int dimension, AdaptionMode adaptionMode) \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -SurfaceKernel::SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(id, dimension, communicator, haloSize, adaptionMode) +SurfaceKernel::SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(id, dimension, communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. diff --git a/src/patchkernel/surface_kernel.hpp b/src/patchkernel/surface_kernel.hpp index 09deb74f62..f8e4defc78 100644 --- a/src/patchkernel/surface_kernel.hpp +++ b/src/patchkernel/surface_kernel.hpp @@ -99,9 +99,9 @@ class SurfaceKernel : public PatchKernel { protected: #if BITPIT_ENABLE_MPI==1 - SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); - SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); - SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + SurfaceKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + SurfaceKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + SurfaceKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); #else SurfaceKernel(AdaptionMode adaptionMode); SurfaceKernel(int dimension, AdaptionMode adaptionMode); diff --git a/src/patchkernel/volume_kernel.cpp b/src/patchkernel/volume_kernel.cpp index ad667bf704..2693bdff5c 100644 --- a/src/patchkernel/volume_kernel.cpp +++ b/src/patchkernel/volume_kernel.cpp @@ -50,9 +50,12 @@ namespace bitpit { \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -VolumeKernel::VolumeKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(communicator, haloSize, adaptionMode) +VolumeKernel::VolumeKernel(MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. @@ -80,9 +83,12 @@ VolumeKernel::VolumeKernel(AdaptionMode adaptionMode) \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -VolumeKernel::VolumeKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(dimension, communicator, haloSize, adaptionMode) +VolumeKernel::VolumeKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(dimension, communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. @@ -112,9 +118,12 @@ VolumeKernel::VolumeKernel(int dimension, AdaptionMode adaptionMode) \param haloSize is the size, expressed in number of layers, of the ghost cells halo \param adaptionMode is the adaption mode that will be used for the patch + \param partitioningMode is the partitioning mode that will be used for the + patch */ -VolumeKernel::VolumeKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode) - : PatchKernel(id, dimension, communicator, haloSize, adaptionMode) +VolumeKernel::VolumeKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, + AdaptionMode adaptionMode, PartitioningMode partitioningMode) + : PatchKernel(id, dimension, communicator, haloSize, adaptionMode, partitioningMode) #else /*! Creates a patch. diff --git a/src/patchkernel/volume_kernel.hpp b/src/patchkernel/volume_kernel.hpp index 66e3b6a14d..e3d73fc6bd 100644 --- a/src/patchkernel/volume_kernel.hpp +++ b/src/patchkernel/volume_kernel.hpp @@ -56,9 +56,9 @@ class VolumeKernel : public PatchKernel { protected: #if BITPIT_ENABLE_MPI==1 - VolumeKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); - VolumeKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); - VolumeKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode); + VolumeKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + VolumeKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); + VolumeKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode, PartitioningMode partitioningMode); #else VolumeKernel(AdaptionMode adaptionMode); VolumeKernel(int dimension, AdaptionMode adaptionMode); diff --git a/src/pointcloud/pointcloud.cpp b/src/pointcloud/pointcloud.cpp index 9d0d8507fa..2690f74496 100644 --- a/src/pointcloud/pointcloud.cpp +++ b/src/pointcloud/pointcloud.cpp @@ -49,7 +49,7 @@ namespace bitpit { among the processes */ PointCloud::PointCloud(MPI_Comm communicator) - : PointKernel(communicator, ADAPTION_MANUAL) + : PointKernel(communicator, ADAPTION_MANUAL, PARTITIONING_DISABLED) #else /*! Creates an uninitialized serial patch. @@ -73,7 +73,7 @@ PointCloud::PointCloud() among the processes */ PointCloud::PointCloud(int dimension, MPI_Comm communicator) - : PointKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, ADAPTION_MANUAL) + : PointKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, ADAPTION_MANUAL, PARTITIONING_DISABLED) #else /*! Creates a patch. @@ -100,7 +100,7 @@ PointCloud::PointCloud(int dimension) among the processes */ PointCloud::PointCloud(int id, int dimension, MPI_Comm communicator) - : PointKernel(id, dimension, communicator, ADAPTION_MANUAL) + : PointKernel(id, dimension, communicator, ADAPTION_MANUAL, PARTITIONING_DISABLED) #else /*! Creates a patch. @@ -126,7 +126,7 @@ PointCloud::PointCloud(int id, int dimension) among the processes */ PointCloud::PointCloud(std::istream &stream, MPI_Comm communicator) - : PointKernel(communicator, ADAPTION_MANUAL) + : PointKernel(communicator, ADAPTION_MANUAL, PARTITIONING_DISABLED) #else /*! Creates a patch restoring the patch saved in the specified stream. diff --git a/src/surfunstructured/surfunstructured.cpp b/src/surfunstructured/surfunstructured.cpp index fb1334cf00..5e7620fd64 100644 --- a/src/surfunstructured/surfunstructured.cpp +++ b/src/surfunstructured/surfunstructured.cpp @@ -53,7 +53,7 @@ namespace bitpit { cells halo */ SurfUnstructured::SurfUnstructured(MPI_Comm communicator, std::size_t haloSize) - : SurfaceKernel(communicator, haloSize, ADAPTION_MANUAL) + : SurfaceKernel(communicator, haloSize, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates an uninitialized serial patch. @@ -108,7 +108,7 @@ SurfUnstructured::SurfUnstructured(int dimension) cells halo */ SurfUnstructured::SurfUnstructured(int id, int dimension, MPI_Comm communicator, std::size_t haloSize) - : SurfaceKernel(id, dimension, communicator, haloSize, ADAPTION_MANUAL) + : SurfaceKernel(id, dimension, communicator, haloSize, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates a patch. @@ -136,7 +136,7 @@ SurfUnstructured::SurfUnstructured(int id, int dimension) cells halo */ SurfUnstructured::SurfUnstructured(std::istream &stream, MPI_Comm communicator, std::size_t haloSize) - : SurfaceKernel(communicator, haloSize, ADAPTION_MANUAL) + : SurfaceKernel(communicator, haloSize, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates a patch restoring the patch saved in the specified stream. diff --git a/src/volcartesian/volcartesian.cpp b/src/volcartesian/volcartesian.cpp index fa7e6293f7..b9c93458d2 100644 --- a/src/volcartesian/volcartesian.cpp +++ b/src/volcartesian/volcartesian.cpp @@ -65,7 +65,7 @@ namespace bitpit { */ VolCartesian::VolCartesian() #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(MPI_COMM_NULL, 0, ADAPTION_DISABLED) + : VolumeKernel(MPI_COMM_NULL, 0, ADAPTION_DISABLED, PARTITIONING_DISABLED) #else : VolumeKernel(ADAPTION_DISABLED) #endif @@ -103,7 +103,7 @@ VolCartesian::VolCartesian(int id, int dimension, const std::array &lengths, const std::array &nCells) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED) + : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED, PARTITIONING_DISABLED) #else : VolumeKernel(id, dimension, ADAPTION_DISABLED) #endif @@ -144,7 +144,7 @@ VolCartesian::VolCartesian(int id, int dimension, const std::array &origin, double length, int nCells) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED) + : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED, PARTITIONING_DISABLED) #else : VolumeKernel(id, dimension, ADAPTION_DISABLED) #endif @@ -185,7 +185,7 @@ VolCartesian::VolCartesian(int id, int dimension, const std::array &origin, double length, double dh) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED) + : VolumeKernel(id, dimension, MPI_COMM_NULL, 0, ADAPTION_DISABLED, PARTITIONING_DISABLED) #else : VolumeKernel(id, dimension, ADAPTION_DISABLED) #endif @@ -206,7 +206,7 @@ VolCartesian::VolCartesian(int id, int dimension, */ VolCartesian::VolCartesian(std::istream &stream) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(MPI_COMM_NULL, 0, ADAPTION_DISABLED) + : VolumeKernel(MPI_COMM_NULL, 0, ADAPTION_DISABLED, PARTITIONING_DISABLED) #else : VolumeKernel(ADAPTION_DISABLED) #endif diff --git a/src/voloctree/voloctree.cpp b/src/voloctree/voloctree.cpp index a4e79c81fb..0f9b2d0c23 100644 --- a/src/voloctree/voloctree.cpp +++ b/src/voloctree/voloctree.cpp @@ -74,7 +74,7 @@ namespace bitpit { cells halo */ VolOctree::VolOctree(MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(communicator, haloSize, ADAPTION_AUTOMATIC) + : VolumeKernel(communicator, haloSize, ADAPTION_AUTOMATIC, PARTITIONING_ENABLED) #else /*! Creates an uninitialized serial patch. @@ -169,7 +169,7 @@ VolOctree::VolOctree(int dimension, const std::array &origin, double cells halo */ VolOctree::VolOctree(int id, int dimension, const std::array &origin, double length, double dh, MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(id, dimension, communicator, haloSize, ADAPTION_AUTOMATIC) + : VolumeKernel(id, dimension, communicator, haloSize, ADAPTION_AUTOMATIC, PARTITIONING_ENABLED) #else /*! Creates a patch. @@ -243,7 +243,7 @@ VolOctree::VolOctree(int id, int dimension, const std::array &origin, cells halo */ VolOctree::VolOctree(std::istream &stream, MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(communicator, haloSize, ADAPTION_AUTOMATIC) + : VolumeKernel(communicator, haloSize, ADAPTION_AUTOMATIC, PARTITIONING_ENABLED) #else /*! Creates a patch restoring the patch saved in the specified stream. @@ -305,7 +305,7 @@ VolOctree::VolOctree(std::unique_ptr &&tree, std::unique_ptr &&tree, std::unique_ptr *adopter) #if BITPIT_ENABLE_MPI==1 - : VolumeKernel(id, tree->getDim(), tree->getComm(), tree->getNofGhostLayers(), ADAPTION_AUTOMATIC) + : VolumeKernel(id, tree->getDim(), tree->getComm(), tree->getNofGhostLayers(), ADAPTION_AUTOMATIC, PARTITIONING_ENABLED) #else : VolumeKernel(id, tree->getDim(), ADAPTION_AUTOMATIC) #endif diff --git a/src/volunstructured/volunstructured.cpp b/src/volunstructured/volunstructured.cpp index 0ad2ae4d3f..f1190e3a9f 100644 --- a/src/volunstructured/volunstructured.cpp +++ b/src/volunstructured/volunstructured.cpp @@ -54,7 +54,7 @@ namespace bitpit { cells halo */ VolUnstructured::VolUnstructured(MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(communicator, haloSize, ADAPTION_MANUAL) + : VolumeKernel(communicator, haloSize, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates an uninitialized serial patch. @@ -111,7 +111,7 @@ VolUnstructured::VolUnstructured(int dimension) cells halo */ VolUnstructured::VolUnstructured(int id, int dimension, MPI_Comm communicator, std::size_t haloSize) - : VolumeKernel(id, dimension, communicator, haloSize, ADAPTION_MANUAL) + : VolumeKernel(id, dimension, communicator, haloSize, ADAPTION_MANUAL, PARTITIONING_ENABLED) #else /*! Creates a patch. diff --git a/test/integration_tests/levelset/test_levelset_00001.cpp b/test/integration_tests/levelset/test_levelset_00001.cpp index 94dad743ab..4ad267c374 100644 --- a/test/integration_tests/levelset/test_levelset_00001.cpp +++ b/test/integration_tests/levelset/test_levelset_00001.cpp @@ -124,7 +124,7 @@ int subtest_001() delta = meshMax -meshMin ; bitpit::VolCartesian mesh( 1, dimensions, meshMin, delta, nc); - mesh.update() ; + mesh.switchMemoryMode(bitpit::VolCartesian::MEMORY_NORMAL) ; mesh.initializeAdjacencies() ; mesh.initializeInterfaces() ;