Commit d09b366b authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use List, FixedList find(), found() methods in face/triFace

parent 0d5283a6
......@@ -622,22 +622,6 @@ Foam::face Foam::face::reverseFace() const
}
Foam::label Foam::face::which(const label globalIndex) const
{
const labelUList& f = *this;
forAll(f, localIdx)
{
if (f[localIdx] == globalIndex)
{
return localIdx;
}
}
return -1;
}
Foam::scalar Foam::face::sweptVol
(
const UList<point>& oldPoints,
......
......@@ -212,20 +212,20 @@ public:
// The starting points of the original and reverse face are identical.
face reverseFace() const;
//- Navigation through face vertices
// Navigation through face vertices
//- Return true if the global point label is found in face.
inline bool found(const label globalIndex) const;
//- Return true if the point label is found in face.
inline bool found(const label pointLabel) const;
//- Which local vertex on face given a global index.
// returns -1 if not found
label which(const label globalIndex) const;
//- Find local index on face for the point label,
// \return position in face (0,1,2,...) or -1 if not found.
inline label which(const label pointLabel) const;
//- Next vertex on face
inline label nextLabel(const label i) const;
//- Next vertex on face
inline label nextLabel(const label i) const;
//- Previous vertex on face
inline label prevLabel(const label i) const;
//- Previous vertex on face
inline label prevLabel(const label i) const;
//- Return the volume swept out by the face when its points move
......
......@@ -132,21 +132,27 @@ inline Foam::edge Foam::face::faceEdge(const label n) const
}
inline bool Foam::face::found(const label globalIndex) const
inline bool Foam::face::found(const label pointLabel) const
{
return which(globalIndex) != -1;
return labelList::found(pointLabel);
}
inline Foam::label Foam::face::which(const label pointLabel) const
{
return labelList::find(pointLabel);
}
inline Foam::label Foam::face::nextLabel(const label i) const
{
return this->fcValue(i);
return labelList::fcValue(i);
}
inline Foam::label Foam::face::prevLabel(const label i) const
{
return this->rcValue(i);
return labelList::rcValue(i);
}
......
......@@ -146,12 +146,12 @@ public:
// The starting points of the original and reverse face are identical.
inline triFace reverseFace() const;
//- Return true if the global point label is found in face.
bool found(const label globalIndex) const;
//- Return true if the point label is found in face.
inline bool found(const label pointLabel) const;
//- Which local index (0,1,2) on face given a global index.
// returns -1 if not found
label which(const label globalIndex) const;
//- Find local index on face for the point label.
// \return position in face (0,1,2) or -1 if not found.
inline label which(const label pointLabel) const;
//- Return swept-volume from old-points to new-points
inline scalar sweptVol
......
......@@ -209,18 +209,15 @@ inline Foam::triFace Foam::triFace::reverseFace() const
}
inline bool Foam::triFace::found(const label globalIndex) const
inline bool Foam::triFace::found(const label pointLabel) const
{
return which(globalIndex) != -1;
return FixedList<label, 3>::found(pointLabel);
}
inline Foam::label Foam::triFace::which(const label globalIndex) const
inline Foam::label Foam::triFace::which(const label pointLabel) const
{
if (operator[](0) == globalIndex) return 0;
if (operator[](1) == globalIndex) return 1;
if (operator[](2) == globalIndex) return 2;
return -1;
return FixedList<label, 3>::find(pointLabel);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment