OpenFOAM logo
Open Source CFD Toolkit

cellShape.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     cellShape
00027 
00028 Description
00029     An analytical geometric cellShape.
00030 
00031     The optional collapse functionality changes the cellModel to the
00032     correct type after removing any duplicate points.
00033 
00034 SourceFiles
00035     cellShapeI.H
00036     cellShape.C
00037     cellShapeIO.C
00038     cellShapeEqual.C
00039 
00040 \*---------------------------------------------------------------------------*/
00041 
00042 #ifndef cellShape_H
00043 #define cellShape_H
00044 
00045 #include "pointField.H"
00046 #include "labelList.H"
00047 #include "cellModel.H"
00048 #include "InfoProxy.H"
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 // Class forward declarations
00056 class cell;
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class cellShape Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class cellShape
00063 :
00064     public labelList
00065 {
00066     // Private data
00067 
00068         //- Access to the cellShape's model
00069         const cellModel *m;
00070 
00071 
00072     // Private Member Functions
00073 
00074 public:
00075 
00076     // Constructors
00077 
00078         //- Construct null
00079         inline cellShape();
00080 
00081         //- Construct from components
00082         inline cellShape
00083         (
00084             const cellModel&,
00085             const labelList&,
00086             const bool doCollapse = false
00087         );
00088 
00089         //- Construct from Istream
00090         inline cellShape(Istream& is);
00091 
00092         //- Clone
00093         inline autoPtr<cellShape> clone() const;
00094 
00095 
00096     // Member Functions
00097 
00098         //- Return the points corresponding to this cellShape
00099         inline pointField points(const pointField& meshPoints) const;
00100 
00101         //- Model reference
00102         inline const cellModel& model() const;
00103 
00104         //- Mesh face labels of this cell (in order of model)
00105         inline labelList meshFaces(const faceList& allFaces, const cell&)
00106          const;
00107 
00108         //- Mesh edge labels of this cell (in order of model)
00109         inline labelList meshEdges(const edgeList& allEdges, const labelList&)
00110          const;
00111 
00112         //- Faces of this cell
00113         inline faceList faces() const;
00114 
00115         //- Collapsed faces of this cell
00116         inline faceList collapsedFaces() const;
00117 
00118         //- Number of faces
00119         inline label nFaces() const;
00120 
00121         //- Edges of this cellShape
00122         inline edgeList edges() const;
00123 
00124         //- Number of edges
00125         inline label nEdges() const;
00126 
00127         //- Number of points
00128         inline label nPoints() const;
00129 
00130         //- Centroid of the cell
00131         inline point centre(const pointField&) const;
00132 
00133         //- Return info proxy.
00134         //  Used to print token information to a stream
00135         InfoProxy<cellShape> info() const
00136         {
00137             return *this;
00138         }
00139 
00140         //- Scalar magnitude
00141         inline scalar mag(const pointField&) const;
00142 
00143         //- Collapse shape to correct one after removing duplicate vertices
00144         void collapse();
00145 
00146     // Friend Operators
00147 
00148         friend bool operator==(const cellShape&, const cellShape&);
00149 
00150 
00151     // IOstream operators
00152 
00153         friend Istream& operator>>(Istream&, cellShape&);
00154         friend Ostream& operator<<(Ostream&, const cellShape&);
00155 };
00156 
00157 
00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00159 
00160 } // End namespace Foam
00161 
00162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00163 
00164 #include "cellShapeI.H"
00165 
00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00167 
00168 #endif
00169 
00170 // ************************************************************************* //
For further information go to www.openfoam.org