Go to the documentation of this file.
26 #include "primitiveMesh.H"
45 if (!isBoundaryEdge_ && !mesh_.isInternalFace(faceI))
48 <<
"Edge is not defined as boundary edge but still walked to"
49 <<
" boundary face:" << faceI <<
" on cell:" << cellI
57 const face&
f = mesh_.faces()[faceLabel_];
59 label v1 =
f.nextLabel(index_);
61 const cell& cFaces = mesh_.cells()[cellI];
65 label faceB = cFaces[i];
67 if (faceB != faceLabel_)
69 label fp = getMinIndex(mesh_.faces()[faceB], v0, v1);
74 setFace(faceB, cellI);
81 <<
"Could not find next face stepping"
82 <<
" through cell along edge." <<
endl
83 <<
"face:" << faceLabel_ <<
" index in face:" << index_
84 <<
" edge:" << mesh_.points()[v0] << mesh_.points()[v1]
95 const label faceLabel,
98 const bool isBoundaryEdge
102 faceLabel_(faceLabel),
103 ownerSide_(ownerSide),
105 isBoundaryEdge_(isBoundaryEdge),
106 startFaceLabel_(faceLabel_)
114 faceLabel_(circ.faceLabel_),
115 ownerSide_(circ.ownerSide_),
117 isBoundaryEdge_(circ.isBoundaryEdge_),
118 startFaceLabel_(circ.startFaceLabel_)
135 label fpMin1 =
f.rcIndex(fp);
143 label fpPlus1 =
f.fcIndex(fp);
145 if (
f[fpPlus1] != v1)
177 return mesh_.faceOwner()[faceLabel_];
179 else if (mesh_.isInternalFace(faceLabel_))
181 return mesh_.faceNeighbour()[faceLabel_];
192 const face&
f = mesh_.faces()[faceLabel_];
194 label fp = getMinIndex(
f, v0, v1);
199 <<
"v0:" << v1 <<
" and v1:" << v1
200 <<
" not on position:" << index_ <<
" on face:" << faceLabel_
206 return ownerSide_ != (
f[index_] == v0);
219 if (mesh_.isInternalFace(faceLabel_))
223 label cellI = mesh_.faceNeighbour()[faceLabel_];
226 ownerSide_ = (mesh_.faceOwner()[faceLabel_] == cellI);
230 label cellI = mesh_.faceOwner()[faceLabel_];
233 ownerSide_ = (mesh_.faceOwner()[faceLabel_] == cellI);
242 label cellI = mesh_.faceOwner()[faceLabel_];
245 ownerSide_ = (mesh_.faceOwner()[faceLabel_] == cellI);
252 const face&
f = mesh_.faces()[faceLabel_];
255 <<
"Walked " << i <<
" cells around edge "
256 << mesh_.points()[
f[index_]]
257 << mesh_.points()[
f.nextLabel(index_)]
258 <<
" without reaching a boundary face."
259 <<
" Are you sure this is a boundary edge?"
266 startFaceLabel_ = faceLabel_;
271 label minFaceI = faceLabel_;
272 bool minOwnerSide = ownerSide_;
273 label minIndex = index_;
279 if (
operator==(end()))
284 if (!mesh_.isInternalFace(faceLabel_))
286 const face&
f = mesh_.faces()[faceLabel_];
289 <<
"Reached boundary face " << faceLabel_
290 <<
" when walking around internal edge "
291 << mesh_.points()[
f[index_]]
292 << mesh_.points()[
f.nextLabel(index_)]
294 <<
"Are you sure this is an internal edge?"
298 if (faceLabel_ < minFaceI)
300 minFaceI = faceLabel_;
301 minOwnerSide = ownerSide_;
306 faceLabel_ = minFaceI;
307 ownerSide_ = minOwnerSide;
309 startFaceLabel_ = faceLabel_;
346 return !(*
this == circ);
354 if (faceLabel_ == -1)
357 <<
"Already reached end(). Cannot walk any further."
363 label cellI = mesh_.faceOwner()[faceLabel_];
366 ownerSide_ = (mesh_.faceOwner()[faceLabel_] != cellI);
369 if (!isBoundaryEdge_ && faceLabel_ == startFaceLabel_)
374 else if (mesh_.isInternalFace(faceLabel_))
377 label cellI = mesh_.faceNeighbour()[faceLabel_];
380 ownerSide_ = (mesh_.faceOwner()[faceLabel_] != cellI);
383 if (!isBoundaryEdge_ && faceLabel_ == startFaceLabel_)
void operator=(const edgeFaceCirculator &iter)
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
bool isBoundaryEdge_
Is boundary edge?
bool operator!=(const edgeFaceCirculator &iter) const
edgeFaceCirculator & operator++()
Step to next face. Uses no edge addressing!
Ostream & endl(Ostream &os)
Add newline and flush stream.
void setEnd()
Set to end() iterator.
label startFaceLabel_
Starting face so we know when to stop. Used when circulating over.
label faceLabel_
Current face.
static label getMinIndex(const face &f, const label v0, const label v1)
Helper: find index in face of edge or -1. Index is such that edge is.
Walks from starting face around edge.
void setFace(const label faceI, const label cellI)
Check and set faceLabel_ and ownerSide_.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
edgeFaceCirculator(const primitiveMesh &mesh, const label faceLabel, const bool ownerSide, const label index, const bool isBoundaryEdge)
Construct from components.
void setCanonical()
Set edge to a unique state so different ones can be compared.
void otherFace(const label cellI)
Set faceLabel_ to be the other face on the cell that uses the.
const edgeFaceCirculator & end() const
Iterator set to beyond the end of the walk.
const edgeFaceCirculator & cend() const
errorManip< error > abort(error &err)
bool sameOrder(const label v0, const label v1) const
Helper: return true if normal of generated face points along.
bool ownerSide_
Current side of face.
bool operator==(const edgeFaceCirculator &iter) const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
edgeFaceCirculator cbegin() const
label cellLabel() const
Helper: get the neighbouring cell according to the ownerSide.
A face is a list of labels corresponding to mesh vertices.
label index_
Edge (between index and index+1 on faces[faceLabel_].
edgeFaceCirculator begin() const
Iterator set to the beginning face. For internal edges this is.
A cell is defined as a list of faces with extra functionality.
Cell-face mesh analysis engine.