1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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
29 A tetrahedron primitive.
31 Ordering of edges needs to be the same for a tetrahedron
32 class, a tetrahedron cell shape model and a tetCell.
38 \*---------------------------------------------------------------------------*/
44 #include "primitiveFieldsFwd.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 // Forward declaration of friend functions and operators
57 template<class Point, class PointRef> class tetrahedron;
59 template<class Point, class PointRef>
60 inline Istream& operator>>
63 tetrahedron<Point, PointRef>&
66 template<class Point, class PointRef>
67 inline Ostream& operator<<
70 const tetrahedron<Point, PointRef>&
74 /*---------------------------------------------------------------------------*\
75 class tetrahedron Declaration
76 \*---------------------------------------------------------------------------*/
78 template<class Point, class PointRef>
83 PointRef a_, b_, c_, d_;
92 nVertices = 4, // Number of vertices in tetrahedron
93 nEdges = 6 // Number of edges in tetrahedron
99 //- Construct from points
108 //- Construct from Istream
109 inline tetrahedron(Istream&);
117 inline const Point& a() const;
119 inline const Point& b() const;
121 inline const Point& c() const;
123 inline const Point& d() const;
128 //- Return face normal
129 inline vector Sa() const;
131 inline vector Sb() const;
133 inline vector Sc() const;
135 inline vector Sd() const;
139 inline scalar mag() const;
141 //- Return circum-centre
142 inline vector circumCentre() const;
144 //- Return circum-radius
145 inline scalar circumRadius() const;
147 //- Return (min)containment sphere, i.e. the smallest sphere with
148 // all points inside. Returns pointHit with:
149 // - hit : if sphere is equal to circumsphere
151 // - point : centre of sphere
152 // - distance : radius of sphere
153 // - eligiblemiss: false
154 // Tol (small compared to 1, e.g. 1E-9) is used to determine
155 // whether point is inside: mag(pt - ctr) < (1+tol)*radius.
156 pointHit containmentSphere(const scalar tol) const;
158 //- Fill buffer with shape function products
159 void gradNiSquared(scalarField& buffer) const;
161 void gradNiDotGradNj(scalarField& buffer) const;
163 void gradNiGradNi(tensorField& buffer) const;
165 void gradNiGradNj(tensorField& buffer) const;
168 // IOstream operators
170 friend Istream& operator>> <Point, PointRef>
176 friend Ostream& operator<< <Point, PointRef>
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 } // End namespace Foam
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 #include "tetrahedronI.H"
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 # include "tetrahedron.C"
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 // ************************************************************************* //