40 void Foam::domainDecomposition::append(
labelList& lst,
const label elem)
42 label sz = lst.size();
48 void Foam::domainDecomposition::addInterProcFace
51 const label ownerProc,
54 List<Map<label>>& nbrToInterPatch,
55 List<DynamicList<DynamicList<label>>>& interPatchFaces
61 label ownerIndex = facei+1;
62 label nbrIndex = -(facei+1);
64 if (patchiter != nbrToInterPatch[ownerProc].
end())
67 label toNbrProcPatchi = patchiter();
68 interPatchFaces[ownerProc][toNbrProcPatchi].append(ownerIndex);
72 label toOwnerProcPatchi = nbrToInterPatch[nbrProc][ownerProc];
73 interPatchFaces[nbrProc][toOwnerProcPatchi].append(nbrIndex);
79 label toNbrProcPatchi = nbrToInterPatch[ownerProc].size();
80 nbrToInterPatch[ownerProc].insert(nbrProc, toNbrProcPatchi);
81 DynamicList<label> oneFace;
82 oneFace.append(ownerIndex);
83 interPatchFaces[ownerProc].append(oneFace);
87 label toOwnerProcPatchi = nbrToInterPatch[nbrProc].size();
88 nbrToInterPatch[nbrProc].insert(ownerProc, toOwnerProcPatchi);
90 oneFace.append(nbrIndex);
91 interPatchFaces[nbrProc].append(oneFace);
105 Info<<
"\nCalculating original mesh data" <<
endl;
116 Info<<
"\nDistributing cells to processors" <<
endl;
121 Info<<
"\nDistributing faces to processors" <<
endl;
128 procFaceAddressing_.setSize(nProcs_);
133 if (cellToProc_[owner[facei]] == cellToProc_[neighbour[facei]])
136 procFaceAddressing_[cellToProc_[owner[facei]]].append(facei+1);
142 forAll(procPatchSize_, proci)
144 procPatchSize_[proci].
setSize(patches.size());
145 procPatchStartIndex_[proci].
setSize(patches.size());
151 forAll(procPatchSize_, proci)
153 procPatchSize_[proci][
patchi] = 0;
154 procPatchStartIndex_[proci][
patchi] =
155 procFaceAddressing_[proci].size();
160 if (!isA<cyclicPolyPatch>(patches[patchi]))
166 patches[
patchi].faceCells();
168 forAll(patchFaceCells, facei)
170 const label curProc = cellToProc_[patchFaceCells[facei]];
173 procFaceAddressing_[curProc].append(patchStart+facei+1);
176 procPatchSize_[curProc][
patchi]++;
181 const cyclicPolyPatch& pp = refCast<const cyclicPolyPatch>
186 const labelUList& patchFaceCells = pp.faceCells();
189 pp.neighbPatch().faceCells();
191 forAll(patchFaceCells, facei)
193 const label curProc = cellToProc_[patchFaceCells[facei]];
194 const label nbrProc = cellToProc_[nbrPatchFaceCells[facei]];
195 if (curProc == nbrProc)
198 procFaceAddressing_[curProc].append(patchStart+facei+1);
200 procPatchSize_[curProc][
patchi]++;
212 List<Map<label>> procNbrToInterPatch(nProcs_);
215 List<DynamicList<DynamicList<label>>> interPatchFaces(nProcs_);
220 label ownerProc = cellToProc_[owner[facei]];
221 label nbrProc = cellToProc_[neighbour[facei]];
223 if (ownerProc != nbrProc)
240 List<labelListList> subPatchIDs(nProcs_);
241 List<labelListList> subPatchStarts(nProcs_);
242 forAll(interPatchFaces, proci)
244 label nInterfaces = interPatchFaces[proci].size();
247 subPatchStarts[proci].setSize(nInterfaces,
labelList(1,
label(0)));
321 forAll(procNbrToInterPatch, proci)
323 label nInterfaces = procNbrToInterPatch[proci].size();
325 procNeighbourProcessors_[proci].
setSize(nInterfaces);
326 procProcessorPatchSize_[proci].
setSize(nInterfaces);
327 procProcessorPatchStartIndex_[proci].
setSize(nInterfaces);
328 procProcessorPatchSubPatchIDs_[proci].
setSize(nInterfaces);
329 procProcessorPatchSubPatchStarts_[proci].
setSize(nInterfaces);
334 const Map<label>& curNbrToInterPatch = procNbrToInterPatch[proci];
335 labelList nbrs = curNbrToInterPatch.toc();
339 DynamicList<DynamicList<label>>& curInterPatchFaces =
340 interPatchFaces[proci];
344 const label nbrProc = nbrs[i];
345 const label interPatch = curNbrToInterPatch[nbrProc];
347 procNeighbourProcessors_[proci][i] = nbrProc;
348 procProcessorPatchSize_[proci][i] =
349 curInterPatchFaces[interPatch].
size();
350 procProcessorPatchStartIndex_[proci][i] =
351 procFaceAddressing_[proci].size();
356 subPatchStarts[proci][interPatch],
357 curInterPatchFaces[interPatch].
size()
359 procProcessorPatchSubPatchIDs_[proci][i].
transfer 361 subPatchIDs[proci][interPatch]
363 procProcessorPatchSubPatchStarts_[proci][i].
transfer 365 subPatchStarts[proci][interPatch]
380 DynamicList<label>& interPatchFaces =
381 curInterPatchFaces[interPatch];
383 forAll(interPatchFaces, j)
385 procFaceAddressing_[proci].append(interPatchFaces[j]);
387 interPatchFaces.clearStorage();
389 curInterPatchFaces.clearStorage();
390 procFaceAddressing_[proci].shrink();
438 Info<<
"\nDistributing points to processors" <<
endl;
444 forAll(procPointAddressing_, proci)
449 const labelList& procFaceLabels = procFaceAddressing_[proci];
451 forAll(procFaceLabels, facei)
454 const labelList& facePoints = fcs[
mag(procFaceLabels[facei]) - 1];
456 forAll(facePoints, pointi)
464 labelList& procPointLabels = procPointAddressing_[proci];
468 label nUsedPoints = 0;
474 procPointLabels[nUsedPoints] = pointi;
481 procPointLabels.setSize(nUsedPoints);
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
HashTable< label, label, Hash< label > >::iterator iterator
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
labelList pointLabels(nPoints,-1)
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
Return number of elements in table.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
UList< label > labelUList
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
List< bool > boolList
Bool container classes.
List< label > labelList
A List of labels.
void setSize(const label)
Reset size of List.
virtual const labelList & faceNeighbour() const
Return face neighbour.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual const labelList & faceOwner() const
Return face owner.
virtual const faceList & faces() const
Return raw faces.
void decomposeMesh()
Decompose mesh.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.