41 if (Pstream::parRun())
43 boolList procHasFaces(Pstream::nProcs(),
false);
45 if ((srcPatch.size() > 0) || (tgtPatch.size() > 0))
47 procHasFaces[Pstream::myProcNo()] =
true;
50 Pstream::gatherList(procHasFaces);
51 Pstream::scatterList(procHasFaces);
53 const label nProcsHaveFaces =
count(procHasFaces,
true);
55 if (nProcsHaveFaces == 0)
59 if (nProcsHaveFaces == 1)
61 singleProcess_ =
findIndex(procHasFaces,
true);
63 if (nProcsHaveFaces > 1)
83 srcPatchProcBbs[Pstream::myProcNo()] =
87 srcBox(srcPatch, srcPointNormals, srcPointNormals0)
96 Pstream::gatherList(srcPatchProcBbs);
97 Pstream::scatterList(srcPatchProcBbs);
102 forAll(tgtPatch, tgtFacei)
104 const treeBoundBox tgtFaceBb = tgtBox(tgtPatch, tgtFacei);
105 forAll(srcPatchProcBbs, proci)
107 forAll(srcPatchProcBbs[proci], bbi)
109 if (srcPatchProcBbs[proci][bbi].overlaps(tgtFaceBb))
111 resultDyn[proci].
append(tgtFacei);
122 result[proci].
transfer(resultDyn[proci]);
141 resultDyn[tgtProci].insert(srcFacei);
149 result[proci] = resultDyn[proci].toc();
170 sendFaces[proci].
size();
178 nReceiveFaces[proci] =
192 forAll(receiveFaces, proci)
196 const label n = nReceiveFaces[proci];
197 receiveFaces[proci].
setSize(n);
198 for (
label i = 0; i <
n; i ++)
200 receiveFaces[proci][i] = localFacei ++;
234 if (proci != thisProci && sendFaces.
size())
246 procLocalFaceis[thisProci] = sendFaces;
254 if (proci != thisProci && receiveNewFaces.
size())
256 UIPstream(proci, pBufs)() >> procLocalFaceis[proci];
263 label nLocalFaces = 0;
264 forAll(procLocalFaceis, proci)
266 nLocalFaces += procLocalFaceis[proci].
size();
268 localProcFaces.
setSize(nLocalFaces);
272 label localTgtFacei = 0;
276 const labelList& fis = procLocalFaceis[thisProci];
279 localProcFaces[localTgtFacei] = {thisProci, fis[i]};
285 forAll(procLocalFaceis, proci)
287 if (proci != thisProci)
289 const labelList& fis = procLocalFaceis[proci];
292 localProcFaces[localTgtFacei] = {proci, fis[i]};
323 if (proci != thisProci && sendTgtFaces.
size())
334 << subPatch.localFaces()
335 << subPatch.localPoints()
353 procLocalFaceis[thisProci] = sendTgtFaces;
354 procLocalFaces[thisProci] = subPatch.localFaces();
355 procLocalPoints[thisProci] = subPatch.localPoints();
358 procLocalPoints0[thisProci] = subPatch.localPoints0();
367 if (proci != thisProci && receiveNewTgtFaces.
size())
370 >> procLocalFaceis[proci]
371 >> procLocalFaces[proci]
372 >> procLocalPoints[proci]
373 >> procLocalPoints0[proci];
383 label nLocalFaces = 0, nLocalPoints = 0;
384 forAll(procLocalFaceis, proci)
386 nLocalFaces += procLocalFaces[proci].
size();
387 nLocalPoints += procLocalPoints[proci].
size();
389 localProcFaces.
setSize(nLocalFaces);
390 localTgtFaces.
setSize(nLocalFaces);
391 localTgtPoints.
setSize(nLocalPoints);
394 localTgtPoints0.
setSize(nLocalPoints);
399 label localTgtFacei = 0, localTgtPointi = 0;
403 const labelList& fis = procLocalFaceis[thisProci];
404 const faceList& fs = procLocalFaces[thisProci];
407 localProcFaces[localTgtFacei] = {thisProci, fis[i]};
408 localTgtFaces[localTgtFacei] =
face(fs[i] + localTgtPointi);
412 const pointField& ps = procLocalPoints[thisProci];
413 const pointField& ps0 = procLocalPoints0[thisProci];
416 localTgtPoints[localTgtPointi] = ps[i];
419 localTgtPoints0[localTgtPointi] = ps0[i];
426 forAll(procLocalFaces, proci)
428 if (proci != thisProci)
430 const labelList& fis = procLocalFaceis[proci];
431 const faceList& fs = procLocalFaces[proci];
434 localProcFaces[localTgtFacei] = {proci, fis[i]};
435 localTgtFaces[localTgtFacei] =
face(fs[i] + localTgtPointi);
439 const pointField& ps = procLocalPoints[proci];
440 const pointField& ps0 = procLocalPoints0[proci];
443 localTgtPoints[localTgtPointi] = ps[i];
446 localTgtPoints0[localTgtPointi] = ps0[i];
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.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
const labelListList & subMap() const
From subsetted data back to original data.
bool has0() const
Return whether or not old-time geometry is available.
Input inter-processor communications stream operating on external buffer.
vectorField pointField
pointField is a vectorField.
void append(const T &)
Append an element at the end of the list.
const Field< PointType > & points0() const
Return reference to old-time global points.
const Field< PointType > & points() const
Return reference to global points.
distributionMap patchDistributionMap(labelListList &&sendFaces) const
Create a distribution map from a list-list of faces to be sent.
Output inter-processor communications stream operating on external buffer.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
labelListList srcPatchSendFaces() const
Determine which source faces need to be sent to the target.
void setSize(const label)
Reset size of List.
Class containing processor-to-processor mapping information.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
void calcSingleProcess(const primitiveOldTimePatch &srcPatch, const primitiveOldTimePatch &tgtPatch)
Determine whether or not the intersection of the given patches.
A List with indirect addressing.
List< DynamicList< label > > tgtLocalSrcFaces_
For each target face, the coupled local source faces.
Standard boundBox + extra functionality for use in octree.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
autoPtr< List< procFace > > localTgtProcFacesPtr_
When running in parallel, a map from local target face index to.
void distributePatch(const distributionMap &map, List< procFace > &localProcFaces) const
Distribute a patch given its distribution map. Just generate.
labelListList tgtPatchSendFaces(const primitiveOldTimePatch &srcPatch, const vectorField &srcPointNormals, const vectorField &srcPointNormals0, const primitiveOldTimePatch &tgtPatch) const
Determine which target faces need to be sent to the source.