@@ -66,8 +66,11 @@ namespace bitpit {
6666 \param haloSize is the size, expressed in number of layers, of the ghost
6767 cells halo
6868 \param adaptionMode is the adaption mode that will be used for the patch
69+ \param partitioningMode is the partitioning mode that will be used for the
70+ patch
6971*/
70- PatchKernel::PatchKernel (MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
72+ PatchKernel::PatchKernel (MPI_Comm communicator, std::size_t haloSize,
73+ AdaptionMode adaptionMode, PartitioningMode partitioningMode)
7174#else
7275/* !
7376 Creates a patch.
@@ -77,6 +80,9 @@ PatchKernel::PatchKernel(MPI_Comm communicator, std::size_t haloSize, AdaptionMo
7780PatchKernel::PatchKernel (AdaptionMode adaptionMode)
7881#endif
7982 : m_adaptionMode(adaptionMode)
83+ #if BITPIT_ENABLE_MPI==1
84+ , m_partitioningMode(partitioningMode)
85+ #endif
8086{
8187 // Initialize the patch
8288#if BITPIT_ENABLE_MPI==1
@@ -108,8 +114,11 @@ PatchKernel::PatchKernel(AdaptionMode adaptionMode)
108114 \param haloSize is the size, expressed in number of layers, of the ghost
109115 cells halo
110116 \param adaptionMode is the adaption mode that will be used for the patch
117+ \param partitioningMode is the partitioning mode that will be used for the
118+ patch
111119*/
112- PatchKernel::PatchKernel (int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
120+ PatchKernel::PatchKernel (int dimension, MPI_Comm communicator, std::size_t haloSize,
121+ AdaptionMode adaptionMode, PartitioningMode partitioningMode)
113122#else
114123/* !
115124 Creates a patch.
@@ -120,6 +129,9 @@ PatchKernel::PatchKernel(int dimension, MPI_Comm communicator, std::size_t haloS
120129PatchKernel::PatchKernel (int dimension, AdaptionMode adaptionMode)
121130#endif
122131 : m_adaptionMode(adaptionMode)
132+ #if BITPIT_ENABLE_MPI==1
133+ , m_partitioningMode(partitioningMode)
134+ #endif
123135{
124136 // Initialize the patch
125137#if BITPIT_ENABLE_MPI==1
@@ -155,8 +167,11 @@ PatchKernel::PatchKernel(int dimension, AdaptionMode adaptionMode)
155167 \param haloSize is the size, expressed in number of layers, of the ghost
156168 cells halo
157169 \param adaptionMode is the adaption mode that will be used for the patch
170+ \param partitioningMode is the partitioning mode that will be used for the
171+ patch
158172*/
159- PatchKernel::PatchKernel (int id, int dimension, MPI_Comm communicator, std::size_t haloSize, AdaptionMode adaptionMode)
173+ PatchKernel::PatchKernel (int id, int dimension, MPI_Comm communicator, std::size_t haloSize,
174+ AdaptionMode adaptionMode, PartitioningMode partitioningMode)
160175#else
161176/* !
162177 Creates a patch.
@@ -168,6 +183,9 @@ PatchKernel::PatchKernel(int id, int dimension, MPI_Comm communicator, std::size
168183PatchKernel::PatchKernel (int id, int dimension, AdaptionMode adaptionMode)
169184#endif
170185 : m_adaptionMode(adaptionMode)
186+ #if BITPIT_ENABLE_MPI==1
187+ , m_partitioningMode(partitioningMode)
188+ #endif
171189{
172190 // Initialize the patch
173191#if BITPIT_ENABLE_MPI==1
@@ -232,7 +250,8 @@ PatchKernel::PatchKernel(const PatchKernel &other)
232250 m_toleranceCustom(other.m_toleranceCustom),
233251 m_tolerance(other.m_tolerance)
234252#if BITPIT_ENABLE_MPI==1
235- , m_partitioningStatus(other.m_partitioningStatus),
253+ , m_partitioningMode(other.m_partitioningMode),
254+ m_partitioningStatus (other.m_partitioningStatus),
236255 m_owner(other.m_owner),
237256 m_haloSize(other.m_haloSize),
238257 m_partitioningCellsTag(other.m_partitioningCellsTag),
@@ -322,6 +341,7 @@ PatchKernel::PatchKernel(PatchKernel &&other)
322341 m_nProcessors(std::move(other.m_nProcessors))
323342#if BITPIT_ENABLE_MPI==1
324343 , m_communicator(std::move(MPI_COMM_NULL)),
344+ m_partitioningMode (other.m_partitioningMode),
325345 m_partitioningStatus(std::move(other.m_partitioningStatus)),
326346 m_owner(std::move(other.m_owner)),
327347 m_haloSize(std::move(other.m_haloSize)),
@@ -411,6 +431,7 @@ PatchKernel & PatchKernel::operator=(PatchKernel &&other)
411431 m_nProcessors = std::move (other.m_nProcessors );
412432#if BITPIT_ENABLE_MPI==1
413433 m_communicator = std::move (MPI_COMM_NULL);
434+ m_partitioningMode = std::move (other.m_partitioningMode );
414435 m_partitioningStatus = std::move (other.m_partitioningStatus );
415436 m_owner = std::move (other.m_owner );
416437 m_haloSize = std::move (other.m_haloSize );
@@ -520,11 +541,7 @@ void PatchKernel::initialize()
520541 initializeHaloSize (haloSize);
521542
522543 // Mark patch as partioned
523- if (getCommunicator () != MPI_COMM_NULL) {
524- setPartitioningStatus (PARTITIONING_CLEAN);
525- } else {
526- setPartitioningStatus (PARTITIONING_UNSUPPORTED);
527- }
544+ setPartitioningStatus (PARTITIONING_CLEAN);
528545
529546 // Initialize partitioning tags
530547 m_partitioningCellsTag = -1 ;
@@ -8335,11 +8352,13 @@ bool PatchKernel::dump(std::ostream &stream) const
83358352 utils::binary::write (stream, m_adaptionMode);
83368353 utils::binary::write (stream, m_adaptionStatus);
83378354
8338- // Partition status
8355+ // Partition information
83398356#if BITPIT_ENABLE_MPI==1
8357+ utils::binary::write (stream, m_partitioningMode);
83408358 utils::binary::write (stream, m_partitioningStatus);
83418359#else
8342- utils::binary::write (stream, PARTITIONING_UNSUPPORTED);
8360+ utils::binary::write (stream, PARTITIONING_DISABLED);
8361+ utils::binary::write (stream, PARTITIONING_CLEAN);
83438362#endif
83448363
83458364 // Adjacencies build strategy
@@ -8434,10 +8453,14 @@ void PatchKernel::restore(std::istream &stream, bool reregister)
84348453 utils::binary::read (stream, m_adaptionMode);
84358454 utils::binary::read (stream, m_adaptionStatus);
84368455
8437- // Partition status
8456+ // Partition information
84388457#if BITPIT_ENABLE_MPI==1
8458+ utils::binary::read (stream, m_partitioningMode);
84398459 utils::binary::read (stream, m_partitioningStatus);
84408460#else
8461+ PartitioningStatus dummyPartitioningMode;
8462+ utils::binary::read (stream, dummyPartitioningMode);
8463+
84418464 PartitioningStatus dummyPartitioningStatus;
84428465 utils::binary::read (stream, dummyPartitioningStatus);
84438466#endif
0 commit comments