1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
28 // Edge to the right of face vertex i
29 inline Foam::label Foam::face::right(const label i) const
35 // Edge to the left of face vertex i
36 inline Foam::label Foam::face::left(const label i) const
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 inline Foam::face::face()
48 inline Foam::face::face(label s)
54 inline Foam::face::face(const labelUList& lst)
60 inline Foam::face::face(const labelList& lst)
66 inline Foam::face::face(const Xfer<labelList>& lst)
72 inline Foam::face::face(Istream& is)
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 inline Foam::pointField Foam::face::points(const pointField& meshPoints) const
82 // There are as many points as there labels for them
85 // For each point in list, set it to the point in 'pnts' addressed
89 p[i] = meshPoints[operator[](i)];
97 inline Foam::scalar Foam::face::mag(const pointField& p) const
99 return ::Foam::mag(normal(p));
103 inline Foam::label Foam::face::nEdges() const
105 // for a closed polygon a number of edges is the same as number of points
110 inline Foam::edge Foam::face::faceEdge(const label n) const
112 return edge(operator[](n), operator[](fcIndex(n)));
116 // Next vertex on face
117 inline Foam::label Foam::face::nextLabel(const label i) const
119 return operator[](fcIndex(i));
123 // Previous vertex on face
124 inline Foam::label Foam::face::prevLabel(const label i) const
126 return operator[](rcIndex(i));
129 // Number of triangles directly known from number of vertices
130 inline Foam::label Foam::face::nTriangles() const
135 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
137 inline bool Foam::operator==(const face& a, const face& b)
139 return face::compare(a,b) != 0;
143 inline bool Foam::operator!=(const face& a, const face& b)
145 return face::compare(a,b) == 0;
149 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
151 inline Foam::Istream& Foam::operator>>(Istream& is, face& f)
153 if (is.version() == IOstream::originalVersion)
156 is.readBegin("face");
158 // Read the 'name' token for the face
162 is >> static_cast<labelList&>(f);
169 is >> static_cast<labelList&>(f);
172 // Check state of Ostream
173 is.check("Istream& operator>>(Istream&, face&)");
178 // ************************************************************************* //