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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::pyramid
29
30Description
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
35SourceFiles
36 pyramidI.H
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef pyramid_H
41#define pyramid_H
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48// Forward Declarations
49
50template<class Point, class PointRef, class polygonRef>
51class pyramid;
52
53template<class Point, class PointRef, class polygonRef>
54inline Istream& operator>>
55(
56 Istream& is,
58);
59
60template<class Point, class PointRef, class polygonRef>
61inline Ostream& operator<<
62(
63 Ostream& os,
65);
66
67
68/*---------------------------------------------------------------------------*\
69 Class pyramid Declaration
70\*---------------------------------------------------------------------------*/
71
72template<class Point, class PointRef, class polygonRef>
73class pyramid
74{
75 // Private Data
76
77 polygonRef base_;
78
79 PointRef apex_;
80
81
82public:
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
124 friend Istream& operator>> <Point, PointRef, polygonRef>
125 (
126 Istream& is,
127 pyramid& p
128 );
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// ************************************************************************* //
CGAL::Point_3< K > Point
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
A geometric pyramid primitive with a base of 'n' sides: i.e. a parametric pyramid....
Definition: pyramid.H:73
const Point & apex() const
Return apex point.
Definition: pyramidI.H:55
polygonRef base() const
Return base polygon.
Definition: pyramidI.H:61
vector height(const UList< point > &points) const
Return height vector.
Definition: pyramidI.H:79
scalar mag(const UList< point > &points) const
Return scalar magnitude - returns volume of pyramid.
Definition: pyramidI.H:90
Point point_type
The point type.
Definition: pyramid.H:86
Point centre(const UList< point > &points) const
Return centre (centroid)
Definition: pyramidI.H:69
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
const pointField & points
Namespace for OpenFOAM.