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::cellModel 00026 00027 Description 00028 Maps a geometry to a set of cell primitives, which enables 00029 geometric cell data to be calculated without access to the primitive 00030 geometric level. This means mapping a 3D geometry to a set of 00031 pyramids which are each described by a cell face and the cell centre 00032 point. 00033 00034 SourceFiles 00035 cellModelI.H 00036 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef cellModel_H 00040 #define cellModel_H 00041 00042 #include <OpenFOAM/pointField.H> 00043 #include <OpenFOAM/edgeList.H> 00044 #include <OpenFOAM/faceList.H> 00045 #include <OpenFOAM/InfoProxy.H> 00046 #include <OpenFOAM/autoPtr.H> 00047 00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00049 00050 namespace Foam 00051 { 00052 00053 // Forward declaration of friend functions and operators 00054 00055 class cellModel; 00056 inline bool operator==(const cellModel&, const cellModel&); 00057 inline bool operator!=(const cellModel&, const cellModel&); 00058 Ostream& operator<<(Ostream&, const cellModel&); 00059 00060 00061 /*---------------------------------------------------------------------------*\ 00062 Class cellModel Declaration 00063 \*---------------------------------------------------------------------------*/ 00064 00065 class cellModel 00066 { 00067 // Private data 00068 00069 //- Name 00070 word name_; 00071 00072 //- Label in the model list 00073 label index_; 00074 00075 //- Number of points in the model which determines the geometry 00076 label nPoints_; 00077 00078 //- Faces of the model 00079 faceList faces_; 00080 00081 //- Edges of the model 00082 edgeList edges_; 00083 00084 00085 public: 00086 00087 // Constructors 00088 00089 //- Construct from Istream 00090 cellModel(Istream&); 00091 00092 //- Return a new cellModel on free-store created from Istream 00093 static autoPtr<cellModel> New(Istream& is) 00094 { 00095 return autoPtr<cellModel>(new cellModel(is)); 00096 } 00097 00098 //- Return clone 00099 autoPtr<cellModel> clone() const 00100 { 00101 return autoPtr<cellModel>(new cellModel(*this)); 00102 } 00103 00104 00105 // Member functions 00106 00107 // Access 00108 00109 //- Return model name 00110 inline const word& name() const; 00111 00112 //- Return index of model in the model list 00113 inline label index() const; 00114 00115 //- Return number of points 00116 inline label nPoints() const; 00117 00118 //- Return number of edges 00119 inline label nEdges() const; 00120 00121 //- Return number of faces 00122 inline label nFaces() const; 00123 00124 //- Return list of edges 00125 inline edgeList edges(const labelList& pointLabels) const; 00126 00127 //- Return a raw list of model faces 00128 inline const faceList& modelFaces() const; 00129 00130 //- Return list of faces 00131 inline faceList faces(const labelList& pointLabels) const; 00132 00133 00134 //- Vector centroid 00135 vector centre 00136 ( 00137 const labelList& pointLabels, 00138 const pointField& points 00139 ) const; 00140 00141 //- Cell volume 00142 scalar mag 00143 ( 00144 const labelList& pointLabels, 00145 const pointField& points 00146 ) const; 00147 00148 //- Return info proxy. 00149 // Used to print token information to a stream 00150 InfoProxy<cellModel> info() const 00151 { 00152 return *this; 00153 } 00154 00155 //- WriteData member function required by regIOobject 00156 bool writeData(Ostream& os) const 00157 { 00158 os << *this; 00159 return os.good(); 00160 } 00161 00162 00163 // Friend operators 00164 00165 //- Equality operator: true => ptr to models are equal ! 00166 friend bool operator==(const cellModel&, const cellModel&); 00167 00168 //- Inequality operator: true => ptr to models are not equal ! 00169 friend bool operator!=(const cellModel&, const cellModel&); 00170 00171 00172 // Ostream operator 00173 00174 friend Ostream& operator<<(Ostream&, const cellModel&); 00175 }; 00176 00177 00178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00179 00180 } // End namespace Foam 00181 00182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00183 00184 #include <OpenFOAM/cellModelI.H> 00185 00186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00187 00188 #endif 00189 00190 // ************************ vim: set sw=4 sts=4 et: ************************ //