libMesh
cell_tet.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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 
26 namespace libMesh
27 {
28 
36 class Tet : public Cell
37 {
38 public:
39 
44  Tet (const unsigned int nn, Elem * p, Node ** nodelinkdata) :
45  Cell(nn, Tet::n_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  virtual unsigned int n_sides() const override final { return 4; }
75 
79  virtual unsigned int n_vertices() const override final { return 4; }
80 
84  virtual unsigned int n_edges() const override final { return 6; }
85 
89  virtual unsigned int n_faces() const override final { return 4; }
90 
94  virtual unsigned int n_children() const override final { return 8; }
95 
99  virtual bool is_edge_on_side(const unsigned int e,
100  const unsigned int s) const override final;
101 
105  using Elem::key;
106 
112  virtual dof_id_type key (const unsigned int s) const override;
113 
117  virtual unsigned int which_node_am_i(unsigned int side,
118  unsigned int side_node) const override;
119 
123  virtual std::unique_ptr<Elem> side_ptr (const unsigned int i) override final;
124 
128  virtual void side_ptr (std::unique_ptr<Elem> & side, const unsigned int i) override final;
129 
134  virtual Real quality (const ElemQuality q) const override;
135 
141  virtual std::pair<Real, Real> qual_bounds (const ElemQuality q) const override;
142 
149  enum Diagonal
150  {
151  DIAG_02_13=0, // diagonal between edges (0,2) and (1,3)
152  DIAG_03_12=1, // diagonal between edges (0,3) and (1,2)
153  DIAG_01_23=2, // diagonal between edges (0,1) and (2,3)
154  INVALID_DIAG=99 // diagonal not yet selected
155  };
156 
161 
166  void select_diagonal (const Diagonal diag) const;
167 
168 
169 
170 #ifdef LIBMESH_ENABLE_AMR
171 
172 
179  virtual unsigned int embedding_matrix_version () const override final
180  {
181  this->choose_diagonal();
182  return this->diagonal_selection();
183  }
184 
185 #endif // LIBMESH_ENABLE_AMR
186 
187 
188 
189 protected:
190 
194  Elem * _elemlinks_data[5+(LIBMESH_DIM>3)];
195 
199  static const Real _master_points[10][3];
200 
205  bool is_child_on_side_helper(const unsigned int c,
206  const unsigned int s,
207  const unsigned int checked_nodes[][3] ) const;
208 
214 
220  void choose_diagonal() const;
221 };
222 
223 } // namespace libMesh
224 
225 #endif // LIBMESH_CELL_TET_H
libMesh::Tet::n_vertices
virtual unsigned int n_vertices() const override final
Definition: cell_tet.h:79
libMesh::Tet::DIAG_01_23
Definition: cell_tet.h:153
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::Elem::set_interior_parent
void set_interior_parent(Elem *p)
Sets the pointer to the element's interior_parent.
Definition: elem.C:801
libMesh::Elem::n_nodes
virtual unsigned int n_nodes() const =0
libMesh::Tet::choose_diagonal
void choose_diagonal() const
Derived classes use this function to select an initial diagonal during refinement.
Definition: cell_tet.C:163
libMesh::Tet::_elemlinks_data
Elem * _elemlinks_data[5+(LIBMESH_DIM >3)]
Data for links to parent/neighbor/interior_parent elements.
Definition: cell_tet.h:194
libMesh::Tet::qual_bounds
virtual std::pair< Real, Real > qual_bounds(const ElemQuality q) const override
Definition: cell_tet.C:207
libMesh::Tet::n_children
virtual unsigned int n_children() const override final
Definition: cell_tet.h:94
libMesh::Cell
The Cell is an abstract element type that lives in three dimensions.
Definition: cell.h:38
libMesh::Tet::INVALID_DIAG
Definition: cell_tet.h:154
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::Tet::select_diagonal
void select_diagonal(const Diagonal diag) const
Allows the user to select the diagonal for the refinement.
Definition: cell_tet.C:98
libMesh::Tet::~Tet
virtual ~Tet()=default
libMesh::Tet::master_point
virtual Point master_point(const unsigned int i) const override final
Definition: cell_tet.h:63
libMesh::Tet::quality
virtual Real quality(const ElemQuality q) const override
Definition: cell_tet.C:199
libMesh::Tet::embedding_matrix_version
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:179
libMesh::Tet::is_child_on_side_helper
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:111
libMesh::Tet::DIAG_02_13
Definition: cell_tet.h:151
libMesh::Tet::DIAG_03_12
Definition: cell_tet.h:152
libMesh::Tet::Tet
Tet(const unsigned int nn, Elem *p, Node **nodelinkdata)
Default tetrahedral element, takes number of nodes and parent.
Definition: cell_tet.h:44
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::Elem::key
virtual dof_id_type key() const
Definition: elem.C:410
libMesh::Node
A Node is like a Point, but with more information.
Definition: node.h:52
libMesh::Tet::is_edge_on_side
virtual bool is_edge_on_side(const unsigned int e, const unsigned int s) const override final
Definition: cell_tet.C:187
libMesh::Tet::which_node_am_i
virtual unsigned int which_node_am_i(unsigned int side, unsigned int side_node) const override
Definition: cell_tet.C:65
libMesh::ElemQuality
ElemQuality
Defines an enum for element quality metrics.
Definition: enum_elem_quality.h:34
libMesh::Tet::operator=
Tet & operator=(const Tet &)=delete
libMesh::Tet::_diagonal_selection
Diagonal _diagonal_selection
The currently-selected diagonal used during refinement.
Definition: cell_tet.h:213
libMesh::Tet::side_ptr
virtual std::unique_ptr< Elem > side_ptr(const unsigned int i) override final
Definition: cell_tet.C:76
libMesh::Tet::diagonal_selection
Diagonal diagonal_selection() const
Definition: cell_tet.h:160
libMesh::Tet::n_faces
virtual unsigned int n_faces() const override final
Definition: cell_tet.h:89
libMesh::Tet::n_sides
virtual unsigned int n_sides() const override final
Definition: cell_tet.h:74
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::Tet::n_edges
virtual unsigned int n_edges() const override final
Definition: cell_tet.h:84
libMesh::Tet
The Tet is an element in 3D composed of 4 sides.
Definition: cell_tet.h:36
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::Tet::_master_points
static const Real _master_points[10][3]
Master element node locations.
Definition: cell_tet.h:199
libMesh::Tet::Diagonal
Diagonal
This enumeration keeps track of which diagonal is selected during refinement.
Definition: cell_tet.h:149