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-2022 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 Foam_tetCell_H
44 #define Foam_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 "tetrahedron.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  // Generated Methods
81 
82  //- The front() accessor (from FixedList) has no purpose
83  void front() = delete;
84 
85  //- The back() accessor (from FixedList) has no purpose
86  void back() = delete;
87 
88 
89  // Constructors
90 
91  //- Default construct, with invalid point labels (-1)
92  inline tetCell();
93 
94  //- Construct from four point labels
95  inline tetCell
96  (
97  const label p0,
98  const label p1,
99  const label p2,
100  const label p3
101  );
102 
103  //- Construct from an initializer list of four point labels
104  inline explicit tetCell(std::initializer_list<label> list);
105 
106  //- Construct from FixedList of four point labels
107  inline tetCell(const FixedList<label, 4>& list);
108 
109  //- Copy construct from a subset of point labels
110  inline tetCell
111  (
112  const labelUList& list,
113  const FixedList<label, 4>& indices
114  );
115 
116  //- Copy construct from a subset of point labels
117  template<unsigned AnyNum>
118  inline tetCell
119  (
120  const FixedList<label, AnyNum>& list,
121  const FixedList<label, 4>& indices
122  );
123 
124  //- Construct from Istream
125  inline explicit tetCell(Istream& is);
126 
127 
128  // Member Functions
129 
130  //- Number of points for TET
131  static constexpr label nPoints() noexcept
132  {
133  return 4;
134  }
135 
136  //- Number of edges for TET
137  static constexpr label nEdges() noexcept
138  {
139  return 6;
140  }
141 
142  //- Number of faces for TET
143  static constexpr label nFaces() noexcept
144  {
145  return 4;
146  }
147 
148  //- Return the model faces
149  static const Foam::faceList& modelFaces();
151  //- Return the model edges
152  static const Foam::edgeList& modelEdges();
153 
154 
155  //- Return i-th face
156  inline Foam::triFace face(const label facei) const;
157 
158  //- Return first face adjacent to the given edge
159  inline label edgeFace(const label edgei) const;
160 
161  //- Return face adjacent to the given face sharing the same edge
162  inline label edgeAdjacentFace
163  (
164  const label edgei,
165  const label facei
166  ) const;
167 
168  //- Return i-th edge
169  inline Foam::edge edge(const label edgei) const;
170 
171  //- Return i-th edge reversed
172  inline Foam::edge reverseEdge(const label edgei) const;
173 
174  //- The points corresponding to this shape
175  inline pointField points(const UList<point>& meshPoints) const;
176 
177 
178  // Operations
179 
180  //- Return TET shape cell
181  cellShape shape() const;
182 
183  //- Return the tetrahedron
184  inline tetPointRef tet(const UList<point>& meshPoints) const;
185 
186 
187  // Housekeeping
188 
189  //- Identical to edge()
190  Foam::edge tetEdge(label edgei) const { return this->edge(edgei); }
191 
192  //- Identical to shape()
193  cellShape tetCellShape() const;
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
198 
199 //- Contiguous data for tetCell
200 template<> struct is_contiguous<tetCell> : std::true_type {};
201 
202 //- Contiguous label data for tetCell
203 template<> struct is_contiguous_label<tetCell> : std::true_type {};
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #include "tetCellI.H"
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
Foam::edge reverseEdge(const label edgei) const
Return i-th edge reversed.
Definition: tetCellI.H:182
A tetrahedron primitive.
Definition: tetrahedron.H:58
tetCell()
Default construct, with invalid point labels (-1)
Definition: tetCellI.H:24
A 1D vector of objects of type <T> with a fixed length <N>.
Definition: HashTable.H:107
static const Foam::edgeList & modelEdges()
Return the model edges.
Definition: tetCell.C:79
An analytical geometric cellShape.
Definition: cellShape.H:68
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
cellShape shape() const
Return TET shape cell.
Definition: tetCell.C:135
static constexpr label nEdges() noexcept
Number of edges for TET.
Definition: tetCell.H:158
static const Foam::faceList & modelFaces()
Return the model faces.
Definition: tetCell.C:57
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:59
A triangular face using a FixedList of labels corresponding to mesh vertices.
Definition: triFace.H:65
label edgeFace(const label edgei) const
Return first face adjacent to the given edge.
Definition: tetCellI.H:106
Foam::edge edge(const label edgei) const
Return i-th edge.
Definition: tetCellI.H:163
A tetrahedral cell primitive.
Definition: tetCell.H:60
static constexpr label nFaces() noexcept
Number of faces for TET.
Definition: tetCell.H:166
void back()=delete
The back() accessor (from FixedList) has no purpose.
tetPointRef tet(const UList< point > &meshPoints) const
Return the tetrahedron.
Definition: tetCellI.H:199
static constexpr label nPoints() noexcept
Number of points for TET.
Definition: tetCell.H:150
const direction noexcept
Definition: Scalar.H:258
pointField points(const UList< point > &meshPoints) const
The points corresponding to this shape.
Definition: tetCellI.H:190
Foam::triFace face(const label facei) const
Return i-th face.
Definition: tetCellI.H:86
label edgeAdjacentFace(const label edgei, const label facei) const
Return face adjacent to the given face sharing the same edge.
Definition: tetCellI.H:126
Foam::edge tetEdge(label edgei) const
Identical to edge()
Definition: tetCell.H:235
void front()=delete
The front() accessor (from FixedList) has no purpose.
cellShape tetCellShape() const
Identical to shape()
Definition: tetCell.C:148
const volScalarField & p0
Definition: EEqn.H:36
Namespace for OpenFOAM.