libMesh
Loading...
Searching...
No Matches
cell_tet.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19
20#ifndef LIBMESH_CELL_TET_H
21#define LIBMESH_CELL_TET_H
22
23// Local includes
24#include "libmesh/cell.h"
25
26namespace libMesh
27{
28
36class Tet : public Cell
37{
38public:
39
44 Tet (const unsigned int nn, Elem * p, Node ** nodelinkdata) :
45 Cell(nn, num_sides, p, _elemlinks_data, nodelinkdata),
47 {
48 // Make sure the interior parent isn't undefined
49 if (LIBMESH_DIM > 3)
50 this->set_interior_parent(nullptr);
51 }
52
53 Tet (Tet &&) = delete;
54 Tet (const Tet &) = delete;
55 Tet & operator= (const Tet &) = delete;
56 Tet & operator= (Tet &&) = delete;
57 virtual ~Tet() = default;
58
63 virtual Point master_point (const unsigned int i) const override final
64 {
65 libmesh_assert_less(i, this->n_nodes());
66 return Point(_master_points[i][0],
67 _master_points[i][1],
68 _master_points[i][2]);
69 }
70
74 static const int num_sides = 4;
75 static const int num_edges = 6;
76 static const int num_children = 8;
77
81 virtual unsigned int n_sides() const override final { return 4; }
82
86 virtual unsigned int n_vertices() const override final { return 4; }
87
91 virtual unsigned int n_edges() const override final { return 6; }
92
96 virtual unsigned int n_faces() const override final { return 4; }
97
101 virtual unsigned int n_children() const override final { return 8; }
102
106 virtual bool is_edge_on_side(const unsigned int e,
107 const unsigned int s) const override final;
108
112 using Elem::key;
113
118 virtual dof_id_type key (const unsigned int s) const override;
119
126 virtual dof_id_type low_order_key (const unsigned int s) const override;
127
131 virtual unsigned int local_side_node(unsigned int side,
132 unsigned int side_node) const override;
133
137 virtual unsigned int local_edge_node(unsigned int edge,
138 unsigned int edge_node) const override;
139
143 virtual std::unique_ptr<Elem> side_ptr (const unsigned int i) override final;
144
148 virtual void side_ptr (std::unique_ptr<Elem> & side, const unsigned int i) override final;
149
154 virtual Real quality (const ElemQuality q) const override;
155
161 virtual std::pair<Real, Real> qual_bounds (const ElemQuality q) const override;
162
170 {
171 DIAG_02_13=0, // diagonal between edges (0,2) and (1,3)
172 DIAG_03_12=1, // diagonal between edges (0,3) and (1,2)
173 DIAG_01_23=2, // diagonal between edges (0,1) and (2,3)
174 INVALID_DIAG=99 // diagonal not yet selected
175 };
176
181
186 void select_diagonal (const Diagonal diag) const;
187
188 virtual std::vector<unsigned int> sides_on_edge(const unsigned int e) const override final;
189
190
191#ifdef LIBMESH_ENABLE_AMR
192
193
200 virtual unsigned int embedding_matrix_version () const override final
201 {
202 this->choose_diagonal();
203 return this->diagonal_selection();
204 }
205
206#endif // LIBMESH_ENABLE_AMR
207
211 virtual unsigned int n_permutations() const override final { return 12; }
212
213 virtual bool is_flipped() const override final;
214
215 virtual std::vector<unsigned int> edges_adjacent_to_node(const unsigned int n) const override;
216
220 static const unsigned int edge_sides_map[6][2];
221
222 virtual bool on_reference_element(const Point & p,
223 const Real eps = TOLERANCE) const override final;
224
225protected:
226
230 Elem * _elemlinks_data[5+(LIBMESH_DIM>3)];
231
235 static const Real _master_points[14][3];
236
241 bool is_child_on_side_helper(const unsigned int c,
242 const unsigned int s,
243 const unsigned int checked_nodes[][3] ) const;
244
250
256 void choose_diagonal() const;
257
265 static const unsigned int adjacent_edges_map[/*num_vertices*/4][/*n_adjacent_edges*/3];
266};
267
268} // namespace libMesh
269
270#endif // LIBMESH_CELL_TET_H
The Cell is an abstract element type that lives in three dimensions.
Definition cell.h:39
This is the base class from which all geometric element types are derived.
Definition elem.h:96
virtual unsigned int n_nodes() const =0
void set_interior_parent(Elem *p)
Sets the pointer to the element's interior_parent.
Definition elem.C:1222
virtual dof_id_type key(const unsigned int s) const =0
A Node is like a Point, but with more information.
Definition node.h:55
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40
The Tet is an element in 3D composed of 4 sides.
Definition cell_tet.h:37
virtual unsigned int local_side_node(unsigned int side, unsigned int side_node) const override
Definition cell_tet.C:96
static const int num_edges
Definition cell_tet.h:75
virtual Point master_point(const unsigned int i) const override final
Definition cell_tet.h:63
virtual unsigned int n_children() const override final
Definition cell_tet.h:101
static const Real _master_points[14][3]
Master element node locations.
Definition cell_tet.h:235
virtual unsigned int n_edges() const override final
Definition cell_tet.h:91
Tet(Tet &&)=delete
virtual unsigned int embedding_matrix_version() const override final
Tetrahedral elements permute the embedding matrix depending on which interior diagonal is used to sub...
Definition cell_tet.h:200
virtual unsigned int n_permutations() const override final
Four sides, three orientations.
Definition cell_tet.h:211
Tet(const unsigned int nn, Elem *p, Node **nodelinkdata)
Default tetrahedral element, takes number of nodes and parent.
Definition cell_tet.h:44
Tet(const Tet &)=delete
void choose_diagonal() const
Derived classes use this function to select an initial diagonal during refinement.
Definition cell_tet.C:204
virtual unsigned int n_faces() const override final
Definition cell_tet.h:96
Elem * _elemlinks_data[5+(LIBMESH_DIM >3)]
Data for links to parent/neighbor/interior_parent elements.
Definition cell_tet.h:230
virtual unsigned int local_edge_node(unsigned int edge, unsigned int edge_node) const override
Definition cell_tet.C:107
virtual unsigned int n_vertices() const override final
Definition cell_tet.h:86
void select_diagonal(const Diagonal diag) const
Allows the user to select the diagonal for the refinement.
Definition cell_tet.C:139
virtual std::pair< Real, Real > qual_bounds(const ElemQuality q) const override
Definition cell_tet.C:277
virtual Real quality(const ElemQuality q) const override
Definition cell_tet.C:269
virtual bool is_flipped() const override final
Definition cell_tet.C:242
static const unsigned int adjacent_edges_map[4][3]
This maps the node to the (in this case) 3 edge ids adjacent to the node.
Definition cell_tet.h:265
virtual std::vector< unsigned int > sides_on_edge(const unsigned int e) const override final
Definition cell_tet.C:233
static const int num_sides
Geometric constants for all Tets.
Definition cell_tet.h:74
static const unsigned int edge_sides_map[6][2]
This maps each edge to the sides that contain said edge.
Definition cell_tet.h:220
virtual dof_id_type key() const
Don't hide Elem::key() defined in the base class.
Definition elem.C:738
virtual std::vector< unsigned int > edges_adjacent_to_node(const unsigned int n) const override
Definition cell_tet.C:251
Diagonal
This enumeration keeps track of which diagonal is selected during refinement.
Definition cell_tet.h:170
virtual std::unique_ptr< Elem > side_ptr(const unsigned int i) override final
Definition cell_tet.C:117
virtual bool on_reference_element(const Point &p, const Real eps=TOLERANCE) const override final
Definition cell_tet.C:323
Diagonal diagonal_selection() const
Definition cell_tet.h:180
bool is_child_on_side_helper(const unsigned int c, const unsigned int s, const unsigned int checked_nodes[][3]) const
Called by descendant classes with appropriate data to determine if child c is on side s.
Definition cell_tet.C:152
virtual bool is_edge_on_side(const unsigned int e, const unsigned int s) const override final
Definition cell_tet.C:222
virtual ~Tet()=default
virtual unsigned int n_sides() const override final
Definition cell_tet.h:81
virtual dof_id_type low_order_key(const unsigned int s) const override
Definition cell_tet.C:85
Diagonal _diagonal_selection
The currently-selected diagonal used during refinement.
Definition cell_tet.h:249
Tet & operator=(const Tet &)=delete
static const int num_children
Definition cell_tet.h:76
The libMesh namespace provides an interface to certain functionality in the library.
ElemQuality
Defines an enum for element quality metrics.
static constexpr Real TOLERANCE
uint8_t dof_id_type
Definition id_types.h:67
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real