1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A tetrahedron primitive.
30 Ordering of edges needs to be the same for a tetrahedron
31 class, a tetrahedron cell shape model and a tetCell.
37 \*---------------------------------------------------------------------------*/
43 #include "primitiveFieldsFwd.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 // Forward declaration of friend functions and operators
56 template<class Point, class PointRef> class tetrahedron;
58 template<class Point, class PointRef>
59 inline Istream& operator>>
62 tetrahedron<Point, PointRef>&
65 template<class Point, class PointRef>
66 inline Ostream& operator<<
69 const tetrahedron<Point, PointRef>&
73 /*---------------------------------------------------------------------------*\
74 class tetrahedron Declaration
75 \*---------------------------------------------------------------------------*/
77 template<class Point, class PointRef>
82 PointRef a_, b_, c_, d_;
91 nVertices = 4, // Number of vertices in tetrahedron
92 nEdges = 6 // Number of edges in tetrahedron
98 //- Construct from points
107 //- Construct from Istream
108 inline tetrahedron(Istream&);
116 inline const Point& a() const;
118 inline const Point& b() const;
120 inline const Point& c() const;
122 inline const Point& d() const;
127 //- Return face normal
128 inline vector Sa() const;
130 inline vector Sb() const;
132 inline vector Sc() const;
134 inline vector Sd() const;
138 inline scalar mag() const;
141 inline vector centre() const;
143 //- Return circum-centre
144 inline vector circumCentre() const;
146 //- Return circum-radius
147 inline scalar circumRadius() const;
149 //- Return (min)containment sphere, i.e. the smallest sphere with
150 // all points inside. Returns pointHit with:
151 // - hit : if sphere is equal to circumsphere
153 // - point : centre of sphere
154 // - distance : radius of sphere
155 // - eligiblemiss: false
156 // Tol (small compared to 1, e.g. 1E-9) is used to determine
157 // whether point is inside: mag(pt - ctr) < (1+tol)*radius.
158 pointHit containmentSphere(const scalar tol) const;
160 //- Fill buffer with shape function products
161 void gradNiSquared(scalarField& buffer) const;
163 void gradNiDotGradNj(scalarField& buffer) const;
165 void gradNiGradNi(tensorField& buffer) const;
167 void gradNiGradNj(tensorField& buffer) const;
170 // IOstream operators
172 friend Istream& operator>> <Point, PointRef>
178 friend Ostream& operator<< <Point, PointRef>
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 } // End namespace Foam
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #include "tetrahedronI.H"
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 # include "tetrahedron.C"
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 // ************************************************************************* //