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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::pyramid
28 
29 Description
30  A geometric pyramid primitive with a base of 'n' sides:
31  i.e. a parametric pyramid. A pyramid is constructed from
32  a base polygon and an apex point.
33 
34 SourceFiles
35  pyramidI.H
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef pyramid_H
40 #define pyramid_H
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of friend functions and operators
48 
49 template<class Point, class PointRef, class polygonRef>
50 class pyramid;
51 
52 template<class Point, class PointRef, class polygonRef>
53 inline Istream& operator>>
54 (
55  Istream& is,
57 );
58 
59 template<class Point, class PointRef, class polygonRef>
60 inline Ostream& operator<<
61 (
62  Ostream& os,
64 );
65 
66 
67 /*---------------------------------------------------------------------------*\
68  Class pyramid Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 template<class Point, class PointRef, class polygonRef>
72 class pyramid
73 {
74  // Private data
75 
76  polygonRef base_;
77  PointRef apex_;
78 
79 
80 public:
81 
82  // Constructors
83 
84  //- Construct from base polygon and apex point
85  inline pyramid(polygonRef base, const Point& apex);
86 
87  //- Construct from Istream
88  inline pyramid(Istream& is);
89 
90 
91  // Member functions
92 
93  // Access
94 
95  //- Return apex point
96  inline const Point& apex() const;
97 
98  //- Return base polygon
99  inline polygonRef base() const;
100 
101 
102  // Properties
103 
104  //- Return centre (centroid)
105  inline Point centre(const UList<point>& points) const;
106 
107  //- Return height vector
108  inline vector height(const UList<point>& points) const;
109 
110  //- Return scalar magnitude - returns volume of pyramid
111  inline scalar mag(const UList<point>& points) const;
112 
113 
114  // IOstream operators
115 
116  friend Istream& operator>> <Point, PointRef, polygonRef>
117  (
118  Istream& is,
119  pyramid& p
120  );
121 
122  friend Ostream& operator<< <Point, PointRef, polygonRef>
123  (
124  Ostream& os,
125  const pyramid& p
126  );
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #include "pyramidI.H"
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
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:49
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
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