mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: regionSplit: allow local region counting
This commit is contained in:
@ -379,6 +379,7 @@ Foam::label Foam::regionSplit::calcLocalRegionSplit
|
|||||||
|
|
||||||
Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
|
Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
|
||||||
(
|
(
|
||||||
|
const bool doGlobalRegions,
|
||||||
const boolList& blockedFace,
|
const boolList& blockedFace,
|
||||||
const List<labelPair>& explicitConnections,
|
const List<labelPair>& explicitConnections,
|
||||||
|
|
||||||
@ -395,7 +396,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
|
|||||||
cellRegion
|
cellRegion
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!Pstream::parRun())
|
if (!doGlobalRegions)
|
||||||
{
|
{
|
||||||
return autoPtr<globalIndex>(new globalIndex(nLocalRegions));
|
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
|
// (this will create gaps in the global region list so they will get
|
||||||
// merged later on)
|
// merged later on)
|
||||||
|
|
||||||
while (Pstream::parRun())
|
while (true)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -690,13 +691,14 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::regionSplit::regionSplit(const polyMesh& mesh)
|
Foam::regionSplit::regionSplit(const polyMesh& mesh, const bool doGlobalRegions)
|
||||||
:
|
:
|
||||||
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
|
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
|
||||||
labelList(mesh.nCells(), -1)
|
labelList(mesh.nCells(), -1)
|
||||||
{
|
{
|
||||||
globalNumberingPtr_ = calcRegionSplit
|
globalNumberingPtr_ = calcRegionSplit
|
||||||
(
|
(
|
||||||
|
doGlobalRegions, //do global regions
|
||||||
boolList(0, false), //blockedFaces
|
boolList(0, false), //blockedFaces
|
||||||
List<labelPair>(0), //explicitConnections,
|
List<labelPair>(0), //explicitConnections,
|
||||||
*this
|
*this
|
||||||
@ -707,7 +709,8 @@ Foam::regionSplit::regionSplit(const polyMesh& mesh)
|
|||||||
Foam::regionSplit::regionSplit
|
Foam::regionSplit::regionSplit
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const boolList& blockedFace
|
const boolList& blockedFace,
|
||||||
|
const bool doGlobalRegions
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
|
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
|
||||||
@ -715,6 +718,7 @@ Foam::regionSplit::regionSplit
|
|||||||
{
|
{
|
||||||
globalNumberingPtr_ = calcRegionSplit
|
globalNumberingPtr_ = calcRegionSplit
|
||||||
(
|
(
|
||||||
|
doGlobalRegions,
|
||||||
blockedFace, //blockedFaces
|
blockedFace, //blockedFaces
|
||||||
List<labelPair>(0), //explicitConnections,
|
List<labelPair>(0), //explicitConnections,
|
||||||
*this
|
*this
|
||||||
@ -726,7 +730,8 @@ Foam::regionSplit::regionSplit
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const boolList& blockedFace,
|
const boolList& blockedFace,
|
||||||
const List<labelPair>& explicitConnections
|
const List<labelPair>& explicitConnections,
|
||||||
|
const bool doGlobalRegions
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
|
MeshObject<polyMesh, Foam::TopologicalMeshObject, regionSplit>(mesh),
|
||||||
@ -734,6 +739,7 @@ Foam::regionSplit::regionSplit
|
|||||||
{
|
{
|
||||||
globalNumberingPtr_ = calcRegionSplit
|
globalNumberingPtr_ = calcRegionSplit
|
||||||
(
|
(
|
||||||
|
doGlobalRegions,
|
||||||
blockedFace, //blockedFaces
|
blockedFace, //blockedFaces
|
||||||
explicitConnections, //explicitConnections,
|
explicitConnections, //explicitConnections,
|
||||||
*this
|
*this
|
||||||
|
|||||||
@ -87,6 +87,9 @@ Description
|
|||||||
proc0 | proc1 | proc2
|
proc0 | proc1 | proc2
|
||||||
|
|
||||||
|
|
||||||
|
Can optionally keep all regions local to the processor.
|
||||||
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
regionSplit.C
|
regionSplit.C
|
||||||
|
|
||||||
@ -155,6 +158,7 @@ class regionSplit
|
|||||||
//- Calculate global region split. Return globalIndex.
|
//- Calculate global region split. Return globalIndex.
|
||||||
autoPtr<globalIndex> calcRegionSplit
|
autoPtr<globalIndex> calcRegionSplit
|
||||||
(
|
(
|
||||||
|
const bool doGlobalRegions,
|
||||||
const boolList& blockedFace,
|
const boolList& blockedFace,
|
||||||
const List<labelPair>& explicitConnections,
|
const List<labelPair>& explicitConnections,
|
||||||
labelList& cellRegion
|
labelList& cellRegion
|
||||||
@ -170,11 +174,20 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
//- Construct from mesh
|
||||||
regionSplit(const polyMesh&);
|
regionSplit
|
||||||
|
(
|
||||||
|
const polyMesh&,
|
||||||
|
const bool doGlobalRegions = Pstream::parRun()
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from mesh and whether face is blocked
|
//- Construct from mesh and whether face is blocked
|
||||||
// NOTE: blockedFace has to be consistent across coupled faces!
|
// 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
|
//- Construct from mesh and whether face is blocked. Additional explicit
|
||||||
// connections between normal boundary faces.
|
// connections between normal boundary faces.
|
||||||
@ -183,7 +196,8 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh&,
|
const polyMesh&,
|
||||||
const boolList& blockedFace,
|
const boolList& blockedFace,
|
||||||
const List<labelPair>&
|
const List<labelPair>&,
|
||||||
|
const bool doGlobalRegions = Pstream::parRun()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -195,6 +209,12 @@ public:
|
|||||||
return globalNumberingPtr_();
|
return globalNumberingPtr_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return local number of regions
|
||||||
|
label nLocalRegions() const
|
||||||
|
{
|
||||||
|
return globalNumbering().localSize(Pstream::myProcNo());
|
||||||
|
}
|
||||||
|
|
||||||
//- Return total number of regions
|
//- Return total number of regions
|
||||||
label nRegions() const
|
label nRegions() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user