face_inf_quad.C
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 // Local includes
20 #include "libmesh/libmesh_config.h"
21 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
22 
23 // Local includes cont'd
24 #include "libmesh/face_inf_quad.h"
25 #include "libmesh/edge_edge2.h"
26 #include "libmesh/edge_inf_edge2.h"
27 #include "libmesh/face_inf_quad4.h"
29 
30 namespace libMesh
31 {
32 
33 
34 // ------------------------------------------------------------
35 // InfQuad class static member initializations
36 
37 
38 // We need to require C++11...
39 const Real InfQuad::_master_points[6][3] =
40  {
41  {-1, 0},
42  {1, 0},
43  {-1, 1},
44  {1, 1},
45  {0, 0},
46  {0, 1}
47  };
48 
49 
50 // ------------------------------------------------------------
51 // InfQuad class member functions
52 dof_id_type InfQuad::key (const unsigned int s) const
53 {
54  libmesh_assert_less (s, this->n_sides());
55 
56  // The order of the node ids does not matter, they are sorted by the
57  // compute_key() function.
58  return this->compute_key(this->node_id(InfQuad4::side_nodes_map[s][0]),
59  this->node_id(InfQuad4::side_nodes_map[s][1]));
60 }
61 
62 
63 
64 unsigned int InfQuad::which_node_am_i(unsigned int side,
65  unsigned int side_node) const
66 {
67  libmesh_assert_less (side, this->n_sides());
68  libmesh_assert_less (side_node, 2);
69 
70  return InfQuad4::side_nodes_map[side][side_node];
71 }
72 
73 
74 
75 std::unique_ptr<Elem> InfQuad::side_ptr (const unsigned int i)
76 {
77  libmesh_assert_less (i, this->n_sides());
78 
79  // Return value
80  std::unique_ptr<Elem> edge;
81 
82  switch (i)
83  {
84  case 0: // base face
85  {
86  edge = libmesh_make_unique<Edge2>();
87  break;
88  }
89 
90  case 1: // adjacent to another infinite element
91  case 2: // adjacent to another infinite element
92  {
93  edge = libmesh_make_unique<InfEdge2>();
94  break;
95  }
96 
97  default:
98  libmesh_error_msg("Invalid side i = " << i);
99  }
100 
101  // Set the nodes
102  for (unsigned n=0; n<edge->n_nodes(); ++n)
103  edge->set_node(n) = this->node_ptr(InfQuad4::side_nodes_map[i][n]);
104 
105  return edge;
106 }
107 
108 
109 
110 void InfQuad::side_ptr (std::unique_ptr<Elem> & side,
111  const unsigned int i)
112 {
113  libmesh_assert_less (i, this->n_sides());
114 
115  switch (i)
116  {
117  // the base face
118  case 0:
119  {
120  if (!side.get() || side->type() != EDGE2)
121  {
122  side = this->side_ptr(i);
123  return;
124  }
125  break;
126  }
127 
128  // connecting to another infinite element
129  case 1:
130  case 2:
131  {
132  if (!side.get() || side->type() != INFEDGE2)
133  {
134  side = this->side_ptr(i);
135  return;
136  }
137  break;
138  }
139 
140  default:
141  libmesh_error_msg("Invalid side i = " << i);
142  }
143 
144  side->subdomain_id() = this->subdomain_id();
145 
146  // Set the nodes
147  for (auto n : side->node_index_range())
148  side->set_node(n) = this->node_ptr(InfQuad4::side_nodes_map[i][n]);
149 }
150 
151 
152 bool InfQuad::is_child_on_side(const unsigned int c,
153  const unsigned int s) const
154 {
155  libmesh_assert_less (c, this->n_children());
156  libmesh_assert_less (s, this->n_sides());
157 
158  return (s == 0 || s == c+1);
159 }
160 
161 
162 
164 {
165  return 0.; // Not implemented
166 }
167 
168 
169 
170 
171 std::pair<Real, Real> InfQuad::qual_bounds (const ElemQuality q) const
172 {
173  std::pair<Real, Real> bounds;
174 
175  switch (q)
176  {
177 
178  case ASPECT_RATIO:
179  bounds.first = 1.;
180  bounds.second = 4.;
181  break;
182 
183  case SKEW:
184  bounds.first = 0.;
185  bounds.second = 0.5;
186  break;
187 
188  case TAPER:
189  bounds.first = 0.;
190  bounds.second = 0.7;
191  break;
192 
193  case WARP:
194  bounds.first = 0.9;
195  bounds.second = 1.;
196  break;
197 
198  case STRETCH:
199  bounds.first = 0.25;
200  bounds.second = 1.;
201  break;
202 
203  case MIN_ANGLE:
204  bounds.first = 45.;
205  bounds.second = 90.;
206  break;
207 
208  case MAX_ANGLE:
209  bounds.first = 90.;
210  bounds.second = 135.;
211  break;
212 
213  case CONDITION:
214  bounds.first = 1.;
215  bounds.second = 4.;
216  break;
217 
218  case JACOBIAN:
219  bounds.first = 0.5;
220  bounds.second = 1.;
221  break;
222 
223  case SHEAR:
224  case SHAPE:
225  case SIZE:
226  bounds.first = 0.3;
227  bounds.second = 1.;
228  break;
229 
230  case DISTORTION:
231  bounds.first = 0.6;
232  bounds.second = 1.;
233  break;
234 
235  default:
236  libMesh::out << "Warning: Invalid quality measure chosen." << std::endl;
237  bounds.first = -1;
238  bounds.second = -1;
239  }
240 
241  return bounds;
242 }
243 
244 } // namespace libMesh
245 
246 
247 
248 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
virtual std::pair< Real, Real > qual_bounds(const ElemQuality q) const override
virtual dof_id_type key() const
Definition: elem.C:401
static const unsigned int side_nodes_map[num_sides][nodes_per_side]
unsigned short int side
Definition: xdr_io.C:50
static const Real _master_points[6][3]
virtual bool is_child_on_side(const unsigned int c, const unsigned int s) const override final
virtual Real quality(const ElemQuality q) const override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
subdomain_id_type subdomain_id() const
Definition: elem.h:2034
const Node * node_ptr(const unsigned int i) const
Definition: elem.h:1957
virtual unsigned int n_sides() const override final
virtual unsigned int n_children() const override final
virtual unsigned int which_node_am_i(unsigned int side, unsigned int side_node) const override
Definition: face_inf_quad.C:64
static dof_id_type compute_key(dof_id_type n0)
Definition: elem.h:2754
OStreamProxy out(std::cout)
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1914
virtual std::unique_ptr< Elem > side_ptr(const unsigned int i) override final
Definition: face_inf_quad.C:75
std::unique_ptr< Elem > side(const unsigned int i) const
Definition: elem.h:2202
uint8_t dof_id_type
Definition: id_types.h:64