30 void Foam::edgeFaceCirculator::setEnd()
37 void Foam::edgeFaceCirculator::setFace
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
55 void Foam::edgeFaceCirculator::otherFace(
const label 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_)
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_;
316 faceLabel_ = circ.faceLabel_;
317 ownerSide_ = circ.ownerSide_;
318 index_ = circ.index_;
319 isBoundaryEdge_ = circ.isBoundaryEdge_;
320 startFaceLabel_ = circ.startFaceLabel_;
326 return faceLabel_ == circ.faceLabel_ && index_ == circ.index_;
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_)
#define forAll(list, i)
Loop across all elements in list.
label rcIndex(const label i) const
Return the reverse circular index, i.e. the previous index.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Walks from starting face around edge.
void operator=(const edgeFaceCirculator &iter)
const edgeFaceCirculator & end() const
Iterator set to beyond the end of the walk.
edgeFaceCirculator & operator++()
Step to next face. Uses no edge addressing!
bool sameOrder(const label v0, const label v1) const
Helper: return true if normal of generated face points along.
edgeFaceCirculator(const primitiveMesh &mesh, const label faceLabel, const bool ownerSide, const label index, const bool isBoundaryEdge)
Construct from components.
const edgeFaceCirculator & cend() const
label cellLabel() const
Helper: get the neighbouring cell according to the ownerSide.
void setCanonical()
Set edge to a unique state so different ones can be compared.
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.
edgeFaceCirculator cbegin() const
edgeFaceCirculator begin() const
Iterator set to the beginning face. For internal edges this is.
bool operator!=(const edgeFaceCirculator &iter) const
bool operator==(const edgeFaceCirculator &iter) const
A face is a list of labels corresponding to mesh vertices.
Cell-face mesh analysis engine.
#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)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.