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

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