hexCell.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) 2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::hexCell
28
29Description
30 A hexahedral cell primitive.
31
32 It is important that the face/edge ordering is identical for
33 a hexahedral cell shape model and a hexCell
34
35SourceFiles
36 hexCell.C
37 hexCellI.H
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef hexCell_H
42#define hexCell_H
43
44#include "FixedList.H"
45#include "faceList.H"
46#include "edgeList.H"
47#include "pointField.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward Declarations
55class cellShape;
56
57/*---------------------------------------------------------------------------*\
58 Class hexCell Declaration
59\*---------------------------------------------------------------------------*/
61class hexCell
62:
63 public FixedList<label, 8>
64{
65 // Static Data Members
66
67 //- The model faces for HEX
68 static const label modelFaces_[6][4];
69
70 //- The model edges for HEX
71 static const label modelEdges_[12][2];
72
73
74 // Private Member Functions
75
76 //- Copy vertices for given face - no checks
77 inline void copyFace(Foam::face& f, const label facei) const;
78
79
80public:
81
82 // Constructors
83
84 //- Default construct, with invalid point labels (-1)
85 inline hexCell();
86
87 //- Construct from an initializer list of eight point labels
88 inline explicit hexCell(std::initializer_list<label> list);
89
90 //- Construct from FixedList of eight point labels
91 inline hexCell(const FixedList<label, 8>& list);
92
93 //- Copy construct from a subset of point labels
94 inline hexCell
95 (
96 const labelUList& list,
97 const FixedList<label, 8>& indices
98 );
99
100 //- Copy construct from a subset of point labels
101 template<unsigned AnyNum>
102 inline hexCell
103 (
104 const FixedList<label, AnyNum>& list,
105 const FixedList<label, 8>& indices
106 );
107
108 //- Construct from Istream
109 inline explicit hexCell(Istream& is);
110
111
112 // Member Functions
113
114 //- Number of points for HEX
115 static constexpr label nPoints() noexcept
116 {
117 return 8;
118 }
119
120 //- Number of edges for HEX
121 static constexpr label nEdges() noexcept
122 {
123 return 12;
124 }
125
126 //- Number of faces for HEX
127 static constexpr label nFaces() noexcept
128 {
129 return 6;
130 }
131
132 //- Return the model faces
133 static const Foam::faceList& modelFaces();
134
135 //- Return the model edges
136 static const Foam::edgeList& modelEdges();
137
138
139 //- Return i-th face
140 inline Foam::face face(const label facei) const;
141
142 //- Return i-th edge
143 inline Foam::edge edge(const label edgei) const;
144
145 //- Return i-th edge reversed
146 inline Foam::edge reverseEdge(const label edgei) const;
147
148 //- Return list of cell faces [6]
149 Foam::faceList faces() const;
150
151 //- Return list of cell edges [12]
152 Foam::edgeList edges() const;
153
154 //- Cell centre - uses simple average of points
155 inline point centre(const UList<point>& meshPoints) const;
156
157 //- The points corresponding to this shape
158 inline pointField points(const UList<point>& meshPoints) const;
159
160
161 // Operations
162
163 //- Return HEX shape cell
164 cellShape shape(const bool doCollapse = false) const;
165};
166
167
168// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
169
170//- Contiguous data for hexCell
171template<> struct is_contiguous<hexCell> : std::true_type {};
172
173//- Contiguous label data for hexCell
174template<> struct is_contiguous_label<hexCell> : std::true_type {};
175
176
177// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178
179} // End namespace Foam
180
181// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182
183#include "hexCellI.H"
184
185// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187#endif
188
189// ************************************************************************* //
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
An analytical geometric cellShape.
Definition: cellShape.H:72
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:66
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
A hexahedral cell primitive.
Definition: hexCell.H:63
static const Foam::edgeList & modelEdges()
Return the model edges.
Definition: hexCell.C:94
point centre(const UList< point > &meshPoints) const
Cell centre - uses simple average of points.
Definition: hexCellI.H:133
static const Foam::faceList & modelFaces()
Return the model faces.
Definition: hexCell.C:71
Foam::faceList faces() const
Return list of cell faces [6].
Definition: hexCell.C:117
Foam::edge reverseEdge(const label edgei) const
Return i-th edge reversed.
Definition: hexCellI.H:125
Foam::edgeList edges() const
Return list of cell edges [12].
Definition: hexCell.C:132
static constexpr label nFaces() noexcept
Number of faces for HEX.
Definition: hexCell.H:126
cellShape shape(const bool doCollapse=false) const
Return HEX shape cell.
Definition: hexCell.C:148
static constexpr label nEdges() noexcept
Number of edges for HEX.
Definition: hexCell.H:120
static constexpr label nPoints() noexcept
Number of points for HEX.
Definition: hexCell.H:114
hexCell()
Default construct, with invalid point labels (-1)
Definition: hexCellI.H:41
const pointField & points
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
labelList f(nPoints)
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:86
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78