libMesh
face_quad.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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_FACE_QUAD_H
21 #define LIBMESH_FACE_QUAD_H
22 
23 
24 // Local includes
25 #include "libmesh/libmesh_common.h"
26 #include "libmesh/face.h"
27 
28 namespace libMesh
29 {
30 
48 class Quad : public Face
49 {
50 public:
51 
56  Quad (const unsigned int nn, Elem * p, Node ** nodelinkdata) :
57  Face(nn, Quad::n_sides(), p, _elemlinks_data, nodelinkdata)
58  {
59  // Make sure the interior parent isn't undefined
60  if (LIBMESH_DIM > 2)
61  this->set_interior_parent(nullptr);
62  }
63 
64  Quad (Quad &&) = delete;
65  Quad (const Quad &) = delete;
66  Quad & operator= (const Quad &) = delete;
67  Quad & operator= (Quad &&) = delete;
68  virtual ~Quad() = default;
69 
74  virtual Point master_point (const unsigned int i) const override final
75  {
76  libmesh_assert_less(i, this->n_nodes());
77  return Point(_master_points[i][0],
78  _master_points[i][1],
79  _master_points[i][2]);
80  }
81 
86  virtual unsigned int n_nodes() const override { return 4; }
87 
91  virtual unsigned int n_sides() const override final { return 4; }
92 
96  virtual unsigned int n_vertices() const override final { return 4; }
97 
101  virtual unsigned int n_edges() const override final { return 4; }
102 
106  virtual unsigned int n_children() const override final { return 4; }
107 
112  virtual bool is_child_on_side(const unsigned int c,
113  const unsigned int s) const override final;
114 
119  virtual unsigned int opposite_side(const unsigned int s) const override final;
120 
126  virtual unsigned int opposite_node(const unsigned int n,
127  const unsigned int s) const override final;
128 
132  using Elem::key;
133 
139  virtual dof_id_type key () const override;
140 
145  virtual dof_id_type key (const unsigned int s) const override;
146 
153  virtual dof_id_type low_order_key (const unsigned int s) const override;
154 
158  virtual unsigned int local_side_node(unsigned int side,
159  unsigned int side_node) const override;
160 
166  virtual unsigned int local_edge_node(unsigned int edge,
167  unsigned int edge_node) const override;
168 
172  virtual std::unique_ptr<Elem> side_ptr (const unsigned int i) override final;
173 
177  virtual void side_ptr (std::unique_ptr<Elem> & elem,
178  const unsigned int i) override final;
179 
184  virtual Real quality (const ElemQuality q) const override;
185 
191  virtual std::pair<Real, Real> qual_bounds (const ElemQuality q) const override;
192 
196  virtual unsigned int n_permutations() const override final { return 4; }
197 
198  virtual bool is_flipped() const override final;
199 
200 protected:
201 
205  Elem * _elemlinks_data[5+(LIBMESH_DIM>2)];
206 
213  static const unsigned short int _second_order_adjacent_vertices[4][2];
214 
218  static const unsigned short int _second_order_vertex_child_number[9];
219 
223  static const unsigned short int _second_order_vertex_child_index[9];
224 
228  static const Real _master_points[9][3];
229 
234  static const int _child_node_lookup[4][9];
235 };
236 
237 } // namespace libMesh
238 
239 #endif // LIBMESH_FACE_QUAD_H
virtual std::pair< Real, Real > qual_bounds(const ElemQuality q) const override
Definition: face_quad.C:387
virtual bool is_flipped() const override final
Definition: face_quad.C:176
Elem * _elemlinks_data[5+(LIBMESH_DIM >2)]
Data for links to parent/neighbor/interior_parent elements.
Definition: face_quad.h:205
virtual unsigned int n_vertices() const override final
Definition: face_quad.h:96
A Node is like a Point, but with more information.
Definition: node.h:52
The Face is an abstract element type that lives in two dimensions.
Definition: face.h:37
static const int _child_node_lookup[4][9]
Lookup table from child id, child node id to "possible node location" (a simple dictionary-index in a...
Definition: face_quad.h:234
virtual dof_id_type key() const
Definition: elem.C:563
virtual std::unique_ptr< Elem > side_ptr(const unsigned int i) override final
Definition: face_quad.C:104
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
virtual Point master_point(const unsigned int i) const override final
Definition: face_quad.h:74
virtual dof_id_type key() const override
Definition: face_quad.C:94
static const Real _master_points[9][3]
Master element node locations.
Definition: face_quad.h:228
The libMesh namespace provides an interface to certain functionality in the library.
void set_interior_parent(Elem *p)
Sets the pointer to the element&#39;s interior_parent.
Definition: elem.C:1056
virtual unsigned int n_children() const override final
Definition: face_quad.h:106
static const unsigned short int _second_order_vertex_child_index[9]
Vector that names the child vertex index for each second order node.
Definition: face_quad.h:223
static const unsigned short int _second_order_vertex_child_number[9]
Vector that names a child sharing each second order node.
Definition: face_quad.h:218
ElemQuality
Defines an enum for element quality metrics.
virtual unsigned int local_side_node(unsigned int side, unsigned int side_node) const override
Definition: face_quad.C:75
static const unsigned short int _second_order_adjacent_vertices[4][2]
Matrix that tells which vertices define the location of mid-side (or second-order) nodes...
Definition: face_quad.h:213
virtual Real quality(const ElemQuality q) const override
Definition: face_quad.C:191
virtual dof_id_type low_order_key(const unsigned int s) const override
Definition: face_quad.C:65
virtual unsigned int n_sides() const override final
Definition: face_quad.h:91
Quad(const unsigned int nn, Elem *p, Node **nodelinkdata)
Default quadrilateral element, takes number of nodes and parent.
Definition: face_quad.h:56
virtual unsigned int n_edges() const override final
Definition: face_quad.h:101
virtual ~Quad()=default
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
The QUAD is an element in 2D composed of 4 sides.
Definition: face_quad.h:48
virtual unsigned int opposite_side(const unsigned int s) const override final
Definition: face_quad.C:140
virtual unsigned int n_permutations() const override final
Four sides, one orientation each.
Definition: face_quad.h:196
virtual unsigned int opposite_node(const unsigned int n, const unsigned int s) const override final
Definition: face_quad.C:149
virtual unsigned int n_nodes() const override
Definition: face_quad.h:86
Quad & operator=(const Quad &)=delete
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
virtual unsigned int local_edge_node(unsigned int edge, unsigned int edge_node) const override
Calls local_side_node(edge, edge_node).
Definition: face_quad.C:86
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const override final
Definition: face_quad.C:126
uint8_t dof_id_type
Definition: id_types.h:67