libMesh
face_inf_quad.C
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 // Local includes
20 #include "libmesh/libmesh_config.h"
21 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
22 
23 // C++ includes
24 
25 // Local includes cont'd
26 #include "libmesh/face_inf_quad.h"
27 #include "libmesh/edge_edge2.h"
28 #include "libmesh/edge_inf_edge2.h"
29 #include "libmesh/face_inf_quad4.h"
30 
31 namespace libMesh
32 {
33 
34 
35 // ------------------------------------------------------------
36 // InfQuad class static member initializations
37 
38 
39 // We need to require C++11...
40 const Real InfQuad::_master_points[6][3] =
41  {
42  {-1, 0},
43  {1, 0},
44  {-1, 1},
45  {1, 1},
46  {0, 0},
47  {0, 1}
48  };
49 
50 
51 // ------------------------------------------------------------
52 // InfQuad class member functions
53 dof_id_type InfQuad::key (const unsigned int s) const
54 {
55  libmesh_assert_less (s, this->n_sides());
56 
57  // The order of the node ids does not matter, they are sorted by the
58  // compute_key() function.
59  return this->compute_key(this->node_id(InfQuad4::side_nodes_map[s][0]),
60  this->node_id(InfQuad4::side_nodes_map[s][1]));
61 }
62 
63 
64 
65 unsigned int InfQuad::which_node_am_i(unsigned int side,
66  unsigned int side_node) const
67 {
68  libmesh_assert_less (side, this->n_sides());
69  libmesh_assert_less (side_node, 2);
70 
71  return InfQuad4::side_nodes_map[side][side_node];
72 }
73 
74 
75 
76 UniquePtr<Elem> InfQuad::side_ptr (const unsigned int i)
77 {
78  libmesh_assert_less (i, this->n_sides());
79 
80  // To be returned wrapped in a UniquePtr
81  Elem * edge = libmesh_nullptr;
82 
83  switch (i)
84  {
85  case 0: // base face
86  {
87  edge = new Edge2;
88  break;
89  }
90 
91  case 1: // adjacent to another infinite element
92  case 2: // adjacent to another infinite element
93  {
94  edge = new InfEdge2;
95  break;
96  }
97 
98  default:
99  libmesh_error_msg("Invalid side i = " << i);
100  }
101 
102  // Set the nodes
103  for (unsigned n=0; n<edge->n_nodes(); ++n)
104  edge->set_node(n) = this->node_ptr(InfQuad4::side_nodes_map[i][n]);
105 
106  return UniquePtr<Elem>(edge);
107 }
108 
109 
110 
111 bool InfQuad::is_child_on_side(const unsigned int c,
112  const unsigned int s) const
113 {
114  libmesh_assert_less (c, this->n_children());
115  libmesh_assert_less (s, this->n_sides());
116 
117  return (s == 0 || s == c+1);
118 }
119 
120 
121 
123 {
124  return 0.; // Not implemented
125 }
126 
127 
128 
129 
130 std::pair<Real, Real> InfQuad::qual_bounds (const ElemQuality q) const
131 {
132  std::pair<Real, Real> bounds;
133 
134  switch (q)
135  {
136 
137  case ASPECT_RATIO:
138  bounds.first = 1.;
139  bounds.second = 4.;
140  break;
141 
142  case SKEW:
143  bounds.first = 0.;
144  bounds.second = 0.5;
145  break;
146 
147  case TAPER:
148  bounds.first = 0.;
149  bounds.second = 0.7;
150  break;
151 
152  case WARP:
153  bounds.first = 0.9;
154  bounds.second = 1.;
155  break;
156 
157  case STRETCH:
158  bounds.first = 0.25;
159  bounds.second = 1.;
160  break;
161 
162  case MIN_ANGLE:
163  bounds.first = 45.;
164  bounds.second = 90.;
165  break;
166 
167  case MAX_ANGLE:
168  bounds.first = 90.;
169  bounds.second = 135.;
170  break;
171 
172  case CONDITION:
173  bounds.first = 1.;
174  bounds.second = 4.;
175  break;
176 
177  case JACOBIAN:
178  bounds.first = 0.5;
179  bounds.second = 1.;
180  break;
181 
182  case SHEAR:
183  case SHAPE:
184  case SIZE:
185  bounds.first = 0.3;
186  bounds.second = 1.;
187  break;
188 
189  case DISTORTION:
190  bounds.first = 0.6;
191  bounds.second = 1.;
192  break;
193 
194  default:
195  libMesh::out << "Warning: Invalid quality measure chosen." << std::endl;
196  bounds.first = -1;
197  bounds.second = -1;
198  }
199 
200  return bounds;
201 }
202 
203 } // namespace libMesh
204 
205 
206 
207 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
virtual Real quality(const ElemQuality q) const libmesh_override
virtual Node *& set_node(const unsigned int i)
Definition: elem.h:1941
virtual UniquePtr< Elem > side_ptr(const unsigned int i) libmesh_override
Definition: face_inf_quad.C:76
UniquePtr< Elem > side(const unsigned int i) const
Definition: elem.h:2105
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
static const Real _master_points[6][3]
Master element node locations.
const class libmesh_nullptr_t libmesh_nullptr
The InfEdge2 is an infinite element in 1D composed of 2 nodes.
static const unsigned int side_nodes_map[3][2]
This maps the node of the side to element node numbers.
The libMesh namespace provides an interface to certain functionality in the library.
virtual unsigned int n_children() const libmesh_override
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
virtual unsigned int n_nodes() const =0
virtual dof_id_type key() const
Definition: elem.C:503
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1874
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const libmesh_override
virtual std::pair< Real, Real > qual_bounds(const ElemQuality q) const libmesh_override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
OStreamProxy out
The Edge2 is an element in 1D composed of 2 nodes.
Definition: edge_edge2.h:43
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1831
ElemQuality
Defines an enum for element quality metrics.
static dof_id_type compute_key(dof_id_type n0)
Definition: elem.h:2621
virtual unsigned int which_node_am_i(unsigned int side, unsigned int side_node) const libmesh_override
Definition: face_inf_quad.C:65
virtual unsigned int n_sides() const libmesh_override
Definition: face_inf_quad.h:96
uint8_t dof_id_type
Definition: id_types.h:64