pyramid.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::pyramid
26 
27 Description
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.
31 
32 SourceFiles
33  pyramidI.H
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef pyramid_H
38 #define pyramid_H
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declaration of friend functions and operators
46 
47 template<class Point, class PointRef, class polygonRef>
48 class pyramid;
49 
50 template<class Point, class PointRef, class polygonRef>
51 inline Istream& operator>>
52 (
53  Istream&,
55 );
56 
57 template<class Point, class PointRef, class polygonRef>
58 inline Ostream& operator<<
59 (
60  Ostream&,
62 );
63 
64 
65 /*---------------------------------------------------------------------------*\
66  Class pyramid Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class Point, class PointRef, class polygonRef>
70 class pyramid
71 {
72  // Private Data
73 
74  polygonRef base_;
75  PointRef apex_;
76 
77 
78 public:
79 
80  // Constructors
81 
82  //- Construct from base polygon and apex point
83  inline pyramid(polygonRef base, const Point& apex);
84 
85  //- Construct from Istream
86  inline pyramid(Istream&);
87 
88 
89  // Member Functions
90 
91  // Access
92 
93  //- Return apex point
94  inline const Point& apex() const;
95 
96  //- Return base polygon
97  inline polygonRef base() const;
98 
99 
100  // Properties
101 
102  //- Return centre (centroid)
103  inline Point centre(const pointField& points) const;
104 
105  //- Return height vector
106  inline vector height(const pointField& points) const;
107 
108  //- Return scalar magnitude - returns volume of pyramid
109  inline scalar mag(const pointField& points) const;
110 
111 
112  // IOstream Operators
113 
114  friend Istream& operator>> <Point, PointRef, polygonRef>
115  (
116  Istream&,
117  pyramid&
118  );
119 
120  friend Ostream& operator<< <Point, PointRef, polygonRef>
121  (
122  Ostream&,
123  const pyramid&
124  );
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #include "pyramidI.H"
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
scalar mag(const pointField &points) const
Return scalar magnitude - returns volume of pyramid.
Definition: pyramidI.H:90
const pointField & points
polygonRef base() const
Return base polygon.
Definition: pyramidI.H:61
const Point & apex() const
Return apex point.
Definition: pyramidI.H:55
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
vector height(const pointField &points) const
Return height vector.
Definition: pyramidI.H:79
Point centre(const pointField &points) const
Return centre (centroid)
Definition: pyramidI.H:69
pyramid(polygonRef base, const Point &apex)
Construct from base polygon and apex point.
Definition: pyramidI.H:34
A geometric pyramid primitive with a base of &#39;n&#39; sides: i.e. a parametric pyramid. A pyramid is constructed from a base polygon and an apex point.
Definition: pyramid.H:47
Namespace for OpenFOAM.