24 #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES 41 libmesh_error_msg(
"Bernstein polynomials require the element type \nbecause edge and face orientation is needed.");
73 libmesh_assert_less (i, 4);
76 const Real zeta1 = p(0);
77 const Real zeta2 = p(1);
78 const Real zeta3 = p(2);
79 const Real zeta0 = 1. - zeta1 - zeta2 - zeta3;
89 libmesh_error_msg(
"Invalid shape function index i = " << i);
98 libmesh_assert_less (i, 8);
101 const Real xi = p(0);
102 const Real eta = p(1);
103 const Real zeta = p(2);
109 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0};
110 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1};
111 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1};
120 libmesh_error_msg(
"Invalid element type = " << type);
135 libmesh_assert_less (i, 10);
138 const Real zeta1 = p(0);
139 const Real zeta2 = p(1);
140 const Real zeta3 = p(2);
141 const Real zeta0 = 1. - zeta1 - zeta2 - zeta3;
145 case 0:
return zeta0*zeta0;
146 case 1:
return zeta1*zeta1;
147 case 2:
return zeta2*zeta2;
148 case 3:
return zeta3*zeta3;
149 case 4:
return 2.*zeta0*zeta1;
150 case 5:
return 2.*zeta1*zeta2;
151 case 6:
return 2.*zeta0*zeta2;
152 case 7:
return 2.*zeta3*zeta0;
153 case 8:
return 2.*zeta1*zeta3;
154 case 9:
return 2.*zeta2*zeta3;
157 libmesh_error_msg(
"Invalid shape function index i = " << i);
164 libmesh_assert_less (i, 20);
167 const Real xi = p(0);
168 const Real eta = p(1);
169 const Real zeta = p(2);
175 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 1, 0, 2, 1, 2, 0, 2, 2, 1, 2, 0, 2, 2};
176 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 1, 0, 2, 1, 2, 2, 0, 2, 1, 2, 2, 2};
177 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 0, 2, 2, 2, 2, 1, 2};
183 static const Real scal20[] = {-0.25, -0.25, -0.25, -0.25, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0};
184 static const Real scal21[] = {-0.25, -0.25, 0, 0, -0.25, -0.25, 0, 0, 0.5, 0, 0, 0, 0.5, 0.5, 0, 0, 0.5, 0, 0, 0};
185 static const Real scal22[] = {0, -0.25, -0.25, 0, 0, -0.25, -0.25, 0, 0, 0.5, 0, 0, 0, 0.5, 0.5, 0, 0, 0.5, 0, 0};
186 static const Real scal23[] = {0, 0, -0.25, -0.25, 0, 0, -0.25, -0.25, 0, 0, 0.5, 0, 0, 0, 0.5, 0.5, 0, 0, 0.5, 0};
187 static const Real scal24[] = {-0.25, 0, 0, -0.25, -0.25, 0, 0, -0.25, 0, 0, 0, 0.5, 0.5, 0, 0, 0.5, 0, 0, 0, 0.5};
188 static const Real scal25[] = {0, 0, 0, 0, -0.25, -0.25, -0.25, -0.25, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0.5};
189 static const Real scal26[] = {-0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25};
227 libmesh_assert_less (i, 27);
230 const Real xi = p(0);
231 const Real eta = p(1);
232 const Real zeta = p(2);
238 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 1, 0, 2, 1, 2, 0, 2, 2, 1, 2, 0, 2, 2};
239 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 1, 0, 2, 1, 2, 2, 0, 2, 1, 2, 2, 2};
240 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 0, 2, 2, 2, 2, 1, 2};
249 libmesh_error_msg(
"Invalid element type = " << type);
330 libmesh_assert_less (i, 64);
333 const Real xi = p(0);
334 const Real eta = p(1);
335 const Real zeta = p(2);
336 Real xi_mapped = p(0);
337 Real eta_mapped = p(1);
338 Real zeta_mapped = p(2);
345 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0, 2, 3, 1, 1, 2, 3, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 2, 3, 1, 1, 2, 3, 0, 0, 2, 3, 2, 3, 2, 3, 2, 3, 1, 1, 1, 1, 2, 3, 2, 3, 0, 0, 0, 0, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3};
346 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 2, 3, 1, 1, 2, 3, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 2, 3, 1, 1, 2, 3, 2, 2, 3, 3, 0, 0, 0, 0, 2, 3, 2, 3, 1, 1, 1, 1, 2, 3, 2, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3};
347 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 2, 3, 2, 3, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3};
354 if ((i0[i] >= 2) && (i1[i] == 0) && (i2[i] == 0))
360 else if ((i0[i] == 1) && (i1[i] >= 2) && (i2[i] == 0))
366 else if ((i0[i] >= 2) && (i1[i] == 1) && (i2[i] == 0))
372 else if ((i0[i] == 0) && (i1[i] >= 2) && (i2[i] == 0))
378 else if ((i0[i] == 0) && (i1[i] == 0) && (i2[i] >=2 ))
384 else if ((i0[i] == 1) && (i1[i] == 0) && (i2[i] >=2 ))
390 else if ((i0[i] == 1) && (i1[i] == 1) && (i2[i] >=2 ))
396 else if ((i0[i] == 0) && (i1[i] == 1) && (i2[i] >=2 ))
402 else if ((i0[i] >=2 ) && (i1[i] == 0) && (i2[i] == 1))
408 else if ((i0[i] == 1) && (i1[i] >=2 ) && (i2[i] == 1))
414 else if ((i0[i] >=2 ) && (i1[i] == 1) && (i2[i] == 1))
420 else if ((i0[i] == 0) && (i1[i] >=2 ) && (i2[i] == 1))
431 if ((i2[i] == 0) && (i0[i] >= 2) && (i1[i] >= 2))
437 if (elem->
point(0) == min_point)
451 else if (elem->
point(3) == min_point)
465 else if (elem->
point(2) == min_point)
479 else if (elem->
point(1) == min_point)
498 else if ((i1[i] == 0) && (i0[i] >= 2) && (i2[i] >= 2))
504 if (elem->
point(0) == min_point)
518 else if (elem->
point(1) == min_point)
532 else if (elem->
point(5) == min_point)
546 else if (elem->
point(4) == min_point)
565 else if ((i0[i] == 1) && (i1[i] >= 2) && (i2[i] >= 2))
571 if (elem->
point(1) == min_point)
585 else if (elem->
point(2) == min_point)
599 else if (elem->
point(6) == min_point)
613 else if (elem->
point(5) == min_point)
632 else if ((i1[i] == 1) && (i0[i] >= 2) && (i2[i] >= 2))
638 if (elem->
point(3) == min_point)
652 else if (elem->
point(7) == min_point)
666 else if (elem->
point(6) == min_point)
680 else if (elem->
point(2) == min_point)
699 else if ((i0[i] == 0) && (i1[i] >= 2) && (i2[i] >= 2))
705 if (elem->
point(0) == min_point)
719 else if (elem->
point(4) == min_point)
733 else if (elem->
point(7) == min_point)
747 else if (elem->
point(3) == min_point)
766 else if ((i2[i] == 1) && (i0[i] >= 2) && (i1[i] >= 2))
772 if (elem->
point(4) == min_point)
786 else if (elem->
point(5) == min_point)
800 else if (elem->
point(6) == min_point)
814 else if (elem->
point(7) == min_point)
839 libmesh_error_msg(
"Invalid element type = " << type);
854 libmesh_assert_less (i, 125);
857 const Real xi = p(0);
858 const Real eta = p(1);
859 const Real zeta = p(2);
860 Real xi_mapped = p(0);
861 Real eta_mapped = p(1);
862 Real zeta_mapped = p(2);
869 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0, 2, 3, 4, 1, 1, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 2, 3, 4, 1, 1, 1, 2, 3, 4, 0, 0, 0, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 2, 3, 4, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4};
870 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 2, 3, 4, 1, 1, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 2, 3, 4, 1, 1, 1, 2, 3, 4, 2, 2, 2, 3, 3, 3, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 2, 3, 4, 2, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 2, 2, 3, 3, 3, 4, 4, 4, 2, 2, 2, 3, 3, 3, 4, 4, 4, 2, 2, 2, 3, 3, 3, 4, 4, 4, 2, 2, 2, 3, 3, 3, 4, 4, 4};
871 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 2, 3, 4, 2, 3, 4, 2, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 3, 3, 3, 4, 4, 4, 2, 2, 2, 3, 3, 3, 4, 4, 4, 2, 2, 2, 3, 3, 3, 4, 4, 4, 2, 2, 2, 3, 3, 3, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4};
878 if ((i0[i] >= 2) && (i1[i] == 0) && (i2[i] == 0))
884 else if ((i0[i] == 1) && (i1[i] >= 2) && (i2[i] == 0))
890 else if ((i0[i] >= 2) && (i1[i] == 1) && (i2[i] == 0))
896 else if ((i0[i] == 0) && (i1[i] >= 2) && (i2[i] == 0))
902 else if ((i0[i] == 0) && (i1[i] == 0) && (i2[i] >=2 ))
908 else if ((i0[i] == 1) && (i1[i] == 0) && (i2[i] >=2 ))
914 else if ((i0[i] == 1) && (i1[i] == 1) && (i2[i] >=2 ))
920 else if ((i0[i] == 0) && (i1[i] == 1) && (i2[i] >=2 ))
926 else if ((i0[i] >=2 ) && (i1[i] == 0) && (i2[i] == 1))
932 else if ((i0[i] == 1) && (i1[i] >=2 ) && (i2[i] == 1))
938 else if ((i0[i] >=2 ) && (i1[i] == 1) && (i2[i] == 1))
944 else if ((i0[i] == 0) && (i1[i] >=2 ) && (i2[i] == 1))
955 if ((i2[i] == 0) && (i0[i] >= 2) && (i1[i] >= 2))
961 if (elem->
point(0) == min_point)
975 else if (elem->
point(3) == min_point)
989 else if (elem->
point(2) == min_point)
1003 else if (elem->
point(1) == min_point)
1022 else if ((i1[i] == 0) && (i0[i] >= 2) && (i2[i] >= 2))
1028 if (elem->
point(0) == min_point)
1042 else if (elem->
point(1) == min_point)
1056 else if (elem->
point(5) == min_point)
1061 zeta_mapped = -zeta;
1070 else if (elem->
point(4) == min_point)
1082 zeta_mapped = -zeta;
1089 else if ((i0[i] == 1) && (i1[i] >= 2) && (i2[i] >= 2))
1095 if (elem->
point(1) == min_point)
1109 else if (elem->
point(2) == min_point)
1123 else if (elem->
point(6) == min_point)
1128 zeta_mapped = -zeta;
1137 else if (elem->
point(5) == min_point)
1149 zeta_mapped = -zeta;
1156 else if ((i1[i] == 1) && (i0[i] >= 2) && (i2[i] >= 2))
1162 if (elem->
point(3) == min_point)
1176 else if (elem->
point(7) == min_point)
1187 zeta_mapped = -zeta;
1190 else if (elem->
point(6) == min_point)
1195 zeta_mapped = -zeta;
1204 else if (elem->
point(2) == min_point)
1223 else if ((i0[i] == 0) && (i1[i] >= 2) && (i2[i] >= 2))
1229 if (elem->
point(0) == min_point)
1243 else if (elem->
point(4) == min_point)
1254 zeta_mapped = -zeta;
1257 else if (elem->
point(7) == min_point)
1262 zeta_mapped = -zeta;
1271 else if (elem->
point(3) == min_point)
1290 else if ((i2[i] == 1) && (i0[i] >= 2) && (i1[i] >= 2))
1296 if (elem->
point(4) == min_point)
1310 else if (elem->
point(5) == min_point)
1324 else if (elem->
point(6) == min_point)
1338 else if (elem->
point(7) == min_point)
1366 libmesh_error_msg(
"Invalid element type = " << type);
1372 libmesh_error_msg(
"Invalid totalorder = " << totalorder);
1388 libmesh_error_msg(
"Bernstein polynomials require the element type \nbecause edge and face orientation is needed.");
1397 const unsigned int i,
1398 const unsigned int j,
1402 #if LIBMESH_DIM == 3 1403 libmesh_assert(elem);
1408 libmesh_assert_less (j, 3);
1423 const Real eps = 1.e-6;
1425 libmesh_assert_less (i, 4);
1426 libmesh_assert_less (j, 3);
1434 const Point pp(p(0)+eps, p(1), p(2));
1435 const Point pm(p(0)-eps, p(1), p(2));
1444 const Point pp(p(0), p(1)+eps, p(2));
1445 const Point pm(p(0), p(1)-eps, p(2));
1453 const Point pp(p(0), p(1), p(2)+eps);
1454 const Point pm(p(0), p(1), p(2)-eps);
1460 libmesh_error_msg(
"Invalid derivative index j = " << j);
1472 libmesh_assert_less (i, 8);
1475 const Real xi = p(0);
1476 const Real eta = p(1);
1477 const Real zeta = p(2);
1483 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0};
1484 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1};
1485 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1};
1508 libmesh_error_msg(
"Invalid derivative index j = " << j);
1513 libmesh_error_msg(
"Invalid element type = " << type);
1529 const Real eps = 1.e-6;
1531 libmesh_assert_less (i, 10);
1532 libmesh_assert_less (j, 3);
1540 const Point pp(p(0)+eps, p(1), p(2));
1541 const Point pm(p(0)-eps, p(1), p(2));
1550 const Point pp(p(0), p(1)+eps, p(2));
1551 const Point pm(p(0), p(1)-eps, p(2));
1559 const Point pp(p(0), p(1), p(2)+eps);
1560 const Point pm(p(0), p(1), p(2)-eps);
1566 libmesh_error_msg(
"Invalid derivative index j = " << j);
1573 libmesh_assert_less (i, 20);
1576 const Real xi = p(0);
1577 const Real eta = p(1);
1578 const Real zeta = p(2);
1584 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 1, 0, 2, 1, 2, 0, 2, 2, 1, 2, 0, 2, 2};
1585 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 1, 0, 2, 1, 2, 2, 0, 2, 1, 2, 2, 2};
1586 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 0, 2, 2, 2, 2, 1, 2};
1587 static const Real scal20[] = {-0.25, -0.25, -0.25, -0.25, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0};
1588 static const Real scal21[] = {-0.25, -0.25, 0, 0, -0.25, -0.25, 0, 0, 0.5, 0, 0, 0, 0.5, 0.5, 0, 0, 0.5, 0, 0, 0};
1589 static const Real scal22[] = {0, -0.25, -0.25, 0, 0, -0.25, -0.25, 0, 0, 0.5, 0, 0, 0, 0.5, 0.5, 0, 0, 0.5, 0, 0};
1590 static const Real scal23[] = {0, 0, -0.25, -0.25, 0, 0, -0.25, -0.25, 0, 0, 0.5, 0, 0, 0, 0.5, 0.5, 0, 0, 0.5, 0};
1591 static const Real scal24[] = {-0.25, 0, 0, -0.25, -0.25, 0, 0, -0.25, 0, 0, 0, 0.5, 0.5, 0, 0, 0.5, 0, 0, 0, 0.5};
1592 static const Real scal25[] = {0, 0, 0, 0, -0.25, -0.25, -0.25, -0.25, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0.5, 0.5};
1593 static const Real scal26[] = {-0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25};
1700 libmesh_error_msg(
"Invalid derivative index j = " << j);
1707 libmesh_assert_less (i, 27);
1710 const Real xi = p(0);
1711 const Real eta = p(1);
1712 const Real zeta = p(2);
1718 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 1, 0, 2, 1, 2, 0, 2, 2, 1, 2, 0, 2, 2};
1719 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 1, 0, 2, 1, 2, 2, 0, 2, 1, 2, 2, 2};
1720 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1, 1, 0, 2, 2, 2, 2, 1, 2};
1743 libmesh_error_msg(
"Invalid derivative index j = " << j);
1749 libmesh_error_msg(
"Invalid element type = " << type);
1814 const Real eps = 1.e-6;
1816 libmesh_assert_less (i, 64);
1817 libmesh_assert_less (j, 3);
1824 const Point pp(p(0)+eps, p(1), p(2));
1825 const Point pm(p(0)-eps, p(1), p(2));
1834 const Point pp(p(0), p(1)+eps, p(2));
1835 const Point pm(p(0), p(1)-eps, p(2));
1843 const Point pp(p(0), p(1), p(2)+eps);
1844 const Point pm(p(0), p(1), p(2)-eps);
1850 libmesh_error_msg(
"Invalid derivative index j = " << j);
2376 libmesh_error_msg(
"Invalid element type = " << type);
2389 const Real eps = 1.e-6;
2391 libmesh_assert_less (i, 125);
2392 libmesh_assert_less (j, 3);
2399 const Point pp(p(0)+eps, p(1), p(2));
2400 const Point pm(p(0)-eps, p(1), p(2));
2409 const Point pp(p(0), p(1)+eps, p(2));
2410 const Point pm(p(0), p(1)-eps, p(2));
2418 const Point pp(p(0), p(1), p(2)+eps);
2419 const Point pm(p(0), p(1), p(2)-eps);
2425 libmesh_error_msg(
"Invalid derivative index j = " << j);
2950 libmesh_error_msg(
"Invalid element type = " << type);
2956 libmesh_error_msg(
"Invalid totalorder = " << totalorder);
2971 static bool warning_given =
false;
2974 libMesh::err <<
"Second derivatives for Bernstein elements " 2975 <<
"are not yet implemented!" 2978 warning_given =
true;
2991 static bool warning_given =
false;
2994 libMesh::err <<
"Second derivatives for Bernstein elements " 2995 <<
"are not yet implemented!" 2998 warning_given =
true;
3006 #endif //LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
static OutputShape shape(const ElemType t, const Order o, const unsigned int i, const Point &p)
The base class for all geometric element types.
static OutputShape shape_deriv(const ElemType t, const Order o, const unsigned int i, const unsigned int j, const Point &p)
unsigned int p_level() const
Template class which generates the different FE families and orders.
OStreamProxy err(std::cerr)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual ElemType type() const =0
long double min(long double a, double b)
A geometric point in (x,y,z) space.
const Point & point(const unsigned int i) const
static OutputShape shape_second_deriv(const ElemType t, const Order o, const unsigned int i, const unsigned int j, const Point &p)