Loading...
Searching...
No Matches
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-2022 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 Foam_pyramid_H
41#define Foam_pyramid_H
42
43#include "point.H"
44#include "face.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52
53template<class Point, class PointRef, class PolygonRef> class pyramid;
54
55template<class Point, class PointRef, class PolygonRef>
56inline Istream& operator>>
57(
60);
61
62template<class Point, class PointRef, class PolygonRef>
63inline Ostream& operator<<
64(
65 Ostream& os,
67);
68
69
70// Common Typedefs
71
72//- A pyramid using referred point and face
74
75
76/*---------------------------------------------------------------------------*\
77 Class pyramid Declaration
78\*---------------------------------------------------------------------------*/
79
80template<class Point, class PointRef, class PolygonRef>
81class pyramid
82{
83 // Private Data
84
85 PolygonRef base_;
86
87 PointRef apex_;
88
89
90public:
91
92 // Public Typedefs
93
94 //- The point type
95 typedef Point point_type;
96
97
98 // Constructors
99
100 //- Construct from base polygon and apex point
101 inline pyramid(PolygonRef base, const Point& apex);
103 //- Construct from Istream
104 inline explicit pyramid(Istream& is);
105
106
107 // Member Functions
108
109 // Access
110
111 //- The apex point
112 const Point& apex() const { return apex_; }
113
114 //- The base polygon
115 PolygonRef base() const { return base_; }
116
118 // Properties
119
120 //- Return centre (centroid)
121 inline Point centre(const UList<point>& points) const;
123 //- Return height vector
124 inline vector height(const UList<point>& points) const;
125
126 //- Return scalar magnitude - returns volume of pyramid
127 inline scalar mag(const UList<point>& points) const;
128
129
130 // IOstream Operators
131
132 friend Istream& operator>> <Point, PointRef, PolygonRef>
133 (
134 Istream& is,
136 );
137
139 (
141 const pyramid& p
142 );
143};
144
146// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147
148} // End namespace Foam
149
150// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152#include "pyramidI.H"
153
154// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155
156#endif
157
158// ************************************************************************* //
CGAL::Point_3< K > Point
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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:89
A geometric pyramid primitive with a base of 'n' sides: i.e. a parametric pyramid....
Definition pyramid.H:79
pyramid(Istream &is)
Construct from Istream.
Definition pyramidI.H:38
vector height(const UList< point > &points) const
Return height vector.
Definition pyramidI.H:58
scalar mag(const UList< point > &points) const
Return scalar magnitude - returns volume of pyramid.
Definition pyramidI.H:69
friend Ostream & operator(Ostream &os, const pyramid &p)
pyramid(PolygonRef base, const Point &apex)
Construct from base polygon and apex point.
Definition pyramidI.H:27
Point centre(const UList< point > &points) const
Return centre (centroid).
Definition pyramidI.H:48
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
const pointField & points
Namespace for OpenFOAM.
pyramid< point, const point &, const face & > pyramidPointFaceRef
A pyramid using referred point and face.
Definition pyramid.H:70
Vector< scalar > vector
Definition vector.H:57