cell_hex.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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_HEX_H
21 #define LIBMESH_CELL_HEX_H
22 
23 // Local includes
24 #include "libmesh/cell.h"
25 
26 namespace libMesh
27 {
28 
36 class Hex : public Cell
37 {
38 public:
39 
44  Hex(const unsigned int nn, Elem * p, Node ** nodelinkdata) :
45  Cell(nn, Hex::n_sides(), p, _elemlinks_data, nodelinkdata)
46  {
47  // Make sure the interior parent isn't undefined
48  if (LIBMESH_DIM > 3)
49  this->set_interior_parent(nullptr);
50  }
51 
52  Hex (Hex &&) = delete;
53  Hex (const Hex &) = delete;
54  Hex & operator= (const Hex &) = delete;
55  Hex & operator= (Hex &&) = delete;
56  virtual ~Hex() = default;
57 
62  virtual Point master_point (const unsigned int i) const override final
63  {
64  libmesh_assert_less(i, this->n_nodes());
65  return Point(_master_points[i][0],
66  _master_points[i][1],
67  _master_points[i][2]);
68  }
69 
73  virtual unsigned int n_sides() const override final { return 6; }
74 
78  virtual unsigned int n_vertices() const override final { return 8; }
79 
83  virtual unsigned int n_edges() const override final { return 12; }
84 
88  virtual unsigned int n_faces() const override final { return 6; }
89 
93  virtual unsigned int n_children() const override final { return 8; }
94 
98  virtual bool is_child_on_side(const unsigned int c,
99  const unsigned int s) const override final;
100 
104  virtual bool is_edge_on_side(const unsigned int e,
105  const unsigned int s) const override final;
106 
111  virtual unsigned int opposite_side(const unsigned int s) const override final;
112 
118  virtual unsigned int opposite_node(const unsigned int n,
119  const unsigned int s) const override final;
120 
124  using Elem::key;
125 
131  virtual dof_id_type key (const unsigned int s) const override;
132 
136  virtual unsigned int which_node_am_i(unsigned int side,
137  unsigned int side_node) const override;
138 
142  virtual std::unique_ptr<Elem> side_ptr (const unsigned int i) override final;
143 
147  virtual void side_ptr (std::unique_ptr<Elem> & side, const unsigned int i) override final;
148 
153  virtual Real quality (const ElemQuality q) const override;
154 
160  virtual std::pair<Real, Real> qual_bounds (const ElemQuality q) const override;
161 
162 
163 protected:
164 
168  Elem * _elemlinks_data[7+(LIBMESH_DIM>3)];
169 
177  static const unsigned short int _second_order_adjacent_vertices[12][2];
178 
182  static const unsigned short int _second_order_vertex_child_number[27];
183 
187  static const unsigned short int _second_order_vertex_child_index[27];
188 
192  static const Real _master_points[27][3];
193 
198  static const int _child_node_lookup[8][27];
199 };
200 
201 } // namespace libMesh
202 
203 #endif // LIBMESH_CELL_HEX_H
virtual unsigned int opposite_side(const unsigned int s) const override final
Definition: cell_hex.C:152
virtual Point master_point(const unsigned int i) const override final
Definition: cell_hex.h:62
A geometric point in (x,y,z) space associated with a DOF.
Definition: node.h:52
static const Real _master_points[27][3]
Definition: cell_hex.h:192
virtual dof_id_type key() const
Definition: elem.C:401
virtual std::pair< Real, Real > qual_bounds(const ElemQuality q) const override
Definition: cell_hex.C:334
The base class for all hexahedral element types.
Definition: cell_hex.h:36
static const unsigned short int _second_order_adjacent_vertices[12][2]
Definition: cell_hex.h:177
The base class for all geometric element types.
Definition: elem.h:100
Elem * _elemlinks_data[7+(LIBMESH_DIM >3)]
Definition: cell_hex.h:168
virtual unsigned int n_children() const override final
Definition: cell_hex.h:93
void set_interior_parent(Elem *p)
Definition: elem.C:856
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const override final
Definition: cell_hex.C:119
virtual unsigned int n_nodes() const =0
static const int _child_node_lookup[8][27]
Definition: cell_hex.h:198
The base class for all 3D geometric element types.
Definition: cell.h:38
virtual std::unique_ptr< Elem > side_ptr(const unsigned int i) override final
Definition: cell_hex.C:97
virtual unsigned int n_edges() const override final
Definition: cell_hex.h:83
virtual unsigned int n_faces() const override final
Definition: cell_hex.h:88
virtual unsigned int n_vertices() const override final
Definition: cell_hex.h:78
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual unsigned int n_sides() const override final
Definition: cell_hex.h:73
virtual Real quality(const ElemQuality q) const override
Definition: cell_hex.C:194
static const unsigned short int _second_order_vertex_child_number[27]
Definition: cell_hex.h:182
Hex(const unsigned int nn, Elem *p, Node **nodelinkdata)
Definition: cell_hex.h:44
static const unsigned short int _second_order_vertex_child_index[27]
Definition: cell_hex.h:187
virtual unsigned int opposite_node(const unsigned int n, const unsigned int s) const override final
Definition: cell_hex.C:161
virtual ~Hex()=default
virtual unsigned int which_node_am_i(unsigned int side, unsigned int side_node) const override
Definition: cell_hex.C:86
A geometric point in (x,y,z) space.
Definition: point.h:38
std::unique_ptr< Elem > side(const unsigned int i) const
Definition: elem.h:2202
Hex & operator=(const Hex &)=delete
uint8_t dof_id_type
Definition: id_types.h:64
virtual bool is_edge_on_side(const unsigned int e, const unsigned int s) const override final
Definition: cell_hex.C:140