34 const Foam::label Foam::enrichedPatch::enrichedFaceRatio_ = 3;
46 if (enrichedFacesPtr_)
49 <<
"Enriched faces already calculated." 62 enrichedFacesPtr_.reset
64 new faceList(masterPatch_.size() + slavePatch_.size())
68 label nEnrichedFaces = 0;
88 const face& oldFace = slavePatch_[facei];
89 const face& oldLocalFace = slaveLocalFaces[facei];
90 const labelList& curEdges = slaveFaceEdges[facei];
103 const label mappedPointi = pmm.
lookup(oldFace[i], oldFace[i]);
105 newFace.append(mappedPointi);
111 projectedSlavePoints[oldLocalFace[i]]
117 pointsIntoSlaveEdges[curEdges[i]];
125 if (pointsOnEdge.
size())
130 const point& startPoint =
131 projectedSlavePoints[oldLocalFace[i]];
133 const point& endPoint =
134 projectedSlavePoints[oldLocalFace.nextLabel(i)];
136 vector e = (endPoint - startPoint);
138 const scalar magSqrE =
magSqr(
e);
147 <<
"Zero length edge in slave patch for face " << i
148 <<
". This is not allowed." 154 forAll(pointsOnEdge, edgePointi)
156 positionOnEdge[edgePointi] =
157 pointMap()[pointsOnEdge[edgePointi]];
159 weightOnEdge[edgePointi] =
164 positionOnEdge[edgePointi]
173 if (
min(weightOnEdge) < 0 ||
max(weightOnEdge) > 1)
176 <<
" not on the edge for edge " << curEdges[i]
177 <<
" of face " << facei <<
" in slave patch." <<
nl 178 <<
"Min weight: " <<
min(weightOnEdge)
179 <<
" Max weight: " <<
max(weightOnEdge)
187 forAll(weightOnEdge, passI)
191 label nextPoint = -1;
196 if (weightOnEdge[wI] < dist)
198 dist = weightOnEdge[wI];
205 newFace.append(pointsOnEdge[nextPoint]);
206 weightOnEdge[nextPoint] = GREAT;
211 pointsOnEdge[nextPoint],
212 positionOnEdge[nextPoint]
230 forAll(masterPatch_, facei)
232 const face& oldFace = masterPatch_[facei];
233 const face& oldLocalFace = masterLocalFaces[facei];
234 const labelList& curEdges = masterFaceEdges[facei];
247 const label mappedPointi = pmm.
lookup(oldFace[i], oldFace[i]);
249 newFace.append(mappedPointi);
255 masterLocalPoints[oldLocalFace[i]]
261 pointsIntoMasterEdges[curEdges[i]];
265 if (pointsOnEdge.
size())
270 const point& startPoint =
271 masterLocalPoints[oldLocalFace[i]];
273 const point& endPoint =
274 masterLocalPoints[oldLocalFace.nextLabel(i)];
276 vector e = (endPoint - startPoint);
278 const scalar magSqrE =
magSqr(
e);
287 <<
"Zero length edge in master patch for face " << i
288 <<
". This is not allowed." 294 forAll(pointsOnEdge, edgePointi)
296 positionOnEdge[edgePointi] =
297 pointMap()[pointsOnEdge[edgePointi]];
299 weightOnEdge[edgePointi] =
304 positionOnEdge[edgePointi] - startPoint
312 if (
min(weightOnEdge) < 0 ||
max(weightOnEdge) > 1)
315 <<
" not on the edge for edge " << curEdges[i]
316 <<
" of face " << facei <<
" in master patch." <<
nl 317 <<
"Min weight: " <<
min(weightOnEdge)
318 <<
" Max weight: " <<
max(weightOnEdge)
326 forAll(weightOnEdge, passI)
330 label nextPoint = -1;
335 if (weightOnEdge[wI] < dist)
337 dist = weightOnEdge[wI];
344 newFace.append(pointsOnEdge[nextPoint]);
345 weightOnEdge[nextPoint] = GREAT;
350 pointsOnEdge[nextPoint],
351 positionOnEdge[nextPoint]
371 Info<<
"Enriched patch support OK. Slave faces: " 372 << slavePatch_.size() <<
" Master faces: " 373 << masterPatch_.size() <<
endl;
378 <<
"Error in enriched patch support" 389 if (!enrichedFacesPtr_)
392 <<
"void enrichedPatch::calcEnrichedFaces\n" 394 <<
" const labelListList& pointsIntoMasterEdges,\n" 395 <<
" const labelListList& pointsIntoSlaveEdges,\n" 396 <<
" const pointField& projectedSlavePoints\n" 398 <<
" before trying to access faces." 402 return *enrichedFacesPtr_;
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
void size(const label n)
Older name for setAddressableSize.
A face is a list of labels corresponding to mesh vertices.
const Field< point_type > & localPoints() const
Return pointField of points in patch.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool checkSupport() const
Check if the patch is fully supported.
#define forAll(list, i)
Loop across all elements in list.
const faceList & enrichedFaces() const
Return enriched faces.
List< face > faceList
List of faces.
const dimensionedScalar e
Elementary charge.
const Map< point > & pointMap() const
Return map of points.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
void calcEnrichedFaces(const labelListList &pointsIntoMasterEdges, const labelListList &pointsIntoSlaveEdges, const pointField &projectedSlavePoints)
Calculate enriched faces.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const labelListList & faceEdges() const
Return face-edge addressing.
const Map< label > & pointMergeMap() const
Return map of point merges.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)