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 geometric pyramid primitive with a base of 'n' sides:
30 i.e. a parametric pyramid. A pyramid is constructed from
31 a base polygon and an apex point.
36 \*---------------------------------------------------------------------------*/
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 // Forward declaration of friend functions and operators
48 template<class Point, class PointRef, class polygonRef>
51 template<class Point, class PointRef, class polygonRef>
52 inline Istream& operator>>
55 pyramid<Point, PointRef, polygonRef>&
58 template<class Point, class PointRef, class polygonRef>
59 inline Ostream& operator<<
62 const pyramid<Point, PointRef, polygonRef>&
66 /*---------------------------------------------------------------------------*\
67 Class pyramid Declaration
68 \*---------------------------------------------------------------------------*/
70 template<class Point, class PointRef, class polygonRef>
83 //- Construct from base polygon and apex point
84 inline pyramid(polygonRef base, const Point& apex);
86 //- Construct from Istream
87 inline pyramid(Istream&);
95 inline const Point& apex() const;
97 //- Return base polygon
98 inline polygonRef base() const;
103 //- Return centre (centroid)
104 inline Point centre(const pointField& points) const;
106 //- Return height vector
107 inline vector height(const pointField& points) const;
109 //- Return scalar magnitude - returns volume of pyramid
110 inline scalar mag(const pointField& points) const;
113 // IOstream operators
115 friend Istream& operator>> <Point, PointRef, polygonRef>
121 friend Ostream& operator<< <Point, PointRef, polygonRef>
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 } // End namespace Foam
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 #include "pyramidI.H"
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 // ************************************************************************* //