FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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