1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "IOstreams.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 template<class Point, class PointRef, class polygonRef>
38 inline pyramid<Point, PointRef, polygonRef>::pyramid
49 template<class Point, class PointRef, class polygonRef>
50 inline pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
53 is.check("pyramid::pyramid(Istream& is)");
57 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
59 template<class Point, class PointRef, class polygonRef>
60 inline const Point& pyramid<Point, PointRef, polygonRef>::apex() const
65 template<class Point, class PointRef, class polygonRef>
66 inline polygonRef pyramid<Point, PointRef, polygonRef>::base() const
72 template<class Point, class PointRef, class polygonRef>
73 inline Point pyramid<Point, PointRef, polygonRef>::centre
75 const pointField& points
78 return (3.0/4.0)*base_.centre(points) + (1.0/4.0)*apex_;
82 template<class Point, class PointRef, class polygonRef>
83 inline vector pyramid<Point, PointRef, polygonRef>::height
85 const pointField& points
88 // Height = apex - baseCentroid
89 return (apex_ - base_.centre(points));
93 template<class Point, class PointRef, class polygonRef>
94 inline scalar pyramid<Point, PointRef, polygonRef>::mag
96 const pointField& points
99 return (1.0/3.0)*(base_.normal(points)&(height(points)));
103 // * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
105 template<class Point, class PointRef, class polygonRef>
106 inline Istream& operator>>
109 pyramid<Point, PointRef, polygonRef>& p
112 is >> p.base_ >> p.apex_;
113 is.check("Istream& operator>>(Istream&, pyramid&)");
118 template<class Point, class PointRef, class polygonRef>
119 inline Ostream& operator<<
122 const pyramid<Point, PointRef, polygonRef>& p
125 os << p.base_ << tab << p.apex_ << nl;
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 } // End namespace Foam
134 // ************************************************************************* //