pyramid.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::pyramid
29 
30 Description
31  A geometric pyramid primitive with a base of 'n' sides:
32  i.e. a parametric pyramid. A pyramid is constructed from
33  a base polygon and an apex point.
34 
35 SourceFiles
36  pyramidI.H
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef pyramid_H
41 #define pyramid_H
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward Declarations
49 
50 template<class Point, class PointRef, class polygonRef>
51 class pyramid;
52 
53 template<class Point, class PointRef, class polygonRef>
54 inline Istream& operator>>
55 (
56  Istream& is,
58 );
59 
60 template<class Point, class PointRef, class polygonRef>
61 inline Ostream& operator<<
62 (
63  Ostream& os,
65 );
66 
67 
68 /*---------------------------------------------------------------------------*\
69  Class pyramid Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 template<class Point, class PointRef, class polygonRef>
73 class pyramid
74 {
75  // Private Data
76 
77  polygonRef base_;
78 
79  PointRef apex_;
80 
81 
82 public:
83 
84  // Public Typedefs
85 
86  //- The point type
87  typedef Point point_type;
88 
89 
90  // Constructors
91 
92  //- Construct from base polygon and apex point
93  inline pyramid(polygonRef base, const Point& apex);
94 
95  //- Construct from Istream
96  inline explicit pyramid(Istream& is);
97 
98 
99  // Member Functions
100 
101  // Access
102 
103  //- Return apex point
104  inline const Point& apex() const;
105 
106  //- Return base polygon
107  inline polygonRef base() const;
108 
109 
110  // Properties
111 
112  //- Return centre (centroid)
113  inline Point centre(const UList<point>& points) const;
114 
115  //- Return height vector
116  inline vector height(const UList<point>& points) const;
117 
118  //- Return scalar magnitude - returns volume of pyramid
119  inline scalar mag(const UList<point>& points) const;
120 
121 
122  // IOstream Operators
123 
124  friend Istream& operator>> <Point, PointRef, polygonRef>
125  (
126  Istream& is,
127  pyramid& p
128  );
129 
130  friend Ostream& operator<< <Point, PointRef, polygonRef>
131  (
132  Ostream& os,
133  const pyramid& p
134  );
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #include "pyramidI.H"
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::pyramid::point_type
Point point_type
The point type.
Definition: pyramid.H:86
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::pyramid::pyramid
pyramid(polygonRef base, const Point &apex)
Construct from base polygon and apex point.
Definition: pyramidI.H:34
Foam::pyramid::centre
Point centre(const UList< point > &points) const
Return centre (centroid)
Definition: pyramidI.H:69
Foam::pyramid
A geometric pyramid primitive with a base of 'n' sides: i.e. a parametric pyramid....
Definition: pyramid.H:50
Foam::pyramid::mag
scalar mag(const UList< point > &points) const
Return scalar magnitude - returns volume of pyramid.
Definition: pyramidI.H:90
Foam::pyramid::base
polygonRef base() const
Return base polygon.
Definition: pyramidI.H:61
Foam::pyramid::apex
const Point & apex() const
Return apex point.
Definition: pyramidI.H:55
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
pyramidI.H
Foam::Vector< scalar >
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
points
const pointField & points
Definition: gmvOutputHeader.H:1
Point
CGAL::Point_3< K > Point
Definition: CGALIndexedPolyhedron.H:53
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::pyramid::height
vector height(const UList< point > &points) const
Return height vector.
Definition: pyramidI.H:79