ENH: regionSplit: allow local region counting

This commit is contained in:
mattijs
2013-09-26 10:35:31 +01:00
parent b811aeaf18
commit d16c545b3e
2 changed files with 34 additions and 8 deletions

View File

@ -379,6 +379,7 @@ Foam::label Foam::regionSplit::calcLocalRegionSplit
Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
(
const bool doGlobalRegions,
const boolList& blockedFace,
const List<labelPair>& explicitConnections,
@ -395,7 +396,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
cellRegion
);
if (!Pstream::parRun())
if (!doGlobalRegions)
{
return autoPtr<globalIndex>(new globalIndex(nLocalRegions));
}
@ -422,7 +423,7 @@ Foam::autoPtr<Foam::globalIndex> 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::globalIndex> Foam::regionSplit::calcRegionSplit
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionSplit::regionSplit(const polyMesh& mesh)
Foam::regionSplit::regionSplit(const polyMesh& mesh, const bool doGlobalRegions)
:
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
labelList(mesh.nCells(), -1)
{
globalNumberingPtr_ = calcRegionSplit
(
doGlobalRegions, //do global regions
boolList(0, false), //blockedFaces
List<labelPair>(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<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
@ -715,6 +718,7 @@ Foam::regionSplit::regionSplit
{
globalNumberingPtr_ = calcRegionSplit
(
doGlobalRegions,
blockedFace, //blockedFaces
List<labelPair>(0), //explicitConnections,
*this
@ -726,7 +730,8 @@ Foam::regionSplit::regionSplit
(
const polyMesh& mesh,
const boolList& blockedFace,
const List<labelPair>& explicitConnections
const List<labelPair>& explicitConnections,
const bool doGlobalRegions
)
:
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
@ -734,6 +739,7 @@ Foam::regionSplit::regionSplit
{
globalNumberingPtr_ = calcRegionSplit
(
doGlobalRegions,
blockedFace, //blockedFaces
explicitConnections, //explicitConnections,
*this

View File

@ -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<globalIndex> calcRegionSplit
(
const bool doGlobalRegions,
const boolList& blockedFace,
const List<labelPair>& 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<labelPair>&
const List<labelPair>&,
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
{