32 const Foam::label Foam::enrichedPatch::enrichedFaceRatio_ = 3;
43 if (enrichedFacesPtr_)
46 <<
"Enriched faces already calculated."
59 enrichedFacesPtr_ =
new faceList(masterPatch_.size() + slavePatch_.size());
62 label nEnrichedFaces = 0;
82 const face oldFace = slavePatch_[facei];
83 const face oldLocalFace = slaveLocalFaces[facei];
85 const labelList& curEdges = slaveFaceEdges[facei];
97 if (mpIter == pmm.
end())
100 newFace.
append(oldFace[i]);
106 projectedSlavePoints[oldLocalFace[i]]
118 projectedSlavePoints[oldLocalFace[i]]
125 pointsIntoSlaveEdges[curEdges[i]];
133 if (slavePointsOnEdge.
size())
137 const point& startPoint = projectedSlavePoints[oldLocalFace[i]];
140 projectedSlavePoints[oldLocalFace.nextLabel(i)]
152 <<
"Zero length edge in slave patch for face " << i
153 <<
". This is not allowed."
159 forAll(slavePointsOnEdge, edgePointi)
161 slavePosOnEdge[edgePointi] =
162 pointMap().find(slavePointsOnEdge[edgePointi])();
164 edgePointWeights[edgePointi] =
165 (
e & (slavePosOnEdge[edgePointi] - startPoint));
171 if (
min(edgePointWeights) < 0 ||
max(edgePointWeights) > 1)
174 <<
" not on the edge for edge " << curEdges[i]
175 <<
" of face " << facei <<
" in slave patch." <<
nl
176 <<
"Min weight: " <<
min(edgePointWeights)
177 <<
" Max weight: " <<
max(edgePointWeights)
185 forAll(edgePointWeights, passI)
189 label nextPoint = -1;
192 forAll(edgePointWeights, wI)
194 if (edgePointWeights[wI] < dist)
196 dist = edgePointWeights[wI];
203 newFace.
append(slavePointsOnEdge[nextPoint]);
204 edgePointWeights[nextPoint] = great;
209 slavePointsOnEdge[nextPoint],
210 slavePosOnEdge[nextPoint]
224 forAll(masterPatch_, facei)
226 const face& oldFace = masterPatch_[facei];
227 const face& oldLocalFace = masterLocalFaces[facei];
229 const labelList& curEdges = masterFaceEdges[facei];
239 pmm.
find(oldFace[i]);
241 if (mpIter == pmm.
end())
244 newFace.
append(oldFace[i]);
250 masterLocalPoints[oldLocalFace[i]]
259 pointMap().insert(mpIter(), masterLocalPoints[oldLocalFace[i]]);
265 pointsIntoMasterEdges[curEdges[i]];
269 if (masterPointsOnEdge.
size())
273 const point& startPoint = masterLocalPoints[oldLocalFace[i]];
276 masterLocalPoints[oldLocalFace.nextLabel(i)]
288 <<
"Zero length edge in master patch for face " << i
289 <<
". This is not allowed."
295 forAll(masterPointsOnEdge, edgePointi)
297 masterPosOnEdge[edgePointi] =
298 pointMap().find(masterPointsOnEdge[edgePointi])();
300 edgePointWeights[edgePointi] =
301 (
e & (masterPosOnEdge[edgePointi] - startPoint));
307 if (
min(edgePointWeights) < 0 ||
max(edgePointWeights) > 1)
310 <<
" not on the edge for edge " << curEdges[i]
311 <<
" of face " << facei <<
" in master patch." <<
nl
312 <<
"Min weight: " <<
min(edgePointWeights)
313 <<
" Max weight: " <<
max(edgePointWeights)
321 forAll(edgePointWeights, passI)
325 label nextPoint = -1;
328 forAll(edgePointWeights, wI)
330 if (edgePointWeights[wI] < dist)
332 dist = edgePointWeights[wI];
339 newFace.
append(masterPointsOnEdge[nextPoint]);
340 edgePointWeights[nextPoint] = great;
345 masterPointsOnEdge[nextPoint],
346 masterPosOnEdge[nextPoint]
363 Info<<
"Enriched patch support OK. Slave faces: "
364 << slavePatch_.size() <<
" Master faces: "
365 << masterPatch_.size() <<
endl;
370 <<
"Error in enriched patch support"
381 if (!enrichedFacesPtr_)
384 <<
"void enrichedPatch::calcEnrichedFaces\n"
386 <<
" const labelListList& pointsIntoMasterEdges,\n"
387 <<
" const labelListList& pointsIntoSlaveEdges,\n"
388 <<
" const pointField& projectedSlavePoints\n"
390 <<
" before trying to access faces."
394 return *enrichedFacesPtr_;
#define forAll(list, i)
Loop across all elements in list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
const labelListList & faceEdges() const
Return face-edge addressing.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
Map< point > & pointMap()
Return non-const access to point map to add points.
const faceList & enrichedFaces() const
Return enriched faces.
void calcEnrichedFaces(const labelListList &pointsIntoMasterEdges, const labelListList &pointsIntoSlaveEdges, const pointField &projectedSlavePoints)
Calculate enriched faces.
Map< label > & pointMergeMap()
Return map of point merges.
bool checkSupport() const
Check if the patch is fully supported.
A face is a list of labels corresponding to mesh vertices.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable