cell.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 OpenFOAM Foundation
9  Copyright (C) 2017-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::cell
29 
30 Description
31  A cell is defined as a list of faces with extra functionality
32 
33 SourceFiles
34  cellI.H
35  cell.C
36  oppositeCellFace.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef Foam_cell_H
41 #define Foam_cell_H
42 
43 #include "faceList.H"
44 #include "oppositeFace.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class primitiveMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class cell Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class cell
59 :
60  public labelList
61 {
62 public:
63 
64  // Static Data Members
65 
66  static const char* const typeName;
67 
68 
69  // Constructors
70 
71  //- Default construct
72  constexpr cell() noexcept = default;
73 
74  //- Construct given size, with invalid point labels (-1)
75  inline explicit cell(const label sz);
76 
77  //- Copy construct from list of face labels
78  inline explicit cell(const labelUList& list);
79 
80  //- Move construct from list of face labels
81  inline explicit cell(labelList&& list);
82 
83  //- Copy construct from list of face labels
84  template<unsigned N>
85  inline explicit cell(const FixedList<label, N>& list);
86 
87  //- Copy construct from subset of face labels
88  inline cell(const labelUList& list, const labelUList& indices);
89 
90  //- Copy construct from subset of face labels
91  template<unsigned N>
92  inline cell(const labelUList& list, const FixedList<label, N>& indices);
93 
94  //- Construct from Istream
95  inline explicit cell(Istream& is);
96 
97 
98  // Member Functions
99 
100  //- Return number of faces
101  inline label nFaces() const noexcept;
102 
103  //- Return unordered list of cell vertices given the list of faces
104  labelList labels(const faceUList& meshFaces) const;
105 
106  //- Return the cell vertices given the list of faces and mesh points
108  (
109  const faceUList& meshFaces,
110  const UList<point>& meshPoints
111  ) const;
112 
113  //- Return cell edges
114  edgeList edges(const faceUList& meshFaces) const;
115 
116  //- Return index of opposite face
117  label opposingFaceLabel
118  (
119  const label masterFaceLabel,
120  const faceUList& meshFaces
121  ) const;
122 
123  //- Return opposite face oriented the same way as the master face
125  (
126  const label masterFaceLabel,
127  const faceUList& meshFaces
128  ) const;
129 
130 
131  // Instructions for centre and mag:
132  // When one wants to access the cell centre and magnitude, the
133  // functionality on the mesh level should be used in preference to the
134  // functions provided here. They do not rely to the functionality
135  // implemented here, provide additional checking and are more efficient.
136  // The cell::centre and cell::mag functions may be removed in the
137  // future.
138 
139  //- Returns cell centre
140  point centre
141  (
142  const UList<point>& meshPoints,
143  const faceUList& meshFaces
144  ) const;
145 
146  //- Returns cell volume
147  scalar mag
148  (
149  const UList<point>& meshPoints,
150  const faceUList& meshFaces
151  ) const;
152 
153  //- The bounding box for the cell
155  (
156  const UList<point>& meshPoints,
157  const faceUList& meshFaces
158  ) const;
159 
160  //- The bounding box for the cell associated with given mesh
161  Pair<point> box(const primitiveMesh& mesh) const;
162 };
163 
164 
165 // Global Operators
166 
167 //- Test if both cells are the same size and contain the same points
168 // The internal point ordering is ignored
169 bool operator==(const cell& a, const cell& b);
170 
171 //- Test if the cells differ (different size or different points)
172 inline bool operator!=(const cell& a, const cell& b);
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #include "cellI.H"
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
Class containing opposite face for a prismatic cell with addressing and a possibility of failure...
Definition: oppositeFace.H:42
constexpr cell() noexcept=default
Default construct.
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:107
scalar mag(const UList< point > &meshPoints, const faceUList &meshFaces) const
Returns cell volume.
Definition: cell.C:213
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:75
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
labelList labels(const faceUList &meshFaces) const
Return unordered list of cell vertices given the list of faces.
Definition: cell.C:33
oppositeFace opposingFace(const label masterFaceLabel, const faceUList &meshFaces) const
Return opposite face oriented the same way as the master face.
label opposingFaceLabel(const label masterFaceLabel, const faceUList &meshFaces) const
Return index of opposite face.
label nFaces() const noexcept
Return number of faces.
Definition: cellI.H:74
pointField points(const faceUList &meshFaces, const UList< point > &meshPoints) const
Return the cell vertices given the list of faces and mesh points.
Definition: cell.C:87
dynamicFvMesh & mesh
Pair< point > box(const UList< point > &meshPoints, const faceUList &meshFaces) const
The bounding box for the cell.
Definition: cell.C:253
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
point centre(const UList< point > &meshPoints, const faceUList &meshFaces) const
Returns cell centre.
Definition: cell.C:149
edgeList edges(const faceUList &meshFaces) const
Return cell edges.
Definition: cell.C:105
const direction noexcept
Definition: Scalar.H:258
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:53
bool operator!=(const eddy &a, const eddy &b)
Definition: eddy.H:297
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Namespace for OpenFOAM.
static const char *const typeName
Definition: cell.H:61