21 #include "libmesh/fe_interface.h" 23 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 24 #include "libmesh/fe_interface_macros.h" 25 #include "libmesh/inf_fe.h" 28 #include "libmesh/elem.h" 29 #include "libmesh/fe.h" 30 #include "libmesh/fe_compute_data.h" 31 #include "libmesh/dof_map.h" 32 #include "libmesh/enum_fe_family.h" 33 #include "libmesh/enum_order.h" 34 #include "libmesh/enum_elem_type.h" 35 #include "libmesh/enum_to_string.h" 44 libmesh_error_msg(
"ERROR: Do not define an object of this type.");
49 #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS 80 #endif //ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS 82 #define fe_family_case_func(family, dim, func_and_args, prefix, suffix) \ 84 prefix FE<dim,family>::func_and_args suffix \ 86 #define fe_family_case(family) \ 89 #define fe_family_scalar_case_func(dim, func_and_args, prefix, suffix) \ 90 fe_family_case_func(CLOUGH, dim, func_and_args, prefix, suffix) \ 91 fe_family_case_func(HERMITE, dim, func_and_args, prefix, suffix) \ 92 fe_family_case_func(HIERARCHIC, dim, func_and_args, prefix, suffix) \ 93 fe_family_case_func(L2_HIERARCHIC, dim, func_and_args, prefix, suffix) \ 94 fe_family_case_func(SIDE_HIERARCHIC, dim, func_and_args, prefix, suffix) \ 95 fe_family_case_func(LAGRANGE, dim, func_and_args, prefix, suffix) \ 96 fe_family_case_func(L2_LAGRANGE, dim, func_and_args, prefix, suffix) \ 97 fe_family_case_func(MONOMIAL, dim, func_and_args, prefix, suffix) \ 98 fe_family_case_func(SCALAR, dim, func_and_args, prefix, suffix) \ 99 fe_family_case_func(XYZ, dim, func_and_args, prefix, suffix) \ 100 fe_family_case_func(SUBDIVISION, 2, func_and_args, \ 101 libmesh_assert_equal_to (dim, 2); prefix, suffix) 103 #define fe_family_scalar_case() \ 104 fe_family_case(CLOUGH) \ 105 fe_family_case(HERMITE) \ 106 fe_family_case(HIERARCHIC) \ 107 fe_family_case(L2_HIERARCHIC) \ 108 fe_family_case(SIDE_HIERARCHIC) \ 109 fe_family_case(LAGRANGE) \ 110 fe_family_case(L2_LAGRANGE) \ 111 fe_family_case(MONOMIAL) \ 112 fe_family_case(SCALAR) \ 113 fe_family_case(XYZ) \ 114 fe_family_case(SUBDIVISION) \ 116 #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES 118 #define fe_family_horder_case_func(dim, func_and_args, prefix, suffix) \ 119 fe_family_case_func(BERNSTEIN, dim, func_and_args, prefix, suffix) \ 120 fe_family_case_func(SZABAB, dim, func_and_args, prefix, suffix) \ 121 fe_family_case_func(RATIONAL_BERNSTEIN, dim, func_and_args, prefix, suffix) \ 123 #define fe_family_horder_case() \ 124 fe_family_case(BERNSTEIN) \ 125 fe_family_case(SZABAB) \ 126 fe_family_case(RATIONAL_BERNSTEIN) \ 130 #define fe_family_horder_case_func(dim, func_and_args, prefix, suffix) 131 #define fe_family_horder_case() 135 #define fe_family_vector_case_func(dim, func_and_args, prefix, suffix) \ 136 fe_family_case_func(HIERARCHIC_VEC, dim, func_and_args, prefix, suffix) \ 137 fe_family_case_func(L2_HIERARCHIC_VEC, dim, func_and_args, prefix, suffix) \ 138 fe_family_case_func(LAGRANGE_VEC, dim, func_and_args, prefix, suffix) \ 139 fe_family_case_func(L2_LAGRANGE_VEC, dim, func_and_args, prefix, suffix) \ 140 fe_family_case_func(MONOMIAL_VEC, dim, func_and_args, prefix, suffix) \ 141 fe_family_case_func(NEDELEC_ONE, dim, func_and_args, prefix, suffix) \ 142 fe_family_case_func(RAVIART_THOMAS, dim, func_and_args, prefix, suffix) \ 143 fe_family_case_func(L2_RAVIART_THOMAS, dim, func_and_args, prefix, suffix) \ 145 #define fe_family_vector_case() \ 146 fe_family_case(HIERARCHIC_VEC) \ 147 fe_family_case(L2_HIERARCHIC_VEC) \ 148 fe_family_case(LAGRANGE_VEC) \ 149 fe_family_case(L2_LAGRANGE_VEC) \ 150 fe_family_case(MONOMIAL_VEC) \ 151 fe_family_case(NEDELEC_ONE) \ 152 fe_family_case(RAVIART_THOMAS) \ 153 fe_family_case(L2_RAVIART_THOMAS) \ 155 #define fe_family_switch(dim, func_and_args, prefix, suffix) \ 157 switch (fe_t.family) \ 159 fe_family_scalar_case_func(dim, func_and_args, prefix, suffix) \ 160 fe_family_horder_case_func(dim, func_and_args, prefix, suffix) \ 162 libmesh_error_msg("Unsupported family = " << Utility::enum_to_string(fe_t.family)); \ 166 #define fe_family_with_vec_switch(dim, func_and_args, prefix, suffix) \ 168 switch (fe_t.family) \ 170 fe_family_scalar_case_func(dim, func_and_args, prefix, suffix) \ 171 fe_family_horder_case_func(dim, func_and_args, prefix, suffix) \ 172 fe_family_vector_case_func(dim, func_and_args, prefix, suffix) \ 174 libmesh_error_msg("Unsupported family = " << Utility::enum_to_string(fe_t.family)); \ 178 #define fe_scalar_vec_error_switch(dim, func_and_args, prefix, suffix) \ 180 switch (fe_t.family) \ 182 fe_family_scalar_case_func(dim, func_and_args, prefix, suffix) \ 183 fe_family_horder_case_func(dim, func_and_args, prefix, suffix) \ 184 fe_family_vector_case() \ 185 libmesh_error_msg("Error: Can only request scalar valued elements for Real FEInterface::func_and_args"); \ 187 libmesh_error_msg("Unsupported family = " << Utility::enum_to_string(fe_t.family)); \ 192 #define fe_vector_scalar_error_switch(dim, func_and_args, prefix, suffix) \ 194 switch (fe_t.family) \ 196 fe_family_vector_case_func(dim, func_and_args, prefix, suffix) \ 197 fe_family_scalar_case() \ 198 fe_family_horder_case() \ 199 libmesh_error_msg("Error: Can only request vector valued elements for RealGradient FEInterface::func_and_args"); \ 201 libmesh_error_msg("Unsupported family = " << Utility::enum_to_string(fe_t.family)); \ 206 #define fe_switch(func_and_args) \ 212 fe_family_switch (0, func_and_args, return, ;); \ 215 fe_family_switch (1, func_and_args, return, ;); \ 218 fe_family_switch (2, func_and_args, return, ;); \ 221 fe_family_switch (3, func_and_args, return, ;); \ 223 libmesh_error_msg("Invalid dim = " << dim); \ 227 #define fe_with_vec_switch(func_and_args) \ 233 fe_family_with_vec_switch (0, func_and_args, return, ;); \ 236 fe_family_with_vec_switch (1, func_and_args, return, ;); \ 239 fe_family_with_vec_switch (2, func_and_args, return, ;); \ 242 fe_family_with_vec_switch (3, func_and_args, return, ;); \ 244 libmesh_error_msg("Invalid dim = " << dim); \ 248 #define void_fe_with_vec_switch(func_and_args) \ 254 fe_family_with_vec_switch (0, func_and_args, , ; return;); \ 257 fe_family_with_vec_switch (1, func_and_args, , ; return;); \ 260 fe_family_with_vec_switch (2, func_and_args, , ; return;); \ 263 fe_family_with_vec_switch (3, func_and_args, , ; return;); \ 265 libmesh_error_msg("Invalid dim = " << dim); \ 271 #ifdef LIBMESH_ENABLE_DEPRECATED 276 libmesh_deprecated();
278 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 284 libmesh_not_implemented();
292 #endif // LIBMESH_ENABLE_DEPRECATED 299 const bool add_p_level)
304 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 317 auto total_order = fe_t.
order + add_p_level*elem->
p_level();
319 fe_with_vec_switch(
n_dofs(elem, total_order));
326 const int extra_order,
332 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 345 auto total_order = fe_t.
order + extra_order;
347 fe_with_vec_switch(
n_dofs(elem, total_order));
352 #ifdef LIBMESH_ENABLE_DEPRECATED 357 libmesh_deprecated();
359 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 365 libmesh_not_implemented();
371 fe_with_vec_switch(
n_dofs(t, o));
382 libmesh_deprecated();
386 #endif // LIBMESH_ENABLE_DEPRECATED 393 const bool add_p_level)
398 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 420 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 429 auto total_order = fe_t.
order + extra_order;
431 fe_with_vec_switch(
n_dofs(elem, total_order));
436 #ifdef LIBMESH_ENABLE_DEPRECATED 440 const unsigned int n)
442 libmesh_deprecated();
444 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 462 libmesh_deprecated();
466 #endif // LIBMESH_ENABLE_DEPRECATED 485 const unsigned int n,
486 const bool add_p_level)
491 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 499 auto total_order = fe_t.
order + add_p_level*elem->
p_level();
508 const int extra_order,
510 const unsigned int n)
515 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 523 auto total_order = fe_t.
order + extra_order;
530 #ifdef LIBMESH_ENABLE_DEPRECATED 535 libmesh_deprecated();
537 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 548 #endif // LIBMESH_ENABLE_DEPRECATED 555 const bool add_p_level)
560 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 568 auto total_order = fe_t.
order + add_p_level*elem->
p_level();
577 const int extra_order,
583 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 591 auto total_order = fe_t.
order + extra_order;
599 const unsigned int dim,
602 std::vector<unsigned int> & di,
603 const bool add_p_level)
607 void_fe_with_vec_switch(
dofs_on_side(elem, o, s, di, add_p_level));
613 const unsigned int dim,
616 std::vector<unsigned int> & di,
617 const bool add_p_level)
621 void_fe_with_vec_switch(
dofs_on_edge(elem, o, e, di, add_p_level));
629 const std::vector<Number> & elem_soln,
630 std::vector<Number> & nodal_soln,
631 const bool add_p_level,
632 const unsigned int vdim)
634 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 653 const unsigned int side,
654 const std::vector<Number> & elem_soln,
655 std::vector<Number> & nodal_soln,
656 const bool add_p_level,
657 const unsigned int vdim)
659 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 663 libmesh_not_implemented();
670 const unsigned int dim = elem->
dim();
677 #ifdef LIBMESH_ENABLE_DEPRECATED 683 libmesh_deprecated();
684 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 688 fe_with_vec_switch(
map(elem, p));
697 const Real tolerance,
700 libmesh_deprecated();
701 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 708 fe_with_vec_switch(
inverse_map(elem, p, tolerance, secure));
716 const std::vector<Point> & physical_points,
717 std::vector<Point> & reference_points,
718 const Real tolerance,
721 libmesh_deprecated();
723 const std::size_t n_pts = physical_points.size();
726 reference_points.resize(n_pts);
730 libMesh::err <<
"WARNING: empty vector physical_points!" 736 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 747 void_fe_with_vec_switch(
inverse_map(elem, physical_points, reference_points, tolerance, secure));
764 const unsigned int i,
767 libmesh_deprecated();
769 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 778 fe_switch(
shape(t,o,i,p));
784 const unsigned int i,
787 libmesh_deprecated();
789 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 798 fe_switch(
shape(elem,o,i,p));
800 #endif // LIBMESH_ENABLE_DEPRECATED 807 const unsigned int i,
809 const bool add_p_level)
814 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 826 fe_switch(
shape(elem, fe_t.
order, i, p, add_p_level));
835 const unsigned int i,
841 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 855 auto total_order = fe_t.
order + extra_order;
857 fe_switch(
shape(elem, total_order, i, p,
false));
862 #ifdef LIBMESH_ENABLE_DEPRECATED 864 void FEInterface::shape<Real>(
const unsigned int dim,
867 const unsigned int i,
871 libmesh_deprecated();
873 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 875 if (is_InfFE_elem(t))
877 phi = ifem_shape(
dim, fe_t, t, i, p);
883 const Order o = fe_t.order;
888 fe_scalar_vec_error_switch(0, shape(t,o,i,p), phi = , ;
break;);
891 fe_scalar_vec_error_switch(1, shape(t,o,i,p), phi = , ;
break;);
894 fe_scalar_vec_error_switch(2, shape(t,o,i,p), phi = , ;
break;);
897 fe_scalar_vec_error_switch(3, shape(t,o,i,p), phi = , ;
break;);
900 libmesh_error_msg(
"Invalid dimension = " <<
dim);
909 void FEInterface::shape<Real>(
const unsigned int dim,
912 const unsigned int i,
916 libmesh_deprecated();
918 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 920 if (elem && is_InfFE_elem(elem->type()))
922 phi = ifem_shape(fe_t, elem, i, p);
927 const Order o = fe_t.order;
932 fe_scalar_vec_error_switch(0, shape(elem,o,i,p), phi = , ;
break;);
935 fe_scalar_vec_error_switch(1, shape(elem,o,i,p), phi = , ;
break;);
938 fe_scalar_vec_error_switch(2, shape(elem,o,i,p), phi = , ;
break;);
941 fe_scalar_vec_error_switch(3, shape(elem,o,i,p), phi = , ;
break;);
944 libmesh_error_msg(
"Invalid dimension = " <<
dim);
949 #endif // LIBMESH_ENABLE_DEPRECATED 954 void FEInterface::shape<Real>(
const FEType & fe_t,
956 const unsigned int i,
961 auto dim = elem->dim();
963 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 965 if (is_InfFE_elem(elem->type()))
967 phi = ifem_shape(fe_t, elem, i, p);
978 fe_scalar_vec_error_switch(0, shape(elem, fe_t.order, i, p,
true), phi = , ;
break;);
981 fe_scalar_vec_error_switch(1, shape(elem, fe_t.order, i, p,
true), phi = , ;
break;);
984 fe_scalar_vec_error_switch(2, shape(elem, fe_t.order, i, p,
true), phi = , ;
break;);
987 fe_scalar_vec_error_switch(3, shape(elem, fe_t.order, i, p,
true), phi = , ;
break;);
990 libmesh_error_msg(
"Invalid dimension = " <<
dim);
997 void FEInterface::shape<Real>(
const FEType & fe_t,
1000 const unsigned int i,
1005 auto dim = elem->dim();
1007 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1009 if (is_InfFE_elem(elem->type()))
1011 phi = ifem_shape(fe_t, elem, i, p);
1018 auto total_order = fe_t.order + extra_order;
1029 fe_scalar_vec_error_switch(0, shape(elem, total_order, i, p,
false), phi = , ;
break;);
1032 fe_scalar_vec_error_switch(1, shape(elem, total_order, i, p,
false), phi = , ;
break;);
1035 fe_scalar_vec_error_switch(2, shape(elem, total_order, i, p,
false), phi = , ;
break;);
1038 fe_scalar_vec_error_switch(3, shape(elem, total_order, i, p,
false), phi = , ;
break;);
1041 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1048 void FEInterface::shapes<Real>(
const unsigned int dim,
1051 const unsigned int i,
1052 const std::vector<Point> & p,
1053 std::vector<Real> & phi,
1054 const bool add_p_level)
1056 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1058 if (elem && is_InfFE_elem(elem->type()))
1061 elevated.
order = fe_t.order + add_p_level * elem->p_level();
1063 phi[qpi] = ifem_shape(elevated, elem, i, p[qpi]);
1068 const Order o = fe_t.order;
1073 fe_scalar_vec_error_switch(0, shapes(elem,o,i,p,phi,add_p_level), , ;
return;);
1076 fe_scalar_vec_error_switch(1, shapes(elem,o,i,p,phi,add_p_level), , ;
return;);
1079 fe_scalar_vec_error_switch(2, shapes(elem,o,i,p,phi,add_p_level), , ;
return;);
1082 fe_scalar_vec_error_switch(3, shapes(elem,o,i,p,phi,add_p_level), , ;
return;);
1085 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1093 void FEInterface::all_shapes<Real>(
const unsigned int dim,
1096 const std::vector<Point> & p,
1097 std::vector<std::vector<Real>> & phi,
1098 const bool add_p_level)
1100 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1102 if (elem && is_InfFE_elem(elem->type()))
1105 FEInterface::shapes<Real>(
dim, fe_t, elem, i, p, phi[i], add_p_level);
1110 const Order o = fe_t.order;
1115 fe_scalar_vec_error_switch(0, all_shapes(elem,o,p,phi,add_p_level), , ;
return;);
1118 fe_scalar_vec_error_switch(1, all_shapes(elem,o,p,phi,add_p_level), , ;
return;);
1121 fe_scalar_vec_error_switch(2, all_shapes(elem,o,p,phi,add_p_level), , ;
return;);
1124 fe_scalar_vec_error_switch(3, all_shapes(elem,o,p,phi,add_p_level), , ;
return;);
1127 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1135 #ifdef LIBMESH_ENABLE_DEPRECATED 1137 void FEInterface::shape<RealGradient>(
const unsigned int dim,
1140 const unsigned int i,
1144 libmesh_deprecated();
1147 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1148 if (is_InfFE_elem(t))
1150 libmesh_not_implemented();
1153 const Order o = fe_t.order;
1158 fe_vector_scalar_error_switch(0, shape(t,o,i,p), phi = , ;
break;);
1161 fe_vector_scalar_error_switch(1, shape(t,o,i,p), phi = , ;
break;);
1164 fe_vector_scalar_error_switch(2, shape(t,o,i,p), phi = , ;
break;);
1167 fe_vector_scalar_error_switch(3, shape(t,o,i,p), phi = , ;
break;);
1170 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1173 #endif // LIBMESH_ENABLE_DEPRECATED 1178 void FEInterface::shape<RealGradient>(
const FEType & fe_t,
1180 const unsigned int i,
1185 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1186 if (is_InfFE_elem(elem->type()))
1188 libmesh_not_implemented();
1192 auto dim = elem->dim();
1204 fe_vector_scalar_error_switch(0, shape(elem, fe_t.order, i, p,
true), phi = , ;
break;);
1207 fe_vector_scalar_error_switch(1, shape(elem, fe_t.order, i, p,
true), phi = , ;
break;);
1210 fe_vector_scalar_error_switch(2, shape(elem, fe_t.order, i, p,
true), phi = , ;
break;);
1213 fe_vector_scalar_error_switch(3, shape(elem, fe_t.order, i, p,
true), phi = , ;
break;);
1216 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1223 void FEInterface::shape<RealGradient>(
const FEType & fe_t,
1226 const unsigned int i,
1231 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1232 if (is_InfFE_elem(elem->type()))
1234 libmesh_not_implemented();
1238 auto dim = elem->dim();
1247 auto total_order = fe_t.order + extra_order;
1252 fe_vector_scalar_error_switch(0, shape(elem, total_order, i, p,
false), phi = , ;
break;);
1255 fe_vector_scalar_error_switch(1, shape(elem, total_order, i, p,
false), phi = , ;
break;);
1258 fe_vector_scalar_error_switch(2, shape(elem, total_order, i, p,
false), phi = , ;
break;);
1261 fe_vector_scalar_error_switch(3, shape(elem, total_order, i, p,
false), phi = , ;
break;);
1264 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1271 void FEInterface::shapes<RealGradient>(
const unsigned int dim,
1274 const unsigned int i,
1275 const std::vector<Point> & p,
1276 std::vector<RealGradient> & phi,
1277 const bool add_p_level)
1280 if (elem->infinite())
1281 libmesh_not_implemented();
1283 const Order o = fe_t.order;
1288 fe_vector_scalar_error_switch(0, shapes(elem,o,i,p,phi,add_p_level), , ;
return;);
1291 fe_vector_scalar_error_switch(1, shapes(elem,o,i,p,phi,add_p_level), , ;
return;);
1294 fe_vector_scalar_error_switch(2, shapes(elem,o,i,p,phi,add_p_level), , ;
return;);
1297 fe_vector_scalar_error_switch(3, shapes(elem,o,i,p,phi,add_p_level), , ;
return;);
1300 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1309 void FEInterface::all_shapes<RealGradient>(
const unsigned int dim,
1312 const std::vector<Point> & p,
1313 std::vector<std::vector<RealGradient>> & phi,
1314 const bool add_p_level)
1317 if (elem->infinite())
1318 libmesh_not_implemented();
1320 const Order o = fe_t.order;
1325 fe_vector_scalar_error_switch(0, all_shapes(elem,o,p,phi,add_p_level), , ;
return;);
1328 fe_vector_scalar_error_switch(1, all_shapes(elem,o,p,phi,add_p_level), , ;
return;);
1331 fe_vector_scalar_error_switch(2, all_shapes(elem,o,p,phi,add_p_level), , ;
return;);
1334 fe_vector_scalar_error_switch(3, all_shapes(elem,o,p,phi,add_p_level), , ;
return;);
1337 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1344 #ifdef LIBMESH_ENABLE_DEPRECATED 1350 libmesh_deprecated();
1352 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1355 inf_fe_switch(
shape);
1360 #endif // LIBMESH_ENABLE_DEPRECATED 1371 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1373 inf_fe_switch(
shape);
1380 #ifdef LIBMESH_ENABLE_DEPRECATED 1384 const unsigned int i,
1385 const unsigned int j,
1388 libmesh_deprecated();
1390 libmesh_assert_greater (
dim,j);
1391 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1408 const unsigned int i,
1409 const unsigned int j,
1412 libmesh_deprecated();
1414 libmesh_assert_greater (
dim,j);
1415 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1428 fe_family_switch (0,
shape_deriv(elem, o, i, j, p),
return , ;);
1430 fe_family_switch (1,
shape_deriv(elem, o, i, j, p),
return , ;);
1432 fe_family_switch (2,
shape_deriv(elem, o, i, j, p),
return , ;);
1434 fe_family_switch (3,
shape_deriv(elem, o, i, j, p),
return , ;);
1436 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1440 #endif // LIBMESH_ENABLE_DEPRECATED 1446 const unsigned int i,
1447 const unsigned int j,
1452 libmesh_assert_greater (
dim, j);
1453 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1475 const unsigned int i,
1476 const unsigned int j,
1481 libmesh_assert_greater (
dim, j);
1482 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1492 auto total_order = fe_t.
order + extra_order;
1499 fe_family_switch (0,
shape_deriv(elem, total_order, i, j, p,
false),
return , ;);
1501 fe_family_switch (1,
shape_deriv(elem, total_order, i, j, p,
false),
return , ;);
1503 fe_family_switch (2,
shape_deriv(elem, total_order, i, j, p,
false),
return , ;);
1505 fe_family_switch (3,
shape_deriv(elem, total_order, i, j, p,
false),
return , ;);
1507 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1517 void FEInterface::shape_derivs<Real>(
const FEType & fe_t,
1519 const unsigned int i,
1520 const unsigned int j,
1521 const std::vector<Point> & p,
1522 std::vector<Real> & dphi,
1523 const bool add_p_level)
1525 const Order o = fe_t.order;
1530 fe_scalar_vec_error_switch(0, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ;
break;);
1533 fe_scalar_vec_error_switch(1, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ;
break;);
1536 fe_scalar_vec_error_switch(2, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ;
break;);
1539 fe_scalar_vec_error_switch(3, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ;
break;);
1542 libmesh_error_msg(
"Invalid dimension = " << elem->dim());
1553 void FEInterface::all_shape_derivs<Real>(
const unsigned int dim,
1556 const std::vector<Point> & p,
1557 std::vector<std::vector<Real>> * comps[3],
1558 const bool add_p_level)
1560 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1562 if (elem && is_InfFE_elem(elem->type()))
1566 FEInterface::shape_derivs<Real>(fe_t, elem, i, j, p, (*comps[j])[i], add_p_level);
1571 const Order o = fe_t.order;
1576 fe_scalar_vec_error_switch(0, all_shape_derivs(elem,o,p,comps,add_p_level), , ;
return;);
1579 fe_scalar_vec_error_switch(1, all_shape_derivs(elem,o,p,comps,add_p_level), , ;
return;);
1582 fe_scalar_vec_error_switch(2, all_shape_derivs(elem,o,p,comps,add_p_level), , ;
return;);
1585 fe_scalar_vec_error_switch(3, all_shape_derivs(elem,o,p,comps,add_p_level), , ;
return;);
1588 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1597 void FEInterface::shape_derivs<RealGradient>(
const FEType & fe_t,
1599 const unsigned int i,
1600 const unsigned int j,
1601 const std::vector<Point> & p,
1602 std::vector<RealGradient> & dphi,
1603 const bool add_p_level)
1605 const Order o = fe_t.order;
1610 fe_vector_scalar_error_switch(0, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ;
break;);
1613 fe_vector_scalar_error_switch(1, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ;
break;);
1616 fe_vector_scalar_error_switch(2, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ;
break;);
1619 fe_vector_scalar_error_switch(3, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ;
break;);
1622 libmesh_error_msg(
"Invalid dimension = " << elem->dim());
1630 #ifdef LIBMESH_ENABLE_DEPRECATED 1636 libmesh_deprecated();
1638 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1646 #endif // LIBMESH_ENABLE_DEPRECATED 1657 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1667 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 1668 #ifdef LIBMESH_ENABLE_DEPRECATED 1672 const unsigned int i,
1673 const unsigned int j,
1676 libmesh_deprecated();
1678 libmesh_assert_greater_equal (
dim*(
dim-1),j);
1679 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1681 libmesh_not_implemented();
1697 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1706 const unsigned int i,
1707 const unsigned int j,
1710 libmesh_deprecated();
1712 libmesh_assert_greater_equal (
dim*(
dim-1),j);
1715 libmesh_not_implemented();
1730 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1734 #endif // LIBMESH_ENABLE_DEPRECATED 1740 const unsigned int i,
1741 const unsigned int j,
1746 libmesh_assert_greater_equal (
dim*(
dim-1),j);
1747 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1749 libmesh_not_implemented();
1766 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1778 const unsigned int i,
1779 const unsigned int j,
1784 libmesh_assert_greater_equal (
dim*(
dim-1),j);
1787 libmesh_not_implemented();
1791 auto total_order = fe_t.
order + extra_order;
1799 fe_family_switch (0,
shape_second_deriv(elem, total_order, i, j, p,
false),
return , ;);
1801 fe_family_switch (1,
shape_second_deriv(elem, total_order, i, j, p,
false),
return , ;);
1803 fe_family_switch (2,
shape_second_deriv(elem, total_order, i, j, p,
false),
return , ;);
1805 fe_family_switch (3,
shape_second_deriv(elem, total_order, i, j, p,
false),
return , ;);
1807 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1816 #ifdef LIBMESH_ENABLE_DEPRECATED 1822 libmesh_deprecated();
1824 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1826 libmesh_not_implemented();
1830 #endif // LIBMESH_ENABLE_DEPRECATED 1840 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1842 libmesh_not_implemented();
1847 #endif //LIBMESH_ENABLE_SECOND_DERIVATIVES 1850 #ifdef LIBMESH_ENABLE_DEPRECATED 1852 void FEInterface::shape<RealGradient>(
const unsigned int dim,
1855 const unsigned int i,
1859 libmesh_deprecated();
1862 if (elem->infinite())
1863 libmesh_not_implemented();
1865 const Order o = fe_t.order;
1870 fe_vector_scalar_error_switch(0, shape(elem,o,i,p), phi = , ;
break;);
1873 fe_vector_scalar_error_switch(1, shape(elem,o,i,p), phi = , ;
break;);
1876 fe_vector_scalar_error_switch(2, shape(elem,o,i,p), phi = , ;
break;);
1879 fe_vector_scalar_error_switch(3, shape(elem,o,i,p), phi = , ;
break;);
1882 libmesh_error_msg(
"Invalid dimension = " <<
dim);
1887 #endif // LIBMESH_ENABLE_DEPRECATED 1895 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 1906 const unsigned int n_dof =
n_dofs (fe_t, elem);
1907 const Point & p = data.
p;
1908 data.
shape.resize(n_dof);
1912 data.
dshape.resize(n_dof);
1915 for (
unsigned int d=0; d<
dim; d++)
1919 std::vector<Point> pt = {p};
1921 fe->reinit(elem, &pt);
1944 for (
unsigned int n=0; n<n_dof; n++)
1954 for (
unsigned int j=0; j<
dim; j++)
1962 #ifdef LIBMESH_ENABLE_AMR 1966 const unsigned int variable_number,
1973 switch (elem->
dim())
2090 libmesh_error_msg(
"Invalid dimension = " << elem->
dim());
2094 #endif // #ifdef LIBMESH_ENABLE_AMR 2098 #ifdef LIBMESH_ENABLE_PERIODIC 2105 const unsigned int variable_number,
2116 constraints, dof_map, boundaries,
mesh, point_locator, variable_number, elem);
2120 constraints, dof_map, boundaries,
mesh, point_locator, variable_number, elem);
2124 "compute_periodic_constraints only set up for vector or scalar FEFieldTypes");
2128 #endif // #ifdef LIBMESH_ENABLE_PERIODIC 2139 const unsigned int unlimited = 11;
2143 const unsigned int unknown = unlimited;
2246 #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES 2637 fe_family_horder_case()
2652 fe_family_vector_case()
Real(* shape_deriv_ptr)(const FEType fet, const Elem *elem, const unsigned int i, const unsigned int j, const Point &p, const bool add_p_level)
Typedef for pointer to a function that returns FE shape function derivative values.
static unsigned int n_dofs_per_elem(const unsigned int dim, const FEType &fe_t, const ElemType t)
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
FEFamily family
The type of finite element.
static Point map(unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p)
This is now deprecated; use FEMap::map instead.
bool need_derivative()
Check whether derivatives should be computed or not.
ElemType
Defines an enum for geometric element types.
Order
defines an enum for polynomial orders.
static unsigned int n_dofs(const unsigned int dim, const FEType &fe_t, const ElemType t)
static shape_ptr shape_function(const unsigned int dim, const FEType &fe_t, const ElemType t)
static Real shape_deriv(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const unsigned int j, const Point &p)
static Real ifem_shape(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const Point &p)
class FEComputeData hides arbitrary data to be passed to and from children of FEBase through the FEIn...
We're using a class instead of a typedef to allow forward declarations and future flexibility...
const Point & p
Holds the point where the data are to be computed.
static unsigned int ifem_n_shape_functions(const FEType &fe_t, const Elem *elem)
static void dofs_on_edge(const Elem *const elem, const unsigned int dim, const FEType &fe_t, unsigned int e, std::vector< unsigned int > &di, const bool add_p_level=true)
Fills the vector di with the local degree of freedom indices associated with edge e of element elem A...
This is the base class from which all geometric element types are derived.
static FEFieldType field_type(const FEType &fe_type)
std::vector< Gradient > dshape
Storage for the computed shape derivative values.
unsigned int p_level() const
OrderWrapper order
The approximation order of the element (at 0 p-refinement level).
std::vector< std::vector< Real > > local_transform
Storage for local to global mapping at p.
The libMesh namespace provides an interface to certain functionality in the library.
static Point ifem_inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
void init()
Inits the output data to default values, provided the fields are correctly resized.
static unsigned int max_order(const FEType &fe_t, const ElemType &el_t)
static bool on_reference_element(const Point &p, const ElemType t, const Real eps=TOLERANCE)
static void side_nodal_soln(const FEType &fe_t, const Elem *elem, const unsigned int side, const std::vector< Number > &elem_soln, std::vector< Number > &nodal_soln, const bool add_p_level=true, const unsigned int vdim=1)
Build the nodal soln on one side from the (full) element soln.
This is the MeshBase class.
static bool orientation_dependent(const FEFamily &fe_family)
static void compute_constraints(DofConstraints &constraints, DofMap &dof_map, const unsigned int variable_number, const Elem *elem)
Computes the constraint matrix contributions (for non-conforming adapted meshes) corresponding to var...
This class handles the numbering of degrees of freedom on a mesh.
FEInterface()
Empty constructor.
static void ifem_compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
static bool extra_hanging_dofs(const FEType &fe_t)
static unsigned int n_shape_functions(const unsigned int dim, const FEType &fe_t, const ElemType t)
static Real shape(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const Point &p)
static void compute_data(const unsigned int dim, const FEType &fe_t, const Elem *elem, FEComputeData &data)
Lets the appropriate child of FEBase compute the requested data for the input specified in data...
static bool is_hierarchic(const FEType &fe_type)
Returns whether or not the input FEType's higher-order shape functions are always hierarchic...
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
const FEType & variable_type(const unsigned int i) const
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
This is now deprecated; use FEMap::inverse_map instead.
static Point ifem_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p)
This is the base class for point locators.
static void ifem_nodal_soln(const unsigned int dim, const FEType &fe_t, const Elem *elem, const std::vector< Number > &elem_soln, std::vector< Number > &nodal_soln)
static bool on_reference_element(const Point &p, const ElemType t, const Real eps=TOLERANCE)
static shape_deriv_ptr shape_deriv_function(const unsigned int dim, const FEType &fe_t, const ElemType t)
static unsigned int ifem_n_dofs_per_elem(const unsigned int dim, const FEType &fe_t, const ElemType t)
static unsigned int n_vec_dim(const MeshBase &mesh, const FEType &fe_type)
std::vector< Number > shape
Storage for the computed shape function values.
static n_dofs_at_node_ptr n_dofs_at_node_function(const unsigned int dim, const FEType &fe_t)
static void compute_periodic_constraints(DofConstraints &constraints, DofMap &dof_map, const PeriodicBoundaries &boundaries, const MeshBase &mesh, const PointLocatorBase *point_locator, const unsigned int variable_number, const Elem *elem)
Computes the constraint matrix contributions (for meshes with periodic boundary conditions) correspon...
std::string enum_to_string(const T e)
static FEContinuity get_continuity(const FEType &fe_type)
Returns the input FEType's FEContinuity based on the underlying FEFamily and potentially the Order...
static void compute_constraints(DofConstraints &constraints, DofMap &dof_map, const unsigned int variable_number, const Elem *elem)
Computes the constraint matrix contributions (for non-conforming adapted meshes) corresponding to var...
static unsigned int n_dofs_at_node(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int n)
static Real shape_second_deriv(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const unsigned int j, const Point &p)
Real(* shape_ptr)(const FEType fe_t, const Elem *elem, const unsigned int i, const Point &p, const bool add_p_level)
Typedef for pointer to a function that returns FE shape function values.
unsigned int(* n_dofs_at_node_ptr)(const ElemType, const Order, const unsigned int)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static shape_second_deriv_ptr shape_second_deriv_function(const unsigned int dim, const FEType &fe_t, const ElemType t)
virtual unsigned short dim() const =0
FEContinuity
defines an enum for finite element types to libmesh_assert a certain level (or type? Hcurl?) of continuity.
static unsigned int ifem_n_dofs(const FEType &fe_t, const Elem *elem)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
static bool is_InfFE_elem(const ElemType et)
Real(* shape_second_deriv_ptr)(const FEType fet, const Elem *elem, const unsigned int i, const unsigned int j, const Point &p, const bool add_p_level)
Typedef for pointer to a function that returns FE shape function second derivative values...
virtual bool infinite() const =0
FEFamily
defines an enum for finite element families.
static void nodal_soln(const unsigned int dim, const FEType &fe_t, const Elem *elem, const std::vector< Number > &elem_soln, std::vector< Number > &nodal_soln, const bool add_p_level=true, const unsigned int vdim=1)
Build the nodal soln from the element soln.
static void compute_periodic_constraints(DofConstraints &constraints, DofMap &dof_map, const PeriodicBoundaries &boundaries, const MeshBase &mesh, const PointLocatorBase *point_locator, const unsigned int variable_number, const Elem *elem)
Computes the constraint matrix contributions (for periodic boundary conditions) corresponding to vari...
static Real ifem_shape_deriv(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const unsigned int j, const Point &p)
virtual ElemType type() const =0
static void dofs_on_side(const Elem *const elem, const unsigned int dim, const FEType &fe_t, unsigned int s, std::vector< unsigned int > &di, const bool add_p_level=true)
Fills the vector di with the local degree of freedom indices associated with side s of element elem A...
A Point defines a location in LIBMESH_DIM dimensional Real space.
The constraint matrix storage format.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
static unsigned int ifem_n_dofs_at_node(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int n)
FEFieldType
defines an enum for finite element field types - i.e.