diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index c5b94c3811..0b180b482c 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -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& oldPoints, diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index 986a65fcb8..a0f59104d9 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.H +++ b/src/OpenFOAM/meshes/meshShapes/face/face.H @@ -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 diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceI.H b/src/OpenFOAM/meshes/meshShapes/face/faceI.H index 1c35b20adb..fa92420659 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceI.H +++ b/src/OpenFOAM/meshes/meshShapes/face/faceI.H @@ -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); } diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H index 4b599dbd94..682e5b4cc1 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H @@ -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 diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H index 0e7f1dae9d..9f645d2d4e 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H @@ -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::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::find(pointLabel); }