tetCell.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-2017 OpenFOAM Foundation
9  Copyright (C) 2019-2021 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::tetCell
29 
30 Description
31  A tetrahedral cell primitive.
32 
33  It is important that the face/edge ordering is identical for
34  a tetrahedron class,
35  a tetrahedron cell shape model and a tetCell
36 
37 SourceFiles
38  tetCell.C
39  tetCellI.H
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef tetCell_H
44 #define tetCell_H
45 
46 #include "FixedList.H"
47 #include "triFace.H"
48 #include "faceList.H"
49 #include "edgeList.H"
50 #include "pointField.H"
51 #include "tetPointRef.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward Declarations
59 class cellShape;
60 
61 /*---------------------------------------------------------------------------*\
62  Class tetCell Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class tetCell
66 :
67  public FixedList<label, 4>
68 {
69  // Static Data Members
70 
71  //- The model faces for TET
72  static const label modelFaces_[4][3];
73 
74  //- The model edges for TET
75  static const label modelEdges_[6][2];
76 
77 
78 public:
79 
80  // Constructors
81 
82  //- Default construct, with invalid point labels (-1)
83  inline tetCell();
84 
85  //- Construct from four point labels
86  inline tetCell
87  (
88  const label a,
89  const label b,
90  const label c,
91  const label d
92  );
93 
94  //- Construct from an initializer list of four point labels
95  inline explicit tetCell(std::initializer_list<label> list);
96 
97  //- Construct from FixedList of four point labels
98  inline tetCell(const FixedList<label, 4>& list);
99 
100  //- Copy construct from a subset of point labels
101  inline tetCell
102  (
103  const labelUList& list,
104  const FixedList<label, 4>& indices
105  );
106 
107  //- Copy construct from a subset of point labels
108  template<unsigned AnyNum>
109  inline tetCell
110  (
111  const FixedList<label, AnyNum>& list,
112  const FixedList<label, 4>& indices
113  );
114 
115  //- Construct from Istream
116  inline explicit tetCell(Istream& is);
117 
118 
119  // Member Functions
120 
121  //- Number of points for TET
122  static constexpr label nPoints() noexcept
123  {
124  return 4;
125  }
126 
127  //- Number of edges for TET
128  static constexpr label nEdges() noexcept
129  {
130  return 6;
131  }
132 
133  //- Number of faces for TET
134  static constexpr label nFaces() noexcept
135  {
136  return 4;
137  }
138 
139  //- Return the model faces
140  static const Foam::faceList& modelFaces();
141 
142  //- Return the model edges
143  static const Foam::edgeList& modelEdges();
144 
145 
146  //- Return i-th face
147  inline Foam::triFace face(const label facei) const;
148 
149  //- Return first face adjacent to the given edge
150  inline label edgeFace(const label edgei) const;
151 
152  //- Return face adjacent to the given face sharing the same edge
153  inline label edgeAdjacentFace
154  (
155  const label edgei,
156  const label facei
157  ) const;
158 
159  //- Return i-th edge
160  inline Foam::edge edge(const label edgei) const;
161 
162  //- Return i-th edge reversed
163  inline Foam::edge reverseEdge(const label edgei) const;
164 
165  //- The points corresponding to this shape
166  inline pointField points(const UList<point>& meshPoints) const;
167 
168 
169  // Operations
170 
171  //- Return TET shape cell
172  cellShape shape() const;
173 
174  //- Return the tetrahedron
175  inline tetPointRef tet(const UList<point>& meshPoints) const;
176 
177 
178  // Housekeeping
179 
180  //- Identical to edge()
181  Foam::edge tetEdge(label edgei) const { return this->edge(edgei); }
182 
183  //- Identical to shape()
184  cellShape tetCellShape() const;
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
189 
190 //- Contiguous data for tetCell
191 template<> struct is_contiguous<tetCell> : std::true_type {};
192 
193 //- Contiguous label data for tetCell
194 template<> struct is_contiguous_label<tetCell> : std::true_type {};
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #include "tetCellI.H"
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
Foam::tetCell::nEdges
static constexpr label nEdges() noexcept
Number of edges for TET.
Definition: tetCell.H:127
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
Foam::tetCell::points
pointField points(const UList< point > &meshPoints) const
The points corresponding to this shape.
Definition: tetCellI.H:197
tetPointRef.H
triFace.H
Foam::tetCell::modelFaces
static const Foam::faceList & modelFaces()
Return the model faces.
Definition: tetCell.C:64
faceList.H
Foam::tetCell::tetCell
tetCell()
Default construct, with invalid point labels (-1)
Definition: tetCellI.H:31
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
Foam::tetCell::tet
tetPointRef tet(const UList< point > &meshPoints) const
Return the tetrahedron.
Definition: tetCellI.H:206
Foam::tetCell::nFaces
static constexpr label nFaces() noexcept
Number of faces for TET.
Definition: tetCell.H:133
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Field< vector >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::tetCell::edgeAdjacentFace
label edgeAdjacentFace(const label edgei, const label facei) const
Return face adjacent to the given face sharing the same edge.
Definition: tetCellI.H:133
Foam::tetCell::tetEdge
Foam::edge tetEdge(label edgei) const
Identical to edge()
Definition: tetCell.H:180
Foam::tetCell::face
Foam::triFace face(const label facei) const
Return i-th face.
Definition: tetCellI.H:93
edgeList.H
Foam::cellShape
An analytical geometric cellShape.
Definition: cellShape.H:69
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::tetCell::modelEdges
static const Foam::edgeList & modelEdges()
Return the model edges.
Definition: tetCell.C:86
Foam::tetCell::tetCellShape
cellShape tetCellShape() const
Identical to shape()
Definition: tetCell.C:155
Foam::tetCell::edgeFace
label edgeFace(const label edgei) const
Return first face adjacent to the given edge.
Definition: tetCellI.H:113
pointField.H
Foam::triFace
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:69
Foam::tetCell::edge
Foam::edge edge(const label edgei) const
Return i-th edge.
Definition: tetCellI.H:170
Foam::List< face >
Foam::FixedList
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:104
Foam::tetCell::shape
cellShape shape() const
Return TET shape cell.
Definition: tetCell.C:142
Foam::UList< label >
Foam::tetCell
A tetrahedral cell primitive.
Definition: tetCell.H:64
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::tetCell::reverseEdge
Foam::edge reverseEdge(const label edgei) const
Return i-th edge reversed.
Definition: tetCellI.H:189
tetCellI.H
FixedList.H
Foam::tetCell::nPoints
static constexpr label nPoints() noexcept
Number of points for TET.
Definition: tetCell.H:121
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::tetrahedron
A tetrahedron primitive.
Definition: tetrahedron.H:63