43 void Foam::regionSplit::calcNonCompactRegionSplit
45 const globalIndex& globalFaces,
47 const List<labelPair>& explicitConnections,
53 List<minData> cellData(
mesh().nCells());
54 List<minData> faceData(
mesh().nFaces());
61 if (blockedFace.size() && blockedFace[facei])
63 faceData[facei] = minData(-2);
73 List<minData> seedData(nUnblocked);
79 if (blockedFace.empty() || !blockedFace[facei])
81 seedFaces[nUnblocked] = facei;
83 seedData[nUnblocked] = minData(globalFaces.toGlobal(facei));
90 FaceCellWave<minData> deltaCalc
99 mesh().globalData().nTotalCells()+1
104 cellRegion.setSize(
mesh().nCells());
107 if (cellData[celli].valid(deltaCalc.data()))
109 cellRegion[celli] = cellData[celli].data();
115 const cell& cFaces =
mesh().
cells()[celli];
116 label facei = cFaces[0];
118 if (blockedFace.size() && !blockedFace[facei])
120 FatalErrorIn(
"regionSplit::calcNonCompactRegionSplit(..)")
121 <<
"Problem: unblocked face " << facei
123 <<
" on unassigned cell " << celli
127 cellRegion[celli] = globalFaces.toGlobal(facei);
135 const bool doGlobalRegions,
137 const List<labelPair>& explicitConnections,
145 if (!doGlobalRegions)
148 boolList coupledOrBlockedFace(blockedFace);
151 if (coupledOrBlockedFace.size())
155 const polyPatch& pp = pbm[
patchi];
156 if (isA<processorPolyPatch>(pp))
158 label facei = pp.start();
161 coupledOrBlockedFace[facei++] =
true;
173 const globalIndex globalRegions(move(offsets));
179 calcNonCompactRegionSplit
182 coupledOrBlockedFace,
188 Map<label> globalToCompact(
mesh().nCells()/8);
191 label region = cellRegion[celli];
196 if (fnd == globalToCompact.end())
198 globalRegion = globalRegions.toGlobal(globalToCompact.size());
199 globalToCompact.insert(region, globalRegion);
203 globalRegion = fnd();
205 cellRegion[celli] = globalRegion;
213 compactOffsets[i] = globalToCompact.size();
216 return autoPtr<globalIndex>(
new globalIndex(move(compactOffsets)));
222 const globalIndex globalRegions(
mesh().nFaces());
225 calcNonCompactRegionSplit
246 label region = cellRegion[celli];
250 if (globalRegions.isLocal(region))
252 if (haveRegion.insert(region))
259 label proci = globalRegions.whichProcID(region);
260 if (haveRegion.insert(region))
262 nOriginating[proci]++;
271 <<
" local regions." <<
endl;
276 autoPtr<globalIndex> globalCompactPtr
280 const globalIndex& globalCompact = globalCompactPtr();
297 nonLocal[proci].resize(2*nOriginating[proci]);
303 label region = cellRegion[celli];
304 if (globalRegions.isLocal(region))
307 globalToCompact.insert
310 globalCompact.toGlobal(globalToCompact.size())
315 nonLocal[globalRegions.whichProcID(region)].insert(region);
325 forAll(sendNonLocal, proci)
327 sendNonLocal[proci] = nonLocal[proci].toc();
332 forAll(sendNonLocal, proci)
334 Pout<<
" from processor " << proci
335 <<
" want " << sendNonLocal[proci].size()
336 <<
" region numbers." 345 Pstream::exchange<labelList, label>(sendNonLocal, recvNonLocal);
352 forAll(recvNonLocal, proci)
354 const labelList& nonLocal = recvNonLocal[proci];
355 sendWantedLocal[proci].
setSize(nonLocal.size());
359 sendWantedLocal[proci][i] = globalToCompact[nonLocal[i]];
365 recvNonLocal.clear();
366 Pstream::exchange<labelList, label>(sendWantedLocal, recvNonLocal);
367 sendWantedLocal.clear();
373 forAll(recvNonLocal, proci)
375 const labelList& wantedRegions = sendNonLocal[proci];
376 const labelList& compactRegions = recvNonLocal[proci];
380 globalToCompact.insert(wantedRegions[i], compactRegions[i]);
387 cellRegion[celli] = globalToCompact[cellRegion[celli]];
390 return globalCompactPtr;
401 globalNumberingPtr_ = calcRegionSplit
415 const bool doGlobalRegions
421 globalNumberingPtr_ = calcRegionSplit
436 const bool doGlobalRegions
442 globalNumberingPtr_ = calcRegionSplit
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
const cellList & cells() const
List< bool > boolList
Bool container classes.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
List< label > labelList
A List of labels.
const vectorField & cellCentres() const
defineTypeNameAndDebug(combustionModel, 0)
regionSplit(const polyMesh &, const bool doGlobalRegions=Pstream::parRun())
Construct from mesh.
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
const polyMesh & mesh() const
static label nProcs(const label communicator=0)
Number of processes in parallel run.
prefixOSstream Pout(cout, "Pout")
Mesh consisting of general polyhedral cells.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.