initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / meshes / meshShapes / tetCell / tetCellI.H
blobc4cfc0ff695f78ab74a930acaa82d73ec93d40f0
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 Description
27 \*---------------------------------------------------------------------------*/
29 #include "IOstreams.H"
31 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
33 inline Foam::tetCell::tetCell()
37 inline Foam::tetCell::tetCell
39     const label a,
40     const label b,
41     const label c,
42     const label d
45     operator[](0) = a;
46     operator[](1) = b;
47     operator[](2) = c;
48     operator[](3) = d;
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};
74 #   ifdef FULLDEBUG
75     if (faceI >= 4)
76     {
77         FatalErrorIn("tetCell::tetEdge(const label faceI) const")
78             << "index out of range 0 -> 3. faceI = " << faceI
79             << abort(FatalError);
80     }
81 #   endif
83     return triFace
84     (
85         operator[](a[faceI]),
86         operator[](b[faceI]),
87         operator[](c[faceI])
88     );
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};
99 #   ifdef FULLDEBUG
100     if (edgeI >= 6)
101     {
102         FatalErrorIn
103         (
104             "tetCell::edgeFace(const label edgeI)"
105             "const"
106         )   << "edge index out of range 0 -> 5. edgeI = " << edgeI
107             << abort(FatalError);
108     }
109 #   endif
111     return edgeFaces[edgeI];
115 inline Foam::label Foam::tetCell::edgeAdjacentFace
117     const label edgeI,
118     const label faceI
119 ) const
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] =
124     {
125         {-1, -1, 3, 2},
126         {-1, 3, -1, 1},
127         {-1, 2, 1, -1},
128         {2, -1, 0, -1},
129         {3, -1, -1, 0},
130         {1, 0, -1, -1}
131     };
133 #   ifdef FULLDEBUG
134     if (faceI >= 4)
135     {
136         FatalErrorIn
137         (
138             "tetCell::edgeAdjacentFace(const label edgeI, const label faceI)"
139             "const"
140         )   << "face index out of range 0 -> 3. faceI = " << faceI
141             << abort(FatalError);
142     }
144     if (edgeI >= 6)
145     {
146         FatalErrorIn
147         (
148             "tetCell::edgeAdjacentFace(const label edgeI, const label faceI)"
149             "const"
150         )   << "edge index out of range 0 -> 5. edgeI = " << edgeI
151             << abort(FatalError);
152     }
153 #   endif
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
163     //
164     static const label start[] = {0, 0, 0, 3, 1, 3};
165     static const label end[] = {1, 2, 3, 1, 2, 2};
167 #   ifdef FULLDEBUG
168     if (edgeI >= 6)
169     {
170         FatalErrorIn("tetCell::tetEdge(const label edgeI) const")
171             << "index out of range 0 -> 5. edgeI = " << edgeI
172             << abort(FatalError);
173     }
174 #   endif
176     return edge(operator[](start[edgeI]), operator[](end[edgeI]));
180 inline Foam::tetPointRef Foam::tetCell::tet(const pointField& points) const
182     return tetPointRef
183     (
184         points[operator[](0)],
185         points[operator[](1)],
186         points[operator[](2)],
187         points[operator[](3)]
188     );
192 // ************************************************************************* //