00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software: you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::pyramid 00026 00027 Description 00028 A geometric pyramid primitive with a base of 'n' sides: 00029 i.e. a parametric pyramid. A pyramid is constructed from 00030 a base polygon and an apex point. 00031 00032 SourceFiles 00033 pyramidI.H 00034 00035 \*---------------------------------------------------------------------------*/ 00036 00037 #ifndef pyramid_H 00038 #define pyramid_H 00039 00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00041 00042 namespace Foam 00043 { 00044 00045 // Forward declaration of friend functions and operators 00046 00047 template<class Point, class PointRef, class polygonRef> 00048 class pyramid; 00049 00050 template<class Point, class PointRef, class polygonRef> 00051 inline Istream& operator>> 00052 ( 00053 Istream&, 00054 pyramid<Point, PointRef, polygonRef>& 00055 ); 00056 00057 template<class Point, class PointRef, class polygonRef> 00058 inline Ostream& operator<< 00059 ( 00060 Ostream&, 00061 const pyramid<Point, PointRef, polygonRef>& 00062 ); 00063 00064 00065 /*---------------------------------------------------------------------------*\ 00066 Class pyramid Declaration 00067 \*---------------------------------------------------------------------------*/ 00068 00069 template<class Point, class PointRef, class polygonRef> 00070 class pyramid 00071 { 00072 // Private data 00073 00074 polygonRef base_; 00075 PointRef apex_; 00076 00077 00078 public: 00079 00080 // Constructors 00081 00082 //- Construct from base polygon and apex point 00083 inline pyramid(polygonRef base, const Point& apex); 00084 00085 //- Construct from Istream 00086 inline pyramid(Istream&); 00087 00088 00089 // Member functions 00090 00091 // Access 00092 00093 //- Return apex point 00094 inline const Point& apex() const; 00095 00096 //- Return base polygon 00097 inline polygonRef base() const; 00098 00099 00100 // Properties 00101 00102 //- Return centre (centroid) 00103 inline Point centre(const pointField& points) const; 00104 00105 //- Return height vector 00106 inline vector height(const pointField& points) const; 00107 00108 //- Return scalar magnitude - returns volume of pyramid 00109 inline scalar mag(const pointField& points) const; 00110 00111 00112 // IOstream operators 00113 00114 friend Istream& operator>> <Point, PointRef, polygonRef> 00115 ( 00116 Istream&, 00117 pyramid& 00118 ); 00119 00120 friend Ostream& operator<< <Point, PointRef, polygonRef> 00121 ( 00122 Ostream&, 00123 const pyramid& 00124 ); 00125 }; 00126 00127 00128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00129 00130 } // End namespace Foam 00131 00132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00133 00134 #include <OpenFOAM/pyramidI.H> 00135 00136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00137 00138 #endif 00139 00140 // ************************ vim: set sw=4 sts=4 et: ************************ //