initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / meshes / primitiveShapes / pyramid / pyramid.H
blob5591f8953d29cdfe8396258635af162e2e9c3259
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 Class
26     Foam::pyramid
28 Description
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.
33 SourceFiles
34     pyramidI.H
36 \*---------------------------------------------------------------------------*/
38 #ifndef pyramid_H
39 #define pyramid_H
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 // Forward declaration of friend functions and operators
48 template<class Point, class PointRef, class polygonRef>
49 class pyramid;
51 template<class Point, class PointRef, class polygonRef>
52 inline Istream& operator>>
54     Istream&,
55     pyramid<Point, PointRef, polygonRef>&
58 template<class Point, class PointRef, class polygonRef>
59 inline Ostream& operator<<
61     Ostream&,
62     const pyramid<Point, PointRef, polygonRef>&
66 /*---------------------------------------------------------------------------*\
67                            Class pyramid Declaration
68 \*---------------------------------------------------------------------------*/
70 template<class Point, class PointRef, class polygonRef>
71 class pyramid
73     // Private data
75         polygonRef base_;
76         PointRef apex_;
79 public:
81     // Constructors
83         //- Construct from base polygon and apex point
84         inline pyramid(polygonRef base, const Point& apex);
86         //- Construct from Istream
87         inline pyramid(Istream&);
90     // Member functions
92         // Access
94             //- Return apex point
95             inline const Point& apex() const;
97             //- Return base polygon
98             inline polygonRef base() const;
101         // Properties
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>
116         (
117             Istream&,
118             pyramid&
119         );
121         friend Ostream& operator<< <Point, PointRef, polygonRef>
122         (
123             Ostream&,
124             const pyramid&
125         );
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 } // End namespace Foam
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 #include "pyramidI.H"
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 #endif
141 // ************************************************************************* //