Loading...
Searching...
No Matches
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-2022 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 Foam_hexCell_H
42#define Foam_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;
57/*---------------------------------------------------------------------------*\
58 Class hexCell Declaration
59\*---------------------------------------------------------------------------*/
60
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 // Generated Methods
83
84 //- The front() accessor (from FixedList) has no purpose
85 void front() = delete;
86
87 //- The back() accessor (from FixedList) has no purpose
88 void back() = delete;
89
90
91 // Constructors
92
93 //- Default construct, with invalid point labels (-1)
94 inline hexCell();
95
96 //- Construct from an initializer list of eight point labels
97 inline explicit hexCell(std::initializer_list<label> list);
98
99 //- Construct from FixedList of eight point labels
100 inline hexCell(const FixedList<label, 8>& list);
101
102 //- Copy construct from a subset of point labels
103 inline hexCell
104 (
105 const labelUList& list,
106 const FixedList<label, 8>& indices
107 );
108
109 //- Copy construct from a subset of point labels
110 template<unsigned AnyNum>
111 inline hexCell
112 (
113 const FixedList<label, AnyNum>& list,
114 const FixedList<label, 8>& indices
115 );
116
117 //- Construct from Istream
118 inline explicit hexCell(Istream& is);
119
120
121 // Member Functions
122
123 //- Number of points for HEX
124 static constexpr label nPoints() noexcept
125 {
126 return 8;
127 }
128
129 //- Number of edges for HEX
130 static constexpr label nEdges() noexcept
131 {
132 return 12;
133 }
134
135 //- Number of faces for HEX
136 static constexpr label nFaces() noexcept
137 {
138 return 6;
139 }
140
141 //- Return the model faces
142 static const Foam::faceList& modelFaces();
144 //- Return the model edges
145 static const Foam::edgeList& modelEdges();
146
147
148 //- Return i-th face
149 inline Foam::face face(const label facei) const;
150
151 //- Return i-th edge
152 inline Foam::edge edge(const label edgei) const;
153
154 //- Return i-th edge reversed
155 inline Foam::edge reverseEdge(const label edgei) const;
156
157 //- Return list of cell faces [6]
158 Foam::faceList faces() const;
160 //- Return list of cell edges [12]
161 Foam::edgeList edges() const;
162
163 //- Cell centre - uses simple average of points
164 inline point centre(const UList<point>& meshPoints) const;
165
166 //- The points corresponding to this shape
167 inline pointField points(const UList<point>& meshPoints) const;
168
169
170 // Operations
171
172 //- Return HEX shape cell
173 cellShape shape(const bool doCollapse = false) const;
174};
175
176
177// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
178
179//- Contiguous data for hexCell
180template<> struct is_contiguous<hexCell> : std::true_type {};
181
182//- Contiguous label data for hexCell
183template<> struct is_contiguous_label<hexCell> : std::true_type {};
184
185
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188} // End namespace Foam
189
190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191
192#include "hexCellI.H"
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196#endif
197
198// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
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
An analytical geometric cellShape.
Definition cellShape.H:71
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Definition edge.H:62
A face is a list of labels corresponding to mesh vertices.
Definition face.H:71
A hexahedral cell primitive.
Definition hexCell.H:59
Foam::edge edge(const label edgei) const
Return i-th edge.
Definition hexCellI.H:99
void back()=delete
The back() accessor (from FixedList) has no purpose.
void front()=delete
The front() accessor (from FixedList) has no purpose.
Foam::face face(const label facei) const
Return i-th face.
Definition hexCellI.H:81
static const Foam::edgeList & modelEdges()
Return the model edges.
Definition hexCell.C:87
point centre(const UList< point > &meshPoints) const
Cell centre - uses simple average of points.
Definition hexCellI.H:126
static const Foam::faceList & modelFaces()
Return the model faces.
Definition hexCell.C:64
Foam::faceList faces() const
Return list of cell faces [6].
Definition hexCell.C:110
Foam::edge reverseEdge(const label edgei) const
Return i-th edge reversed.
Definition hexCellI.H:118
Foam::edgeList edges() const
Return list of cell edges [12].
Definition hexCell.C:125
static constexpr label nFaces() noexcept
Number of faces for HEX.
Definition hexCell.H:159
cellShape shape(const bool doCollapse=false) const
Return HEX shape cell.
Definition hexCell.C:141
static constexpr label nEdges() noexcept
Number of edges for HEX.
Definition hexCell.H:151
static constexpr label nPoints() noexcept
Number of points for HEX.
Definition hexCell.H:143
hexCell()
Default construct, with invalid point labels (-1).
Definition hexCellI.H:34
const pointField & points
Namespace for OpenFOAM.
List< edge > edgeList
List of edge.
Definition edgeList.H:32
List< face > faceList
List of faces.
Definition faceListFwd.H:41
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
labelList f(nPoints)
A template class to specify if a data type is composed solely of Foam::label elements.
Definition contiguous.H:82
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70