Line data Source code
1 : // The libMesh Finite Element Library.
2 : // Copyright (C) 2002-2026 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 : // Local includes
19 : #include "libmesh/face_quad.h"
20 : #include "libmesh/edge_edge2.h"
21 : #include "libmesh/face_quad4.h"
22 : #include "libmesh/enum_elem_quality.h"
23 :
24 : // C++ includes
25 : #include <array>
26 :
27 :
28 : namespace libMesh
29 : {
30 :
31 : // ------------------------------------------------------------
32 : // Quad class static member initializations
33 : const int Quad::num_sides;
34 : const int Quad::num_children;
35 :
36 : // Note: we can omit initialization of the third entry of each row because
37 : // static variables are automatically zero-initialized.
38 : const Real Quad::_master_points[9][3] =
39 : {
40 : {-1, -1},
41 : {1, -1},
42 : {1, 1},
43 : {-1, 1},
44 : {0, -1},
45 : {1, 0},
46 : {0, 1},
47 : {-1, 0},
48 : {0, 0}
49 : };
50 :
51 : const unsigned int Quad::adjacent_sides_map[/*num_vertices*/4][/*n_adjacent_sides*/2] =
52 : {
53 : {0, 3}, // Sides adjacent to node 0
54 : {0, 1}, // Sides adjacent to node 1
55 : {1, 2}, // Sides adjacent to node 2
56 : {2, 3} // Sides adjacent to node 3
57 : };
58 :
59 :
60 :
61 : // ------------------------------------------------------------
62 : // Quad class member functions
63 0 : dof_id_type Quad::key (const unsigned int s) const
64 : {
65 0 : libmesh_assert_less (s, this->n_sides());
66 :
67 0 : return this->compute_key(this->node_id(Quad4::side_nodes_map[s][0]),
68 0 : this->node_id(Quad4::side_nodes_map[s][1]));
69 : }
70 :
71 :
72 :
73 8230394 : dof_id_type Quad::low_order_key (const unsigned int s) const
74 : {
75 3955736 : libmesh_assert_less (s, this->n_sides());
76 :
77 10231510 : return this->compute_key(this->node_id(Quad4::side_nodes_map[s][0]),
78 12186130 : this->node_id(Quad4::side_nodes_map[s][1]));
79 : }
80 :
81 :
82 :
83 22693356 : unsigned int Quad::local_side_node(unsigned int side,
84 : unsigned int side_node) const
85 : {
86 5792224 : libmesh_assert_less (side, this->n_sides());
87 5792224 : libmesh_assert_less (side_node, Quad4::nodes_per_side);
88 :
89 22693356 : return Quad4::side_nodes_map[side][side_node];
90 : }
91 :
92 :
93 :
94 75160256 : unsigned int Quad::local_edge_node(unsigned int edge,
95 : unsigned int edge_node) const
96 : {
97 75160256 : return local_side_node(edge, edge_node);
98 : }
99 :
100 :
101 :
102 0 : dof_id_type Quad::key () const
103 : {
104 0 : return this->compute_key(this->node_id(0),
105 : this->node_id(1),
106 : this->node_id(2),
107 0 : this->node_id(3));
108 : }
109 :
110 :
111 :
112 31131 : std::unique_ptr<Elem> Quad::side_ptr (const unsigned int i)
113 : {
114 12250 : libmesh_assert_less (i, this->n_sides());
115 :
116 31131 : std::unique_ptr<Elem> edge = std::make_unique<Edge2>();
117 :
118 93393 : for (auto n : edge->node_index_range())
119 77686 : edge->set_node(n, this->node_ptr(Quad4::side_nodes_map[i][n]));
120 :
121 31131 : return edge;
122 0 : }
123 :
124 :
125 :
126 7505291 : void Quad::side_ptr (std::unique_ptr<Elem> & side,
127 : const unsigned int i)
128 : {
129 7505291 : this->simple_side_ptr<Quad,Quad4>(side, i, EDGE2);
130 7505291 : }
131 :
132 :
133 :
134 15537306 : bool Quad::is_child_on_side(const unsigned int c,
135 : const unsigned int s) const
136 : {
137 14662055 : libmesh_assert_less (c, this->n_children());
138 14662055 : libmesh_assert_less (s, this->n_sides());
139 :
140 : // A quad's children and nodes don't share the same ordering:
141 : // child 2 and 3 are swapped;
142 15537306 : unsigned int n = (c < 2) ? c : 5-c;
143 15537306 : return (n == s || n == (s+1)%4);
144 : }
145 :
146 :
147 :
148 0 : unsigned int Quad::opposite_side(const unsigned int side_in) const
149 : {
150 0 : libmesh_assert_less (side_in, 4);
151 :
152 0 : return (side_in + 2) % 4;
153 : }
154 :
155 :
156 :
157 0 : unsigned int Quad::opposite_node(const unsigned int node_in,
158 : const unsigned int side_in) const
159 : {
160 0 : libmesh_assert_less (node_in, 8);
161 0 : libmesh_assert_less (node_in, this->n_nodes());
162 0 : libmesh_assert_less (side_in, this->n_sides());
163 0 : libmesh_assert(this->is_node_on_side(node_in, side_in));
164 :
165 : static const unsigned char side02_nodes_map[] =
166 : {3, 2, 1, 0, 6, 255, 4, 255};
167 : static const unsigned char side13_nodes_map[] =
168 : {1, 0, 3, 2, 255, 7, 255, 5};
169 :
170 0 : switch (side_in)
171 : {
172 0 : case 0:
173 : case 2:
174 0 : return side02_nodes_map[node_in];
175 0 : case 1:
176 : case 3:
177 0 : return side13_nodes_map[node_in];
178 0 : default:
179 0 : libmesh_error_msg("Unsupported side_in = " << side_in);
180 : }
181 : }
182 :
183 :
184 756 : bool Quad::is_flipped() const
185 : {
186 : return (
187 : #if LIBMESH_DIM > 2
188 : // Don't bother outside the XY plane
189 952 : !this->point(0)(2) && !this->point(1)(2) &&
190 1708 : !this->point(2)(2) && !this->point(3)(2) &&
191 : #endif
192 952 : ((this->point(1)(0)-this->point(0)(0))*
193 756 : (this->point(3)(1)-this->point(0)(1)) <
194 952 : (this->point(3)(0)-this->point(0)(0))*
195 952 : (this->point(1)(1)-this->point(0)(1))));
196 : }
197 :
198 :
199 : std::vector<unsigned int>
200 47100 : Quad::edges_adjacent_to_node(const unsigned int n) const
201 : {
202 11800 : libmesh_assert_less(n, this->n_nodes());
203 :
204 : // For vertices, we use the Quad::adjacent_sides_map, otherwise each
205 : // of the mid-edge nodes is adjacent only to the edge it is on, and the
206 : // center node is not adjacent to any edge.
207 47100 : if (this->is_vertex(n))
208 28900 : return {std::begin(adjacent_sides_map[n]), std::end(adjacent_sides_map[n])};
209 24000 : else if (this->is_edge(n))
210 : {
211 19200 : if (this->type() == QUAD16)
212 6400 : return { (n - this->n_vertices())/2};
213 12800 : return {n - this->n_vertices()};
214 : }
215 1200 : libmesh_assert(this->is_face(n));
216 3600 : return {};
217 : }
218 :
219 13797 : Real Quad::quality (const ElemQuality q) const
220 : {
221 13797 : switch (q)
222 : {
223 : // The EDGE_LENGTH_RATIO metric is handled by the base class.
224 : //
225 : // The CUBIT 15.1 User Documentation refers to the
226 : // EDGE_LENGTH_RATIO as the "Aspect Ratio" metric for Quads,
227 : // however, we prefer the slightly more robust aspect ratio
228 : // formula employed by Ansys, and have therefore designated that
229 : // as our ASPECT_RATIO metric here.
230 : //
231 : // As a counter-example for employing the EDGE_LENGTH_RATIO in
232 : // Quads, consider a "rhombus". All four side lengths are equal,
233 : // so the EDGE_LENGTH_RATIO of this element is always (the
234 : // optimal value) 1.0, regardless of the internal angle "theta"
235 : // of the rhombus. A more sensitive shape quality metric should
236 : // take this internal angle into account, so that very thin
237 : // rhombus-shaped Quads are not considered optimal.
238 :
239 749 : case ASPECT_RATIO:
240 : {
241 : // Aspect Ratio definition from Ansys Theory Manual.
242 : // Reference: Ansys, Inc. Theory Reference, Ansys Release 9.0, 2004 (Chapter: 13.7.3)
243 : //
244 : // For the rhombus case described above, the aspect ratio of
245 : // the element using the Ansys Aspect Ratio metric is
246 : // 1/sin(theta), where theta is the acute interior angle of
247 : // the rhombus. The aspect ratio therefore has a minimum value
248 : // of 1.0 (when theta = pi/2), and blows up to infinity as
249 : // sin(theta) -> 0, rather than remaining equal to 1.0 as in
250 : // the CUBIT formula.
251 :
252 : // Compute midpoint positions along each edge
253 380 : Point m0 = Real(0.5) * (this->point(0) + this->point(1));
254 190 : Point m1 = Real(0.5) * (this->point(1) + this->point(2));
255 190 : Point m2 = Real(0.5) * (this->point(2) + this->point(3));
256 190 : Point m3 = Real(0.5) * (this->point(3) + this->point(0));
257 :
258 : // Compute vectors adjoining opposite side midpoints
259 190 : Point v0 = m2 - m0;
260 190 : Point v1 = m1 - m3;
261 :
262 : // Compute the length of the midlines
263 749 : Real v0_norm = v0.norm();
264 749 : Real v1_norm = v1.norm();
265 :
266 : // Instead of dividing by zero in the next step, just return
267 : // 0. The optimal aspect ratio is 1.0, and "high" aspect
268 : // ratios are bad, but an aspect ratio of 0 should also be
269 : // considered bad.
270 749 : if (v0_norm == 0. || v1_norm == 0.)
271 0 : return 0.;
272 :
273 : // Compute sine of the angle between v0, v1. For rectangular
274 : // elements, sin_theta == 1.
275 749 : Real sin_theta = cross_norm(v0, v1) / v0_norm / v1_norm;
276 749 : Real v0s = v0_norm*sin_theta;
277 749 : Real v1s = v1_norm*sin_theta;
278 :
279 : // Determine the min, max of each midline length and its
280 : // projection.
281 : //
282 : // Note: The return values min{0,1} and max{0,1} here are
283 : // *references* and we cannot pass a temporary to
284 : // std::minmax() since the reference returned becomes a
285 : // dangling reference at "the end of the full expression that
286 : // contains the call to std::minmax()"
287 : // https://en.cppreference.com/w/cpp/algorithm/minmax
288 190 : auto [min0, max0] = std::minmax(v0_norm, v1s);
289 190 : auto [min1, max1] = std::minmax(v0s, v1_norm);
290 :
291 : // Return the max of the two quotients
292 759 : return std::max(max0/min0, max1/min1);
293 : }
294 :
295 : // Compute the min/max diagonal ratio.
296 : // This is modeled after the Hex element
297 672 : case DISTORTION:
298 : case DIAGONAL:
299 : {
300 : // Diagonal between node 0 and node 2
301 672 : const Real d02 = this->length(0,2);
302 :
303 : // Diagonal between node 1 and node 3
304 672 : const Real d13 = this->length(1,3);
305 :
306 : // Find the biggest and smallest diagonals
307 672 : if ((d02 > 0.) && (d13 >0.))
308 672 : if (d02 < d13) return d02 / d13;
309 672 : else return d13 / d02;
310 : else
311 0 : return 0.;
312 : break;
313 : }
314 :
315 : // CUBIT 15.1 User Documentation:
316 : // Stretch: Sqrt(2) * minimum edge length / maximum diagonal length
317 672 : case STRETCH:
318 : {
319 672 : Real lengths[4] = {this->length(0,1), this->length(1,2), this->length(2,3), this->length(3,0)};
320 672 : Real min_edge = *std::min_element(lengths, lengths+4);
321 672 : Real d_max = std::max(this->length(0,2), this->length(1,3));
322 :
323 : // Return 0. instead of dividing by zero.
324 672 : if (d_max == 0.)
325 0 : return 0.;
326 : else
327 672 : return std::sqrt(2) * min_edge / d_max;
328 : }
329 :
330 : // Maximum ratio of lengths derived from opposite edges. This uses
331 : // the same convention as the Hex TAPER metric (of which the Quad
332 : // is the single-face case): for each of the two pairs of opposite
333 : // edges we form the ratio of the shorter to the longer length,
334 : // and return the smallest (worst) such ratio. The value lies in
335 : // (0, 1], with 1 indicating no taper, i.e. both pairs of opposite
336 : // edges are equal in length (as for any parallelogram).
337 700 : case TAPER:
338 : {
339 700 : const Real d01 = this->length(0,1);
340 700 : const Real d12 = this->length(1,2);
341 700 : const Real d23 = this->length(2,3);
342 700 : const Real d03 = this->length(0,3);
343 :
344 : // Longer length of each opposite-edge pair.
345 700 : const Real max0 = std::max(d01, d23);
346 700 : const Real max1 = std::max(d12, d03);
347 :
348 : // Degenerate element with a zero-length pair of opposite edges:
349 : // return 0 (the lowest quality).
350 700 : if (max0 == 0. || max1 == 0.)
351 0 : return 0.;
352 :
353 1052 : return std::min(std::min(d01, d23) / max0,
354 1224 : std::min(d12, d03) / max1);
355 : }
356 :
357 1344 : case SHAPE:
358 : case SKEW:
359 : {
360 : // From: P. Knupp, "Algebraic mesh quality metrics for
361 : // unstructured initial meshes," Finite Elements in Analysis
362 : // and Design 39, 2003, p. 217-241, Sections 5.2 and 5.3.
363 : typedef std::array<Real, 4> Array4;
364 : typedef std::array<Real, 6> Array6;
365 :
366 : // x, y, z node coordinates.
367 : std::vector<Real>
368 3024 : x = {this->point(0)(0), this->point(1)(0), this->point(2)(0), this->point(3)(0)},
369 3024 : y = {this->point(0)(1), this->point(1)(1), this->point(2)(1), this->point(3)(1)},
370 3024 : z = {this->point(0)(2), this->point(1)(2), this->point(2)(2), this->point(3)(2)};
371 :
372 : // Nodal Jacobians. These are 3x2 matrices, hence we represent
373 : // them by Array6.
374 : std::array<Array6, 4> A;
375 6720 : for (unsigned int k=0; k<4; ++k)
376 : {
377 : unsigned int
378 5376 : kp1 = k+1 > 3 ? k+1-4 : k+1,
379 5376 : kp3 = k+3 > 3 ? k+3-4 : k+3;
380 :
381 : // To initialize std::array we need double curly braces in
382 : // C++11 but not C++14 apparently.
383 8064 : A[k] = {{x[kp1] - x[k], x[kp3] - x[k],
384 8064 : y[kp1] - y[k], y[kp3] - y[k],
385 9408 : z[kp1] - z[k], z[kp3] - z[k]}};
386 : }
387 :
388 : // Compute metric tensors, T_k = A_k^T * A_k. These are 2x2
389 : // square matrices, hence we represent them by Array4.
390 : std::array<Array4, 4> T;
391 6720 : for (unsigned int k=0; k<4; ++k)
392 : {
393 : Real
394 5376 : top_left = A[k][0]*A[k][0] + A[k][2]*A[k][2] + A[k][4]*A[k][4],
395 5376 : off_diag = A[k][0]*A[k][1] + A[k][2]*A[k][3] + A[k][4]*A[k][5],
396 5376 : bot_rigt = A[k][1]*A[k][1] + A[k][3]*A[k][3] + A[k][5]*A[k][5];
397 :
398 5376 : T[k] = {{top_left, off_diag,
399 : off_diag, bot_rigt}};
400 : }
401 :
402 :
403 : // Nodal areas. These are approximated as sqrt(det(A^T * A))
404 : // to handle the general case of a 2D element living in 3D.
405 : Array4 alpha;
406 6720 : for (unsigned int k=0; k<4; ++k)
407 6720 : alpha[k] = std::sqrt(T[k][0]*T[k][3] - T[k][1]*T[k][2]);
408 :
409 : // All nodal areas must be strictly positive. Return 0 (the
410 : // lowest quality) otherwise. We know they can't be negative
411 : // because they are the result of a sqrt, but they might be
412 : // identically 0.
413 1344 : if (*std::min_element(alpha.begin(), alpha.end()) == 0.)
414 0 : return 0.;
415 :
416 : // Compute and return the shape metric. These only use the
417 : // diagonal entries of the T_k.
418 336 : Real den = 0.;
419 1344 : if (q == SHAPE)
420 : {
421 3360 : for (unsigned int k=0; k<4; ++k)
422 3360 : den += (T[k][0] + T[k][3]) / alpha[k];
423 672 : return (den == 0.) ? 0 : (8. / den);
424 : }
425 : else
426 : {
427 3360 : for (unsigned int k=0; k<4; ++k)
428 3360 : den += std::sqrt(T[k][0] * T[k][3]) / alpha[k];
429 672 : return (den == 0.) ? 0 : (4. / den);
430 : }
431 : }
432 :
433 : // Verdict/CUBIT "skew" metric: the maximum |cos A|, where A is
434 : // the angle between the principal axes of the element. The
435 : // principal axes are the vectors connecting the midpoints of
436 : // opposite edges. A value of 0 indicates a perfectly orthogonal
437 : // (unskewed) element; larger values (up to 1) indicate
438 : // increasing skew. This differs from the SKEW metric above,
439 : // which is Knupp's algebraic skew (1 is ideal).
440 : // See: C. J. Stimpson et al., "The Verdict Geometric Quality
441 : // Library," Sandia report SAND2007-1751, 2007.
442 707 : case SKEW_ANGLE:
443 : {
444 1063 : const Point x0 = this->point(0), x1 = this->point(1),
445 885 : x2 = this->point(2), x3 = this->point(3);
446 :
447 : // Principal axes: midpoint-to-midpoint of opposite edges.
448 178 : const Point X1 = (x1 - x0) + (x2 - x3);
449 178 : const Point X2 = (x3 - x0) + (x2 - x1);
450 :
451 529 : const Real n1 = X1.norm(), n2 = X2.norm();
452 :
453 : // Degenerate element: return 0 (the Verdict convention) if
454 : // either principal axis has zero length.
455 707 : if (n1 == 0. || n2 == 0.)
456 2 : return 0.;
457 :
458 876 : return std::abs((X1 * X2) / (n1 * n2));
459 : }
460 :
461 : // This test returns 0 if a Quad:
462 : // 1) Is "twisted" (i.e. has an invalid numbering)
463 : // 2) Has nearly parallel adjacent edges
464 : // 3) Has a nearly zero length edge
465 : // Otherwise, it returns 1.
466 0 : case TWIST:
467 : {
468 : // Compute the cross product induced by each "corner" of the QUAD
469 : // and check that:
470 : // 1) None of the cross products are zero (within a tolernace), and
471 : // 2) all of the cross products point in the same direction.
472 :
473 : // Corner 0
474 0 : Point vec_01 = point(1) - point(0);
475 0 : Point vec_03 = point(3) - point(0);
476 0 : Point corner_0_vec = vec_01.cross(vec_03);
477 :
478 : // Corner 1
479 0 : Point vec_12 = point(2) - point(1);
480 0 : Point vec_10 = point(0) - point(1);
481 0 : Point corner_1_vec = vec_12.cross(vec_10);
482 :
483 : // Corner 2
484 0 : Point vec_23 = point(3) - point(2);
485 0 : Point vec_21 = point(1) - point(2);
486 0 : Point corner_2_vec = vec_23.cross(vec_21);
487 :
488 : // Corner 3
489 0 : Point vec_30 = point(0) - point(3);
490 0 : Point vec_32 = point(2) - point(3);
491 0 : Point corner_3_vec = vec_30.cross(vec_32);
492 :
493 : // If any of these cross products is nearly zero, then either
494 : // we have nearly parallel adjacent edges or a nearly zero
495 : // length edge. We return 0 in this case.
496 0 : if ((corner_0_vec.norm() < TOLERANCE*TOLERANCE) ||
497 0 : (corner_1_vec.norm() < TOLERANCE*TOLERANCE) ||
498 0 : (corner_2_vec.norm() < TOLERANCE*TOLERANCE) ||
499 0 : (corner_3_vec.norm() < TOLERANCE*TOLERANCE))
500 : {
501 0 : return 0.;
502 : }
503 :
504 : // Now check whether the element is twisted.
505 0 : Real dot_01 = corner_0_vec * corner_1_vec;
506 0 : Real dot_02 = corner_0_vec * corner_2_vec;
507 0 : Real dot_03 = corner_0_vec * corner_3_vec;
508 :
509 0 : if ((dot_01 <= 0.) || (dot_02 <= 0.) || (dot_03 <= 0.))
510 0 : return 0.;
511 :
512 : // If we made it here, then Elem is not twisted.
513 0 : return 1.;
514 : }
515 :
516 714 : case WARP:
517 : {
518 : // We compute the angle between the two planes formed by
519 : // drawing an imaginary diagonal separating opposite vertices
520 : // A and B, where (A,B) = (0,2) and (1,3). The element warpage
521 : // is then taken to be the smaller of these two angles. For a
522 : // flat quadrilateral, the planes are parallel, thus the angle
523 : // between them is zero, and the element warpage is therefore
524 : // 1.
525 : //
526 : // Reference: https://cubit.sandia.gov/files/cubit/16.08/help_manual/WebHelp/mesh_generation/mesh_quality_assessment/quadrilateral_metrics.htm
527 : Point
528 894 : n0 = (this->point(1) - this->point(0)).cross(this->point(3) - this->point(0)).unit(),
529 894 : n1 = (this->point(2) - this->point(1)).cross(this->point(0) - this->point(1)).unit(),
530 894 : n2 = (this->point(3) - this->point(2)).cross(this->point(1) - this->point(2)).unit(),
531 894 : n3 = (this->point(0) - this->point(3)).cross(this->point(2) - this->point(3)).unit();
532 :
533 904 : return std::min(n0*n2, n1*n3);
534 : }
535 :
536 8239 : default:
537 8239 : return Elem::quality(q);
538 : }
539 : }
540 :
541 :
542 :
543 :
544 :
545 :
546 2016 : std::pair<Real, Real> Quad::qual_bounds (const ElemQuality q) const
547 : {
548 504 : std::pair<Real, Real> bounds;
549 :
550 504 : switch (q)
551 : {
552 56 : case EDGE_LENGTH_RATIO:
553 : case ASPECT_RATIO:
554 56 : bounds.first = 1.;
555 56 : bounds.second = 4.;
556 56 : break;
557 :
558 28 : case TAPER:
559 : // TAPER is 1 for an untapered element and decreases toward 0 with
560 : // increasing taper (see Quad::quality), so the good range runs up
561 : // to 1, not down from 0.
562 28 : bounds.first = 0.7;
563 28 : bounds.second = 1.;
564 28 : break;
565 :
566 28 : case WARP:
567 28 : bounds.first = 0.9;
568 28 : bounds.second = 1.;
569 28 : break;
570 :
571 28 : case STRETCH:
572 28 : bounds.first = 0.25;
573 28 : bounds.second = 1.;
574 28 : break;
575 :
576 28 : case MIN_ANGLE:
577 28 : bounds.first = 45.;
578 28 : bounds.second = 90.;
579 28 : break;
580 :
581 28 : case MAX_ANGLE:
582 28 : bounds.first = 90.;
583 28 : bounds.second = 135.;
584 28 : break;
585 :
586 28 : case CONDITION:
587 28 : bounds.first = 1.;
588 28 : bounds.second = 4.;
589 28 : break;
590 :
591 28 : case SCALED_JACOBIAN:
592 28 : bounds.first = 0.5;
593 28 : bounds.second = 1.;
594 28 : break;
595 :
596 112 : case SHEAR:
597 : case SHAPE:
598 : case SKEW:
599 : case SIZE:
600 112 : bounds.first = 0.3;
601 112 : bounds.second = 1.;
602 112 : break;
603 :
604 28 : case SKEW_ANGLE:
605 28 : bounds.first = 0.;
606 28 : bounds.second = 0.5;
607 28 : break;
608 :
609 28 : case DISTORTION:
610 28 : bounds.first = 0.6;
611 28 : bounds.second = 1.;
612 28 : break;
613 :
614 0 : case TWIST:
615 0 : bounds.first = 0.;
616 0 : bounds.second = 1.;
617 0 : break;
618 :
619 84 : default:
620 : libmesh_warning("Invalid quality measure chosen.");
621 84 : bounds.first = -1;
622 84 : bounds.second = -1;
623 : }
624 :
625 2016 : return bounds;
626 : }
627 :
628 :
629 :
630 4656844 : bool Quad::on_reference_element(const Point & p,
631 : const Real eps) const
632 : {
633 2530561 : const Real & xi = p(0);
634 2530561 : const Real & eta = p(1);
635 :
636 : // The reference quadrilateral element is [-1,1]^2.
637 8917485 : return ((xi >= -1.-eps) &&
638 4260641 : (xi <= 1.+eps) &&
639 10930742 : (eta >= -1.-eps) &&
640 6921748 : (eta <= 1.+eps));
641 : }
642 :
643 :
644 :
645 : const unsigned short int Quad::_second_order_adjacent_vertices[4][2] =
646 : {
647 : {0, 1}, // vertices adjacent to node 4
648 : {1, 2}, // vertices adjacent to node 5
649 : {2, 3}, // vertices adjacent to node 6
650 : {0, 3} // vertices adjacent to node 7
651 : };
652 :
653 :
654 :
655 : const unsigned short int Quad::_second_order_vertex_child_number[9] =
656 : {
657 : 99,99,99,99, // Vertices
658 : 0,1,2,0, // Edges
659 : 0 // Interior
660 : };
661 :
662 :
663 :
664 : const unsigned short int Quad::_second_order_vertex_child_index[9] =
665 : {
666 : 99,99,99,99, // Vertices
667 : 1,2,3,3, // Edges
668 : 2 // Interior
669 : };
670 :
671 :
672 :
673 : #ifdef LIBMESH_ENABLE_AMR
674 :
675 : // We number 25 "possible node locations" for a 2x2 refinement of
676 : // quads with up to 3x3 nodes each
677 : const int Quad::_child_node_lookup[4][9] =
678 : {
679 : // node lookup for child 0 (near node 0)
680 : { 0, 2, 12, 10, 1, 7, 11, 5, 6},
681 :
682 : // node lookup for child 1 (near node 1)
683 : { 2, 4, 14, 12, 3, 9, 13, 7, 8},
684 :
685 : // node lookup for child 2 (near node 3)
686 : { 10, 12, 22, 20, 11, 17, 21, 15, 16},
687 :
688 : // node lookup for child 3 (near node 2)
689 : { 12, 14, 24, 22, 13, 19, 23, 17, 18}
690 : };
691 :
692 :
693 : #endif
694 :
695 : } // namespace libMesh
|