1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
28 A geometric pyramid primitive with a base of 'n' sides:
29 i.e. a parametric pyramid. A pyramid is constructed from
30 a base polygon and an apex point.
35 \*---------------------------------------------------------------------------*/
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 // Forward declaration of friend functions and operators
47 template<class Point, class PointRef, class polygonRef>
50 template<class Point, class PointRef, class polygonRef>
51 inline Istream& operator>>
54 pyramid<Point, PointRef, polygonRef>&
57 template<class Point, class PointRef, class polygonRef>
58 inline Ostream& operator<<
61 const pyramid<Point, PointRef, polygonRef>&
65 /*---------------------------------------------------------------------------*\
66 Class pyramid Declaration
67 \*---------------------------------------------------------------------------*/
69 template<class Point, class PointRef, class polygonRef>
82 //- Construct from base polygon and apex point
83 inline pyramid(polygonRef base, const Point& apex);
85 //- Construct from Istream
86 inline pyramid(Istream&);
94 inline const Point& apex() const;
96 //- Return base polygon
97 inline polygonRef base() const;
102 //- Return centre (centroid)
103 inline Point centre(const pointField& points) const;
105 //- Return height vector
106 inline vector height(const pointField& points) const;
108 //- Return scalar magnitude - returns volume of pyramid
109 inline scalar mag(const pointField& points) const;
112 // IOstream operators
114 friend Istream& operator>> <Point, PointRef, polygonRef>
120 friend Ostream& operator<< <Point, PointRef, polygonRef>
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 } // End namespace Foam
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 #include "pyramidI.H"
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 // ************************************************************************* //