Commit 11731227 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: provide number of unreachable blocked cells

- in debug, also report the first 10 cell ids

- format header documentation
parent e438bd89
......@@ -35,9 +35,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(regionSplit, 0);
defineTypeNameAndDebug(regionSplit, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......@@ -66,21 +64,20 @@ void Foam::regionSplit::calcNonCompactRegionSplit
}
}
// Seed all faces on (real) boundaries and faces on cells next to blockFace
// (since regions can only occur because of boundaries (or blocked faces))
// Seed all faces on (real) boundaries and cell faces next to blockFace,
// since regions can only occur because of boundaries (or blocked faces)
PackedBoolList isSeed(mesh().nFaces());
// Get internal or coupled faces
PackedBoolList isConnection(syncTools::getInternalOrCoupledFaces(mesh()));
// 1. Seed (real) boundaries
for
(
label facei = mesh().nInternalFaces();
facei < mesh().nFaces();
facei++
++facei
)
{
if (!isConnection[facei])
......@@ -94,6 +91,10 @@ void Foam::regionSplit::calcNonCompactRegionSplit
if (blockedFace.size())
{
label nBlockedCells = 0;
label celli = 0;
for (const cell& cFaces : mesh().cells())
{
bool blockedCell = false;
......@@ -113,8 +114,34 @@ void Foam::regionSplit::calcNonCompactRegionSplit
if (blockedCell)
{
isSeed.set(connectedFacei); // silently ignores -1
if (connectedFacei < 0)
{
++nBlockedCells;
if (debug && nBlockedCells <= 10)
{
// Report a few, but not all
WarningInFunction
<< "Cell " << celli << " has all faces blocked."
<< endl;
}
}
else
{
isSeed.set(connectedFacei);
}
}
++celli;
}
reduce(nBlockedCells, sumOp<label>());
if (nBlockedCells)
{
Info<< "Detected " << nBlockedCells << " from "
<< returnReduce(mesh().nCells(), sumOp<label>())
<< " cells with all faces blocked." << nl;
}
}
......@@ -246,15 +273,15 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
label globalRegion;
Map<label>::const_iterator fnd = globalToCompact.find(region);
if (fnd == globalToCompact.end())
const auto fnd = globalToCompact.cfind(region);
if (fnd.found())
{
globalRegion = globalRegions.toGlobal(globalToCompact.size());
globalToCompact.insert(region, globalRegion);
globalRegion = *fnd;
}
else
{
globalRegion = fnd();
globalRegion = globalRegions.toGlobal(globalToCompact.size());
globalToCompact.insert(region, globalRegion);
}
cellRegion[celli] = globalRegion;
}
......@@ -454,9 +481,9 @@ Foam::regionSplit::regionSplit(const polyMesh& mesh, const bool doGlobalRegions)
{
globalNumberingPtr_ = calcRegionSplit
(
doGlobalRegions, //do global regions
boolList(0, false), //blockedFaces
List<labelPair>(0), //explicitConnections,
doGlobalRegions,
boolList(), // No blockedFace
List<labelPair>(), // No explicitConnections
*this
);
}
......@@ -475,8 +502,8 @@ Foam::regionSplit::regionSplit
globalNumberingPtr_ = calcRegionSplit
(
doGlobalRegions,
blockedFace, //blockedFaces
List<labelPair>(0), //explicitConnections,
blockedFace,
List<labelPair>(), // No explicitConnections
*this
);
}
......@@ -496,8 +523,8 @@ Foam::regionSplit::regionSplit
globalNumberingPtr_ = calcRegionSplit
(
doGlobalRegions,
blockedFace, //blockedFaces
explicitConnections, //explicitConnections,
blockedFace,
explicitConnections,
*this
);
}
......
......@@ -31,6 +31,7 @@ Description
Say 6 cells, 3 processors, with single baffle on proc1.
\verbatim
baffle
|
+---+---+---+---+---+---+
......@@ -38,8 +39,11 @@ Description
+---+---+---+---+---+---+
proc0 | proc1 | proc2
\endverbatim
\verbatim
1: determine local regions (uncoupled)
+---+---+---+---+---+---+
......@@ -47,45 +51,58 @@ Description
+---+---+---+---+---+---+
proc0 | proc1 | proc2
\endverbatim
2: make global
\verbatim
+---+---+---+---+---+---+
| 0 | 0 | 1 | 2 | 3 | 3 |
+---+---+---+---+---+---+
proc0 | proc1 | proc2
\endverbatim
3: merge connected across procs
\verbatim
+---+---+---+---+---+---+
| 0 | 0 | 0 | 2 | 2 | 2 |
+---+---+---+---+---+---+
proc0 | proc1 | proc2
\endverbatim
4. determine locally owner regions. determine compact numbering for the
local regions and send these to all processors that need them:
4. determine locally owner regions.
proc0 uses regions:
- 0 which is local to it.
proc1 uses regions
- 0 which originates from proc0
- 2 which is local to it
proc2 uses regions
- 2 which originates from proc1
Determine compact numbering for the local regions and send these to
all processors that need them:
- proc0 uses regions:
- 0 which is local to it.
- proc1 uses regions
- 0 which originates from proc0
- 2 which is local to it
- proc2 uses regions
- 2 which originates from proc1
So proc1 needs to get the compact number for region 0 from proc0 and proc2
needs to get the compact number for region 2 from proc1:
\verbatim
+---+---+---+---+---+---+
| 0 | 0 | 0 | 1 | 1 | 1 |
+---+---+---+---+---+---+
proc0 | proc1 | proc2
\endverbatim
Can optionally keep all regions local to the processor.
......@@ -164,7 +181,7 @@ public:
);
//- 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&,
......@@ -172,9 +189,9 @@ public:
const bool doGlobalRegions = Pstream::parRun()
);
//- Construct from mesh and whether face is blocked. Additional explicit
// connections between normal boundary faces.
// NOTE: blockedFace has to be consistent across coupled faces!
//- Construct from mesh and whether face is blocked.
// Additional explicit connections between normal boundary faces.
// \note blockedFace has to be consistent across coupled faces!
regionSplit
(
const polyMesh&,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment