39 void Foam::edgeFaceCirculator::setEnd()
46 void Foam::edgeFaceCirculator::setFace
54 if (!isBoundaryEdge_ && !
mesh().isInternalFace(facei))
57 <<
"Edge is not defined as boundary edge but still walked to" 58 <<
" boundary face:" << facei <<
" on cell:" << celli
64 void Foam::edgeFaceCirculator::otherFace(
const label celli)
68 label v1 =
f.nextLabel(index_);
70 const cell& cFaces =
mesh().
cells()[celli];
74 label faceB = cFaces[i];
76 if (faceB != faceLabel_)
78 label fp = getMinIndex(
mesh().faces()[faceB], v0, v1);
83 setFace(faceB, celli);
90 <<
"Could not find next face stepping" 91 <<
" through cell along edge." <<
endl 92 <<
"face:" << faceLabel_ <<
" index in face:" << index_
100 Foam::edgeFaceCirculator::edgeFaceCirculator()
104 isBoundaryEdge_(false),
111 Foam::edgeFaceCirculator::edgeFaceCirculator
114 const label faceLabel,
115 const bool ownerSide,
117 const bool isBoundaryEdge
121 ownerSide_(ownerSide),
122 isBoundaryEdge_(isBoundaryEdge),
123 faceLabel_(faceLabel),
125 startFaceLabel_(faceLabel_)
131 meshPtr_(circ.meshPtr_),
132 ownerSide_(circ.ownerSide_),
133 isBoundaryEdge_(circ.isBoundaryEdge_),
134 faceLabel_(circ.faceLabel_),
136 startFaceLabel_(circ.startFaceLabel_)
149 label fp =
f.
find(v0);
163 if (
f[fpPlus1] != v1)
185 && meshPtr_->isInternalFace(faceLabel_)
208 else if (
mesh().isInternalFace(faceLabel_))
221 label fp = getMinIndex(
f, v0, v1);
226 <<
"v0:" << v1 <<
" and v1:" << v1
227 <<
" not on position:" << index_ <<
" on face:" << faceLabel_
233 return ownerSide_ != (
f[index_] == v0);
246 if (
mesh().isInternalFace(faceLabel_))
282 <<
"Walked " << i <<
" cells around edge " 285 <<
" without reaching a boundary face." 286 <<
" Are you sure this is a boundary edge?" 293 startFaceLabel_ = faceLabel_;
298 label minFacei = faceLabel_;
299 bool minOwnerSide = ownerSide_;
300 label minIndex = index_;
306 if (
operator==(
end()))
311 if (!
mesh().isInternalFace(faceLabel_))
316 <<
"Reached boundary face " << faceLabel_
317 <<
" when walking around internal edge " 321 <<
"Are you sure this is an internal edge?" 325 if (faceLabel_ < minFacei)
327 minFacei = faceLabel_;
328 minOwnerSide = ownerSide_;
333 faceLabel_ = minFacei;
334 ownerSide_ = minOwnerSide;
336 startFaceLabel_ = faceLabel_;
343 ownerSide_ = circ.ownerSide_;
344 isBoundaryEdge_ = circ.isBoundaryEdge_;
345 faceLabel_ = circ.faceLabel_;
346 index_ = circ.index_;
347 startFaceLabel_ = circ.startFaceLabel_;
353 return faceLabel_ == circ.faceLabel_ && index_ == circ.index_;
373 return !(*
this == circ);
381 if (faceLabel_ == -1)
384 <<
"Already reached end(). Cannot walk any further." 396 if (!isBoundaryEdge_ && faceLabel_ == startFaceLabel_)
401 else if (
mesh().isInternalFace(faceLabel_))
410 if (!isBoundaryEdge_ && faceLabel_ == startFaceLabel_)
A face is a list of labels corresponding to mesh vertices.
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.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Cell-face mesh analysis engine.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
void operator=(const edgeFaceCirculator &iter)
const edgeFaceCirculator end() const
Iterator set to beyond the end of the walk.
const cellList & cells() const
label cellLabel() const
Helper: get the neighbouring cell according to the ownerSide.
bool sameOrder(const label v0, const label v1) const
Helper: return true if normal of generated face points along.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
bool isInternalFace() const
Return true if the face label corresponds to an internal face.
label faceLabel() const
Return the face label, -1 for end iterator.
const edgeFaceCirculator cend() const
virtual const labelList & faceOwner() const
Return face owner.
virtual const faceList & faces() const
Return raw faces.
errorManip< error > abort(error &err)
label find(const T &val) const
Find index of the first occurrence of the value.
edgeFaceCirculator & operator++()
Step to next face. Uses no edge addressing!
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
edgeFaceCirculator begin() const
Iterator set to the beginning face. For internal edges this is.
bool operator!=(const edgeFaceCirculator &iter) const
constexpr auto cbegin(const C &c) -> decltype(c.begin())
Return const_iterator to the beginning of the container c.
Walks from starting face around edge.
void setCanonical()
Set edge to a unique state so different ones can be compared.
edgeFaceCirculator cbegin() const
label rcIndex(const label i) const noexcept
The reverse circular index. The previous index in the list which returns to the last at the beginning...
bool operator==(const edgeFaceCirculator &iter) const