libMesh
face_quad.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_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, num_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 
85  static const int num_sides = 4;
86  static const int num_children = 4;
87 
92  virtual unsigned int n_nodes() const override { return 4; }
93 
97  virtual unsigned int n_sides() const override final { return 4; }
98 
102  virtual unsigned int n_vertices() const override final { return 4; }
103 
107  virtual unsigned int n_edges() const override final { return 4; }
108 
112  virtual unsigned int n_children() const override final { return 4; }
113 
118  virtual bool is_child_on_side(const unsigned int c,
119  const unsigned int s) const override final;
120 
125  virtual unsigned int opposite_side(const unsigned int s) const override final;
126 
132  virtual unsigned int opposite_node(const unsigned int n,
133  const unsigned int s) const override final;
134 
138  using Elem::key;
139 
145  virtual dof_id_type key () const override;
146 
151  virtual dof_id_type key (const unsigned int s) const override;
152 
159  virtual dof_id_type low_order_key (const unsigned int s) const override;
160 
164  virtual unsigned int local_side_node(unsigned int side,
165  unsigned int side_node) const override;
166 
172  virtual unsigned int local_edge_node(unsigned int edge,
173  unsigned int edge_node) const override;
174 
178  virtual std::unique_ptr<Elem> side_ptr (const unsigned int i) override final;
179 
183  virtual void side_ptr (std::unique_ptr<Elem> & elem,
184  const unsigned int i) override final;
185 
190  virtual Real quality (const ElemQuality q) const override;
191 
197  virtual std::pair<Real, Real> qual_bounds (const ElemQuality q) const override;
198 
202  virtual unsigned int n_permutations() const override final { return 4; }
203 
204  virtual bool is_flipped() const override final;
205 
206  virtual std::vector<unsigned int> edges_adjacent_to_node(const unsigned int n) const override;
207 
208  virtual bool on_reference_element(const Point & p,
209  const Real eps = TOLERANCE) const override final;
210 
211 protected:
212 
216  Elem * _elemlinks_data[5+(LIBMESH_DIM>2)];
217 
224  static const unsigned short int _second_order_adjacent_vertices[4][2];
225 
229  static const unsigned short int _second_order_vertex_child_number[9];
230 
234  static const unsigned short int _second_order_vertex_child_index[9];
235 
239  static const Real _master_points[9][3];
240 
245  static const int _child_node_lookup[4][9];
246 
254  static const unsigned int adjacent_sides_map[/*num_vertices*/4][/*n_adjacent_sides*/2];
255 };
256 
257 } // namespace libMesh
258 
259 #endif // LIBMESH_FACE_QUAD_H
virtual std::pair< Real, Real > qual_bounds(const ElemQuality q) const override
Definition: face_quad.C:488
virtual bool is_flipped() const override final
Definition: face_quad.C:184
Elem * _elemlinks_data[5+(LIBMESH_DIM >2)]
Data for links to parent/neighbor/interior_parent elements.
Definition: face_quad.h:216
virtual unsigned int n_vertices() const override final
Definition: face_quad.h:102
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:245
virtual dof_id_type key() const
Definition: elem.C:753
static constexpr Real TOLERANCE
virtual std::unique_ptr< Elem > side_ptr(const unsigned int i) override final
Definition: face_quad.C:112
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:102
static const Real _master_points[9][3]
Master element node locations.
Definition: face_quad.h:239
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:1248
virtual unsigned int n_children() const override final
Definition: face_quad.h:112
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:234
virtual std::vector< unsigned int > edges_adjacent_to_node(const unsigned int n) const override
Definition: face_quad.C:200
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:229
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:83
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:224
virtual Real quality(const ElemQuality q) const override
Definition: face_quad.C:216
virtual dof_id_type low_order_key(const unsigned int s) const override
Definition: face_quad.C:73
virtual unsigned int n_sides() const override final
Definition: face_quad.h:97
Quad(const unsigned int nn, Elem *p, Node **nodelinkdata)
Default quadrilateral element, takes number of nodes and parent.
Definition: face_quad.h:56
static const int num_sides
Geometric constants for Quad4.
Definition: face_quad.h:85
static const unsigned int adjacent_sides_map[4][2]
This maps the node to the (in this case) 2 side ids adjacent to the node.
Definition: face_quad.h:254
virtual unsigned int n_edges() const override final
Definition: face_quad.h:107
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:148
virtual unsigned int n_permutations() const override final
Four sides, one orientation each.
Definition: face_quad.h:202
virtual unsigned int opposite_node(const unsigned int n, const unsigned int s) const override final
Definition: face_quad.C:157
virtual unsigned int n_nodes() const override
Definition: face_quad.h:92
Quad & operator=(const Quad &)=delete
virtual bool on_reference_element(const Point &p, const Real eps=TOLERANCE) const override final
Definition: face_quad.C:565
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:94
static const int num_children
Definition: face_quad.h:86
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const override final
Definition: face_quad.C:134
uint8_t dof_id_type
Definition: id_types.h:67