cellShape.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::cellShape
28 
29 Description
30  An analytical geometric cellShape.
31 
32  The optional collapse functionality changes the cellModel to the
33  correct type after removing any duplicate points.
34 
35 SourceFiles
36  cellShapeI.H
37  cellShape.C
38  cellShapeIO.C
39  cellShapeEqual.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef cellShape_H
44 #define cellShape_H
45 
46 #include "pointField.H"
47 #include "labelList.H"
48 #include "cellModel.H"
49 #include "autoPtr.H"
50 #include "InfoProxy.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class cell;
59 
60 // Forward declaration of friend functions and operators
61 
62 class cellShape;
63 bool operator==(const cellShape& a, const cellShape& b);
64 Istream& operator>>(Istream& is, cellShape& s);
65 Ostream& operator<<(Ostream& os, const cellShape& s);
66 
67 
68 /*---------------------------------------------------------------------------*\
69  Class cellShape Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class cellShape
73 :
74  public labelList
75 {
76  // Private data
77 
78  //- Access to the cellShape's model
79  const cellModel *m;
80 
81 
82 public:
83 
84  // Constructors
85 
86  //- Construct null
87  inline cellShape();
88 
89  //- Construct from components
90  inline cellShape
91  (
92  const cellModel& model,
93  const labelUList& labels,
94  const bool doCollapse = false
95  );
96 
97  //- Construct from components
98  inline cellShape
99  (
100  const cellModel& model,
101  labelUList&& labels,
102  const bool doCollapse = false
103  );
104 
105  //- Construct from components
106  inline cellShape
107  (
108  const word& modelName,
109  const labelUList& labels,
110  const bool doCollapse = false
111  );
112 
113  //- Construct from Istream
114  inline cellShape(Istream& is);
115 
116  //- Clone
117  inline autoPtr<cellShape> clone() const;
118 
119 
120  // Member Functions
121 
122  //- Return the points corresponding to this cellShape
123  inline pointField points(const UList<point>& meshPoints) const;
124 
125  //- Model reference
126  inline const cellModel& model() const;
127 
128  //- Mesh face labels of this cell (in order of model)
129  inline labelList meshFaces
130  (
131  const faceList& allFaces,
132  const cell& cFaces
133  ) const;
134 
135  //- Mesh edge labels of this cell (in order of model)
136  inline labelList meshEdges
137  (
138  const edgeList& allEdges,
139  const labelList& cEdges
140  ) const;
141 
142  //- Faces of this cell
143  inline faceList faces() const;
144 
145  //- Collapsed faces of this cell
146  inline faceList collapsedFaces() const;
147 
148  //- Number of faces
149  inline label nFaces() const;
150 
151  //- Edges of this cellShape
152  inline edgeList edges() const;
153 
154  //- Number of edges
155  inline label nEdges() const;
156 
157  //- Number of points
158  inline label nPoints() const;
159 
160  //- Centroid of the cell
161  inline point centre(const UList<point>& points) const;
162 
163  //- Return info proxy.
164  // Used to print token information to a stream
166  {
167  return *this;
168  }
169 
170  //- Scalar magnitude
171  inline scalar mag(const UList<point>& points) const;
172 
173  //- Collapse shape to correct one after removing duplicate vertices
174  void collapse();
175 
176 
177  // Friend Operators
178 
179  friend bool operator==(const cellShape& a, const cellShape& b);
180 
181 
182  // IOstream operators
183 
184  friend Istream& operator>>(Istream& is, cellShape& s);
185  friend Ostream& operator<<(Ostream& os, const cellShape& s);
186 };
187 
188 
189 template<>
190 Ostream& operator<<(Ostream& os, const InfoProxy<cellShape>& ip);
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #include "cellShapeI.H"
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
Foam::cellShape::collapse
void collapse()
Collapse shape to correct one after removing duplicate vertices.
Definition: cellShape.C:33
Foam::cellShape::operator<<
friend Ostream & operator<<(Ostream &os, const cellShape &s)
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:47
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
cellShapeI.H
Foam::cellShape::centre
point centre(const UList< point > &points) const
Centroid of the cell.
Definition: cellShapeI.H:278
InfoProxy.H
Foam::cellShape::meshFaces
labelList meshFaces(const faceList &allFaces, const cell &cFaces) const
Mesh face labels of this cell (in order of model)
Definition: cellShapeI.H:132
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::cellShape::faces
faceList faces() const
Faces of this cell.
Definition: cellShapeI.H:199
Foam::cellShape::meshEdges
labelList meshEdges(const edgeList &allEdges, const labelList &cEdges) const
Mesh edge labels of this cell (in order of model)
Definition: cellShapeI.H:166
Foam::cellShape::points
pointField points(const UList< point > &meshPoints) const
Return the points corresponding to this cellShape.
Definition: cellShapeI.H:106
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
labelList.H
Foam::Field< vector >
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::cellShape::edges
edgeList edges() const
Edges of this cellShape.
Definition: cellShapeI.H:260
cellModel.H
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::cellShape::clone
autoPtr< cellShape > clone() const
Clone.
Definition: cellShapeI.H:97
Foam::cellShape::operator>>
friend Istream & operator>>(Istream &is, cellShape &s)
Foam::cellShape::operator==
friend bool operator==(const cellShape &a, const cellShape &b)
Foam::cellShape::cellShape
cellShape()
Construct null.
Definition: cellShapeI.H:34
Foam::cellShape
An analytical geometric cellShape.
Definition: cellShape.H:71
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cellShape::mag
scalar mag(const UList< point > &points) const
Scalar magnitude.
Definition: cellShapeI.H:284
pointField.H
Foam::cellShape::nFaces
label nFaces() const
Number of faces.
Definition: cellShapeI.H:254
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cellShape::nEdges
label nEdges() const
Number of edges.
Definition: cellShapeI.H:266
Foam::cellShape::info
Foam::InfoProxy< cellShape > info() const
Return info proxy.
Definition: cellShape.H:164
Foam::Vector< scalar >
Foam::List< label >
Foam::UList< label >
Foam::cellShape::nPoints
label nPoints() const
Number of points.
Definition: cellShapeI.H:272
Foam::cellShape::collapsedFaces
faceList collapsedFaces() const
Collapsed faces of this cell.
Definition: cellShapeI.H:205
Foam::cellModel
Maps a geometry to a set of cell primitives.
Definition: cellModel.H:72
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::cell
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:54
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::cellShape::model
const cellModel & model() const
Model reference.
Definition: cellShapeI.H:125
autoPtr.H