diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index c5b94c381165e74d6f6b2b419518ad4e4d23a38f..0b180b482c4dfbd70bc1d33d4aad91be44902303 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<point>& oldPoints, diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index 986a65fcb897124d49435db8e802458975709ee2..a0f59104d95e971bfa2d47c6726d5fd2ece33d94 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 1c35b20adbcdcd19ae042393e521b13edd1b8067..fa92420659a085ab4ad94b9da4ac7909ea58d7ec 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 4b599dbd949eff28e6cfedb5d8ce4b7d2e556fdd..682e5b4cc1a3bf0394af586245cbe4e9a0110b37 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 0e7f1dae9d5292bd93c593fd0add9359f72bf60e..9f645d2d4ef434580b48d6119e3fa93b191c564e 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<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); }