Skip to content

Commit 461e472

Browse files
committed
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 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.
1 parent 6da381c commit 461e472

29 files changed

+335
-383
lines changed

src/lineunstructured/lineunstructured.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ namespace bitpit {
5050
among the processes
5151
*/
5252
LineUnstructured::LineUnstructured(MPI_Comm communicator)
53-
: LineKernel(communicator, 1, true)
53+
: LineKernel(communicator, 1, ADAPTION_MANUAL)
5454
#else
5555
/*!
5656
Creates an uninitialized serial patch.
5757
*/
5858
LineUnstructured::LineUnstructured()
59-
: LineKernel(true)
59+
: LineKernel(ADAPTION_MANUAL)
6060
#endif
6161
{
6262
}
@@ -74,15 +74,15 @@ LineUnstructured::LineUnstructured()
7474
among the processes
7575
*/
7676
LineUnstructured::LineUnstructured(int dimension, MPI_Comm communicator)
77-
: LineKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, 1, true)
77+
: LineKernel(PatchManager::AUTOMATIC_ID, dimension, communicator, 1, ADAPTION_MANUAL)
7878
#else
7979
/*!
8080
Creates a patch.
8181
8282
\param dimension is the dimension of the patch
8383
*/
8484
LineUnstructured::LineUnstructured(int dimension)
85-
: LineKernel(PatchManager::AUTOMATIC_ID, dimension, true)
85+
: LineKernel(PatchManager::AUTOMATIC_ID, dimension, ADAPTION_MANUAL)
8686
#endif
8787
{
8888
}
@@ -101,7 +101,7 @@ LineUnstructured::LineUnstructured(int dimension)
101101
among the processes
102102
*/
103103
LineUnstructured::LineUnstructured(int id, int dimension, MPI_Comm communicator)
104-
: LineKernel(id, dimension, communicator, 1, true)
104+
: LineKernel(id, dimension, communicator, 1, ADAPTION_MANUAL)
105105
#else
106106
/*!
107107
Creates a patch.
@@ -110,7 +110,7 @@ LineUnstructured::LineUnstructured(int id, int dimension, MPI_Comm communicator)
110110
\param dimension is the dimension of the patch
111111
*/
112112
LineUnstructured::LineUnstructured(int id, int dimension)
113-
: LineKernel(id, dimension, true)
113+
: LineKernel(id, dimension, ADAPTION_MANUAL)
114114
#endif
115115
{
116116
}
@@ -127,15 +127,15 @@ LineUnstructured::LineUnstructured(int id, int dimension)
127127
among the processes
128128
*/
129129
LineUnstructured::LineUnstructured(std::istream &stream, MPI_Comm communicator)
130-
: LineKernel(communicator, 1, false)
130+
: LineKernel(communicator, 1, ADAPTION_MANUAL)
131131
#else
132132
/*!
133133
Creates a patch restoring the patch saved in the specified stream.
134134
135135
\param stream is the stream to read from
136136
*/
137137
LineUnstructured::LineUnstructured(std::istream &stream)
138-
: LineKernel(false)
138+
: LineKernel(ADAPTION_MANUAL)
139139
#endif
140140
{
141141
// Restore the patch

src/patchkernel/line_kernel.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ namespace bitpit {
4040
will be created
4141
\param haloSize is the size, expressed in number of layers, of the ghost
4242
cells halo
43-
\param expert if true, the expert mode will be enabled
43+
\param adaptionMode is the adaption mode that will be used for the patch
4444
*/
45-
LineKernel::LineKernel(MPI_Comm communicator, std::size_t haloSize, bool expert)
46-
: PatchKernel(communicator, haloSize, expert)
45+
LineKernel::LineKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
46+
: PatchKernel(communicator, haloSize, adaptionMode)
4747
#else
4848
/*!
4949
Creates a patch.
5050
51-
\param expert if true, the expert mode will be enabled
51+
\param adaptionMode is the adaption mode that will be used for the patch
5252
*/
53-
LineKernel::LineKernel(bool expert)
54-
: PatchKernel(expert)
53+
LineKernel::LineKernel(AdaptionMode adaptionMode)
54+
: PatchKernel(adaptionMode)
5555
#endif
5656
{
5757
initialize();
@@ -71,19 +71,19 @@ LineKernel::LineKernel(bool expert)
7171
will be created
7272
\param haloSize is the size, expressed in number of layers, of the ghost
7373
cells halo
74-
\param expert if true, the expert mode will be enabled
74+
\param adaptionMode is the adaption mode that will be used for the patch
7575
*/
76-
LineKernel::LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert)
77-
: PatchKernel(dimension, communicator, haloSize, expert)
76+
LineKernel::LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
77+
: PatchKernel(dimension, communicator, haloSize, adaptionMode)
7878
#else
7979
/*!
8080
Creates a patch.
8181
8282
\param dimension is the dimension of the patch
83-
\param expert if true, the expert mode will be enabled
83+
\param adaptionMode is the adaption mode that will be used for the patch
8484
*/
85-
LineKernel::LineKernel(int dimension, bool expert)
86-
: PatchKernel(dimension, expert)
85+
LineKernel::LineKernel(int dimension, AdaptionMode adaptionMode)
86+
: PatchKernel(dimension, adaptionMode)
8787
#endif
8888
{
8989
initialize();
@@ -104,20 +104,20 @@ LineKernel::LineKernel(int dimension, bool expert)
104104
will be created
105105
\param haloSize is the size, expressed in number of layers, of the ghost
106106
cells halo
107-
\param expert if true, the expert mode will be enabled
107+
\param adaptionMode is the adaption mode that will be used for the patch
108108
*/
109-
LineKernel::LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert)
110-
: PatchKernel(id, dimension, communicator, haloSize, expert)
109+
LineKernel::LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
110+
: PatchKernel(id, dimension, communicator, haloSize, adaptionMode)
111111
#else
112112
/*!
113113
Creates a patch.
114114
115115
\param id is the id that will be assigned to the patch
116116
\param dimension is the dimension of the patch
117-
\param expert if true, the expert mode will be enabled
117+
\param adaptionMode is the adaption mode that will be used for the patch
118118
*/
119-
LineKernel::LineKernel(int id, int dimension, bool expert)
120-
: PatchKernel(id, dimension, expert)
119+
LineKernel::LineKernel(int id, int dimension, AdaptionMode adaptionMode)
120+
: PatchKernel(id, dimension, adaptionMode)
121121
#endif
122122
{
123123
}

src/patchkernel/line_kernel.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ class LineKernel : public PatchKernel {
4949

5050
protected:
5151
#if BITPIT_ENABLE_MPI==1
52-
LineKernel(MPI_Comm communicator, std::size_t haloSize, bool expert);
53-
LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert);
54-
LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, bool expert);
52+
LineKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode);
53+
LineKernel(int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode);
54+
LineKernel(int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode);
5555
#else
56-
LineKernel(bool expert);
57-
LineKernel(int dimension, bool expert);
58-
LineKernel(int id, int dimension, bool expert);
56+
LineKernel(AdaptionMode adaptionMode);
57+
LineKernel(int dimension, AdaptionMode adaptionMode);
58+
LineKernel(int id, int dimension, AdaptionMode adaptionMode);
5959
#endif
6060

6161
};

0 commit comments

Comments
 (0)