Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::cell
29
30Description
31 A cell is defined as a list of faces with extra functionality
32
33SourceFiles
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
48namespace Foam
49{
50
51// Forward Declarations
52class primitiveMesh;
54/*---------------------------------------------------------------------------*\
55 Class cell Declaration
56\*---------------------------------------------------------------------------*/
57
58class cell
59:
60 public labelList
62public:
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
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
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
154 Pair<point> box
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
169bool operator==(const cell& a, const cell& b);
170
171//- Test if the cells differ (different size or different points)
172inline 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// ************************************************************************* //
A 1D vector of objects of type <T> with a fixed length <N>.
Definition FixedList.H:73
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An ordered pair of two objects of type <T> with first() and second() elements.
Definition Pair.H:66
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
labelList labels(const faceUList &meshFaces) const
Return unordered list of cell vertices given the list of faces.
Definition cell.C:33
constexpr cell() noexcept=default
Default construct.
oppositeFace opposingFace(const label masterFaceLabel, const faceUList &meshFaces) const
Return opposite face oriented the same way as the master face.
edgeList edges(const faceUList &meshFaces) const
Return cell edges.
Definition cell.C:105
scalar mag(const UList< point > &meshPoints, const faceUList &meshFaces) const
Returns cell volume.
Definition cell.C:213
label opposingFaceLabel(const label masterFaceLabel, const faceUList &meshFaces) const
Return index of opposite face.
point centre(const UList< point > &meshPoints, const faceUList &meshFaces) const
Returns cell centre.
Definition cell.C:149
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
Pair< point > box(const UList< point > &meshPoints, const faceUList &meshFaces) const
The bounding box for the cell.
Definition cell.C:253
static const char *const typeName
Definition cell.H:61
Class containing opposite face for a prismatic cell with addressing and a possibility of failure.
Cell-face mesh analysis engine.
dynamicFvMesh & mesh
Namespace for OpenFOAM.
List< edge > edgeList
List of edge.
Definition edgeList.H:32
List< label > labelList
A List of labels.
Definition List.H:62
vector point
Point is a vector.
Definition point.H:37
const direction noexcept
Definition scalarImpl.H:265
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
UList< face > faceUList
UList of faces.
Definition faceListFwd.H:43
volScalarField & b
const Vector< label > N(dict.get< Vector< label > >("N"))