diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edge.H b/src/OpenFOAM/meshes/meshShapes/edge/edge.H index 81a6d1ef3a41bb57fa36a376a810424a0c1177ca..ede402d50d14270b383aeea7e4e581d05be84c24 100644 --- a/src/OpenFOAM/meshes/meshShapes/edge/edge.H +++ b/src/OpenFOAM/meshes/meshShapes/edge/edge.H @@ -134,6 +134,9 @@ public: // No special handling of negative point labels. inline label maxVertex() const; + //- Return true if the vertices are unique and non-negative. + inline bool valid() const; + //- Return true if point label is found in edge. // Always false for a negative label. inline bool found(const label pointLabel) const; @@ -146,19 +149,19 @@ public: // Negative point labels never connect. inline bool connects(const edge& other) const; - //- Return vertex common with otherEdge or -1 on failure + //- Return vertex common with other edge or -1 on failure // Negative point labels are never considered common between edges. inline label commonVertex(const edge& other) const; - //- Given one vertex index, return the other one. + //- Given the point label for one vertex, return the other one. // No special treatment for negative point labels. - inline label otherVertex(const label index) const; + inline label otherVertex(const label pointLabel) const; // Editing //- 'Collapse' edge by marking duplicate point labels as '-1', - // the lower vertex is retained. + //- the lower vertex is retained. // Return the effective size after collapsing. inline label collapse(); diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H b/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H index 22efb3d438a0c3f22d28d0b550bc5d566033d6d2..e011a8d0d8a0f2a540d034f2a27a17765fd9c235 100644 --- a/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H +++ b/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H @@ -114,6 +114,12 @@ inline Foam::label Foam::edge::maxVertex() const } +inline bool Foam::edge::valid() const +{ + return (first() != second() && first() >= 0 && second() >= 0); +} + + inline bool Foam::edge::found(const label pointLabel) const { // -1: always false @@ -166,13 +172,13 @@ inline Foam::label Foam::edge::commonVertex(const edge& other) const } -inline Foam::label Foam::edge::otherVertex(const label index) const +inline Foam::label Foam::edge::otherVertex(const label pointLabel) const { - if (index == first()) + if (pointLabel == first()) { return second(); } - if (index == second()) + if (pointLabel == second()) { return first(); }