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-2020 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 cell_H
41#define cell_H
42
43#include "faceList.H"
44#include "oppositeFace.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class cell Declaration
53\*---------------------------------------------------------------------------*/
55class cell
56:
57 public labelList
58{
59public:
60
61 // Static Data Members
63 static const char* const typeName;
64
65
66 // Constructors
67
68 //- Default construct
69 constexpr cell() noexcept = default;
70
71 //- Construct given size, with invalid point labels (-1)
72 inline explicit cell(const label sz);
73
74 //- Copy construct from list of face labels
75 inline explicit cell(const labelUList& list);
76
77 //- Move construct from list of face labels
78 inline explicit cell(labelList&& list);
79
80 //- Copy construct from list of face labels
81 template<unsigned N>
82 inline explicit cell(const FixedList<label, N>& list);
83
84 //- Copy construct from subset of face labels
85 inline cell(const labelUList& list, const labelUList& indices);
86
87 //- Copy construct from subset of face labels
88 template<unsigned N>
89 inline cell(const labelUList& list, const FixedList<label, N>& indices);
90
91 //- Construct from Istream
92 inline explicit cell(Istream& is);
93
94
95 // Member Functions
96
97 //- Return number of faces
98 inline label nFaces() const noexcept;
99
100 //- Return unordered list of cell vertices given the list of faces
101 labelList labels(const faceUList& meshFaces) const;
102
103 //- Return the cell vertices given the list of faces and mesh points
105 (
106 const faceUList& meshFaces,
107 const UList<point>& meshPoints
108 ) const;
109
110 //- Return cell edges
111 edgeList edges(const faceUList& meshFaces) const;
112
113 //- Return index of opposite face
115 (
116 const label masterFaceLabel,
117 const faceUList& meshFaces
118 ) const;
119
120 //- Return opposite face oriented the same way as the master face
122 (
123 const label masterFaceLabel,
124 const faceUList& meshFaces
125 ) const;
126
127
128 // Instructions for centre and mag:
129 // When one wants to access the cell centre and magnitude, the
130 // functionality on the mesh level should be used in preference to the
131 // functions provided here. They do not rely to the functionality
132 // implemented here, provide additional checking and are more efficient.
133 // The cell::centre and cell::mag functions may be removed in the
134 // future.
135
136 //- Returns cell centre
138 (
139 const UList<point>& meshPoints,
140 const faceUList& meshFaces
141 ) const;
142
143 //- Returns cell volume
144 scalar mag
145 (
146 const UList<point>& meshPoints,
147 const faceUList& meshFaces
148 ) const;
149};
150
151
152// Global Operators
153
154//- Test if both cells are the same size and contain the same points
155// The internal point ordering is ignored
156bool operator==(const cell& a, const cell& b);
157
158//- Test if the cells differ (different size or different points)
159inline bool operator!=(const cell& a, const cell& b);
160
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164} // End namespace Foam
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168#include "cellI.H"
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172#endif
173
174// ************************************************************************* //
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: FixedList.H:81
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A cell is defined as a list of faces with extra functionality.
Definition: cell.H:57
labelList labels(const faceUList &meshFaces) const
Return unordered list of cell vertices given the list of faces.
Definition: cell.C:39
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:111
scalar mag(const UList< point > &meshPoints, const faceUList &meshFaces) const
Returns cell volume.
Definition: cell.C:219
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:155
label nFaces() const noexcept
Return number of faces.
Definition: cellI.H:81
static const char *const typeName
Definition: cell.H:62
Class containing opposite face for a prismatic cell with addressing and a possibility of failure.
Definition: oppositeFace.H:54
const pointField & points
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
volScalarField & b
Definition: createFields.H:27
const Vector< label > N(dict.get< Vector< label > >("N"))