@@ -65,8 +65,11 @@ namespace bitpit {
6565 \param haloSize is the size, expressed in number of layers, of the ghost
6666 cells halo
6767 \param adaptionMode is the adaption mode that will be used for the patch
68+ \param partitioningMode is the partitioning mode that will be used for the
69+ patch
6870*/
69- PatchKernel::PatchKernel (MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
71+ PatchKernel::PatchKernel (MPI_Comm communicator, std::size_t haloSize,
72+ AdaptionMode adaptionMode, PartitioningMode partitioningMode)
7073#else
7174/* !
7275 Creates a patch.
@@ -76,6 +79,9 @@ PatchKernel::PatchKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMo
7679PatchKernel::PatchKernel (AdaptionMode adaptionMode)
7780#endif
7881 : m_adaptionMode(adaptionMode)
82+ #if BITPIT_ENABLE_MPI==1
83+ , m_partitioningMode(partitioningMode)
84+ #endif
7985{
8086 // Initialize the patch
8187#if BITPIT_ENABLE_MPI==1
@@ -107,8 +113,11 @@ PatchKernel::PatchKernel(AdaptionMode adaptionMode)
107113 \param haloSize is the size, expressed in number of layers, of the ghost
108114 cells halo
109115 \param adaptionMode is the adaption mode that will be used for the patch
116+ \param partitioningMode is the partitioning mode that will be used for the
117+ patch
110118*/
111- PatchKernel::PatchKernel (int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
119+ PatchKernel::PatchKernel (int dimension, MPI_Comm communicator, std::size_t haloSize,
120+ AdaptionMode adaptionMode, PartitioningMode partitioningMode)
112121#else
113122/* !
114123 Creates a patch.
@@ -119,6 +128,9 @@ PatchKernel::PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloS
119128PatchKernel::PatchKernel (int dimension, AdaptionMode adaptionMode)
120129#endif
121130 : m_adaptionMode(adaptionMode)
131+ #if BITPIT_ENABLE_MPI==1
132+ , m_partitioningMode(partitioningMode)
133+ #endif
122134{
123135 // Initialize the patch
124136#if BITPIT_ENABLE_MPI==1
@@ -154,8 +166,11 @@ PatchKernel::PatchKernel(int dimension, AdaptionMode adaptionMode)
154166 \param haloSize is the size, expressed in number of layers, of the ghost
155167 cells halo
156168 \param adaptionMode is the adaption mode that will be used for the patch
169+ \param partitioningMode is the partitioning mode that will be used for the
170+ patch
157171*/
158- PatchKernel::PatchKernel (int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
172+ PatchKernel::PatchKernel (int id, int dimension, MPI_Comm communicator, std::size_t haloSize,
173+ AdaptionMode adaptionMode, PartitioningMode partitioningMode)
159174#else
160175/* !
161176 Creates a patch.
@@ -167,6 +182,9 @@ PatchKernel::PatchKernel(int id, int dimension, MPI_Comm communicator, std::size
167182PatchKernel::PatchKernel (int id, int dimension, AdaptionMode adaptionMode)
168183#endif
169184 : m_adaptionMode(adaptionMode)
185+ #if BITPIT_ENABLE_MPI==1
186+ , m_partitioningMode(partitioningMode)
187+ #endif
170188{
171189 // Initialize the patch
172190#if BITPIT_ENABLE_MPI==1
@@ -231,7 +249,8 @@ PatchKernel::PatchKernel(const PatchKernel &other)
231249 m_toleranceCustom(other.m_toleranceCustom),
232250 m_tolerance(other.m_tolerance)
233251#if BITPIT_ENABLE_MPI==1
234- , m_partitioningStatus(other.m_partitioningStatus),
252+ , m_partitioningMode(other.m_partitioningMode),
253+ m_partitioningStatus (other.m_partitioningStatus),
235254 m_owner(other.m_owner),
236255 m_haloSize(other.m_haloSize),
237256 m_partitioningCellsTag(other.m_partitioningCellsTag),
@@ -321,6 +340,7 @@ PatchKernel::PatchKernel(PatchKernel &&other)
321340 m_nProcessors(std::move(other.m_nProcessors))
322341#if BITPIT_ENABLE_MPI==1
323342 , m_communicator(std::move(MPI_COMM_NULL)),
343+ m_partitioningMode (other.m_partitioningMode),
324344 m_partitioningStatus(std::move(other.m_partitioningStatus)),
325345 m_owner(std::move(other.m_owner)),
326346 m_haloSize(std::move(other.m_haloSize)),
@@ -410,6 +430,7 @@ PatchKernel & PatchKernel::operator=(PatchKernel &&other)
410430 m_nProcessors = std::move (other.m_nProcessors );
411431#if BITPIT_ENABLE_MPI==1
412432 m_communicator = std::move (MPI_COMM_NULL);
433+ m_partitioningMode = std::move (other.m_partitioningMode );
413434 m_partitioningStatus = std::move (other.m_partitioningStatus );
414435 m_owner = std::move (other.m_owner );
415436 m_haloSize = std::move (other.m_haloSize );
@@ -519,11 +540,7 @@ void PatchKernel::initialize()
519540 initializeHaloSize (haloSize);
520541
521542 // Mark patch as partioned
522- if (isPartitioned ()) {
523- setPartitioningStatus (PARTITIONING_CLEAN);
524- } else {
525- setPartitioningStatus (PARTITIONING_UNSUPPORTED);
526- }
543+ setPartitioningStatus (PARTITIONING_CLEAN);
527544
528545 // Initialize partitioning tags
529546 m_partitioningCellsTag = -1 ;
@@ -8331,11 +8348,13 @@ bool PatchKernel::dump(std::ostream &stream) const
83318348 utils::binary::write (stream, m_adaptionMode);
83328349 utils::binary::write (stream, m_adaptionStatus);
83338350
8334- // Partition status
8351+ // Partition information
83358352#if BITPIT_ENABLE_MPI==1
8353+ utils::binary::write (stream, m_partitioningMode);
83368354 utils::binary::write (stream, m_partitioningStatus);
83378355#else
8338- utils::binary::write (stream, PARTITIONING_UNSUPPORTED);
8356+ utils::binary::write (stream, PARTITIONING_DISABLED);
8357+ utils::binary::write (stream, PARTITIONING_CLEAN);
83398358#endif
83408359
83418360 // Adjacencies build strategy
@@ -8430,10 +8449,14 @@ void PatchKernel::restore(std::istream &stream, bool reregister)
84308449 utils::binary::read (stream, m_adaptionMode);
84318450 utils::binary::read (stream, m_adaptionStatus);
84328451
8433- // Partition status
8452+ // Partition information
84348453#if BITPIT_ENABLE_MPI==1
8454+ utils::binary::read (stream, m_partitioningMode);
84358455 utils::binary::read (stream, m_partitioningStatus);
84368456#else
8457+ PartitioningStatus dummyPartitioningMode;
8458+ utils::binary::read (stream, dummyPartitioningMode);
8459+
84378460 PartitioningStatus dummyPartitioningStatus;
84388461 utils::binary::read (stream, dummyPartitioningStatus);
84398462#endif
0 commit comments