1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "IOstreams.H"
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 template<class Point, class PointRef, class polygonRef>
33 inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid
44 template<class Point, class PointRef, class polygonRef>
45 inline Foam::pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
48 is.check("pyramid::pyramid(Istream&)");
52 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 template<class Point, class PointRef, class polygonRef>
55 inline const Point& Foam::pyramid<Point, PointRef, polygonRef>::apex() const
60 template<class Point, class PointRef, class polygonRef>
61 inline polygonRef Foam::pyramid<Point, PointRef, polygonRef>::base() const
67 template<class Point, class PointRef, class polygonRef>
68 inline Point Foam::pyramid<Point, PointRef, polygonRef>::centre
70 const pointField& points
73 return (3.0/4.0)*base_.centre(points) + (1.0/4.0)*apex_;
77 template<class Point, class PointRef, class polygonRef>
78 inline Foam::vector Foam::pyramid<Point, PointRef, polygonRef>::height
80 const pointField& points
83 // Height = apex - baseCentroid
84 return (apex_ - base_.centre(points));
88 template<class Point, class PointRef, class polygonRef>
89 inline Foam::scalar Foam::pyramid<Point, PointRef, polygonRef>::mag
91 const pointField& points
94 return (1.0/3.0)*(base_.normal(points)&(height(points)));
98 // * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
100 template<class Point, class PointRef, class polygonRef>
101 inline Foam::Istream& Foam::operator>>
104 pyramid<Point, PointRef, polygonRef>& p
107 is >> p.base_ >> p.apex_;
108 is.check("Istream& operator>>(Istream&, pyramid&)");
113 template<class Point, class PointRef, class polygonRef>
114 inline Foam::Ostream& Foam::operator<<
117 const pyramid<Point, PointRef, polygonRef>& p
120 os << p.base_ << tab << p.apex_ << nl;
125 // ************************************************************************* //