Skip to content

Commit

Permalink
patchkernel: explicitly define the adaption mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrea-iob committed Feb 6, 2023
1 parent 6da381c commit 461e472
Show file tree
Hide file tree
Showing 29 changed files with 335 additions and 383 deletions.
16 changes: 8 additions & 8 deletions src/lineunstructured/lineunstructured.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
}
Expand All @@ -74,15 +74,15 @@ 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.
\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
{
}
Expand All @@ -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.
Expand All @@ -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
{
}
Expand All @@ -127,15 +127,15 @@ 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.
\param stream is the stream to read from
*/
LineUnstructured::LineUnstructured(std::istream &stream)
: LineKernel(false)
: LineKernel(ADAPTION_MANUAL)
#endif
{
// Restore the patch
Expand Down
36 changes: 18 additions & 18 deletions src/patchkernel/line_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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
{
}
Expand Down
12 changes: 6 additions & 6 deletions src/patchkernel/line_kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

};
Expand Down
Loading

0 comments on commit 461e472

Please sign in to comment.