OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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     Foam::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 // Forward declaration of friend functions and operators
00055 
00056 class cellModel;
00057 inline bool operator==(const cellModel&, const cellModel&);
00058 inline bool operator!=(const cellModel&, const cellModel&);
00059 Ostream& operator<<(Ostream&, const cellModel&);
00060 
00061 
00062 /*---------------------------------------------------------------------------*\
00063                            Class cellModel Declaration
00064 \*---------------------------------------------------------------------------*/
00065 
00066 class cellModel
00067 {
00068     // Private data
00069 
00070         //- Name
00071         word name_;
00072 
00073         //- Label in the model list
00074         label index_;
00075 
00076         //- Number of points in the model which determines the geometry
00077         label nPoints_;
00078 
00079         //- Faces of the model
00080         faceList faces_;
00081 
00082         //- Edges of the model
00083         edgeList edges_;
00084 
00085 
00086 public:
00087 
00088     // Constructors
00089 
00090         //- Construct from Istream
00091         cellModel(Istream&);
00092 
00093         //- Return a new cellModel on free-store created from Istream
00094         static autoPtr<cellModel> New(Istream& is)
00095         {
00096             return autoPtr<cellModel>(new cellModel(is));
00097         }
00098 
00099         //- Return clone
00100         autoPtr<cellModel> clone() const
00101         {
00102             return autoPtr<cellModel>(new cellModel(*this));
00103         }
00104 
00105 
00106     // Member functions
00107 
00108         // Access
00109 
00110             //- Return model name
00111             inline const word& name() const;
00112 
00113             //- Return index of model in the model list
00114             inline label index() const;
00115 
00116             //- Return number of points
00117             inline label nPoints() const;
00118 
00119             //- Return number of edges
00120             inline label nEdges() const;
00121 
00122             //- Return number of faces
00123             inline label nFaces() const;
00124 
00125             //- Return list of edges
00126             inline edgeList edges(const labelList& pointLabels) const;
00127 
00128             //- Return a raw list of model faces
00129             inline const faceList& modelFaces() const;
00130 
00131             //- Return list of faces
00132             inline faceList faces(const labelList& pointLabels) const;
00133 
00134 
00135         //- Vector centroid
00136         vector centre
00137         (
00138             const labelList& pointLabels,
00139             const pointField& points
00140         ) const;
00141 
00142         //- Cell volume
00143         scalar mag
00144         (
00145             const labelList& pointLabels,
00146             const pointField& points
00147         ) const;
00148 
00149         //- Return info proxy.
00150         //  Used to print token information to a stream
00151         InfoProxy<cellModel> info() const
00152         {
00153             return *this;
00154         }
00155 
00156         //- WriteData member function required by regIOobject
00157         bool writeData(Ostream& os) const
00158         {
00159             os << *this;
00160             return os.good();
00161         }
00162 
00163 
00164     // Friend operators
00165 
00166         //- Equality operator: true => ptr to models are equal !
00167         friend bool operator==(const cellModel&, const cellModel&);
00168 
00169         //- Inequality operator: true => ptr to models are not equal !
00170         friend bool operator!=(const cellModel&, const cellModel&);
00171 
00172 
00173     // Ostream operator
00174 
00175         friend Ostream& operator<<(Ostream&, const cellModel&);
00176 };
00177 
00178 
00179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00180 
00181 } // End namespace Foam
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 #include "cellModelI.H"
00186 
00187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00188 
00189 #endif
00190 
00191 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd