1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 // Edge to the right of face vertex i
33 inline label face::right(const label i) const
39 // Edge to the left of face vertex i
40 inline label face::left(const label i) const
42 return i == 0 ? size() - 1 : (i - 1);
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
53 // Construct given size
54 inline face::face(label s)
60 // Construct from components
61 inline face::face(const labelList& l)
67 // Construct from Istream
68 inline face::face(Istream& is)
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
76 inline pointField face::points(const pointField& meshPoints) const
78 // There are as many points as there labels for them
81 // For each point in list, set it to the point in 'pnts' addressed
85 p[i] = meshPoints[operator[](i)];
93 inline scalar face::mag(const pointField& p) const
95 return ::Foam::mag(normal(p));
99 inline label face::nEdges() const
101 // for a closed polygon a number of edges is the same as number of points
106 inline edge face::faceEdge(const label n) const
108 return edge(operator[](n), operator[](fcIndex(n)));
112 // Next vertex on face
113 inline label face::nextLabel(const label i) const
115 return operator[](fcIndex(i));
119 // Previous vertex on face
120 inline label face::prevLabel(const label i) const
122 return operator[](rcIndex(i));
126 // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
128 inline bool operator==(const face& a, const face& b)
130 return face::compare(a,b) != 0;
134 inline bool operator!=(const face& a, const face& b)
136 return face::compare(a,b) == 0;
140 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
142 inline Istream& operator>>(Istream& is, face& f)
144 if (is.version() == IOstream::originalVersion)
147 is.readBegin("face");
149 // Read the 'name' token for the face
153 is >> static_cast<labelList&>(f);
160 is >> static_cast<labelList&>(f);
163 // Check state of Ostream
164 is.check("Istream& operator>>(Istream&, face&)");
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // ************************************************************************* //