38 if (Pstream::parRun())
40 boolList procHasElements(Pstream::nProcs(),
false);
42 if (srcSize > 0 || tgtSize > 0)
44 procHasElements[Pstream::myProcNo()] =
true;
47 Pstream::gatherList(procHasElements);
48 Pstream::scatterList(procHasElements);
50 const label nProcsHaveElements =
count(procHasElements,
true);
52 if (nProcsHaveElements == 0)
57 if (nProcsHaveElements == 1)
59 result =
findIndex(procHasElements,
true);
62 if (nProcsHaveElements > 1)
80 transferSizes[Pstream::myProcNo()].
setSize(Pstream::nProcs());
83 transferSizes[Pstream::myProcNo()][proci] =
86 Pstream::gatherList(transferSizes);
87 Pstream::scatterList(transferSizes);
91 label index = constructMap[Pstream::myProcNo()].
size();
92 forAll(constructMap, proci)
94 const label n = transferSizes[proci][Pstream::myProcNo()];
97 for (
label i = 0; i <
n; i ++)
99 constructMap[proci][i] = index ++;
122 static const label thisProci = Pstream::myProcNo();
130 for (
label proci = 0; proci < Pstream::nProcs(); proci++)
134 if (proci != thisProci && sendFaceis.
size())
146 procLocalFaceis[thisProci] = sendFaceis;
150 for (
label proci = 0; proci < Pstream::nProcs(); proci++)
154 UIPstream(proci, pBufs)() >> procLocalFaceis[proci];
162 label nLocalFaces = 0;
163 forAll(procLocalFaceis, proci)
165 nLocalFaces += procLocalFaceis[proci].
size();
167 localProcFaces.
setSize(nLocalFaces);
171 label localFacei = 0;
172 forAll(procLocalFaceis, proci)
174 const labelList& fis = procLocalFaceis[proci];
177 localProcFaces[localFacei] = {proci, fis[i]};
182 return localProcFaces;
194 forAll(tgtLocalSrcFaces, tgtFacei)
196 const label tgtProci = localTgtProcFaces[tgtFacei].proci;
198 forAll(tgtLocalSrcFaces[tgtFacei], i)
200 const label srcFacei = tgtLocalSrcFaces[tgtFacei][i];
202 resultDyn[tgtProci].insert(srcFacei);
210 result[proci] = resultDyn[proci].toc();
252 oldToNew[oldi] = newi;
253 newToOld[newi] = oldi;
262 allOldIsUsed[proci] =
268 Pstream::exchange<boolList, bool>(allOldIsUsed, allSubOldIsUsed);
276 if (allSubOldIsUsed[proci][oldi])
278 map.
subMap()[proci][newi ++] =
279 map.
subMap()[proci][oldi];
291 if (allOldIsUsed[proci][oldi])
310 forAll(indices, thisFacei)
312 result[thisFacei].
resize(indices[thisFacei].size());
314 forAll(indices[thisFacei], i)
316 result[thisFacei][i] =
318 ?
remote(Pstream::myProcNo(), indices[thisFacei][i])
319 : indexToProcIndex[indices[thisFacei][i]];
352 forAll(localSrcProcFaces, localSrcFacei)
356 localSrcProcFaces[localSrcFacei],
367 tgtLocalSrcFaces.
resize(tgtSize);
368 forAll(tgtSrcProcFaces, tgtFacei)
370 tgtLocalSrcFaces[tgtFacei].
resize(tgtSrcProcFaces[tgtFacei].size());
372 forAll(tgtSrcProcFaces[tgtFacei], i)
374 tgtLocalSrcFaces[tgtFacei][i] =
375 srcProcFaceToLocal[tgtSrcProcFaces[tgtFacei][i]];
#define forAll(list, i)
Loop across all elements in list.
An STL-conforming hash table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
void resize(const label)
Alias for setSize(const label)
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
Input inter-processor communications stream operating on external buffer.
A List with indirect addressing.
Output inter-processor communications stream operating on external buffer.
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
const labelListList & subMap() const
From subsetted data back to original data.
Class containing processor-to-processor mapping information.
Struct for keeping processor, element (cell, face, point) index.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
List< labelList > labelListList
A List of labelList.
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.