31 template<
class Po
intType>
35 List<PointType>& points
40 autoPtr<mapDistribute> map(
buildMap(toProc));
42 map().distribute(points);
48 template<
class Po
intType>
51 const List<PointType>& pts
54 DynamicList<label> toCandidateProc;
55 DynamicList<point> testPoints;
59 label nTotalCandidates = 0;
65 label nCandidates = 0;
67 forAll(allBackgroundMeshBounds_, proci)
69 if (allBackgroundMeshBounds_[proci].contains(pt))
71 toCandidateProc.append(proci);
72 testPoints.append(pt);
78 ptBlockStart[pI] = nTotalCandidates;
79 ptBlockSize[pI] = nCandidates;
81 nTotalCandidates += nCandidates;
85 label preDistributionToCandidateProcSize = toCandidateProc.size();
87 autoPtr<mapDistribute> map(
buildMap(toCandidateProc));
89 map().distribute(testPoints);
91 List<bool> pointOnCandidate(testPoints.size(),
false);
99 map().reverseDistribute
101 preDistributionToCandidateProcSize,
107 DynamicList<label> failedPointIndices;
108 DynamicList<point> failedPoints;
114 SubList<bool> ptProcResults
121 forAll(ptProcResults, pPRI)
123 if (ptProcResults[pPRI])
125 ptProc[pI] = toCandidateProc[ptBlockStart[pI] + pPRI];
135 if (!globalBackgroundBounds_.
contains(pt))
138 <<
"The position " << pt
139 <<
" is not in any part of the background mesh " 140 << globalBackgroundBounds_ <<
endl 141 <<
"A background mesh with a wider margin around " 142 <<
"the geometry may help." 149 <<
"The position " << pt
150 <<
" was not found in the background mesh " 151 << globalBackgroundBounds_ <<
", finding nearest." 155 failedPointIndices.append(pI);
156 failedPoints.append(pt);
164 label pI = failedPointIndices[fPI];
166 ptProc[pI] = ptNearestProc[fPI];
bool positionOnThisProcessor(const point &pt) const
Is the given position inside the domain of this decomposition.
#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.
pointFromPoint topoint(const Point &P)
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static autoPtr< mapDistribute > buildMap(const List< label > &toProc)
Build a mapDistribute for the supplied destination processor data.
labelList processorNearestPosition(const List< point > &pts) const
What is the nearest processor to the given position?
List< label > labelList
A List of labels.
autoPtr< mapDistribute > distributePoints(List< PointType > &points) const
Distribute supplied the points to the appropriate processor.
bool contains(const vector &dir, const point &) const
Contains point (inside or on edge) and moving in direction.
labelList processorPosition(const List< PointType > &pts) const
What processor is the given position on?
#define WarningInFunction
Report a warning using Foam::Warning.