libMesh
cell_tet.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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)
51  }
52 
57  virtual Point master_point (const unsigned int i) const libmesh_override
58  {
59  libmesh_assert_less(i, this->n_nodes());
60  return Point(_master_points[i][0],
61  _master_points[i][1],
62  _master_points[i][2]);
63  }
64 
68  virtual unsigned int n_sides() const libmesh_override { return 4; }
69 
73  virtual unsigned int n_vertices() const libmesh_override { return 4; }
74 
78  virtual unsigned int n_edges() const libmesh_override { return 6; }
79 
83  virtual unsigned int n_faces() const libmesh_override { return 4; }
84 
88  virtual unsigned int n_children() const libmesh_override { return 8; }
89 
93  virtual bool is_edge_on_side(const unsigned int e,
94  const unsigned int s) const libmesh_override;
95 
99  using Elem::key;
100 
106  virtual dof_id_type key (const unsigned int s) const libmesh_override;
107 
111  virtual unsigned int which_node_am_i(unsigned int side,
112  unsigned int side_node) const libmesh_override;
113 
117  virtual UniquePtr<Elem> side_ptr (const unsigned int i) libmesh_override;
118 
123  virtual Real quality (const ElemQuality q) const libmesh_override;
124 
130  virtual std::pair<Real, Real> qual_bounds (const ElemQuality q) const libmesh_override;
131 
138  enum Diagonal
139  {
140  DIAG_02_13=0, // diagonal between edges (0,2) and (1,3)
141  DIAG_03_12=1, // diagonal between edges (0,3) and (1,2)
142  DIAG_01_23=2, // diagonal between edges (0,1) and (2,3)
143  INVALID_DIAG=99 // diagonal not yet selected
144  };
145 
150 
155  void select_diagonal (const Diagonal diag) const;
156 
157 
158 
159 #ifdef LIBMESH_ENABLE_AMR
160 
161 
168  virtual unsigned int embedding_matrix_version () const libmesh_override
169  {
170  this->choose_diagonal();
171  return this->diagonal_selection();
172  }
173 
174 #endif // LIBMESH_ENABLE_AMR
175 
176 
177 
178 protected:
179 
183  Elem * _elemlinks_data[5+(LIBMESH_DIM>3)];
184 
188  static const Real _master_points[10][3];
189 
194  bool is_child_on_side_helper(const unsigned int c,
195  const unsigned int s,
196  const unsigned int checked_nodes[][3] ) const;
197 
203 
209  void choose_diagonal() const;
210 };
211 
212 } // namespace libMesh
213 
214 #endif // LIBMESH_CELL_TET_H
void choose_diagonal() const
Derived classes use this function to select an initial diagonal during refinement.
Definition: cell_tet.C:155
A Node is like a Point, but with more information.
Definition: node.h:52
virtual Real quality(const ElemQuality q) const libmesh_override
Definition: cell_tet.C:191
virtual unsigned int embedding_matrix_version() const libmesh_override
Tetrahedral elements permute the embedding matrix depending on which interior diagonal is used to sub...
Definition: cell_tet.h:168
UniquePtr< Elem > side(const unsigned int i) const
Definition: elem.h:2105
Diagonal
This enumeration keeps track of which diagonal is selected during refinement.
Definition: cell_tet.h:138
virtual unsigned int n_children() const libmesh_override
Definition: cell_tet.h:88
virtual unsigned int n_vertices() const libmesh_override
Definition: cell_tet.h:73
virtual unsigned int which_node_am_i(unsigned int side, unsigned int side_node) const libmesh_override
Definition: cell_tet.C:66
void select_diagonal(const Diagonal diag) const
Allows the user to select the diagonal for the refinement.
Definition: cell_tet.C:90
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
const class libmesh_nullptr_t libmesh_nullptr
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:103
Diagonal _diagonal_selection
The currently-selected diagonal used during refinement.
Definition: cell_tet.h:202
The libMesh namespace provides an interface to certain functionality in the library.
virtual unsigned int n_sides() const libmesh_override
Definition: cell_tet.h:68
virtual unsigned int n_faces() const libmesh_override
Definition: cell_tet.h:83
void set_interior_parent(Elem *p)
Sets the pointer to the element&#39;s interior_parent.
Definition: elem.C:1003
The Tet is an element in 3D composed of 4 sides.
Definition: cell_tet.h:36
virtual bool is_edge_on_side(const unsigned int e, const unsigned int s) const libmesh_override
Definition: cell_tet.C:179
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
virtual unsigned int n_nodes() const =0
Tet(const unsigned int nn, Elem *p, Node **nodelinkdata)
Default tetrahedral element, takes number of nodes and parent.
Definition: cell_tet.h:44
virtual dof_id_type key() const
Definition: elem.C:503
Diagonal diagonal_selection() const
Definition: cell_tet.h:149
The Cell is an abstract element type that lives in three dimensions.
Definition: cell.h:38
static const Real _master_points[10][3]
Master element node locations.
Definition: cell_tet.h:188
Elem * _elemlinks_data[5+(LIBMESH_DIM >3)]
Data for links to parent/neighbor/interior_parent elements.
Definition: cell_tet.h:183
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual std::pair< Real, Real > qual_bounds(const ElemQuality q) const libmesh_override
Definition: cell_tet.C:199
virtual UniquePtr< Elem > side_ptr(const unsigned int i) libmesh_override
Definition: cell_tet.C:77
virtual Point master_point(const unsigned int i) const libmesh_override
Definition: cell_tet.h:57
ElemQuality
Defines an enum for element quality metrics.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
uint8_t dof_id_type
Definition: id_types.h:64
virtual unsigned int n_edges() const libmesh_override
Definition: cell_tet.h:78