diff --git a/src/meshTools/regionSplit/regionSplit.C b/src/meshTools/regionSplit/regionSplit.C index f7815a16d8..2583c2ddfe 100644 --- a/src/meshTools/regionSplit/regionSplit.C +++ b/src/meshTools/regionSplit/regionSplit.C @@ -379,6 +379,7 @@ Foam::label Foam::regionSplit::calcLocalRegionSplit Foam::autoPtr Foam::regionSplit::calcRegionSplit ( + const bool doGlobalRegions, const boolList& blockedFace, const List& explicitConnections, @@ -395,7 +396,7 @@ Foam::autoPtr Foam::regionSplit::calcRegionSplit cellRegion ); - if (!Pstream::parRun()) + if (!doGlobalRegions) { return autoPtr(new globalIndex(nLocalRegions)); } @@ -422,7 +423,7 @@ Foam::autoPtr Foam::regionSplit::calcRegionSplit // (this will create gaps in the global region list so they will get // merged later on) - while (Pstream::parRun()) + while (true) { if (debug) { @@ -690,13 +691,14 @@ Foam::autoPtr Foam::regionSplit::calcRegionSplit // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::regionSplit::regionSplit(const polyMesh& mesh) +Foam::regionSplit::regionSplit(const polyMesh& mesh, const bool doGlobalRegions) : MeshObject(mesh), labelList(mesh.nCells(), -1) { globalNumberingPtr_ = calcRegionSplit ( + doGlobalRegions, //do global regions boolList(0, false), //blockedFaces List(0), //explicitConnections, *this @@ -707,7 +709,8 @@ Foam::regionSplit::regionSplit(const polyMesh& mesh) Foam::regionSplit::regionSplit ( const polyMesh& mesh, - const boolList& blockedFace + const boolList& blockedFace, + const bool doGlobalRegions ) : MeshObject(mesh), @@ -715,6 +718,7 @@ Foam::regionSplit::regionSplit { globalNumberingPtr_ = calcRegionSplit ( + doGlobalRegions, blockedFace, //blockedFaces List(0), //explicitConnections, *this @@ -726,7 +730,8 @@ Foam::regionSplit::regionSplit ( const polyMesh& mesh, const boolList& blockedFace, - const List& explicitConnections + const List& explicitConnections, + const bool doGlobalRegions ) : MeshObject(mesh), @@ -734,6 +739,7 @@ Foam::regionSplit::regionSplit { globalNumberingPtr_ = calcRegionSplit ( + doGlobalRegions, blockedFace, //blockedFaces explicitConnections, //explicitConnections, *this diff --git a/src/meshTools/regionSplit/regionSplit.H b/src/meshTools/regionSplit/regionSplit.H index b7be9dd32e..83302529df 100644 --- a/src/meshTools/regionSplit/regionSplit.H +++ b/src/meshTools/regionSplit/regionSplit.H @@ -87,6 +87,9 @@ Description proc0 | proc1 | proc2 + Can optionally keep all regions local to the processor. + + SourceFiles regionSplit.C @@ -155,6 +158,7 @@ class regionSplit //- Calculate global region split. Return globalIndex. autoPtr calcRegionSplit ( + const bool doGlobalRegions, const boolList& blockedFace, const List& explicitConnections, labelList& cellRegion @@ -170,11 +174,20 @@ public: // Constructors //- Construct from mesh - regionSplit(const polyMesh&); + regionSplit + ( + const polyMesh&, + const bool doGlobalRegions = Pstream::parRun() + ); //- Construct from mesh and whether face is blocked // NOTE: blockedFace has to be consistent across coupled faces! - regionSplit(const polyMesh&, const boolList& blockedFace); + regionSplit + ( + const polyMesh&, + const boolList& blockedFace, + const bool doGlobalRegions = Pstream::parRun() + ); //- Construct from mesh and whether face is blocked. Additional explicit // connections between normal boundary faces. @@ -183,7 +196,8 @@ public: ( const polyMesh&, const boolList& blockedFace, - const List& + const List&, + const bool doGlobalRegions = Pstream::parRun() ); @@ -195,6 +209,12 @@ public: return globalNumberingPtr_(); } + //- Return local number of regions + label nLocalRegions() const + { + return globalNumbering().localSize(Pstream::myProcNo()); + } + //- Return total number of regions label nRegions() const {