42 void Foam::domainDecomposition::addInterProcFace
45 const label ownerProc,
48 List<Map<label>>& nbrToInterPatch,
49 List<DynamicList<DynamicList<label>>>& interPatchFaces
53 const label ownerIndex = facei+1;
54 const label nbrIndex = -(facei+1);
56 const auto patchiter = nbrToInterPatch[ownerProc].cfind(nbrProc);
61 const label toNbrProcPatchi = *patchiter;
62 interPatchFaces[ownerProc][toNbrProcPatchi].append(ownerIndex);
66 label toOwnerProcPatchi = nbrToInterPatch[nbrProc][ownerProc];
67 interPatchFaces[nbrProc][toOwnerProcPatchi].append(nbrIndex);
73 const label toNbrProcPatchi = nbrToInterPatch[ownerProc].size();
74 nbrToInterPatch[ownerProc].insert(nbrProc, toNbrProcPatchi);
76 DynamicList<label> oneFace;
77 oneFace.append(ownerIndex);
78 interPatchFaces[ownerProc].append(oneFace);
82 label toOwnerProcPatchi = nbrToInterPatch[nbrProc].size();
83 nbrToInterPatch[nbrProc].insert(ownerProc, toOwnerProcPatchi);
85 oneFace.append(nbrIndex);
86 interPatchFaces[nbrProc].append(oneFace);
100 Info<<
"\nCalculating original mesh data" <<
endl;
103 const polyBoundaryMesh&
patches = boundaryMesh();
106 const labelList& neighbour = faceNeighbour();
111 Info<<
"\nDistributing cells to processors" <<
endl;
116 Info<<
"\nDistributing faces to processors" <<
endl;
123 procFaceAddressing_.setSize(nProcs_);
128 if (cellToProc_[owner[facei]] == cellToProc_[neighbour[facei]])
131 procFaceAddressing_[cellToProc_[owner[facei]]].append(facei+1);
137 forAll(procPatchSize_, proci)
140 procPatchStartIndex_[proci].setSize(
patches.
size());
146 forAll(procPatchSize_, proci)
148 procPatchSize_[proci][patchi] = 0;
149 procPatchStartIndex_[proci][patchi] =
150 procFaceAddressing_[proci].size();
155 if (!isA<cyclicPolyPatch>(
patches[patchi]))
163 forAll(patchFaceCells, facei)
165 const label curProc = cellToProc_[patchFaceCells[facei]];
168 procFaceAddressing_[curProc].append(patchStart+facei+1);
171 procPatchSize_[curProc][patchi]++;
176 const cyclicPolyPatch&
pp = refCast<const cyclicPolyPatch>
184 pp.neighbPatch().faceCells();
186 forAll(patchFaceCells, facei)
188 const label curProc = cellToProc_[patchFaceCells[facei]];
189 const label nbrProc = cellToProc_[nbrPatchFaceCells[facei]];
190 if (curProc == nbrProc)
193 procFaceAddressing_[curProc].append(patchStart+facei+1);
195 procPatchSize_[curProc][patchi]++;
207 List<Map<label>> procNbrToInterPatch(nProcs_);
210 List<DynamicList<DynamicList<label>>> interPatchFaces(nProcs_);
215 label ownerProc = cellToProc_[owner[facei]];
216 label nbrProc = cellToProc_[neighbour[facei]];
218 if (ownerProc != nbrProc)
235 List<labelListList> subPatchIDs(nProcs_);
236 List<labelListList> subPatchStarts(nProcs_);
237 forAll(interPatchFaces, proci)
239 label nInterfaces = interPatchFaces[proci].size();
241 subPatchIDs[proci].setSize(nInterfaces,
labelList(1, label(-1)));
242 subPatchStarts[proci].setSize(nInterfaces,
labelList(1,
Zero));
316 forAll(procNbrToInterPatch, proci)
318 label nInterfaces = procNbrToInterPatch[proci].size();
320 procNeighbourProcessors_[proci].setSize(nInterfaces);
321 procProcessorPatchSize_[proci].setSize(nInterfaces);
322 procProcessorPatchStartIndex_[proci].setSize(nInterfaces);
323 procProcessorPatchSubPatchIDs_[proci].setSize(nInterfaces);
324 procProcessorPatchSubPatchStarts_[proci].setSize(nInterfaces);
329 const Map<label>& curNbrToInterPatch = procNbrToInterPatch[proci];
330 labelList nbrs = curNbrToInterPatch.toc();
334 DynamicList<DynamicList<label>>& curInterPatchFaces =
335 interPatchFaces[proci];
339 const label nbrProc = nbrs[i];
340 const label interPatch = curNbrToInterPatch[nbrProc];
342 procNeighbourProcessors_[proci][i] = nbrProc;
343 procProcessorPatchSize_[proci][i] =
344 curInterPatchFaces[interPatch].size();
345 procProcessorPatchStartIndex_[proci][i] =
346 procFaceAddressing_[proci].size();
349 subPatchStarts[proci][interPatch].append
351 curInterPatchFaces[interPatch].size()
353 procProcessorPatchSubPatchIDs_[proci][i].transfer
355 subPatchIDs[proci][interPatch]
357 procProcessorPatchSubPatchStarts_[proci][i].transfer
359 subPatchStarts[proci][interPatch]
374 DynamicList<label>& interPatchFaces =
375 curInterPatchFaces[interPatch];
377 forAll(interPatchFaces, j)
379 procFaceAddressing_[proci].append(interPatchFaces[j]);
381 interPatchFaces.clearStorage();
383 curInterPatchFaces.clearStorage();
384 procFaceAddressing_[proci].shrink();
431 Info<<
"\nDistributing points to processors" <<
endl;
437 forAll(procPointAddressing_, proci)
439 bitSet pointsInUse(
nPoints(),
false);
442 for (
const label facei : procFaceAddressing_[proci])
448 pointsInUse.
set(facePoints);
451 procPointAddressing_[proci] = pointsInUse.sortedToc();
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
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 start() const noexcept
The start label of boundary faces in the polyMesh face list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
List< face > faceList
List of faces.
UPtrList< const labelUList > faceCells() const
Return a list of faceCells for each patch.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
label size() const noexcept
The number of entries in the list.
const polyBoundaryMesh & patches
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< label > labelList
A List of labels.
void decomposeMesh()
Decompose mesh.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)