Go to the documentation of this file.
34 #include "primitiveMesh.H"
55 <<
"Cut faces addressing already calculated."
104 const face& curLocalFace = lf[faceI];
105 const face& curGlobalFace = enFaces[faceI];
148 forAll(curLocalFace, edgeI)
150 edgeSeeds.
append(cfe[edgeI]);
157 while (edgeSeeds.size())
173 && curLocalFace.
nextLabel(curEdgeWhich) == curEdge.
end()
178 if (usedFaceEdges[curEdgeWhich])
continue;
180 usedFaceEdges[curEdgeWhich] =
true;
184 if (edgesUsedTwice.
found(curEdge))
continue;
198 cutFaceGlobalPoints.
append(
mp[prevPointLabel]);
199 cutFaceLocalPoints.
append(prevPointLabel);
202 label curPointLabel = curEdge.
end();
203 point curPoint = lp[curPointLabel];
204 cutFaceGlobalPoints.
append(
mp[curPointLabel]);
205 cutFaceLocalPoints.
append(curPointLabel);
207 bool completedCutFace =
false;
217 const labelList& nextPoints = pp[curPointLabel];
224 vector ahead = curPoint - lp[prevPointLabel];
236 scalar atanTurn = -GREAT;
237 label bestAtanPoint = -1;
243 if (nextPoints[nextI] != prevPointLabel)
249 vector newDir = lp[nextPoints[nextI]] - curPoint;
253 scalar magNewDir =
mag(newDir);
257 if (magNewDir < SMALL)
260 <<
"projection error: slave patch probably "
261 <<
"does not project onto master. "
262 <<
"Please switch on "
263 <<
"enriched patch debug for more info"
270 atan2(newDir & right, newDir & ahead);
274 if (curAtanTurn > atanTurn)
276 bestAtanPoint = nextPoints[nextI];
277 atanTurn = curAtanTurn;
295 const label whichNextPoint = curLocalFace.
which(curPointLabel);
300 && curLocalFace.
nextLabel(whichNextPoint) == bestAtanPoint
301 && usedFaceEdges[whichNextPoint]
310 completedCutFace =
true;
314 if (edgesUsedTwice.
found(
edge(curPointLabel, bestAtanPoint)))
318 completedCutFace =
true;
323 if (completedCutFace)
continue;
326 if (
mp[bestAtanPoint] == cutFaceGlobalPoints[0])
330 completedCutFace =
true;
334 Pout<<
" local: " << cutFaceLocalPoints
335 <<
" one side: " << faceI;
340 cutFaceGlobal.
transfer(cutFaceGlobalPoints);
345 cutFaceLocal.
transfer(cutFaceLocalPoints);
355 forAll(cutFaceLocal, cutI)
357 const edge curCutFaceEdge
365 edgesUsedOnce.
find(curCutFaceEdge);
367 if (euoIter == edgesUsedOnce.end())
372 edgesUsedOnce.
insert(curCutFaceEdge);
379 edgesUsedOnce.
erase(euoIter);
380 edgesUsedTwice.
insert(curCutFaceEdge);
383 const label curCutFaceEdgeWhich = curLocalFace.
which
385 curCutFaceEdge.
start()
390 curCutFaceEdgeWhich > -1
391 && curLocalFace.
nextLabel(curCutFaceEdgeWhich)
392 == curCutFaceEdge.
end()
402 usedFaceEdges[curCutFaceEdgeWhich] =
true;
439 masterPointFaceAddr.find(cutFaceGlobal[0]);
441 bool otherSideFound =
false;
443 if (mpfAddrIter != masterPointFaceAddr.end())
448 const labelList& masterFacesOfPZero = mpfAddrIter();
455 pointI < cutFaceGlobal.
size();
461 masterPointFaceAddr.find
463 cutFaceGlobal[pointI]
469 == masterPointFaceAddr.end()
484 forAll(masterFacesOfPZero, j)
489 == masterFacesOfPZero[j]
504 if (hits[pointI] == cutFaceGlobal.
size())
507 otherSideFound =
true;
511 masterFacesOfPZero[pointI]
522 Pout<<
" other side: "
523 << masterFacesOfPZero[pointI]
531 if (!otherSideFound || miss)
568 prevPointLabel = curPointLabel;
569 curPointLabel = bestAtanPoint;
570 curPoint = lp[curPointLabel];
571 cutFaceGlobalPoints.
append(
mp[curPointLabel]);
572 cutFaceLocalPoints.
append(curPointLabel);
574 if (debug || cutFaceGlobalPoints.size() > faceSizeDebug)
579 forAll(cutFaceGlobalPoints, checkI)
583 label checkJ = checkI + 1;
584 checkJ < cutFaceGlobalPoints.size();
590 cutFaceGlobalPoints[checkI]
591 == cutFaceGlobalPoints[checkJ]
595 cutFaceLocalPoints.
shrink();
617 <<
"Duplicate point found in cut face. "
618 <<
"Error in the face cutting "
619 <<
"algorithm for global face "
620 << origFace <<
" local face "
621 << origFaceLocal <<
nl
625 <<
" index: " << faceI <<
".\n"
626 <<
"Face: " << curGlobalFace <<
nl
627 <<
"Cut face: " << cutFaceGlobalPoints
628 <<
" local: " << cutFaceLocalPoints
637 }
while (!completedCutFace);
642 Pout<<
" Finished face " << faceI <<
endl;
676 return *cutFacesPtr_;
682 if (!cutFaceMasterPtr_)
687 return *cutFaceMasterPtr_;
693 if (!cutFaceSlavePtr_)
698 return *cutFaceSlavePtr_;
vector normal(const pointField &) const
Vector normal; magnitude is equal to area of face.
const dimensionedScalar mp
Proton mass.
labelList * cutFaceMasterPtr_
Cut face master.
const labelList & meshPoints() const
Return mesh points.
const Map< labelList > & masterPointFaces() const
Master point face addressing.
void append(const T &a)
Add at tail of list.
List< label > labelList
A List of labels.
edge reverseEdge() const
Return reverse edge.
Non-intrusive singly-linked list.
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
labelList * cutFaceSlavePtr_
Cut face slave.
const primitiveFacePatch & slavePatch_
Reference to slave patch.
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
An STL-conforming const_iterator.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
A HashTable to objects of type <T> with a label key.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
const pointField & localPoints() const
Return local points.
A HashTable with keys but without contents.
static const unsigned edgesPerPoint_
Estimated number of edges per point.
const primitiveFacePatch & masterPatch_
Reference to master patch.
label which(const label globalIndex) const
Navigation through face vertices.
label end() const
Return end vertex label.
void deleteDemandDrivenData(DataPtr &dataPtr)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
void calcCutFaces() const
Calculate cut faces.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
edgeList edges() const
Return edges in face point ordering,.
const faceList & cutFaces() const
Return list of cut faces.
const faceList & enrichedFaces() const
Return enriched faces.
bool found(const Key &) const
Return true if hashedEntry is found in table.
errorManip< error > abort(error &err)
faceList * cutFacesPtr_
Cut faces.
pointField points(const pointField &) const
Return the points corresponding to this face.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
const faceList & localFaces() const
Return local faces.
const labelListList & pointPoints() const
Return point-point addressing.
const labelList & cutFaceSlave() const
Return cut face slave list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
label nextLabel(const label i) const
Next vertex on face.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label start() const
Return start vertex label.
prefixOSstream Pout(cout, "Pout")
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool insert(const Key &key)
Insert a new entry.
static const label maxFaceSizeDebug_
Size of face on which the check is forced.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
T removeHead()
Remove and return head.
void clearCutFaces()
Clear cut faces.
A normal distribution model.
const labelList & cutFaceMaster() const
Return cut face master list.