![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 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 the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 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, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 pyramid 00027 00028 Description 00029 A geometric pyramid primitive with a base of 'n' sides: 00030 i.e. a parametric pyramid. A pyramid is constructed from 00031 a base polygon and an apex point. 00032 00033 SourceFiles 00034 pyramidI.H 00035 00036 \*---------------------------------------------------------------------------*/ 00037 00038 #ifndef pyramid_H 00039 #define pyramid_H 00040 00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00042 00043 namespace Foam 00044 { 00045 00046 // * * * * * * Forward declaration of template friend fuctions * * * * * * * // 00047 00048 template<class Point, class PointRef, class polygonRef> 00049 class pyramid; 00050 00051 template<class Point, class PointRef, class polygonRef> 00052 inline Istream& operator>> 00053 ( 00054 Istream&, 00055 pyramid<Point, PointRef, polygonRef>& 00056 ); 00057 00058 template<class Point, class PointRef, class polygonRef> 00059 inline Ostream& operator<< 00060 ( 00061 Ostream&, 00062 const pyramid<Point, PointRef, polygonRef>& 00063 ); 00064 00065 00066 /*---------------------------------------------------------------------------*\ 00067 Class pyramid Declaration 00068 \*---------------------------------------------------------------------------*/ 00069 00070 template<class Point, class PointRef, class polygonRef> 00071 class pyramid 00072 { 00073 // Private data 00074 00075 polygonRef base_; 00076 PointRef apex_; 00077 00078 00079 public: 00080 00081 // Constructors 00082 00083 //- Construct from base polygon and apex point 00084 inline pyramid(polygonRef base, const Point& apex); 00085 00086 //- Construct from Istream 00087 inline pyramid(Istream&); 00088 00089 00090 // Member functions 00091 00092 // Access 00093 00094 //- Return apex point 00095 inline const Point& apex() const; 00096 00097 //- Return base polygon 00098 inline polygonRef base() const; 00099 00100 00101 // Properties 00102 00103 //- Return centre (centroid) 00104 inline Point centre(const pointField& points) const; 00105 00106 //- Return height vector 00107 inline vector height(const pointField& points) const; 00108 00109 //- Return scalar magnitude - returns volume of pyramid 00110 inline scalar mag(const pointField& points) const; 00111 00112 00113 // IOstream operators 00114 00115 friend Istream& operator>> <Point, PointRef, polygonRef> 00116 ( 00117 Istream&, 00118 pyramid& 00119 ); 00120 00121 friend Ostream& operator<< <Point, PointRef, polygonRef> 00122 ( 00123 Ostream&, 00124 const pyramid& 00125 ); 00126 }; 00127 00128 00129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00130 00131 } // End namespace Foam 00132 00133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00134 00135 #include "pyramidI.H" 00136 00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00138 00139 #endif 00140 00141 // ************************************************************************* //