1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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
27 \*---------------------------------------------------------------------------*/
29 #include "IOstreams.H"
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 inline Foam::tetCell::tetCell()
37 inline Foam::tetCell::tetCell
52 inline Foam::tetCell::tetCell(const FixedList<label, 4>& lst)
54 FixedList<label, 4>(lst)
58 inline Foam::tetCell::tetCell(Istream& is)
60 FixedList<label, 4>(is)
64 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 inline Foam::triFace Foam::tetCell::face(const label faceI) const
68 // Warning. Ordering of faces needs to be the same for a tetrahedron
69 // class, a tetrahedron cell shape model and a tetCell
70 static const label a[] = {1, 0, 0, 0};
71 static const label b[] = {2, 3, 1, 2};
72 static const label c[] = {3, 2, 3, 1};
77 FatalErrorIn("tetCell::tetEdge(const label faceI) const")
78 << "index out of range 0 -> 3. faceI = " << faceI
92 inline Foam::label Foam::tetCell::edgeFace(const label edgeI) const
94 // Warning. Ordering of faces needs to be the same for a tetrahedron
95 // class, a tetrahedron cell shape model and a tetCell
96 //static const label edgeFaces[6] = {2, 1, 1, 0, 0, 0};
97 static const label edgeFaces[6] = {2, 3, 1, 0, 0, 1};
104 "tetCell::edgeFace(const label edgeI)"
106 ) << "edge index out of range 0 -> 5. edgeI = " << edgeI
107 << abort(FatalError);
111 return edgeFaces[edgeI];
115 inline Foam::label Foam::tetCell::edgeAdjacentFace
121 // Warning. Ordering of faces needs to be the same for a tetrahedron
122 // class, a tetrahedron cell shape model and a tetCell
123 static const label adjacentFace[6][4] =
138 "tetCell::edgeAdjacentFace(const label edgeI, const label faceI)"
140 ) << "face index out of range 0 -> 3. faceI = " << faceI
141 << abort(FatalError);
148 "tetCell::edgeAdjacentFace(const label edgeI, const label faceI)"
150 ) << "edge index out of range 0 -> 5. edgeI = " << edgeI
151 << abort(FatalError);
155 return adjacentFace[edgeI][faceI];
159 inline Foam::edge Foam::tetCell::tetEdge(const label edgeI) const
161 // Warning. Ordering of edges needs to be the same for a tetrahedron
162 // class, a tetrahedron cell shape model and a tetCell
164 static const label start[] = {0, 0, 0, 3, 1, 3};
165 static const label end[] = {1, 2, 3, 1, 2, 2};
170 FatalErrorIn("tetCell::tetEdge(const label edgeI) const")
171 << "index out of range 0 -> 5. edgeI = " << edgeI
172 << abort(FatalError);
176 return edge(operator[](start[edgeI]), operator[](end[edgeI]));
180 inline Foam::tetPointRef Foam::tetCell::tet(const pointField& points) const
184 points[operator[](0)],
185 points[operator[](1)],
186 points[operator[](2)],
187 points[operator[](3)]
192 // ************************************************************************* //