OpenFOAM logo
Open Source CFD Toolkit

cellModel.H

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