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
98 mesh().globalData().nTotalCells()+1
103 cellRegion.setSize(
mesh().nCells());
106 if (cellData[celli].
valid(deltaCalc.data()))
108 cellRegion[celli] = cellData[celli].data();
114 const cell& cFaces =
mesh().
cells()[celli];
115 label facei = cFaces[0];
117 if (blockedFace.size() && !blockedFace[facei])
119 FatalErrorIn(
"regionSplit::calcNonCompactRegionSplit(..)")
120 <<
"Problem: unblocked face " << facei
122 <<
" on unassigned cell " << celli
126 cellRegion[celli] = globalFaces.toGlobal(facei);
134 const bool doGlobalRegions,
136 const List<labelPair>& explicitConnections,
144 if (!doGlobalRegions)
147 boolList coupledOrBlockedFace(blockedFace);
148 const polyBoundaryMesh& pbm = mesh().boundaryMesh();
150 if (coupledOrBlockedFace.size())
154 const polyPatch& pp = pbm[
patchi];
155 if (isA<processorPolyPatch>(pp))
157 label facei = pp.start();
160 coupledOrBlockedFace[facei++] =
true;
170 offsets[i] = mesh().nFaces();
172 const globalIndex globalRegions(move(offsets));
178 calcNonCompactRegionSplit
181 coupledOrBlockedFace,
187 Map<label> globalToCompact(mesh().nCells()/8);
190 label region = cellRegion[celli];
195 if (fnd == globalToCompact.end())
197 globalRegion = globalRegions.toGlobal(globalToCompact.size());
198 globalToCompact.insert(region, globalRegion);
202 globalRegion = fnd();
204 cellRegion[celli] = globalRegion;
212 compactOffsets[i] = globalToCompact.size();
215 return autoPtr<globalIndex>(
new globalIndex(move(compactOffsets)));
221 const globalIndex globalRegions(mesh().nFaces());
224 calcNonCompactRegionSplit
245 label region = cellRegion[celli];
249 if (globalRegions.isLocal(region))
251 if (haveRegion.insert(region))
258 label proci = globalRegions.whichProcID(region);
259 if (haveRegion.insert(region))
261 nOriginating[proci]++;
270 <<
" local regions." <<
endl;
275 autoPtr<globalIndex> globalCompactPtr
279 const globalIndex& globalCompact = globalCompactPtr();
296 nonLocal[proci].resize(2*nOriginating[proci]);
302 label region = cellRegion[celli];
303 if (globalRegions.isLocal(region))
306 globalToCompact.insert
309 globalCompact.toGlobal(globalToCompact.size())
314 nonLocal[globalRegions.whichProcID(region)].insert(region);
324 forAll(sendNonLocal, proci)
326 sendNonLocal[proci] = nonLocal[proci].toc();
331 forAll(sendNonLocal, proci)
333 Pout<<
" from processor " << proci
334 <<
" want " << sendNonLocal[proci].size()
335 <<
" region numbers."
344 Pstream::exchange<labelList, label>(sendNonLocal, recvNonLocal);
351 forAll(recvNonLocal, proci)
353 const labelList& nonLocal = recvNonLocal[proci];
354 sendWantedLocal[proci].
setSize(nonLocal.size());
358 sendWantedLocal[proci][i] = globalToCompact[nonLocal[i]];
364 recvNonLocal.clear();
365 Pstream::exchange<labelList, label>(sendWantedLocal, recvNonLocal);
366 sendWantedLocal.clear();
372 forAll(recvNonLocal, proci)
374 const labelList& wantedRegions = sendNonLocal[proci];
375 const labelList& compactRegions = recvNonLocal[proci];
379 globalToCompact.insert(wantedRegions[i], compactRegions[i]);
386 cellRegion[celli] = globalToCompact[cellRegion[celli]];
389 return globalCompactPtr;
400 globalNumberingPtr_ = calcRegionSplit
414 const bool doGlobalRegions
420 globalNumberingPtr_ = calcRegionSplit
435 const bool doGlobalRegions
441 globalNumberingPtr_ = calcRegionSplit
#define forAll(list, i)
Loop across all elements in list.
friend class const_iterator
Declare friendship with the const_iterator.
void setSize(const label)
Reset size of List.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Mesh consisting of general polyhedral cells.
const vectorField & faceCentres() const
const vectorField & cellCentres() const
const cellList & cells() const
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
regionSplit(const polyMesh &, const bool doGlobalRegions=Pstream::parRun())
Construct from mesh.
const polyMesh & mesh() const
Return reference to the polyMesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
bool valid(const PtrList< ModelType > &l)
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< bool > boolList
Bool container classes.
List< labelList > labelListList
A List of labelList.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.