32 Foam::label Foam::AMIInterpolation::calcDistribution
43 if ((srcPatch.size() > 0) || (tgtPatch.size() > 0))
55 label nHaveFaces =
sum(facesPresentOnProc);
63 <<
"AMI split across multiple processors" <<
endl;
66 else if (nHaveFaces == 1)
72 <<
"AMI local to processor" << proci <<
endl;
83 Foam::label Foam::AMIInterpolation::calcOverlappingProcs
85 const List<treeBoundBoxList>& procBb,
86 const treeBoundBox& bb,
90 overlaps.setSize(procBb.size());
101 if (bbs[bbI].overlaps(bb))
103 overlaps[proci] =
true;
113 void Foam::AMIInterpolation::distributePatches
115 const mapDistribute& map,
117 const globalIndex& gi,
118 List<faceList>& faces,
119 List<pointField>& points,
120 List<labelList>& faceIDs
127 const labelList& sendElems = map.subMap()[domain];
134 globalElems[i] = gi.toGlobal(sendElems[i]);
137 faceList subFaces(UIndirectList<face>(pp, sendElems));
140 SubList<face>(subFaces, subFaces.size()),
146 Pout<<
"distributePatches: to processor " << domain
147 <<
" sending faces " << subPatch.faceCentres() <<
endl;
150 UOPstream toDomain(domain, pBufs);
152 << subPatch.localFaces() << subPatch.localPoints()
158 pBufs.finishedSends();
167 faceList subFaces(UIndirectList<face>(pp, sendElems));
170 SubList<face>(subFaces, subFaces.size()),
178 <<
" sending faces " << subPatch.faceCentres() <<
endl;
194 const labelList& recvElems = map.constructMap()[domain];
198 UIPstream str(domain, pBufs);
208 void Foam::AMIInterpolation::distributeAndMergePatches
210 const mapDistribute& map,
212 const globalIndex& gi,
219 List<faceList> allFaces;
221 List<labelList> allTgtFaceIDs;
222 distributePatches(map, tgtPatch, gi, allFaces, allPoints, allTgtFaceIDs);
229 nFaces += allFaces[proci].size();
230 nPoints += allPoints[proci].size();
233 tgtFaces.setSize(nFaces);
234 tgtPoints.setSize(nPoints);
235 tgtFaceIDs.setSize(nFaces);
243 SubList<label>(tgtFaceIDs, faceIDs.size()) = faceIDs;
248 const face&
f = fcs[i];
249 face& newF = tgtFaces[nFaces++];
250 newF.setSize(f.size());
260 tgtPoints[nPoints++] = pts[i];
270 const labelList& faceIDs = allTgtFaceIDs[proci];
271 SubList<label>(tgtFaceIDs, faceIDs.size(), nFaces) = faceIDs;
273 const faceList& fcs = allFaces[proci];
276 const face&
f = fcs[i];
277 face& newF = tgtFaces[nFaces++];
278 newF.setSize(f.size());
288 tgtPoints[nPoints++] = pts[i];
309 Pout<<
"Merged from " << tgtPoints.size()
310 <<
" down to " << newTgtPoints.size() <<
" points" <<
endl;
313 tgtPoints.transfer(newTgtPoints);
323 Foam::AMIInterpolation::calcProcMap
340 srcPatch.meshPoints()
363 Info<<
"Determining extent of srcPatch per processor:" <<
nl 364 <<
"\tproc\tbb" <<
endl;
367 Info<<
'\t' << proci <<
'\t' << procBb[proci] <<
endl;
373 const faceList& faces = tgtPatch.localFaces();
374 const pointField& points = tgtPatch.localPoints();
387 if (faces[facei].size())
389 treeBoundBox faceBb(points, faces[facei]);
392 calcOverlappingProcs(procBb, faceBb, procBbOverlaps);
394 forAll(procBbOverlaps, proci)
396 if (procBbOverlaps[proci])
398 dynSendMap[proci].append(facei);
408 sendMap[proci].transfer(dynSendMap[proci]);
415 Pout<<
"Of my " << faces.size() <<
" I need to send to:" <<
nl 416 <<
"\tproc\tfaces" <<
endl;
419 Pout<<
'\t' << proci <<
'\t' << sendMap[proci].size() <<
endl;
445 forAll(constructMap, proci)
451 constructMap[proci].setSize(nRecv);
453 for (
label i = 0; i < nRecv; i++)
455 constructMap[proci][i] = segmentI++;
460 autoPtr<mapDistribute> mapPtr
List< labelList > labelListList
A List of labelList.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
List< treeBoundBox > treeBoundBoxList
List of bounding boxes.
#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 inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
List< bool > boolList
Bool container classes.
vectorField pointField
pointField is a vectorField.
List< label > labelList
A List of labels.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
Addressing for a faceList slice.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
prefixOSstream Pout(cout, "Pout")
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.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
#define InfoInFunction
Report an information message using Foam::Info.