Go to the documentation of this file.
33 template<
class SourcePatch,
class TargetPatch>
36 const SourcePatch& srcPatch,
37 const TargetPatch& tgtPatch
42 if (Pstream::parRun())
44 List<label> facesPresentOnProc(Pstream::nProcs(), 0);
45 if ((srcPatch.size() > 0) || (tgtPatch.size() > 0))
47 facesPresentOnProc[Pstream::myProcNo()] = 1;
51 facesPresentOnProc[Pstream::myProcNo()] = 0;
54 Pstream::gatherList(facesPresentOnProc);
55 Pstream::scatterList(facesPresentOnProc);
57 label nHaveFaces =
sum(facesPresentOnProc);
64 Info<<
"AMIInterpolation::calcDistribution: "
65 <<
"AMI split across multiple processors" <<
endl;
68 else if (nHaveFaces == 1)
73 Info<<
"AMIInterpolation::calcDistribution: "
74 <<
"AMI local to processor" << procI <<
endl;
85 template<
class SourcePatch,
class TargetPatch>
105 if (bbp[bbI].overlaps(bb))
107 overlaps[procI] =
true;
118 template<
class SourcePatch,
class TargetPatch>
122 const TargetPatch& pp,
131 for (
label domain = 0; domain < Pstream::nProcs(); domain++)
135 if (domain != Pstream::myProcNo() && sendElems.
size())
140 globalElems[i] = gi.
toGlobal(sendElems[i]);
152 Pout<<
"distributePatches: to processor " << domain
166 faces.
setSize(Pstream::nProcs());
167 points.setSize(Pstream::nProcs());
168 faceIDs.
setSize(Pstream::nProcs());
183 Pout<<
"distributePatches: to processor " << Pstream::myProcNo()
187 faces[Pstream::myProcNo()] = subPatch.
localFaces();
190 faceIDs[Pstream::myProcNo()].
setSize(sendElems.
size());
193 faceIDs[Pstream::myProcNo()][i] = gi.
toGlobal(sendElems[i]);
198 for (
label domain = 0; domain < Pstream::nProcs(); domain++)
202 if (domain != Pstream::myProcNo() && recvElems.
size())
214 template<
class SourcePatch,
class TargetPatch>
219 const TargetPatch& tgtPatch,
230 distributePatches(map, tgtPatch, gi, allFaces,
allPoints, allTgtFaceIDs);
237 nFaces += allFaces[procI].
size();
250 const labelList& faceIDs = allTgtFaceIDs[Pstream::myProcNo()];
253 const faceList& fcs = allFaces[Pstream::myProcNo()];
256 const face&
f = fcs[i];
257 face& newF = tgtFaces[nFaces++];
276 if (procI != Pstream::myProcNo())
278 const labelList& faceIDs = allTgtFaceIDs[procI];
281 const faceList& fcs = allFaces[procI];
284 const face&
f = fcs[i];
285 face& newF = tgtFaces[nFaces++];
317 Pout<<
"Merged from " << tgtPoints.size()
318 <<
" down to " << newTgtPoints.size() <<
" points" <<
endl;
321 tgtPoints.transfer(newTgtPoints);
330 template<
class SourcePatch,
class TargetPatch>
334 const SourcePatch& srcPatch,
335 const TargetPatch& tgtPatch
343 procBb[Pstream::myProcNo()] =
346 srcPatch.localFaces(),
347 srcPatch.localPoints(),
356 Pstream::gatherList(procBb);
357 Pstream::scatterList(procBb);
361 Info<<
"Determining extent of srcPatch per processor:" <<
nl
362 <<
"\tproc\tbb" <<
endl;
365 Info<<
'\t' << procI <<
'\t' << procBb[procI] <<
endl;
370 const faceList& faces = tgtPatch.localFaces();
380 boolList procBbOverlaps(Pstream::nProcs());
384 if (faces[faceI].size())
389 calcOverlappingProcs(procBb, faceBb, procBbOverlaps);
391 forAll(procBbOverlaps, procI)
393 if (procBbOverlaps[procI])
395 dynSendMap[procI].
append(faceI);
402 sendMap.
setSize(Pstream::nProcs());
405 sendMap[procI].
transfer(dynSendMap[procI]);
412 Pout<<
"Of my " << faces.
size() <<
" I need to send to:" <<
nl
413 <<
"\tproc\tfaces" <<
endl;
416 Pout<<
'\t' << procI <<
'\t' << sendMap[procI].
size() <<
endl;
423 sendSizes[Pstream::myProcNo()].
setSize(Pstream::nProcs());
426 sendSizes[Pstream::myProcNo()][procI] = sendMap[procI].
size();
428 Pstream::gatherList(sendSizes);
429 Pstream::scatterList(sendSizes);
436 constructMap[Pstream::myProcNo()] =
identity
438 sendMap[Pstream::myProcNo()].size()
441 label segmentI = constructMap[Pstream::myProcNo()].
size();
442 forAll(constructMap, procI)
444 if (procI != Pstream::myProcNo())
447 label nRecv = sendSizes[procI][Pstream::myProcNo()];
448 constructMap[procI].
setSize(nRecv);
450 for (
label i = 0; i < nRecv; i++)
452 constructMap[procI][i] = segmentI++;
const labelListList & subMap() const
From subsetted data back to original data.
autoPtr< mapDistribute > calcProcMap(const SourcePatch &srcPatch, const TargetPatch &tgtPatch) const
Output inter-processor communications stream operating on external buffer.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
A List obtained as a section of another List.
Standard boundBox + extra functionality for use in octree.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
const List< treeBoundBox > & boundBoxes() const
Return the bounding boxes making up the tree.
label calcOverlappingProcs(const List< treeBoundBoxList > &procBb, const treeBoundBox &bb, boolList &overlaps) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a 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.
Pre-declare SubField and related Field type.
void append(const T &)
Append an element at the end of the list.
Class containing processor-to-processor mapping information.
void assign(const UList< T > &)
Assign elements to those from UList.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
void distributeAndMergePatches(const mapDistribute &map, const TargetPatch &tgtPatch, const globalIndex &gi, faceList &tgtFaces, pointField &tgtPoints, labelList &tgtFaceIDs) const
void setSize(const label)
Reset size of List.
void distributePatches(const mapDistribute &map, const TargetPatch &pp, const globalIndex &gi, List< faceList > &faces, List< pointField > &points, List< labelList > &tgtFaceIDs) const
prefixOSstream Pout(cout, "Pout")
Templated tree of axis-aligned bounding boxes (AABB)
const Field< PointType > & faceCentres() const
Return face centres for patch.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
A List with indirect addressing.
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
Input inter-processor communications stream operating on external buffer.
label calcDistribution(const SourcePatch &srcPatch, const TargetPatch &tgtPatch) const
Calculate if patches are on multiple processors.
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
List< treeBoundBox > treeBoundBoxList
List of bounding boxes.
label mergePoints(const UList< Type > &points, const scalar mergeTol, const bool verbose, labelList &pointMap, const Type &origin=Type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
label toGlobal(const label i) const
From local to global.
A list of faces which address into the list of points.