44 label sz = lst.size();
50void Foam::domainDecomposition::addInterProcFace
53 const label ownerProc,
56 List<Map<label>>& nbrToInterPatch,
57 List<DynamicList<DynamicList<label>>>& interPatchFaces
61 const label ownerIndex = facei+1;
62 const label nbrIndex = -(facei+1);
64 const auto patchiter = nbrToInterPatch[ownerProc].cfind(nbrProc);
66 if (patchiter.found())
69 const label toNbrProcPatchi = *patchiter;
70 interPatchFaces[ownerProc][toNbrProcPatchi].append(ownerIndex);
72 if (isInternalFace(facei))
74 label toOwnerProcPatchi = nbrToInterPatch[nbrProc][ownerProc];
75 interPatchFaces[nbrProc][toOwnerProcPatchi].append(nbrIndex);
81 const label toNbrProcPatchi = nbrToInterPatch[ownerProc].size();
82 nbrToInterPatch[ownerProc].insert(nbrProc, toNbrProcPatchi);
84 DynamicList<label> oneFace;
85 oneFace.append(ownerIndex);
86 interPatchFaces[ownerProc].append(oneFace);
88 if (isInternalFace(facei))
90 label toOwnerProcPatchi = nbrToInterPatch[nbrProc].size();
91 nbrToInterPatch[nbrProc].insert(ownerProc, toOwnerProcPatchi);
93 oneFace.append(nbrIndex);
94 interPatchFaces[nbrProc].append(oneFace);
108 Info<<
"\nCalculating original mesh data" <<
endl;
111 const polyBoundaryMesh&
patches = boundaryMesh();
114 const labelList& neighbour = faceNeighbour();
119 Info<<
"\nDistributing cells to processors" <<
endl;
124 Info<<
"\nDistributing faces to processors" <<
endl;
131 procFaceAddressing_.setSize(nProcs_);
136 if (cellToProc_[owner[facei]] == cellToProc_[neighbour[facei]])
139 procFaceAddressing_[cellToProc_[owner[facei]]].append(facei+1);
145 forAll(procPatchSize_, proci)
148 procPatchStartIndex_[proci].setSize(
patches.
size());
154 forAll(procPatchSize_, proci)
156 procPatchSize_[proci][patchi] = 0;
157 procPatchStartIndex_[proci][patchi] =
158 procFaceAddressing_[proci].size();
163 if (!isA<cyclicPolyPatch>(
patches[patchi]))
171 forAll(patchFaceCells, facei)
173 const label curProc = cellToProc_[patchFaceCells[facei]];
176 procFaceAddressing_[curProc].append(patchStart+facei+1);
179 procPatchSize_[curProc][patchi]++;
184 const cyclicPolyPatch& pp = refCast<const cyclicPolyPatch>
189 const labelUList& patchFaceCells = pp.faceCells();
192 pp.neighbPatch().faceCells();
194 forAll(patchFaceCells, facei)
196 const label curProc = cellToProc_[patchFaceCells[facei]];
197 const label nbrProc = cellToProc_[nbrPatchFaceCells[facei]];
198 if (curProc == nbrProc)
201 procFaceAddressing_[curProc].append(patchStart+facei+1);
203 procPatchSize_[curProc][patchi]++;
215 List<Map<label>> procNbrToInterPatch(nProcs_);
218 List<DynamicList<DynamicList<label>>> interPatchFaces(nProcs_);
223 label ownerProc = cellToProc_[owner[facei]];
224 label nbrProc = cellToProc_[neighbour[facei]];
226 if (ownerProc != nbrProc)
243 List<labelListList> subPatchIDs(nProcs_);
244 List<labelListList> subPatchStarts(nProcs_);
245 forAll(interPatchFaces, proci)
247 label nInterfaces = interPatchFaces[proci].size();
249 subPatchIDs[proci].setSize(nInterfaces,
labelList(1, label(-1)));
250 subPatchStarts[proci].setSize(nInterfaces,
labelList(1,
Zero));
324 forAll(procNbrToInterPatch, proci)
326 label nInterfaces = procNbrToInterPatch[proci].size();
328 procNeighbourProcessors_[proci].setSize(nInterfaces);
329 procProcessorPatchSize_[proci].setSize(nInterfaces);
330 procProcessorPatchStartIndex_[proci].setSize(nInterfaces);
331 procProcessorPatchSubPatchIDs_[proci].setSize(nInterfaces);
332 procProcessorPatchSubPatchStarts_[proci].setSize(nInterfaces);
337 const Map<label>& curNbrToInterPatch = procNbrToInterPatch[proci];
338 labelList nbrs = curNbrToInterPatch.toc();
342 DynamicList<DynamicList<label>>& curInterPatchFaces =
343 interPatchFaces[proci];
347 const label nbrProc = nbrs[i];
348 const label interPatch = curNbrToInterPatch[nbrProc];
350 procNeighbourProcessors_[proci][i] = nbrProc;
351 procProcessorPatchSize_[proci][i] =
352 curInterPatchFaces[interPatch].size();
353 procProcessorPatchStartIndex_[proci][i] =
354 procFaceAddressing_[proci].size();
359 subPatchStarts[proci][interPatch],
360 curInterPatchFaces[interPatch].size()
362 procProcessorPatchSubPatchIDs_[proci][i].transfer
364 subPatchIDs[proci][interPatch]
366 procProcessorPatchSubPatchStarts_[proci][i].transfer
368 subPatchStarts[proci][interPatch]
383 DynamicList<label>& interPatchFaces =
384 curInterPatchFaces[interPatch];
386 forAll(interPatchFaces, j)
388 procFaceAddressing_[proci].append(interPatchFaces[j]);
390 interPatchFaces.clearStorage();
392 curInterPatchFaces.clearStorage();
393 procFaceAddressing_[proci].shrink();
440 Info<<
"\nDistributing points to processors" <<
endl;
446 forAll(procPointAddressing_, proci)
448 bitSet pointsInUse(
nPoints(),
false);
451 for (
const label facei : procFaceAddressing_[proci])
457 pointsInUse.
set(facePoints);
460 procPointAddressing_[proci] = pointsInUse.sortedToc();
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
label size() const noexcept
The number of elements in the list.
void decomposeMesh()
Decompose mesh.
UPtrList< const labelUList > faceCells() const
Return a list of faceCells for each patch.
label start() const noexcept
The start label of boundary faces in the polyMesh face list.
bool append() const noexcept
True if output format uses an append mode.
const polyBoundaryMesh & patches
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
static constexpr const zero Zero
Global zero (0)
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
List< face > faceList
A List of faces.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.