initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / meshes / meshShapes / cellShape / cellShape.H
blobe14365247497b659c75d7a476d6add19ff040ea4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::cellShape
28 Description
29     An analytical geometric cellShape.
31     The optional collapse functionality changes the cellModel to the
32     correct type after removing any duplicate points.
34 SourceFiles
35     cellShapeI.H
36     cellShape.C
37     cellShapeIO.C
38     cellShapeEqual.C
40 \*---------------------------------------------------------------------------*/
42 #ifndef cellShape_H
43 #define cellShape_H
45 #include "pointField.H"
46 #include "labelList.H"
47 #include "cellModel.H"
48 #include "autoPtr.H"
49 #include "InfoProxy.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 // Forward declaration of classes
57 class cell;
59 // Forward declaration of friend functions and operators
61 class cellShape;
62 bool operator==(const cellShape&, const cellShape&);
63 Istream& operator>>(Istream&, cellShape&);
64 Ostream& operator<<(Ostream&, const cellShape&);
67 /*---------------------------------------------------------------------------*\
68                            Class cellShape Declaration
69 \*---------------------------------------------------------------------------*/
71 class cellShape
73     public labelList
75     // Private data
77         //- Access to the cellShape's model
78         const cellModel *m;
81 public:
83     // Constructors
85         //- Construct null
86         inline cellShape();
88         //- Construct from components
89         inline cellShape
90         (
91             const cellModel&,
92             const labelList&,
93             const bool doCollapse = false
94         );
96         //- Construct from Istream
97         inline cellShape(Istream& is);
99         //- Clone
100         inline autoPtr<cellShape> clone() const;
103     // Member Functions
105         //- Return the points corresponding to this cellShape
106         inline pointField points(const pointField& meshPoints) const;
108         //- Model reference
109         inline const cellModel& model() const;
111         //- Mesh face labels of this cell (in order of model)
112         inline labelList meshFaces(const faceList& allFaces, const cell&) const;
114         //- Mesh edge labels of this cell (in order of model)
115         inline labelList meshEdges
116         (
117             const edgeList& allEdges,
118             const labelList&
119         ) const;
121         //- Faces of this cell
122         inline faceList faces() const;
124         //- Collapsed faces of this cell
125         inline faceList collapsedFaces() const;
127         //- Number of faces
128         inline label nFaces() const;
130         //- Edges of this cellShape
131         inline edgeList edges() const;
133         //- Number of edges
134         inline label nEdges() const;
136         //- Number of points
137         inline label nPoints() const;
139         //- Centroid of the cell
140         inline point centre(const pointField&) const;
142         //- Return info proxy.
143         //  Used to print token information to a stream
144         Foam::InfoProxy<cellShape> info() const
145         {
146             return *this;
147         }
149         //- Scalar magnitude
150         inline scalar mag(const pointField&) const;
152         //- Collapse shape to correct one after removing duplicate vertices
153         void collapse();
156     // Friend Operators
158         friend bool operator==(const cellShape&, const cellShape&);
161     // IOstream operators
163         friend Istream& operator>>(Istream&, cellShape&);
164         friend Ostream& operator<<(Ostream&, const cellShape&);
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 } // End namespace Foam
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 #include "cellShapeI.H"
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 #endif
180 // ************************************************************************* //