libMesh
cell_tet4.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 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_TET4_H
21 #define LIBMESH_CELL_TET4_H
22 
23 // Local includes
24 #include "libmesh/cell_tet.h"
25 
26 namespace libMesh
27 {
28 
59 class Tet4 final : public Tet
60 {
61 public:
62 
66  explicit
67  Tet4 (Elem * p=nullptr) :
69  {}
70 
71  Tet4 (Tet4 &&) = delete;
72  Tet4 (const Tet4 &) = delete;
73  Tet4 & operator= (const Tet4 &) = delete;
74  Tet4 & operator= (Tet4 &&) = delete;
75  virtual ~Tet4() = default;
76 
80  virtual ElemType type () const override { return TET4; }
81 
85  virtual unsigned int n_nodes() const override { return num_nodes; }
86 
90  virtual unsigned int n_sub_elem() const override { return 1; }
91 
95  virtual bool is_vertex(const unsigned int i) const override;
96 
100  virtual bool is_edge(const unsigned int i) const override;
101 
105  virtual bool is_face(const unsigned int i) const override;
106 
111  virtual bool is_node_on_side(const unsigned int n,
112  const unsigned int s) const override;
113 
114  virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override;
115 
116  virtual std::vector<unsigned int> nodes_on_edge(const unsigned int e) const override;
117 
122  virtual bool is_node_on_edge(const unsigned int n,
123  const unsigned int e) const override;
124 
129  virtual bool is_child_on_side(const unsigned int c,
130  const unsigned int s) const override;
131 
136  virtual bool has_affine_map () const override { return true; }
137 
141  virtual bool has_invertible_map(Real tol) const override;
142 
147  virtual bool is_linear () const override { return true; }
148 
152  virtual Order default_order() const override;
153 
158  virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i) override;
159 
163  virtual void build_side_ptr (std::unique_ptr<Elem> & elem,
164  const unsigned int i) override;
165 
166  // Avoid hiding deprecated version with different signature
167  using Elem::build_side_ptr;
168 
173  virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int i) override;
174 
178  virtual void build_edge_ptr (std::unique_ptr<Elem> & edge, const unsigned int i) override;
179 
180  virtual void connectivity(const unsigned int sc,
181  const IOPackage iop,
182  std::vector<dof_id_type> & conn) const override;
183 
187  static const int num_nodes = 4;
188  static const int nodes_per_side = 3;
189  static const int nodes_per_edge = 2;
190 
195  static const unsigned int side_nodes_map[num_sides][nodes_per_side];
196 
201  static const unsigned int edge_nodes_map[num_edges][nodes_per_edge];
202 
207  virtual Point true_centroid () const override;
208 
213  virtual Real volume () const override;
214 
224  std::pair<Real, Real> min_and_max_angle() const;
225 
229  using Tet::key;
230 
236  virtual dof_id_type key () const override;
237 
242  virtual bool contains_point (const Point & p, Real tol) const override;
243 
244  virtual void permute(unsigned int perm_num) override final;
245 
246  virtual void flip(BoundaryInfo *) override final;
247 
248  ElemType side_type (const unsigned int s) const override final;
249 
250 protected:
251 
256 
257 
258 
259 #ifdef LIBMESH_ENABLE_AMR
260 
264  virtual Real embedding_matrix (const unsigned int i,
265  const unsigned int j,
266  const unsigned int k) const override;
267 
273 
275 
276 #endif
277 
278 };
279 
280 } // namespace libMesh
281 
282 
283 #endif // LIBMESH_CELL_TET4_H
virtual void permute(unsigned int perm_num) override final
Permutes the element (by swapping node and neighbor pointers) according to the specified index...
Definition: cell_tet4.C:576
ElemType
Defines an enum for geometric element types.
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
virtual std::vector< unsigned int > nodes_on_edge(const unsigned int e) const override
Definition: cell_tet4.C:145
A Node is like a Point, but with more information.
Definition: node.h:52
virtual Point true_centroid() const override
The centroid of a 4-node tetrahedron is simply given by the average of its vertex positions...
Definition: cell_tet4.C:310
std::pair< Real, Real > min_and_max_angle() const
Definition: cell_tet4.C:335
virtual std::vector< unsigned int > nodes_on_side(const unsigned int s) const override
Definition: cell_tet4.C:138
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i)=0
virtual dof_id_type key() const
Definition: elem.C:753
static const unsigned int side_nodes_map[num_sides][nodes_per_side]
This maps the node of the side to element node numbers.
Definition: cell_tet4.h:195
static const int num_sides
Geometric constants for all Tets.
Definition: cell_tet.h:74
IOPackage
libMesh interfaces with several different software packages for the purposes of creating, reading, and writing mesh files.
Node * _nodelinks_data[num_nodes]
Data for links to nodes.
Definition: cell_tet4.h:255
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
Tet4(Elem *p=nullptr)
Constructor.
Definition: cell_tet4.h:67
static const int num_edges
Definition: cell_tet.h:75
virtual bool is_edge(const unsigned int i) const override
Definition: cell_tet4.C:65
virtual unsigned int n_sub_elem() const override
Definition: cell_tet4.h:90
The libMesh namespace provides an interface to certain functionality in the library.
virtual void connectivity(const unsigned int sc, const IOPackage iop, std::vector< dof_id_type > &conn) const override
Definition: cell_tet4.C:185
virtual bool is_vertex(const unsigned int i) const override
Definition: cell_tet4.C:59
virtual dof_id_type key() const override
Definition: cell_tet4.C:360
The Tet is an element in 3D composed of 4 sides.
Definition: cell_tet.h:36
static const int nodes_per_side
Definition: cell_tet4.h:188
Tet4 & operator=(const Tet4 &)=delete
static const int num_nodes
Geometric constants for Tet4.
Definition: cell_tet4.h:187
virtual Order default_order() const override
Definition: cell_tet4.C:151
static const Real _embedding_matrix[num_children][num_nodes][num_nodes]
Matrix that computes new nodal locations/solution values from current nodes/solution.
Definition: cell_tet4.h:272
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
Definition: boundary_info.h:57
virtual ~Tet4()=default
ElemType side_type(const unsigned int s) const override final
Definition: cell_tet4.C:622
virtual void flip(BoundaryInfo *) override final
Flips the element (by swapping node and neighbor pointers) to have a mapping Jacobian of opposite sig...
Definition: cell_tet4.C:610
virtual bool is_node_on_edge(const unsigned int n, const unsigned int e) const override
Definition: cell_tet4.C:75
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i) override
Builds a TRI3 built coincident with face i.
Definition: cell_tet4.C:156
virtual unsigned int n_nodes() const override
Definition: cell_tet4.h:85
virtual bool is_face(const unsigned int i) const override
Definition: cell_tet4.C:70
virtual bool has_invertible_map(Real tol) const override
Definition: cell_tet4.C:121
virtual bool is_node_on_side(const unsigned int n, const unsigned int s) const override
Definition: cell_tet4.C:128
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const override
Definition: cell_tet4.C:90
virtual bool is_linear() const override
Definition: cell_tet4.h:147
virtual Real volume() const override
An optimized method for computing the area of a 4-node tetrahedron.
Definition: cell_tet4.C:317
virtual bool contains_point(const Point &p, Real tol) const override
Uses simple geometric tests to determine if the point p is inside the tetrahedron.
Definition: cell_tet4.C:370
LIBMESH_ENABLE_TOPOLOGY_CACHES
Definition: cell_tet4.h:274
The Tet4 is an element in 3D composed of 4 nodes.
Definition: cell_tet4.h:59
static const int num_children
Definition: cell_tet.h:76
virtual ElemType type() const override
Definition: cell_tet4.h:80
static const unsigned int edge_nodes_map[num_edges][nodes_per_edge]
This maps the node of the edge to element node numbers.
Definition: cell_tet4.h:201
virtual bool has_affine_map() const override
Definition: cell_tet4.h:136
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int i) override
Builds a EDGE2 built coincident with face i.
Definition: cell_tet4.C:171
virtual Real embedding_matrix(const unsigned int i, const unsigned int j, const unsigned int k) const override
Matrix used to create the elements children.
Definition: cell_tet4.C:407
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
static const int nodes_per_edge
Definition: cell_tet4.h:189
uint8_t dof_id_type
Definition: id_types.h:67