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

This commit is contained in:
Mark Olesen
2018-09-13 10:14:52 +02:00
parent 0d5283a6bc
commit d09b366b3a
5 changed files with 29 additions and 42 deletions

View File

@ -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 Foam::scalar Foam::face::sweptVol
( (
const UList<point>& oldPoints, const UList<point>& oldPoints,

View File

@ -212,20 +212,20 @@ public:
// The starting points of the original and reverse face are identical. // The starting points of the original and reverse face are identical.
face reverseFace() const; face reverseFace() const;
//- Navigation through face vertices // Navigation through face vertices
//- Return true if the global point label is found in face. //- Return true if the point label is found in face.
inline bool found(const label globalIndex) const; inline bool found(const label pointLabel) const;
//- Which local vertex on face given a global index. //- Find local index on face for the point label,
// returns -1 if not found // \return position in face (0,1,2,...) or -1 if not found.
label which(const label globalIndex) const; inline label which(const label pointLabel) const;
//- Next vertex on face //- Next vertex on face
inline label nextLabel(const label i) const; inline label nextLabel(const label i) const;
//- Previous vertex on face //- Previous vertex on face
inline label prevLabel(const label i) const; inline label prevLabel(const label i) const;
//- Return the volume swept out by the face when its points move //- Return the volume swept out by the face when its points move

View File

@ -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 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 inline Foam::label Foam::face::prevLabel(const label i) const
{ {
return this->rcValue(i); return labelList::rcValue(i);
} }

View File

@ -146,12 +146,12 @@ public:
// The starting points of the original and reverse face are identical. // The starting points of the original and reverse face are identical.
inline triFace reverseFace() const; inline triFace reverseFace() const;
//- Return true if the global point label is found in face. //- Return true if the point label is found in face.
bool found(const label globalIndex) const; inline bool found(const label pointLabel) const;
//- Which local index (0,1,2) on face given a global index. //- Find local index on face for the point label.
// returns -1 if not found // \return position in face (0,1,2) or -1 if not found.
label which(const label globalIndex) const; inline label which(const label pointLabel) const;
//- Return swept-volume from old-points to new-points //- Return swept-volume from old-points to new-points
inline scalar sweptVol inline scalar sweptVol

View File

@ -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; return FixedList<label, 3>::find(pointLabel);
if (operator[](1) == globalIndex) return 1;
if (operator[](2) == globalIndex) return 2;
return -1;
} }