LCOV - code coverage report
Current view: top level - src/fe - fe_interface.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4573 (924896) with base 3f0912 Lines: 451 937 48.1 %
Date: 2026-11-18 21:52:26 Functions: 40 71 56.3 %
Legend: Lines: hit not hit

          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             : 
      19             : 
      20             : // Local includes
      21             : #include "libmesh/fe_interface.h"
      22             : #include "libmesh/fe_lagrange_gll_shape_1D.h"
      23             : 
      24             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
      25             : #include "libmesh/fe_interface_macros.h"
      26             : #include "libmesh/inf_fe.h"
      27             : #endif
      28             : 
      29             : #include "libmesh/elem.h"
      30             : #include "libmesh/fe.h"
      31             : #include "libmesh/fe_compute_data.h"
      32             : #include "libmesh/dof_map.h"
      33             : #include "libmesh/enum_fe_family.h"
      34             : #include "libmesh/enum_order.h"
      35             : #include "libmesh/enum_elem_type.h"
      36             : #include "libmesh/enum_to_string.h"
      37             : 
      38             : namespace libMesh
      39             : {
      40             : 
      41             : //------------------------------------------------------------
      42             : //FEInterface class members
      43           0 : FEInterface::FEInterface()
      44             : {
      45           0 :   libmesh_error_msg("ERROR: Do not define an object of this type.");
      46             : }
      47             : 
      48             : 
      49             : 
      50             : #ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
      51             : 
      52             : bool
      53           0 : FEInterface::is_InfFE_elem(const ElemType)
      54             : {
      55           0 :   return false;
      56             : }
      57             : 
      58             : #else
      59             : 
      60             : bool
      61  1193896219 : FEInterface::is_InfFE_elem(const ElemType et)
      62             : {
      63             : 
      64  1193896219 :   switch (et)
      65             :     {
      66      184479 :     case INFEDGE2:
      67             :     case INFQUAD4:
      68             :     case INFQUAD6:
      69             :     case INFHEX8:
      70             :     case INFHEX16:
      71             :     case INFHEX18:
      72             :     case INFPRISM6:
      73             :     case INFPRISM12:
      74      184479 :       return true;
      75             : 
      76  1193388928 :     default:
      77  1193388928 :       return false;
      78             :     }
      79             : }
      80             : 
      81             : #endif //ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
      82             : 
      83             : #define fe_family_case_func(family, dim, func_and_args, prefix, suffix) \
      84             :   case family:                                                          \
      85             :     prefix FE<dim,family>::func_and_args suffix                         \
      86             : 
      87             : #define fe_family_case(family) \
      88             :   case family:
      89             : 
      90             : #define fe_family_scalar_case_func(dim, func_and_args, prefix, suffix)     \
      91             :   fe_family_case_func(CLOUGH, dim, func_and_args, prefix, suffix)          \
      92             :   fe_family_case_func(HERMITE, dim, func_and_args, prefix, suffix)         \
      93             :   fe_family_case_func(HIERARCHIC, dim, func_and_args, prefix, suffix)      \
      94             :   fe_family_case_func(L2_HIERARCHIC, dim, func_and_args, prefix, suffix)   \
      95             :   fe_family_case_func(SIDE_HIERARCHIC, dim, func_and_args, prefix, suffix) \
      96             :   fe_family_case_func(LAGRANGE, dim, func_and_args, prefix, suffix)        \
      97             :   fe_family_case_func(L2_LAGRANGE, dim, func_and_args, prefix, suffix)     \
      98             :   fe_family_case_func(L2_LAGRANGE_GLL, dim, func_and_args, prefix, suffix) \
      99             :   fe_family_case_func(LAGRANGE_GLL, dim, func_and_args, prefix, suffix)    \
     100             :   fe_family_case_func(MONOMIAL, dim, func_and_args, prefix, suffix)        \
     101             :   fe_family_case_func(SCALAR, dim, func_and_args, prefix, suffix)          \
     102             :   fe_family_case_func(XYZ, dim, func_and_args, prefix, suffix)             \
     103             :   fe_family_case_func(SUBDIVISION, 2, func_and_args,                       \
     104             :                       libmesh_assert_equal_to (dim, 2); prefix, suffix)
     105             : 
     106             : #define fe_family_scalar_case()   \
     107             :   fe_family_case(CLOUGH)          \
     108             :   fe_family_case(HERMITE)         \
     109             :   fe_family_case(HIERARCHIC)      \
     110             :   fe_family_case(L2_HIERARCHIC)   \
     111             :   fe_family_case(SIDE_HIERARCHIC) \
     112             :   fe_family_case(LAGRANGE)        \
     113             :   fe_family_case(L2_LAGRANGE)     \
     114             :   fe_family_case(L2_LAGRANGE_GLL) \
     115             :   fe_family_case(LAGRANGE_GLL)    \
     116             :   fe_family_case(MONOMIAL)        \
     117             :   fe_family_case(SCALAR)          \
     118             :   fe_family_case(XYZ)             \
     119             :   fe_family_case(SUBDIVISION)     \
     120             : 
     121             : #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
     122             : 
     123             : #define fe_family_horder_case_func(dim, func_and_args, prefix, suffix)        \
     124             :   fe_family_case_func(BERNSTEIN, dim, func_and_args, prefix, suffix)          \
     125             :   fe_family_case_func(SZABAB, dim, func_and_args, prefix, suffix)             \
     126             :   fe_family_case_func(RATIONAL_BERNSTEIN, dim, func_and_args, prefix, suffix) \
     127             : 
     128             : #define fe_family_horder_case()      \
     129             :   fe_family_case(BERNSTEIN)          \
     130             :   fe_family_case(SZABAB)             \
     131             :   fe_family_case(RATIONAL_BERNSTEIN) \
     132             : 
     133             : #else
     134             : 
     135             : #define fe_family_horder_case_func(dim, func_and_args, prefix, suffix)
     136             : #define fe_family_horder_case()
     137             : 
     138             : #endif
     139             : 
     140             : #define fe_family_vector_case_func(dim, func_and_args, prefix, suffix)       \
     141             :   fe_family_case_func(HIERARCHIC_VEC, dim, func_and_args, prefix, suffix)    \
     142             :   fe_family_case_func(L2_HIERARCHIC_VEC, dim, func_and_args, prefix, suffix) \
     143             :   fe_family_case_func(LAGRANGE_VEC, dim, func_and_args, prefix, suffix)      \
     144             :   fe_family_case_func(L2_LAGRANGE_VEC, dim, func_and_args, prefix, suffix)   \
     145             :   fe_family_case_func(MONOMIAL_VEC, dim, func_and_args, prefix, suffix)      \
     146             :   fe_family_case_func(NEDELEC_ONE, dim, func_and_args, prefix, suffix)       \
     147             :   fe_family_case_func(RAVIART_THOMAS, dim, func_and_args, prefix, suffix)    \
     148             :   fe_family_case_func(L2_RAVIART_THOMAS, dim, func_and_args, prefix, suffix) \
     149             : 
     150             : #define fe_family_vector_case()     \
     151             :   fe_family_case(HIERARCHIC_VEC)    \
     152             :   fe_family_case(L2_HIERARCHIC_VEC) \
     153             :   fe_family_case(LAGRANGE_VEC)      \
     154             :   fe_family_case(L2_LAGRANGE_VEC)   \
     155             :   fe_family_case(MONOMIAL_VEC)      \
     156             :   fe_family_case(NEDELEC_ONE)       \
     157             :   fe_family_case(RAVIART_THOMAS)    \
     158             :   fe_family_case(L2_RAVIART_THOMAS) \
     159             : 
     160             : #define fe_family_switch(dim, func_and_args, prefix, suffix)            \
     161             :   do {                                                                  \
     162             :     switch (fe_t.family)                                                \
     163             :       {                                                                 \
     164             :       fe_family_scalar_case_func(dim, func_and_args, prefix, suffix)    \
     165             :       fe_family_horder_case_func(dim, func_and_args, prefix, suffix)    \
     166             :       default:                                                          \
     167             :         libmesh_error_msg("Unsupported family = " << Utility::enum_to_string(fe_t.family)); \
     168             :       }                                                                 \
     169             :   } while (0)
     170             : 
     171             : #define fe_family_with_vec_switch(dim, func_and_args, prefix, suffix)   \
     172             :   do {                                                                  \
     173             :     switch (fe_t.family)                                                \
     174             :       {                                                                 \
     175             :       fe_family_scalar_case_func(dim, func_and_args, prefix, suffix)    \
     176             :       fe_family_horder_case_func(dim, func_and_args, prefix, suffix)    \
     177             :       fe_family_vector_case_func(dim, func_and_args, prefix, suffix)    \
     178             :       default:                                                          \
     179             :         libmesh_error_msg("Unsupported family = " << Utility::enum_to_string(fe_t.family)); \
     180             :       }                                                                 \
     181             :   } while (0)
     182             : 
     183             : #define fe_scalar_vec_error_switch(dim, func_and_args, prefix, suffix)  \
     184             :   do {                                                                  \
     185             :     switch (fe_t.family)                                                \
     186             :       {                                                                 \
     187             :       fe_family_scalar_case_func(dim, func_and_args, prefix, suffix)    \
     188             :       fe_family_horder_case_func(dim, func_and_args, prefix, suffix)    \
     189             :       fe_family_vector_case()                                           \
     190             :         libmesh_error_msg("Error: Can only request scalar valued elements for Real FEInterface::func_and_args"); \
     191             :       default:                                                          \
     192             :         libmesh_error_msg("Unsupported family = " << Utility::enum_to_string(fe_t.family)); \
     193             :       }                                                                 \
     194             :   } while (0)
     195             : 
     196             : 
     197             : #define fe_vector_scalar_error_switch(dim, func_and_args, prefix, suffix) \
     198             :   do {                                                                    \
     199             :     switch (fe_t.family)                                                  \
     200             :       {                                                                   \
     201             :       fe_family_vector_case_func(dim, func_and_args, prefix, suffix)      \
     202             :       fe_family_scalar_case()                                             \
     203             :       fe_family_horder_case()                                             \
     204             :         libmesh_error_msg("Error: Can only request vector valued elements for RealGradient FEInterface::func_and_args"); \
     205             :       default:                                                            \
     206             :         libmesh_error_msg("Unsupported family = " << Utility::enum_to_string(fe_t.family)); \
     207             :       }                                                                   \
     208             :   } while (0)
     209             : 
     210             : 
     211             : #define fe_switch(func_and_args)                        \
     212             :   do {                                                  \
     213             :     switch (dim)                                        \
     214             :       {                                                 \
     215             :         /* 0D */                                        \
     216             :       case 0:                                           \
     217             :         fe_family_switch (0, func_and_args, return, ;); \
     218             :         /* 1D */                                        \
     219             :       case 1:                                           \
     220             :         fe_family_switch (1, func_and_args, return, ;); \
     221             :         /* 2D */                                        \
     222             :       case 2:                                           \
     223             :         fe_family_switch (2, func_and_args, return, ;); \
     224             :         /* 3D */                                        \
     225             :       case 3:                                           \
     226             :         fe_family_switch (3, func_and_args, return, ;); \
     227             :       default:                                          \
     228             :         libmesh_error_msg("Invalid dim = " << dim);     \
     229             :       }                                                 \
     230             :   } while (0)
     231             : 
     232             : #define fe_with_vec_switch(func_and_args)                               \
     233             :   do {                                                                  \
     234             :     switch (dim)                                                        \
     235             :       {                                                                 \
     236             :         /* 0D */                                                        \
     237             :       case 0:                                                           \
     238             :         fe_family_with_vec_switch (0, func_and_args, return, ;);        \
     239             :         /* 1D */                                                        \
     240             :       case 1:                                                           \
     241             :         fe_family_with_vec_switch (1, func_and_args, return, ;);        \
     242             :         /* 2D */                                                        \
     243             :       case 2:                                                           \
     244             :         fe_family_with_vec_switch (2, func_and_args, return, ;);        \
     245             :         /* 3D */                                                        \
     246             :       case 3:                                                           \
     247             :         fe_family_with_vec_switch (3, func_and_args, return, ;);        \
     248             :       default:                                                          \
     249             :         libmesh_error_msg("Invalid dim = " << dim);                     \
     250             :       }                                                                 \
     251             :   } while (0)
     252             : 
     253             : #define void_fe_with_vec_switch(func_and_args)                          \
     254             :   do {                                                                  \
     255             :     switch (dim)                                                        \
     256             :       {                                                                 \
     257             :         /* 0D */                                                        \
     258             :       case 0:                                                           \
     259             :         fe_family_with_vec_switch (0, func_and_args, , ; return;);      \
     260             :         /* 1D */                                                        \
     261             :       case 1:                                                           \
     262             :         fe_family_with_vec_switch (1, func_and_args, , ; return;);      \
     263             :         /* 2D */                                                        \
     264             :       case 2:                                                           \
     265             :         fe_family_with_vec_switch (2, func_and_args, , ; return;);      \
     266             :         /* 3D */                                                        \
     267             :       case 3:                                                           \
     268             :         fe_family_with_vec_switch (3, func_and_args, , ; return;);      \
     269             :       default:                                                          \
     270             :         libmesh_error_msg("Invalid dim = " << dim);                     \
     271             :       }                                                                 \
     272             :   } while (0)
     273             : 
     274             : 
     275             : 
     276             : #ifdef LIBMESH_ENABLE_DEPRECATED
     277           0 : unsigned int FEInterface::n_shape_functions(const unsigned int dim,
     278             :                                             const FEType & fe_t,
     279             :                                             const ElemType t)
     280             : {
     281             :   libmesh_deprecated();
     282             : 
     283             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     284             : 
     285             :   // We no longer support calling this function with an infinite
     286             :   // ElemType, you must call the FeInterface::n_shape_functions()
     287             :   // taking an Elem* instead.
     288           0 :   if (is_InfFE_elem(t))
     289           0 :     libmesh_not_implemented();
     290             : 
     291             : #endif
     292             : 
     293           0 :   const Order o = fe_t.order;
     294             : 
     295           0 :   fe_with_vec_switch(n_shape_functions(t, o));
     296             : }
     297             : #endif // LIBMESH_ENABLE_DEPRECATED
     298             : 
     299             : 
     300             : 
     301             : unsigned int
     302     2638941 : FEInterface::n_shape_functions(const FEType & fe_t,
     303             :                                const Elem * elem,
     304             :                                const bool add_p_level)
     305             : {
     306             :   // dim is required by the fe_with_vec_switch macro
     307     2638941 :   auto dim = elem->dim();
     308             : 
     309             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     310             :   /*
     311             :    * Since the FEType, stored in DofMap/(some System child), has to
     312             :    * be the _same_ for InfFE and FE, we have to catch calls
     313             :    * to infinite elements through the element type.
     314             :    */
     315             : 
     316     1861918 :   if (is_InfFE_elem(elem->type()))
     317           0 :     return ifem_n_shape_functions(fe_t, elem);
     318             : 
     319             : #endif
     320             : 
     321             :   // Account for Elem::p_level() when computing total_order
     322     3402058 :   auto total_order = fe_t.order + add_p_level*elem->p_level();
     323             : 
     324     2638941 :   fe_with_vec_switch(n_dofs(elem, total_order));
     325             : }
     326             : 
     327             : 
     328             : 
     329             : unsigned int
     330   428356232 : FEInterface::n_shape_functions(const FEType & fe_t,
     331             :                                const int extra_order,
     332             :                                const Elem * elem)
     333             : {
     334             :   // dim is required by the fe_with_vec_switch macro
     335   428356232 :   auto dim = elem->dim();
     336             : 
     337             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     338             :   /*
     339             :    * Since the FEType, stored in DofMap/(some System child), has to
     340             :    * be the _same_ for InfFE and FE, we have to catch calls
     341             :    * to infinite elements through the element type.
     342             :    */
     343             : 
     344   317332062 :   if (is_InfFE_elem(elem->type()))
     345           0 :     return ifem_n_shape_functions(fe_t, elem);
     346             : 
     347             : #endif
     348             : 
     349             :   // Ignore Elem::p_level() and instead use extra_order to compute total_order.
     350   234906808 :   auto total_order = fe_t.order + extra_order;
     351             : 
     352   428356232 :   fe_with_vec_switch(n_dofs(elem, total_order));
     353             : }
     354             : 
     355             : 
     356             : 
     357             : #ifdef LIBMESH_ENABLE_DEPRECATED
     358           0 : unsigned int FEInterface::n_dofs(const unsigned int dim,
     359             :                                  const FEType & fe_t,
     360             :                                  const ElemType t)
     361             : {
     362             :   libmesh_deprecated();
     363             : 
     364             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     365             : 
     366             :   // We no longer support calling this function with an infinite
     367             :   // ElemType, you must call the FeInterface::n_dofs() taking an Elem*
     368             :   // instead.
     369           0 :   if (is_InfFE_elem(t))
     370           0 :     libmesh_not_implemented();
     371             : 
     372             : #endif
     373             : 
     374           0 :   const Order o = fe_t.order;
     375             : 
     376           0 :   fe_with_vec_switch(n_dofs(t, o));
     377             : }
     378             : 
     379             : 
     380             : 
     381             : 
     382             : unsigned int
     383           0 : FEInterface::n_dofs (const unsigned int dim,
     384             :                      const FEType & fe_t,
     385             :                      const Elem * elem)
     386             : {
     387             :   libmesh_deprecated();
     388             : 
     389           0 :   fe_with_vec_switch(n_dofs(elem, fe_t.order + elem->p_level()));
     390             : }
     391             : #endif // LIBMESH_ENABLE_DEPRECATED
     392             : 
     393             : 
     394             : 
     395             : unsigned int
     396     1910705 : FEInterface::n_dofs(const FEType & fe_t,
     397             :                     const Elem * elem,
     398             :                     const bool add_p_level)
     399             : {
     400             :   // dim is required by the fe_with_vec_switch macro
     401     1910705 :   auto dim = elem->dim();
     402             : 
     403             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     404             : 
     405             :   // InfElems currently don't support p_level()
     406     1571340 :   if (is_InfFE_elem(elem->type()))
     407      223092 :     return ifem_n_dofs(fe_t, elem);
     408             : 
     409             : #endif
     410             : 
     411             :   // Account for Elem::p_level() when computing total_order
     412     1687613 :   fe_with_vec_switch(n_dofs(elem, fe_t.order + add_p_level*elem->p_level()));
     413             : }
     414             : 
     415             : 
     416             : 
     417             : unsigned int
     418    24729507 : FEInterface::n_dofs(const FEType & fe_t,
     419             :                     int extra_order,
     420             :                     const Elem * elem)
     421             : {
     422             :   // dim is required by the fe_with_vec_switch macro
     423    24729507 :   auto dim = elem->dim();
     424             : 
     425             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     426             : 
     427             :   // InfElems currently don't support p_level()
     428    24729430 :   if (is_InfFE_elem(elem->type()))
     429        4257 :     return ifem_n_dofs(fe_t, elem);
     430             : 
     431             : #endif
     432             : 
     433             :   // Elem::p_level() is ignored, extra_order is used instead.
     434    24725096 :   auto total_order = fe_t.order + extra_order;
     435             : 
     436    24725250 :   fe_with_vec_switch(n_dofs(elem, total_order));
     437             : }
     438             : 
     439             : 
     440             : 
     441             : #ifdef LIBMESH_ENABLE_DEPRECATED
     442           0 : unsigned int FEInterface::n_dofs_at_node(const unsigned int dim,
     443             :                                          const FEType & fe_t,
     444             :                                          const ElemType t,
     445             :                                          const unsigned int n)
     446             : {
     447             :   libmesh_deprecated();
     448             : 
     449             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     450             : 
     451           0 :   if (is_InfFE_elem(t))
     452           0 :     return ifem_n_dofs_at_node(dim, fe_t, t, n);
     453             : 
     454             : #endif
     455             : 
     456           0 :   const Order o = fe_t.order;
     457             : 
     458           0 :   fe_with_vec_switch(n_dofs_at_node(t, o, n));
     459             : }
     460             : 
     461             : 
     462             : 
     463             : FEInterface::n_dofs_at_node_ptr
     464           0 : FEInterface::n_dofs_at_node_function(const unsigned int dim,
     465             :                                      const FEType & fe_t)
     466             : {
     467             :   libmesh_deprecated();
     468             : 
     469           0 :   fe_with_vec_switch(n_dofs_at_node);
     470             : }
     471             : #endif // LIBMESH_ENABLE_DEPRECATED
     472             : 
     473             : 
     474             : 
     475             : FEInterface::n_dofs_at_node_ptr
     476    85685210 : FEInterface::n_dofs_at_node_function(const FEType & fe_t,
     477             :                                      const Elem * elem)
     478             : {
     479             :   // dim is required by the fe_with_vec_switch macro
     480    85685210 :   auto dim = elem->dim();
     481             : 
     482    85685210 :   fe_with_vec_switch(n_dofs_at_node);
     483             : }
     484             : 
     485             : 
     486             : 
     487             : unsigned int
     488    43905736 : FEInterface::n_dofs_at_node(const FEType & fe_t,
     489             :                             const Elem * elem,
     490             :                             const unsigned int n,
     491             :                             const bool add_p_level)
     492             : {
     493             :   // dim is required by the fe_with_vec_switch macro
     494    43905736 :   auto dim = elem->dim();
     495             : 
     496             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     497             : 
     498    30998328 :   if (is_InfFE_elem(elem->type()))
     499       99078 :     return ifem_n_dofs_at_node(fe_t, elem, n);
     500             : 
     501             : #endif
     502             : 
     503             :   // Account for Elem::p_level() when computing total_order
     504    56297753 :   auto total_order = fe_t.order + add_p_level*elem->p_level();
     505             : 
     506    43806658 :   fe_with_vec_switch(n_dofs_at_node(*elem, total_order, n));
     507             : }
     508             : 
     509             : 
     510             : 
     511             : unsigned int
     512      158668 : FEInterface::n_dofs_at_node(const FEType & fe_t,
     513             :                             const int extra_order,
     514             :                             const Elem * elem,
     515             :                             const unsigned int n)
     516             : {
     517             :   // dim is required by the fe_with_vec_switch macro
     518      158668 :   auto dim = elem->dim();
     519             : 
     520             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     521             : 
     522      158524 :   if (is_InfFE_elem(elem->type()))
     523      158092 :     return ifem_n_dofs_at_node(fe_t, elem, n);
     524             : 
     525             : #endif
     526             : 
     527             :   // Ignore Elem::p_level() and instead use extra_order to compute total_order.
     528         288 :   auto total_order = fe_t.order + extra_order;
     529             : 
     530         576 :   fe_with_vec_switch(n_dofs_at_node(*elem, total_order, n));
     531             : }
     532             : 
     533             : 
     534             : 
     535             : #ifdef LIBMESH_ENABLE_DEPRECATED
     536           0 : unsigned int FEInterface::n_dofs_per_elem(const unsigned int dim,
     537             :                                           const FEType & fe_t,
     538             :                                           const ElemType t)
     539             : {
     540             :   libmesh_deprecated();
     541             : 
     542             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     543             : 
     544           0 :   if (is_InfFE_elem(t))
     545           0 :     return ifem_n_dofs_per_elem(dim, fe_t, t);
     546             : 
     547             : #endif
     548             : 
     549           0 :   const Order o = fe_t.order;
     550             : 
     551           0 :   fe_with_vec_switch(n_dofs_per_elem(t, o));
     552             : }
     553             : #endif // LIBMESH_ENABLE_DEPRECATED
     554             : 
     555             : 
     556             : 
     557             : unsigned int
     558     6173417 : FEInterface::n_dofs_per_elem(const FEType & fe_t,
     559             :                              const Elem * elem,
     560             :                              const bool add_p_level)
     561             : {
     562             :   // dim is required by the fe_with_vec_switch macro
     563     6173417 :   auto dim = elem->dim();
     564             : 
     565             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     566             : 
     567     4641638 :   if (is_InfFE_elem(elem->type()))
     568        7932 :     return ifem_n_dofs_per_elem(fe_t, elem);
     569             : 
     570             : #endif
     571             : 
     572             :   // Account for Elem::p_level() when computing total_order
     573     7935777 :   auto total_order = fe_t.order + add_p_level*elem->p_level();
     574             : 
     575     6165485 :   fe_with_vec_switch(n_dofs_per_elem(*elem, total_order));
     576             : }
     577             : 
     578             : 
     579             : 
     580             : unsigned int
     581    85685210 : FEInterface::n_dofs_per_elem(const FEType & fe_t,
     582             :                              const int extra_order,
     583             :                              const Elem * elem)
     584             : {
     585             :   // dim is required by the fe_with_vec_switch macro
     586    85685210 :   auto dim = elem->dim();
     587             : 
     588             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     589             : 
     590    58033834 :   if (is_InfFE_elem(elem->type()))
     591       14840 :     return ifem_n_dofs_per_elem(fe_t, elem);
     592             : 
     593             : #endif
     594             : 
     595             :   // Ignore Elem::p_level() and instead use extra_order to compute total_order.
     596    50059948 :   auto total_order = fe_t.order + extra_order;
     597             : 
     598    85670370 :   fe_with_vec_switch(n_dofs_per_elem(*elem, total_order));
     599             : }
     600             : 
     601             : 
     602             : 
     603      281464 : void FEInterface::dofs_on_side(const Elem * const elem,
     604             :                                const unsigned int dim,
     605             :                                const FEType & fe_t,
     606             :                                unsigned int s,
     607             :                                std::vector<unsigned int> & di,
     608             :                                const bool add_p_level)
     609             : {
     610      161640 :   const Order o = fe_t.order;
     611             : 
     612      281464 :   void_fe_with_vec_switch(dofs_on_side(elem, o, s, di, add_p_level));
     613             : }
     614             : 
     615             : 
     616             : 
     617       49680 : void FEInterface::dofs_on_edge(const Elem * const elem,
     618             :                                const unsigned int dim,
     619             :                                const FEType & fe_t,
     620             :                                unsigned int e,
     621             :                                std::vector<unsigned int> & di,
     622             :                                const bool add_p_level)
     623             : {
     624       25594 :   const Order o = fe_t.order;
     625             : 
     626       49680 :   void_fe_with_vec_switch(dofs_on_edge(elem, o, e, di, add_p_level));
     627             : }
     628             : 
     629             : 
     630             : 
     631     4914496 : void FEInterface::nodal_soln(const unsigned int dim,
     632             :                              const FEType & fe_t,
     633             :                              const Elem * elem,
     634             :                              const std::vector<Number> & elem_soln,
     635             :                              std::vector<Number> &       nodal_soln,
     636             :                              const bool add_p_level,
     637             :                              const unsigned int vdim)
     638             : {
     639             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     640             : 
     641     3474776 :   if (is_InfFE_elem(elem->type()))
     642             :     {
     643           0 :       ifem_nodal_soln(dim, fe_t, elem, elem_soln, nodal_soln);
     644           0 :       return;
     645             :     }
     646             : 
     647             : #endif
     648             : 
     649     2887984 :   const Order order = fe_t.order;
     650             : 
     651     4914496 :   void_fe_with_vec_switch(nodal_soln(elem, order, elem_soln, nodal_soln, add_p_level, vdim));
     652             : }
     653             : 
     654             : 
     655             : 
     656      164792 : void FEInterface::side_nodal_soln(const FEType & fe_t,
     657             :                                   const Elem * elem,
     658             :                                   const unsigned int side,
     659             :                                   const std::vector<Number> & elem_soln,
     660             :                                   std::vector<Number> &       nodal_soln,
     661             :                                   const bool add_p_level,
     662             :                                   const unsigned int vdim)
     663             : {
     664             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     665             : 
     666      123402 :   if (is_InfFE_elem(elem->type()))
     667             :     {
     668           0 :       libmesh_not_implemented();
     669             :       return;
     670             :     }
     671             : 
     672             : #endif
     673             : 
     674       82780 :   const Order order = fe_t.order;
     675      164792 :   const unsigned int dim = elem->dim();
     676             : 
     677      164792 :   void_fe_with_vec_switch(side_nodal_soln(elem, order, side, elem_soln, nodal_soln, add_p_level, vdim));
     678             : }
     679             : 
     680             : 
     681             : 
     682             : #ifdef LIBMESH_ENABLE_DEPRECATED
     683           0 : Point FEInterface::map(unsigned int dim,
     684             :                        const FEType & fe_t,
     685             :                        const Elem * elem,
     686             :                        const Point & p)
     687             : {
     688             :   libmesh_deprecated();
     689             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     690           0 :   if (is_InfFE_elem(elem->type()))
     691           0 :     return ifem_map(dim, fe_t, elem, p);
     692             : #endif
     693           0 :   fe_with_vec_switch(map(elem, p));
     694             : }
     695             : 
     696             : 
     697             : 
     698           0 : Point FEInterface::inverse_map (const unsigned int dim,
     699             :                                 const FEType & fe_t,
     700             :                                 const Elem * elem,
     701             :                                 const Point & p,
     702             :                                 const Real tolerance,
     703             :                                 const bool secure)
     704             : {
     705             :   libmesh_deprecated();
     706             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     707             : 
     708           0 :   if (is_InfFE_elem(elem->type()))
     709           0 :     return ifem_inverse_map(dim, fe_t, elem, p,tolerance, secure);
     710             : 
     711             : #endif
     712             : 
     713           0 :   fe_with_vec_switch(inverse_map(elem, p, tolerance, secure));
     714             : }
     715             : 
     716             : 
     717             : 
     718           0 : void FEInterface::inverse_map (const unsigned int dim,
     719             :                                const FEType & fe_t,
     720             :                                const Elem * elem,
     721             :                                const std::vector<Point> & physical_points,
     722             :                                std::vector<Point> &       reference_points,
     723             :                                const Real tolerance,
     724             :                                const bool secure)
     725             : {
     726             :   libmesh_deprecated();
     727             : 
     728           0 :   const std::size_t n_pts = physical_points.size();
     729             : 
     730             :   // Resize the vector
     731           0 :   reference_points.resize(n_pts);
     732             : 
     733           0 :   if (n_pts == 0)
     734             :     {
     735           0 :       libMesh::err << "WARNING: empty vector physical_points!"
     736           0 :                    << std::endl;
     737           0 :       libmesh_here();
     738           0 :       return;
     739             :     }
     740             : 
     741             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     742             : 
     743           0 :   if (is_InfFE_elem(elem->type()))
     744             :     {
     745           0 :       ifem_inverse_map(dim, fe_t, elem, physical_points, reference_points, tolerance, secure);
     746           0 :       return;
     747             :       // libmesh_not_implemented();
     748             :     }
     749             : 
     750             : #endif
     751             : 
     752           0 :   void_fe_with_vec_switch(inverse_map(elem, physical_points, reference_points, tolerance, secure));
     753             : }
     754             : 
     755             : 
     756             : 
     757           0 : bool FEInterface::on_reference_element(const Point & p,
     758             :                                        const ElemType t,
     759             :                                        const Real eps)
     760             : {
     761           0 :   return FEBase::on_reference_element(p,t,eps);
     762             : }
     763             : 
     764             : 
     765             : 
     766           0 : Real FEInterface::shape(const unsigned int dim,
     767             :                         const FEType & fe_t,
     768             :                         const ElemType t,
     769             :                         const unsigned int i,
     770             :                         const Point & p)
     771             : {
     772             :   libmesh_deprecated();
     773             : 
     774             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     775             : 
     776           0 :   if (is_InfFE_elem(t))
     777           0 :     return ifem_shape(dim, fe_t, t, i, p);
     778             : 
     779             : #endif
     780             : 
     781           0 :   const Order o = fe_t.order;
     782             : 
     783           0 :   fe_switch(shape(t,o,i,p));
     784             : }
     785             : 
     786           0 : Real FEInterface::shape(const unsigned int dim,
     787             :                         const FEType & fe_t,
     788             :                         const Elem * elem,
     789             :                         const unsigned int i,
     790             :                         const Point & p)
     791             : {
     792             :   libmesh_deprecated();
     793             : 
     794             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     795             : 
     796           0 :   if (elem && is_InfFE_elem(elem->type()))
     797           0 :     return ifem_shape(fe_t, elem, i, p);
     798             : 
     799             : #endif
     800             : 
     801           0 :   const Order o = fe_t.order;
     802             : 
     803           0 :   fe_switch(shape(elem,o,i,p));
     804             : }
     805             : #endif // LIBMESH_ENABLE_DEPRECATED
     806             : 
     807             : 
     808             : 
     809             : Real
     810    81010275 : FEInterface::shape(const FEType & fe_t,
     811             :                    const Elem * elem,
     812             :                    const unsigned int i,
     813             :                    const Point & p,
     814             :                    const bool add_p_level)
     815             : {
     816             :   // dim is required by the fe_switch macro
     817    81010275 :   auto dim = elem->dim();
     818             : 
     819             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     820             : 
     821    59667043 :   if (elem && is_InfFE_elem(elem->type()))
     822           0 :     return ifem_shape(fe_t, elem, i, p);
     823             : 
     824             : #endif
     825             : 
     826             :   // We are calling
     827             :   //
     828             :   // FE<X,Y>::shape(Elem *, Order, unsigned, Point, true)
     829             :   //
     830             :   // See fe.h for more details.
     831    81010275 :   fe_switch(shape(elem, fe_t.order, i, p, add_p_level));
     832             : }
     833             : 
     834             : 
     835             : 
     836             : Real
     837   418073389 : FEInterface::shape(const FEType & fe_t,
     838             :                    int extra_order,
     839             :                    const Elem * elem,
     840             :                    const unsigned int i,
     841             :                    const Point & p)
     842             : {
     843             :   // dim is required by the fe_switch macro
     844   418073389 :   auto dim = elem->dim();
     845             : 
     846             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     847             : 
     848   305131881 :   if (elem && is_InfFE_elem(elem->type()))
     849           0 :     return ifem_shape(fe_t, elem, i, p);
     850             : 
     851             : #endif
     852             : 
     853             :   // We are calling
     854             :   //
     855             :   // FE<X,Y>::shape(Elem *, Order, unsigned, Point, false)
     856             :   //
     857             :   // with the last parameter set to "false" so that the
     858             :   // Elem::p_level() is not used internally and the "total_order" that
     859             :   // we compute is used instead. See fe.h for more details.
     860   217829174 :   auto total_order = fe_t.order + extra_order;
     861             : 
     862   418073389 :   fe_switch(shape(elem, total_order, i, p, false));
     863             : }
     864             : 
     865             : 
     866             : 
     867             : #ifdef LIBMESH_ENABLE_DEPRECATED
     868             : template<>
     869           0 : void FEInterface::shape<Real>(const unsigned int dim,
     870             :                               const FEType & fe_t,
     871             :                               const ElemType t,
     872             :                               const unsigned int i,
     873             :                               const Point & p,
     874             :                               Real & phi)
     875             : {
     876             :   libmesh_deprecated();
     877             : 
     878             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     879             : 
     880           0 :   if (is_InfFE_elem(t))
     881             :     {
     882           0 :       phi = ifem_shape(dim, fe_t, t, i, p);
     883           0 :       return;
     884             :     }
     885             : 
     886             : #endif
     887             : 
     888           0 :   const Order o = fe_t.order;
     889             : 
     890           0 :   switch(dim)
     891             :     {
     892           0 :     case 0:
     893           0 :       fe_scalar_vec_error_switch(0, shape(t,o,i,p), phi = , ; break;);
     894           0 :       break;
     895           0 :     case 1:
     896           0 :       fe_scalar_vec_error_switch(1, shape(t,o,i,p), phi = , ; break;);
     897           0 :       break;
     898           0 :     case 2:
     899           0 :       fe_scalar_vec_error_switch(2, shape(t,o,i,p), phi = , ; break;);
     900           0 :       break;
     901           0 :     case 3:
     902           0 :       fe_scalar_vec_error_switch(3, shape(t,o,i,p), phi = , ; break;);
     903           0 :       break;
     904           0 :     default:
     905           0 :       libmesh_error_msg("Invalid dimension = " << dim);
     906             :     }
     907             : 
     908           0 :   return;
     909             : }
     910             : 
     911             : 
     912             : 
     913             : template<>
     914           0 : void FEInterface::shape<Real>(const unsigned int dim,
     915             :                               const FEType & fe_t,
     916             :                               const Elem * elem,
     917             :                               const unsigned int i,
     918             :                               const Point & p,
     919             :                               Real & phi)
     920             : {
     921             :   libmesh_deprecated();
     922             : 
     923             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     924             : 
     925           0 :   if (elem && is_InfFE_elem(elem->type()))
     926             :     {
     927           0 :       phi = ifem_shape(fe_t, elem, i, p);
     928           0 :       return;
     929             :     }
     930             : #endif
     931             : 
     932           0 :   const Order o = fe_t.order;
     933             : 
     934           0 :   switch(dim)
     935             :     {
     936           0 :     case 0:
     937           0 :       fe_scalar_vec_error_switch(0, shape(elem,o,i,p), phi = , ; break;);
     938           0 :       break;
     939           0 :     case 1:
     940           0 :       fe_scalar_vec_error_switch(1, shape(elem,o,i,p), phi = , ; break;);
     941           0 :       break;
     942           0 :     case 2:
     943           0 :       fe_scalar_vec_error_switch(2, shape(elem,o,i,p), phi = , ; break;);
     944           0 :       break;
     945           0 :     case 3:
     946           0 :       fe_scalar_vec_error_switch(3, shape(elem,o,i,p), phi = , ; break;);
     947           0 :       break;
     948           0 :     default:
     949           0 :       libmesh_error_msg("Invalid dimension = " << dim);
     950             :     }
     951             : 
     952           0 :   return;
     953             : }
     954             : #endif // LIBMESH_ENABLE_DEPRECATED
     955             : 
     956             : 
     957             : 
     958             : template<>
     959           0 : void FEInterface::shape<Real>(const FEType & fe_t,
     960             :                               const Elem * elem,
     961             :                               const unsigned int i,
     962             :                               const Point & p,
     963             :                               Real & phi)
     964             : {
     965             :   // dim is required by the fe_switch macro
     966           0 :   auto dim = elem->dim();
     967             : 
     968             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
     969             : 
     970           0 :   if (is_InfFE_elem(elem->type()))
     971             :     {
     972           0 :       phi = ifem_shape(fe_t, elem, i, p);
     973           0 :       return;
     974             :     }
     975             : 
     976             : #endif
     977             : 
     978             :   // Below we call FE<X,Y>::shape(Elem *, Order, unsigned, Point, true)
     979             :   // so that the Elem::p_level() is accounted for internally.
     980           0 :   switch(dim)
     981             :     {
     982           0 :     case 0:
     983           0 :       fe_scalar_vec_error_switch(0, shape(elem, fe_t.order, i, p, true), phi = , ; break;);
     984           0 :       break;
     985           0 :     case 1:
     986           0 :       fe_scalar_vec_error_switch(1, shape(elem, fe_t.order, i, p, true), phi = , ; break;);
     987           0 :       break;
     988           0 :     case 2:
     989           0 :       fe_scalar_vec_error_switch(2, shape(elem, fe_t.order, i, p, true), phi = , ; break;);
     990           0 :       break;
     991           0 :     case 3:
     992           0 :       fe_scalar_vec_error_switch(3, shape(elem, fe_t.order, i, p, true), phi = , ; break;);
     993           0 :       break;
     994           0 :     default:
     995           0 :       libmesh_error_msg("Invalid dimension = " << dim);
     996             :     }
     997           0 : }
     998             : 
     999             : 
    1000             : 
    1001             : template<>
    1002           0 : void FEInterface::shape<Real>(const FEType & fe_t,
    1003             :                               int extra_order,
    1004             :                               const Elem * elem,
    1005             :                               const unsigned int i,
    1006             :                               const Point & p,
    1007             :                               Real & phi)
    1008             : {
    1009             :   // dim is required by the fe_switch macro
    1010           0 :   auto dim = elem->dim();
    1011             : 
    1012             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1013             : 
    1014           0 :   if (is_InfFE_elem(elem->type()))
    1015             :     {
    1016           0 :       phi = ifem_shape(fe_t, elem, i, p);
    1017           0 :       return;
    1018             :     }
    1019             : 
    1020             : #endif
    1021             : 
    1022             :   // Ignore Elem::p_level() and instead use extra_order to compute total_order
    1023           0 :   auto total_order = fe_t.order + extra_order;
    1024             : 
    1025             :   // Below we call
    1026             :   //
    1027             :   // FE<X,Y>::shape(Elem *, Order, unsigned, Point, false)
    1028             :   //
    1029             :   // so that the Elem::p_level() is ignored and the total_order that
    1030             :   // we compute is used instead.
    1031           0 :   switch(dim)
    1032             :     {
    1033           0 :     case 0:
    1034           0 :       fe_scalar_vec_error_switch(0, shape(elem, total_order, i, p, false), phi = , ; break;);
    1035           0 :       break;
    1036           0 :     case 1:
    1037           0 :       fe_scalar_vec_error_switch(1, shape(elem, total_order, i, p, false), phi = , ; break;);
    1038           0 :       break;
    1039           0 :     case 2:
    1040           0 :       fe_scalar_vec_error_switch(2, shape(elem, total_order, i, p, false), phi = , ; break;);
    1041           0 :       break;
    1042           0 :     case 3:
    1043           0 :       fe_scalar_vec_error_switch(3, shape(elem, total_order, i, p, false), phi = , ; break;);
    1044           0 :       break;
    1045           0 :     default:
    1046           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1047             :     }
    1048           0 : }
    1049             : 
    1050             : 
    1051             : 
    1052             : template<>
    1053     1806579 : void FEInterface::shapes<Real>(const unsigned int dim,
    1054             :                                const FEType & fe_t,
    1055             :                                const Elem * elem,
    1056             :                                const unsigned int i,
    1057             :                                const std::vector<Point> & p,
    1058             :                                std::vector<Real> & phi,
    1059             :                                const bool add_p_level)
    1060             : {
    1061             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1062             : 
    1063     1320475 :   if (elem && is_InfFE_elem(elem->type()))
    1064             :     {
    1065           0 :       FEType elevated = fe_t;
    1066           0 :       elevated.order = fe_t.order + add_p_level * elem->p_level();
    1067           0 :       for (auto qpi : index_range(p))
    1068           0 :         phi[qpi] = ifem_shape(elevated, elem, i, p[qpi]);
    1069           0 :       return;
    1070             :     }
    1071             : #endif
    1072             : 
    1073      938908 :   const Order o = fe_t.order;
    1074             : 
    1075     1806579 :   switch(dim)
    1076             :     {
    1077           0 :     case 0:
    1078           0 :       fe_scalar_vec_error_switch(0, shapes(elem,o,i,p,phi,add_p_level), , ; return;);
    1079             :       break;
    1080        1408 :     case 1:
    1081        1408 :       fe_scalar_vec_error_switch(1, shapes(elem,o,i,p,phi,add_p_level), , ; return;);
    1082             :       break;
    1083      851101 :     case 2:
    1084      851101 :       fe_scalar_vec_error_switch(2, shapes(elem,o,i,p,phi,add_p_level), , ; return;);
    1085             :       break;
    1086      954070 :     case 3:
    1087      954070 :       fe_scalar_vec_error_switch(3, shapes(elem,o,i,p,phi,add_p_level), , ; return;);
    1088             :       break;
    1089           0 :     default:
    1090           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1091             :     }
    1092             : 
    1093             :   return;
    1094             : }
    1095             : 
    1096             : 
    1097             : template<>
    1098    42306776 : void FEInterface::all_shapes<Real>(const unsigned int dim,
    1099             :                                    const FEType & fe_t,
    1100             :                                    const Elem * elem,
    1101             :                                    const std::vector<Point> & p,
    1102             :                                    std::vector<std::vector<Real>> & phi,
    1103             :                                    const bool add_p_level)
    1104             : {
    1105             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1106             : 
    1107    30808788 :   if (elem && is_InfFE_elem(elem->type()))
    1108             :     {
    1109           0 :       for (auto i : index_range(phi))
    1110           0 :         FEInterface::shapes<Real>(dim, fe_t, elem, i, p, phi[i], add_p_level);
    1111           0 :       return;
    1112             :     }
    1113             : #endif
    1114             : 
    1115    24300174 :   const Order o = fe_t.order;
    1116             : 
    1117    42306776 :   switch(dim)
    1118             :     {
    1119       68420 :     case 0:
    1120       68420 :       fe_scalar_vec_error_switch(0, all_shapes(elem,o,p,phi,add_p_level), , ; return;);
    1121             :       break;
    1122      730317 :     case 1:
    1123      730317 :       fe_scalar_vec_error_switch(1, all_shapes(elem,o,p,phi,add_p_level), , ; return;);
    1124             :       break;
    1125    30549657 :     case 2:
    1126    30549657 :       fe_scalar_vec_error_switch(2, all_shapes(elem,o,p,phi,add_p_level), , ; return;);
    1127             :       break;
    1128    10958382 :     case 3:
    1129    10958382 :       fe_scalar_vec_error_switch(3, all_shapes(elem,o,p,phi,add_p_level), , ; return;);
    1130             :       break;
    1131           0 :     default:
    1132           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1133             :     }
    1134             : 
    1135             :   return;
    1136             : }
    1137             : 
    1138             : 
    1139             : 
    1140             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1141             : template<>
    1142           0 : void FEInterface::shape<RealGradient>(const unsigned int dim,
    1143             :                                       const FEType & fe_t,
    1144             :                                       const ElemType t,
    1145             :                                       const unsigned int i,
    1146             :                                       const Point & p,
    1147             :                                       RealGradient & phi)
    1148             : {
    1149             :   libmesh_deprecated();
    1150             : 
    1151             :   // This API does not currently support infinite elements.
    1152             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1153           0 :   if (is_InfFE_elem(t))
    1154             :   {
    1155           0 :      libmesh_not_implemented();
    1156             :   }
    1157             : #endif
    1158           0 :   const Order o = fe_t.order;
    1159             : 
    1160           0 :   switch(dim)
    1161             :     {
    1162           0 :     case 0:
    1163           0 :       fe_vector_scalar_error_switch(0, shape(t,o,i,p), phi = , ; break;);
    1164           0 :       break;
    1165           0 :     case 1:
    1166           0 :       fe_vector_scalar_error_switch(1, shape(t,o,i,p), phi = , ; break;);
    1167           0 :       break;
    1168           0 :     case 2:
    1169           0 :       fe_vector_scalar_error_switch(2, shape(t,o,i,p), phi = , ; break;);
    1170           0 :       break;
    1171           0 :     case 3:
    1172           0 :       fe_vector_scalar_error_switch(3, shape(t,o,i,p), phi = , ; break;);
    1173           0 :       break;
    1174           0 :     default:
    1175           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1176             :     }
    1177           0 : }
    1178             : #endif // LIBMESH_ENABLE_DEPRECATED
    1179             : 
    1180             : 
    1181             : 
    1182             : template<>
    1183           0 : void FEInterface::shape<RealGradient>(const FEType & fe_t,
    1184             :                                       const Elem * elem,
    1185             :                                       const unsigned int i,
    1186             :                                       const Point & p,
    1187             :                                       RealGradient & phi)
    1188             : {
    1189             :   // This API does not currently support infinite elements.
    1190             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1191           0 :   if (is_InfFE_elem(elem->type()))
    1192             :   {
    1193           0 :      libmesh_not_implemented();
    1194             :   }
    1195             : #endif
    1196             : 
    1197           0 :   auto dim = elem->dim();
    1198             : 
    1199             :   // We are calling
    1200             :   //
    1201             :   // FE<X,Y>::shape(Elem *, Order, unsigned, Point, true)
    1202             :   //
    1203             :   // with the last parameter set to "true" so that the Elem::p_level()
    1204             :   // is accounted for internally. See fe.h for more details.
    1205             : 
    1206           0 :   switch(dim)
    1207             :     {
    1208           0 :     case 0:
    1209           0 :       fe_vector_scalar_error_switch(0, shape(elem, fe_t.order, i, p, true), phi = , ; break;);
    1210           0 :       break;
    1211           0 :     case 1:
    1212           0 :       fe_vector_scalar_error_switch(1, shape(elem, fe_t.order, i, p, true), phi = , ; break;);
    1213           0 :       break;
    1214           0 :     case 2:
    1215           0 :       fe_vector_scalar_error_switch(2, shape(elem, fe_t.order, i, p, true), phi = , ; break;);
    1216           0 :       break;
    1217           0 :     case 3:
    1218           0 :       fe_vector_scalar_error_switch(3, shape(elem, fe_t.order, i, p, true), phi = , ; break;);
    1219           0 :       break;
    1220           0 :     default:
    1221           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1222             :     }
    1223           0 : }
    1224             : 
    1225             : 
    1226             : 
    1227             : template<>
    1228    47766414 : void FEInterface::shape<RealGradient>(const FEType & fe_t,
    1229             :                                       int extra_order,
    1230             :                                       const Elem * elem,
    1231             :                                       const unsigned int i,
    1232             :                                       const Point & p,
    1233             :                                       RealGradient & phi)
    1234             : {
    1235             :   // This API does not currently support infinite elements.
    1236             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1237    33003240 :   if (is_InfFE_elem(elem->type()))
    1238             :   {
    1239           0 :      libmesh_not_implemented();
    1240             :   }
    1241             : #endif
    1242             : 
    1243    47766414 :   auto dim = elem->dim();
    1244             : 
    1245             :   // We are calling
    1246             :   //
    1247             :   // FE<X,Y>::shape(Elem *, Order, unsigned, Point, false)
    1248             :   //
    1249             :   // with the last parameter set to "false" so that the
    1250             :   // Elem::p_level() is not used internally and the "total_order" that
    1251             :   // we compute is used instead. See fe.h for more details.
    1252    22221960 :   auto total_order = fe_t.order + extra_order;
    1253             : 
    1254    47766414 :   switch(dim)
    1255             :     {
    1256           0 :     case 0:
    1257           0 :       fe_vector_scalar_error_switch(0, shape(elem, total_order, i, p, false), phi = , ; break;);
    1258           0 :       break;
    1259           0 :     case 1:
    1260           0 :       fe_vector_scalar_error_switch(1, shape(elem, total_order, i, p, false), phi = , ; break;);
    1261           0 :       break;
    1262    14857516 :     case 2:
    1263    14857516 :       fe_vector_scalar_error_switch(2, shape(elem, total_order, i, p, false), phi = , ; break;);
    1264     3641840 :       break;
    1265    32908898 :     case 3:
    1266    32908898 :       fe_vector_scalar_error_switch(3, shape(elem, total_order, i, p, false), phi = , ; break;);
    1267     7469140 :       break;
    1268           0 :     default:
    1269           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1270             :     }
    1271    47766414 : }
    1272             : 
    1273             : 
    1274             : 
    1275             : template<>
    1276           0 : void FEInterface::shapes<RealGradient>(const unsigned int dim,
    1277             :                                        const FEType & fe_t,
    1278             :                                        const Elem * elem,
    1279             :                                        const unsigned int i,
    1280             :                                        const std::vector<Point> & p,
    1281             :                                        std::vector<RealGradient> & phi,
    1282             :                                        const bool add_p_level)
    1283             : {
    1284             :   // This is actually an issue for infinite elements: They require type 'Gradient'!
    1285           0 :   if (elem->infinite())
    1286           0 :     libmesh_not_implemented();
    1287             : 
    1288           0 :   const Order o = fe_t.order;
    1289             : 
    1290           0 :   switch(dim)
    1291             :     {
    1292           0 :     case 0:
    1293           0 :       fe_vector_scalar_error_switch(0, shapes(elem,o,i,p,phi,add_p_level), , ; return;);
    1294             :       break;
    1295           0 :     case 1:
    1296           0 :       fe_vector_scalar_error_switch(1, shapes(elem,o,i,p,phi,add_p_level), , ; return;);
    1297             :       break;
    1298           0 :     case 2:
    1299           0 :       fe_vector_scalar_error_switch(2, shapes(elem,o,i,p,phi,add_p_level), , ; return;);
    1300             :       break;
    1301           0 :     case 3:
    1302           0 :       fe_vector_scalar_error_switch(3, shapes(elem,o,i,p,phi,add_p_level), , ; return;);
    1303             :       break;
    1304           0 :     default:
    1305           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1306             :     }
    1307             : 
    1308             :   return;
    1309             : }
    1310             : 
    1311             : 
    1312             : 
    1313             : template<>
    1314     2134917 : void FEInterface::all_shapes<RealGradient>(const unsigned int dim,
    1315             :                                            const FEType & fe_t,
    1316             :                                            const Elem * elem,
    1317             :                                            const std::vector<Point> & p,
    1318             :                                            std::vector<std::vector<RealGradient>> & phi,
    1319             :                                            const bool add_p_level)
    1320             : {
    1321             :   // This is actually an issue for infinite elements: They require type 'Gradient'!
    1322     1597406 :   if (elem->infinite())
    1323           0 :     libmesh_not_implemented();
    1324             : 
    1325     1075022 :   const Order o = fe_t.order;
    1326             : 
    1327     2134917 :   switch(dim)
    1328             :     {
    1329           0 :     case 0:
    1330           0 :       fe_vector_scalar_error_switch(0, all_shapes(elem,o,p,phi,add_p_level), , ; return;);
    1331             :       break;
    1332           0 :     case 1:
    1333           0 :       fe_vector_scalar_error_switch(1, all_shapes(elem,o,p,phi,add_p_level), , ; return;);
    1334             :       break;
    1335      654789 :     case 2:
    1336      654789 :       fe_vector_scalar_error_switch(2, all_shapes(elem,o,p,phi,add_p_level), , ; return;);
    1337             :       break;
    1338     1480128 :     case 3:
    1339     1480128 :       fe_vector_scalar_error_switch(3, all_shapes(elem,o,p,phi,add_p_level), , ; return;);
    1340             :       break;
    1341           0 :     default:
    1342           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1343             :     }
    1344             : 
    1345             :   return;
    1346             : }
    1347             : 
    1348             : 
    1349             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1350             : FEInterface::shape_ptr
    1351           0 : FEInterface::shape_function(const unsigned int dim,
    1352             :                             const FEType & fe_t,
    1353             :                             const ElemType libmesh_inf_var(t))
    1354             : {
    1355             :   libmesh_deprecated();
    1356             : 
    1357             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1358           0 :   if (is_InfFE_elem(t))
    1359             :    {
    1360           0 :     inf_fe_switch(shape);
    1361             :    }
    1362             : #endif
    1363           0 :   fe_switch(shape);
    1364             : }
    1365             : #endif // LIBMESH_ENABLE_DEPRECATED
    1366             : 
    1367             : 
    1368             : 
    1369             : FEInterface::shape_ptr
    1370    92380764 : FEInterface::shape_function(const FEType & fe_t,
    1371             :                             const Elem * elem)
    1372             : {
    1373             :   // dim is needed by the fe_switch macros below
    1374    92380764 :   auto dim = elem->dim();
    1375             : 
    1376             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1377    69467279 :   if (is_InfFE_elem(elem->type()))
    1378           0 :     inf_fe_switch(shape);
    1379             : #endif
    1380    92380764 :   fe_switch(shape);
    1381             : }
    1382             : 
    1383             : 
    1384             : 
    1385             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1386           0 : Real FEInterface::shape_deriv(const unsigned int dim,
    1387             :                               const FEType & fe_t,
    1388             :                               const ElemType t,
    1389             :                               const unsigned int i,
    1390             :                               const unsigned int j,
    1391             :                               const Point & p)
    1392             : {
    1393             :   libmesh_deprecated();
    1394             : 
    1395           0 :   libmesh_assert_greater (dim,j);
    1396             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1397             : 
    1398           0 :   if (is_InfFE_elem(t)){
    1399           0 :     return ifem_shape_deriv(dim, fe_t, t, i, j, p);
    1400             :   }
    1401             : 
    1402             : #endif
    1403             : 
    1404           0 :   const Order o = fe_t.order;
    1405           0 :   fe_switch(shape_deriv(t,o,i,j,p));
    1406             :   return 0;
    1407             : }
    1408             : 
    1409             : 
    1410           0 : Real FEInterface::shape_deriv(const unsigned int dim,
    1411             :                               const FEType & fe_t,
    1412             :                               const Elem * elem,
    1413             :                               const unsigned int i,
    1414             :                               const unsigned int j,
    1415             :                               const Point & p)
    1416             : {
    1417             :   libmesh_deprecated();
    1418             : 
    1419           0 :   libmesh_assert_greater (dim,j);
    1420             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1421             : 
    1422           0 :   if (elem->infinite()){
    1423           0 :     return ifem_shape_deriv(fe_t, elem, i, j, p);
    1424             :   }
    1425             : 
    1426             : #endif
    1427             : 
    1428           0 :   const Order o = fe_t.order;
    1429             : 
    1430           0 :   switch(dim)
    1431             :     {
    1432           0 :     case 0:
    1433           0 :       fe_family_switch (0, shape_deriv(elem, o, i, j, p), return , ;);
    1434           0 :     case 1:
    1435           0 :       fe_family_switch (1, shape_deriv(elem, o, i, j, p), return , ;);
    1436           0 :     case 2:
    1437           0 :       fe_family_switch (2, shape_deriv(elem, o, i, j, p), return , ;);
    1438           0 :     case 3:
    1439           0 :       fe_family_switch (3, shape_deriv(elem, o, i, j, p), return , ;);
    1440           0 :     default:
    1441           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1442             :     }
    1443             :   return 0;
    1444             : }
    1445             : #endif // LIBMESH_ENABLE_DEPRECATED
    1446             : 
    1447             : 
    1448             : 
    1449           0 : Real FEInterface::shape_deriv(const FEType & fe_t,
    1450             :                               const Elem * elem,
    1451             :                               const unsigned int i,
    1452             :                               const unsigned int j,
    1453             :                               const Point & p)
    1454             : {
    1455           0 :   auto dim = elem->dim();
    1456             : 
    1457           0 :   libmesh_assert_greater (dim, j);
    1458             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1459             : 
    1460           0 :   if (is_InfFE_elem(elem->type())){
    1461           0 :     return ifem_shape_deriv(fe_t, elem, i, j, p);
    1462             :   }
    1463             : 
    1464             : #endif
    1465             : 
    1466             :   // Account for Elem::p_level() when computing total order. Note: we are calling
    1467             :   // FE::shape_deriv() with the final argument == true so that the Elem::p_level()
    1468             :   // is accounted for automatically internally.
    1469           0 :   fe_switch(shape_deriv(elem, fe_t.order, i, j, p, true));
    1470             : 
    1471             :   // We'll never get here
    1472             :   return 0;
    1473             : }
    1474             : 
    1475             : 
    1476             : 
    1477   374277343 : Real FEInterface::shape_deriv(const FEType & fe_t,
    1478             :                               int extra_order,
    1479             :                               const Elem * elem,
    1480             :                               const unsigned int i,
    1481             :                               const unsigned int j,
    1482             :                               const Point & p)
    1483             : {
    1484   374277343 :   auto dim = elem->dim();
    1485             : 
    1486    95937904 :   libmesh_assert_greater (dim, j);
    1487             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1488             : 
    1489   274572966 :   if (elem->infinite()){
    1490           0 :     return ifem_shape_deriv(fe_t, elem, i, j, p);
    1491             :   }
    1492             : 
    1493             : #endif
    1494             : 
    1495             :   // Ignore Elem::p_level() when computing total order, use
    1496             :   // extra_order instead.
    1497   191875808 :   auto total_order = fe_t.order + extra_order;
    1498             : 
    1499             :   // We call shape_deriv() with the final argument == false so that
    1500             :   // the Elem::p_level() is ignored internally.
    1501   374277343 :   switch(dim)
    1502             :     {
    1503           0 :     case 0:
    1504           0 :       fe_family_switch (0, shape_deriv(elem, total_order, i, j, p, false), return , ;);
    1505      462499 :     case 1:
    1506      462499 :       fe_family_switch (1, shape_deriv(elem, total_order, i, j, p, false), return , ;);
    1507    94363824 :     case 2:
    1508    94363824 :       fe_family_switch (2, shape_deriv(elem, total_order, i, j, p, false), return , ;);
    1509   279451020 :     case 3:
    1510   279451020 :       fe_family_switch (3, shape_deriv(elem, total_order, i, j, p, false), return , ;);
    1511           0 :     default:
    1512           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1513             :     }
    1514             : 
    1515             :   // We'll never get here
    1516             :   return 0;
    1517             : }
    1518             : 
    1519             : 
    1520             : 
    1521             : template<>
    1522     5301932 : void FEInterface::shape_derivs<Real>(const FEType & fe_t,
    1523             :                                      const Elem * elem,
    1524             :                                      const unsigned int i,
    1525             :                                      const unsigned int j,
    1526             :                                      const std::vector<Point> & p,
    1527             :                                      std::vector<Real> & dphi,
    1528             :                                      const bool add_p_level)
    1529             : {
    1530     2767348 :   const Order o = fe_t.order;
    1531             : 
    1532     5301932 :   switch(elem->dim())
    1533             :     {
    1534           0 :     case 0:
    1535           0 :       fe_scalar_vec_error_switch(0, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ; break;);
    1536           0 :       break;
    1537        1598 :     case 1:
    1538        1598 :       fe_scalar_vec_error_switch(1, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ; break;);
    1539         401 :       break;
    1540     2460744 :     case 2:
    1541     2460744 :       fe_scalar_vec_error_switch(2, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ; break;);
    1542      676944 :       break;
    1543     2839590 :     case 3:
    1544     2839590 :       fe_scalar_vec_error_switch(3, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ; break;);
    1545      706329 :       break;
    1546           0 :     default:
    1547           0 :       libmesh_error_msg("Invalid dimension = " << elem->dim());
    1548             :     }
    1549             : 
    1550     5301932 :   return;
    1551             : }
    1552             : 
    1553             : 
    1554             : 
    1555             : // Only instantiating Real because we don't expect vector-valued
    1556             : // mapping functions, and that's what's using this interface.
    1557             : template<>
    1558    13160367 : void FEInterface::all_shape_derivs<Real>(const unsigned int dim,
    1559             :                                          const FEType & fe_t,
    1560             :                                          const Elem * elem,
    1561             :                                          const std::vector<Point> & p,
    1562             :                                          std::vector<std::vector<Real>> * comps[3],
    1563             :                                          const bool add_p_level)
    1564             : {
    1565             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1566             : 
    1567     9981073 :   if (elem && is_InfFE_elem(elem->type()))
    1568             :     {
    1569           0 :       for (auto j : make_range(dim))
    1570           0 :         for (auto i : index_range(*comps[j]))
    1571           0 :           FEInterface::shape_derivs<Real>(fe_t, elem, i, j, p, (*comps[j])[i], add_p_level);
    1572           0 :       return;
    1573             :     }
    1574             : #endif
    1575             : 
    1576     6910424 :   const Order o = fe_t.order;
    1577             : 
    1578    13160367 :   switch(dim)
    1579             :     {
    1580           0 :     case 0:
    1581           0 :       fe_scalar_vec_error_switch(0, all_shape_derivs(elem,o,p,comps,add_p_level), , ; return;);
    1582             :       break;
    1583       48752 :     case 1:
    1584       48752 :       fe_scalar_vec_error_switch(1, all_shape_derivs(elem,o,p,comps,add_p_level), , ; return;);
    1585             :       break;
    1586     5185635 :     case 2:
    1587     5185635 :       fe_scalar_vec_error_switch(2, all_shape_derivs(elem,o,p,comps,add_p_level), , ; return;);
    1588             :       break;
    1589     7925980 :     case 3:
    1590     7925980 :       fe_scalar_vec_error_switch(3, all_shape_derivs(elem,o,p,comps,add_p_level), , ; return;);
    1591             :       break;
    1592           0 :     default:
    1593           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1594             :     }
    1595             : 
    1596             :   return;
    1597             : }
    1598             : 
    1599             : 
    1600             : 
    1601             : template<>
    1602           0 : void FEInterface::shape_derivs<RealGradient>(const FEType & fe_t,
    1603             :                                              const Elem * elem,
    1604             :                                              const unsigned int i,
    1605             :                                              const unsigned int j,
    1606             :                                              const std::vector<Point> & p,
    1607             :                                              std::vector<RealGradient> & dphi,
    1608             :                                              const bool add_p_level)
    1609             : {
    1610           0 :   const Order o = fe_t.order;
    1611             : 
    1612           0 :   switch(elem->dim())
    1613             :     {
    1614           0 :     case 0:
    1615           0 :       fe_vector_scalar_error_switch(0, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ; break;);
    1616           0 :       break;
    1617           0 :     case 1:
    1618           0 :       fe_vector_scalar_error_switch(1, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ; break;);
    1619           0 :       break;
    1620           0 :     case 2:
    1621           0 :       fe_vector_scalar_error_switch(2, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ; break;);
    1622           0 :       break;
    1623           0 :     case 3:
    1624           0 :       fe_vector_scalar_error_switch(3, shape_derivs(elem,o,i,j,p,dphi,add_p_level), , ; break;);
    1625           0 :       break;
    1626           0 :     default:
    1627           0 :       libmesh_error_msg("Invalid dimension = " << elem->dim());
    1628             :     }
    1629             : 
    1630           0 :   return;
    1631             : }
    1632             : 
    1633             : 
    1634             : 
    1635             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1636             : FEInterface::shape_deriv_ptr
    1637           0 : FEInterface::shape_deriv_function(const unsigned int dim,
    1638             :                                   const FEType & fe_t,
    1639             :                                   const ElemType libmesh_inf_var(t))
    1640             : {
    1641             :   libmesh_deprecated();
    1642             : 
    1643             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1644           0 :   if (is_InfFE_elem(t))
    1645             :   {
    1646           0 :     inf_fe_switch(shape_deriv);
    1647             :   }
    1648             : #endif
    1649           0 :   fe_switch(shape_deriv);
    1650             : }
    1651             : #endif // LIBMESH_ENABLE_DEPRECATED
    1652             : 
    1653             : 
    1654             : 
    1655             : FEInterface::shape_deriv_ptr
    1656   302958202 : FEInterface::shape_deriv_function(const FEType & fe_t,
    1657             :                                   const Elem * elem)
    1658             : {
    1659             :   // dim is needed by the fe_switch macros below
    1660   302958202 :   auto dim = elem->dim();
    1661             : 
    1662             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1663   223627130 :   if (is_InfFE_elem(elem->type()))
    1664             :   {
    1665           0 :     inf_fe_switch(shape_deriv);
    1666             :   }
    1667             : #endif
    1668   302958202 :   fe_switch(shape_deriv);
    1669             : }
    1670             : 
    1671             : 
    1672             : #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
    1673             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1674           0 : Real FEInterface::shape_second_deriv(const unsigned int dim,
    1675             :                                      const FEType & fe_t,
    1676             :                                      const ElemType t,
    1677             :                                      const unsigned int i,
    1678             :                                      const unsigned int j,
    1679             :                                      const Point & p)
    1680             : {
    1681             :   libmesh_deprecated();
    1682             : 
    1683           0 :   libmesh_assert_greater_equal (dim*(dim-1),j);
    1684             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1685           0 :   if (is_InfFE_elem(t))
    1686           0 :     libmesh_not_implemented();
    1687             : #endif
    1688             : 
    1689           0 :   const Order o = fe_t.order;
    1690             : 
    1691           0 :   switch(dim)
    1692             :     {
    1693           0 :     case 0:
    1694           0 :       fe_family_switch (0, shape_second_deriv(t, o, i, j, p), return , ;);
    1695           0 :     case 1:
    1696           0 :       fe_family_switch (1, shape_second_deriv(t, o, i, j, p), return , ;);
    1697           0 :     case 2:
    1698           0 :       fe_family_switch (2, shape_second_deriv(t, o, i, j, p), return  , ;);
    1699           0 :     case 3:
    1700           0 :       fe_family_switch (3, shape_second_deriv(t, o, i, j, p), return , ;);
    1701           0 :     default:
    1702           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1703             :     }
    1704             :   return 0;
    1705             : }
    1706             : 
    1707             : 
    1708           0 : Real FEInterface::shape_second_deriv(const unsigned int dim,
    1709             :                                      const FEType & fe_t,
    1710             :                                      const Elem * elem,
    1711             :                                      const unsigned int i,
    1712             :                                      const unsigned int j,
    1713             :                                      const Point & p)
    1714             : {
    1715             :   libmesh_deprecated();
    1716             : 
    1717           0 :   libmesh_assert_greater_equal (dim*(dim-1),j);
    1718             : 
    1719           0 :   if (elem->infinite())
    1720           0 :     libmesh_not_implemented();
    1721             : 
    1722           0 :   const Order o = fe_t.order;
    1723             : 
    1724           0 :   switch(dim)
    1725             :     {
    1726           0 :     case 0:
    1727           0 :       fe_family_switch (0, shape_second_deriv(elem, o, i, j, p), return , ;);
    1728           0 :     case 1:
    1729           0 :       fe_family_switch (1, shape_second_deriv(elem, o, i, j, p), return , ;);
    1730           0 :     case 2:
    1731           0 :       fe_family_switch (2, shape_second_deriv(elem, o, i, j, p), return , ;);
    1732           0 :     case 3:
    1733           0 :       fe_family_switch (3, shape_second_deriv(elem, o, i, j, p), return , ;);
    1734           0 :     default:
    1735           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1736             :     }
    1737             :   return 0;
    1738             : }
    1739             : #endif // LIBMESH_ENABLE_DEPRECATED
    1740             : 
    1741             : 
    1742             : 
    1743           0 : Real FEInterface::shape_second_deriv(const FEType & fe_t,
    1744             :                                      const Elem * elem,
    1745             :                                      const unsigned int i,
    1746             :                                      const unsigned int j,
    1747             :                                      const Point & p)
    1748             : {
    1749           0 :   auto dim = elem->dim();
    1750             : 
    1751           0 :   libmesh_assert_greater_equal (dim*(dim-1),j);
    1752             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1753           0 :   if (is_InfFE_elem(elem->type()))
    1754           0 :     libmesh_not_implemented();
    1755             : #endif
    1756             : 
    1757             :   // We are calling FE::shape_second_deriv() with the final argument
    1758             :   // == true so that the Elem::p_level() is accounted for
    1759             :   // automatically internally.
    1760           0 :   switch(dim)
    1761             :     {
    1762           0 :     case 0:
    1763           0 :       fe_family_switch (0, shape_second_deriv(elem, fe_t.order, i, j, p, true), return , ;);
    1764           0 :     case 1:
    1765           0 :       fe_family_switch (1, shape_second_deriv(elem, fe_t.order, i, j, p, true), return , ;);
    1766           0 :     case 2:
    1767           0 :       fe_family_switch (2, shape_second_deriv(elem, fe_t.order, i, j, p, true), return , ;);
    1768           0 :     case 3:
    1769           0 :       fe_family_switch (3, shape_second_deriv(elem, fe_t.order, i, j, p, true), return , ;);
    1770           0 :     default:
    1771           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1772             :     }
    1773             : 
    1774             :   // We'll never get here
    1775             :   return 0;
    1776             : }
    1777             : 
    1778             : 
    1779             : 
    1780   105034447 : Real FEInterface::shape_second_deriv(const FEType & fe_t,
    1781             :                                      int extra_order,
    1782             :                                      const Elem * elem,
    1783             :                                      const unsigned int i,
    1784             :                                      const unsigned int j,
    1785             :                                      const Point & p)
    1786             : {
    1787   105034447 :   auto dim = elem->dim();
    1788             : 
    1789    26273056 :   libmesh_assert_greater_equal (dim*(dim-1),j);
    1790             : 
    1791    78761391 :   if (elem->infinite())
    1792           0 :     libmesh_not_implemented();
    1793             : 
    1794             :   // Ignore Elem::p_level() when computing total order, use
    1795             :   // extra_order instead.
    1796    52546112 :   auto total_order = fe_t.order + extra_order;
    1797             : 
    1798             :   // We are calling FE::shape_second_deriv() with the final argument
    1799             :   // == false so that the Elem::p_level() is ignored and the
    1800             :   // total_order we compute is used instead.
    1801   105034447 :   switch(dim)
    1802             :     {
    1803           0 :     case 0:
    1804           0 :       fe_family_switch (0, shape_second_deriv(elem, total_order, i, j, p, false), return , ;);
    1805        3436 :     case 1:
    1806        3436 :       fe_family_switch (1, shape_second_deriv(elem, total_order, i, j, p, false), return , ;);
    1807      746091 :     case 2:
    1808      746091 :       fe_family_switch (2, shape_second_deriv(elem, total_order, i, j, p, false), return , ;);
    1809   104284920 :     case 3:
    1810   104284920 :       fe_family_switch (3, shape_second_deriv(elem, total_order, i, j, p, false), return , ;);
    1811           0 :     default:
    1812           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1813             :     }
    1814             : 
    1815             :   // We'll never get here
    1816             :   return 0;
    1817             : }
    1818             : 
    1819             : 
    1820             : 
    1821             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1822             : FEInterface::shape_second_deriv_ptr
    1823           0 : FEInterface::shape_second_deriv_function(const unsigned int dim,
    1824             :                                          const FEType & fe_t,
    1825             :                                          const ElemType libmesh_inf_var(t))
    1826             : {
    1827             :   libmesh_deprecated();
    1828             : 
    1829             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1830           0 :   if (is_InfFE_elem(t))
    1831           0 :     libmesh_not_implemented();
    1832             : #endif
    1833           0 :   fe_switch(shape_second_deriv);
    1834             : }
    1835             : #endif // LIBMESH_ENABLE_DEPRECATED
    1836             : 
    1837             : 
    1838             : 
    1839             : FEInterface::shape_second_deriv_ptr
    1840    23111392 : FEInterface::shape_second_deriv_function(const FEType & fe_t,
    1841             :                                          const Elem * elem)
    1842             : {
    1843    23111392 :   auto dim = elem->dim();
    1844             : 
    1845             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1846    17261702 :   if (is_InfFE_elem(elem->type()))
    1847           0 :     libmesh_not_implemented();
    1848             : #endif
    1849    23111392 :   fe_switch(shape_second_deriv);
    1850             : }
    1851             : 
    1852             : #endif //LIBMESH_ENABLE_SECOND_DERIVATIVES
    1853             : 
    1854             : 
    1855             : #ifdef LIBMESH_ENABLE_DEPRECATED
    1856             : template<>
    1857           0 : void FEInterface::shape<RealGradient>(const unsigned int dim,
    1858             :                                       const FEType & fe_t,
    1859             :                                       const Elem * elem,
    1860             :                                       const unsigned int i,
    1861             :                                       const Point & p,
    1862             :                                       RealGradient & phi)
    1863             : {
    1864             :   libmesh_deprecated();
    1865             : 
    1866             :   // This is actually an issue for infinite elements: They require type 'Gradient'!
    1867           0 :   if (elem->infinite())
    1868           0 :     libmesh_not_implemented();
    1869             : 
    1870           0 :   const Order o = fe_t.order;
    1871             : 
    1872           0 :   switch(dim)
    1873             :     {
    1874           0 :     case 0:
    1875           0 :       fe_vector_scalar_error_switch(0, shape(elem,o,i,p), phi = , ; break;);
    1876           0 :       break;
    1877           0 :     case 1:
    1878           0 :       fe_vector_scalar_error_switch(1, shape(elem,o,i,p), phi = , ; break;);
    1879           0 :       break;
    1880           0 :     case 2:
    1881           0 :       fe_vector_scalar_error_switch(2, shape(elem,o,i,p), phi = , ; break;);
    1882           0 :       break;
    1883           0 :     case 3:
    1884           0 :       fe_vector_scalar_error_switch(3, shape(elem,o,i,p), phi = , ; break;);
    1885           0 :       break;
    1886           0 :     default:
    1887           0 :       libmesh_error_msg("Invalid dimension = " << dim);
    1888             :     }
    1889             : 
    1890           0 :   return;
    1891             : }
    1892             : #endif // LIBMESH_ENABLE_DEPRECATED
    1893             : 
    1894             : 
    1895      993116 : void FEInterface::compute_data(const unsigned int dim,
    1896             :                                const FEType & fe_t,
    1897             :                                const Elem * elem,
    1898             :                                FEComputeData & data)
    1899             : {
    1900             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
    1901             : 
    1902      702356 :   if (elem && is_InfFE_elem(elem->type()))
    1903             :     {
    1904           0 :       data.init();
    1905           0 :       ifem_compute_data(dim, fe_t, elem, data);
    1906           0 :       return;
    1907             :     }
    1908             : 
    1909             : #endif
    1910             : 
    1911      993116 :   const unsigned int n_dof = n_dofs (fe_t, elem);
    1912      993116 :   const Point & p = data.p;
    1913      993116 :   data.shape.resize(n_dof);
    1914             : 
    1915      993116 :   if (data.need_derivative())
    1916             :     {
    1917           0 :       data.dshape.resize(n_dof);
    1918           0 :       data.local_transform.resize(dim);
    1919             : 
    1920           0 :       for (unsigned int d=0; d<dim; d++)
    1921           0 :         data.local_transform[d].resize(dim);
    1922             : 
    1923           0 :       auto fe = FEBase::build(dim, fe_t);
    1924           0 :       std::vector<Point> pt = {p};
    1925           0 :       fe->get_dphideta(); // to compute the map
    1926           0 :       fe->reinit(elem, &pt);
    1927             : 
    1928             :       // compute the reference->physical map.
    1929           0 :       data.local_transform[0][0] = fe->get_dxidx()[0];
    1930           0 :       if (dim > 1)
    1931             :         {
    1932           0 :           data.local_transform[1][0] = fe->get_detadx()[0];
    1933           0 :           data.local_transform[1][1] = fe->get_detady()[0];
    1934           0 :           data.local_transform[0][1] = fe->get_dxidy()[0];
    1935           0 :           if (dim > 2)
    1936             :             {
    1937           0 :               data.local_transform[2][0] = fe->get_dzetadx()[0];
    1938           0 :               data.local_transform[2][1] = fe->get_dzetady()[0];
    1939           0 :               data.local_transform[2][2] = fe->get_dzetadz()[0];
    1940           0 :               data.local_transform[1][2] = fe->get_detadz()[0];
    1941           0 :               data.local_transform[0][2] = fe->get_dxidz()[0];
    1942             :             }
    1943             :         }
    1944           0 :     }
    1945             : 
    1946             :   // set default values for all the output fields
    1947      993116 :   data.init();
    1948             : 
    1949     8142998 :   for (unsigned int n=0; n<n_dof; n++)
    1950             :     {
    1951             :       // Here we pass the original fe_t object. Additional p-levels
    1952             :       // (if any) are handled internally by the shape() and
    1953             :       // shape_deriv() functions since they have access to the elem
    1954             :       // pointer. Note that we are already using the n_dof value
    1955             :       // appropriate to the elevated p-level.
    1956     7149882 :       data.shape[n] = shape(fe_t, elem, n, p);
    1957     7149882 :       if (data.need_derivative())
    1958             :         {
    1959           0 :           for (unsigned int j=0; j<dim; j++)
    1960           0 :             data.dshape[n](j) = shape_deriv(fe_t, elem, n, j, p);
    1961             :         }
    1962             :     }
    1963      290760 : }
    1964             : 
    1965             : 
    1966             : 
    1967             : #ifdef LIBMESH_ENABLE_AMR
    1968             : 
    1969     2600081 : void FEInterface::compute_constraints (DofConstraints & constraints,
    1970             :                                        DofMap & dof_map,
    1971             :                                        const unsigned int variable_number,
    1972             :                                        const Elem * elem)
    1973             : {
    1974      700561 :   libmesh_assert(elem);
    1975             : 
    1976      700561 :   const FEType & fe_t = dof_map.variable_type(variable_number);
    1977             : 
    1978     2600081 :   switch (elem->dim())
    1979             :     {
    1980       13408 :     case 0:
    1981             :     case 1:
    1982             :       {
    1983             :         // No constraints in 0D/1D.
    1984       13408 :         return;
    1985             :       }
    1986             : 
    1987             : 
    1988     1485065 :     case 2:
    1989             :       {
    1990     1485065 :         switch (fe_t.family)
    1991             :           {
    1992       12952 :           case CLOUGH:
    1993       12952 :             FE<2,CLOUGH>::compute_constraints (constraints,
    1994             :                                                dof_map,
    1995             :                                                variable_number,
    1996       12952 :                                                elem); return;
    1997             : 
    1998        6304 :           case HERMITE:
    1999        6304 :             FE<2,HERMITE>::compute_constraints (constraints,
    2000             :                                                 dof_map,
    2001             :                                                 variable_number,
    2002        6304 :                                                 elem); return;
    2003             : 
    2004     1146319 :           case LAGRANGE:
    2005     1146319 :             FE<2,LAGRANGE>::compute_constraints (constraints,
    2006             :                                                  dof_map,
    2007             :                                                  variable_number,
    2008     1146319 :                                                  elem); return;
    2009             : 
    2010       76696 :           case HIERARCHIC:
    2011       76696 :             FE<2,HIERARCHIC>::compute_constraints (constraints,
    2012             :                                                    dof_map,
    2013             :                                                    variable_number,
    2014       76696 :                                                    elem); return;
    2015             : 
    2016        2620 :           case HIERARCHIC_VEC:
    2017        2620 :             FE<2,HIERARCHIC_VEC>::compute_constraints (constraints,
    2018             :                                                        dof_map,
    2019             :                                                        variable_number,
    2020        2620 :                                                        elem); return;
    2021             : 
    2022       21552 :           case SIDE_HIERARCHIC:
    2023       21552 :             FE<2,SIDE_HIERARCHIC>::compute_constraints (constraints,
    2024             :                                                         dof_map,
    2025             :                                                         variable_number,
    2026       21552 :                                                         elem); return;
    2027             : 
    2028        2352 :           case LAGRANGE_VEC:
    2029        2352 :             FE<2,LAGRANGE_VEC>::compute_constraints (constraints,
    2030             :                                                      dof_map,
    2031             :                                                      variable_number,
    2032        2352 :                                                      elem); return;
    2033             : 
    2034       19750 :           fe_family_horder_case_func(2, compute_constraints (constraints,
    2035             :                                                              dof_map,
    2036             :                                                              variable_number,
    2037             :                                                              elem), , ; return;)
    2038       49916 :           default:
    2039       49916 :             return;
    2040             :           }
    2041             :       }
    2042             : 
    2043             : 
    2044     1065826 :     case 3:
    2045             :       {
    2046     1065826 :         switch (fe_t.family)
    2047             :           {
    2048          56 :           case HERMITE:
    2049          56 :             FE<3,HERMITE>::compute_constraints (constraints,
    2050             :                                                 dof_map,
    2051             :                                                 variable_number,
    2052          56 :                                                 elem); return;
    2053             : 
    2054      414573 :           case LAGRANGE:
    2055      414573 :             FE<3,LAGRANGE>::compute_constraints (constraints,
    2056             :                                                  dof_map,
    2057             :                                                  variable_number,
    2058      414573 :                                                  elem); return;
    2059             : 
    2060       10764 :           case HIERARCHIC:
    2061       10764 :             FE<3,HIERARCHIC>::compute_constraints (constraints,
    2062             :                                                    dof_map,
    2063             :                                                    variable_number,
    2064       10764 :                                                    elem); return;
    2065             : 
    2066       48416 :           case SIDE_HIERARCHIC:
    2067       48416 :             FE<3,SIDE_HIERARCHIC>::compute_constraints (constraints,
    2068             :                                                         dof_map,
    2069             :                                                         variable_number,
    2070       48416 :                                                         elem); return;
    2071             : 
    2072        3800 :           case LAGRANGE_VEC:
    2073        3800 :             FE<3,LAGRANGE_VEC>::compute_constraints (constraints,
    2074             :                                                      dof_map,
    2075             :                                                      variable_number,
    2076        3800 :                                                      elem); return;
    2077             : 
    2078           0 :           case HIERARCHIC_VEC:
    2079           0 :             FE<3,HIERARCHIC_VEC>::compute_constraints (constraints,
    2080             :                                                        dof_map,
    2081             :                                                        variable_number,
    2082           0 :                                                        elem); return;
    2083             : 
    2084        5792 :           fe_family_horder_case_func(3, compute_constraints (constraints,
    2085             :                                                              dof_map,
    2086             :                                                              variable_number,
    2087             :                                                              elem), , ; return;)
    2088      155662 :           default:
    2089      155662 :             return;
    2090             :           }
    2091             :       }
    2092             : 
    2093             : 
    2094           0 :     default:
    2095           0 :       libmesh_error_msg("Invalid dimension = " << elem->dim());
    2096             :     }
    2097             : }
    2098             : 
    2099             : #endif // #ifdef LIBMESH_ENABLE_AMR
    2100             : 
    2101             : 
    2102             : 
    2103             : #ifdef LIBMESH_ENABLE_PERIODIC
    2104             : 
    2105      206228 : void FEInterface::compute_periodic_constraints (DofConstraints & constraints,
    2106             :                                                 DofMap & dof_map,
    2107             :                                                 const PeriodicBoundaries & boundaries,
    2108             :                                                 const MeshBase & mesh,
    2109             :                                                 const PointLocatorBase * point_locator,
    2110             :                                                 const unsigned int variable_number,
    2111             :                                                 const Elem * elem)
    2112             : {
    2113       67498 :   const FEType & fe_t = dof_map.variable_type(variable_number);
    2114             :   // No element-specific optimizations currently exist, although
    2115             :   // we do have to select the right compute_periodic_constraints
    2116             :   // for the OutputType of this FEType.
    2117      206228 :   switch (field_type(fe_t))
    2118             :   {
    2119      206228 :     case TYPE_SCALAR:
    2120      206228 :       FEBase::compute_periodic_constraints(
    2121             :           constraints, dof_map, boundaries, mesh, point_locator, variable_number, elem);
    2122      206228 :       break;
    2123           0 :     case TYPE_VECTOR:
    2124           0 :       FEVectorBase::compute_periodic_constraints(
    2125             :           constraints, dof_map, boundaries, mesh, point_locator, variable_number, elem);
    2126           0 :       break;
    2127           0 :     default:
    2128           0 :       libmesh_error_msg(
    2129             :           "compute_periodic_constraints only set up for vector or scalar FEFieldTypes");
    2130             :   }
    2131      206228 : }
    2132             : 
    2133             : #endif // #ifdef LIBMESH_ENABLE_PERIODIC
    2134             : 
    2135             : 
    2136             : 
    2137     6315878 : unsigned int FEInterface::max_order(const FEType & fe_t,
    2138             :                                     const ElemType & el_t)
    2139             : {
    2140             :   // Yeah, I know, infinity is much larger than 11, but our
    2141             :   // solvers don't seem to like high degree polynomials, and our
    2142             :   // quadrature rules and number_lookups tables
    2143             :   // need to go up higher.
    2144     1925754 :   const unsigned int unlimited = 11;
    2145             : 
    2146             :   // If we used 0 as a default, then elements missing from this
    2147             :   // table (e.g. infinite elements) would be considered broken.
    2148     1925754 :   const unsigned int unknown = unlimited;
    2149             : 
    2150     6315878 :   switch (fe_t.family)
    2151             :     {
    2152     3837786 :     case LAGRANGE:
    2153             :     case LAGRANGE_VEC:
    2154     3837786 :       switch (el_t)
    2155             :         {
    2156      122022 :         case EDGE2:
    2157             :         case EDGE3:
    2158             :         case EDGE4:
    2159      122022 :           return 3;
    2160      229952 :         case TRI3:
    2161             :         case TRISHELL3:
    2162             :         case C0POLYGON:
    2163      229952 :           return 1;
    2164        7912 :         case TRI6:
    2165        7912 :           return 2;
    2166         880 :         case TRI7:
    2167         880 :           return 3;
    2168      458276 :         case QUAD4:
    2169             :         case QUADSHELL4:
    2170      458276 :           return 1;
    2171      161108 :         case QUAD8:
    2172             :         case QUADSHELL8:
    2173             :         case QUAD9:
    2174             :         case QUADSHELL9:
    2175      161108 :           return 2;
    2176       78140 :         case TET4:
    2177       78140 :           return 1;
    2178        3072 :         case TET10:
    2179        3072 :           return 2;
    2180        3840 :         case TET14:
    2181        3840 :           return 3;
    2182      129852 :         case HEX8:
    2183      129852 :           return 1;
    2184        8548 :         case HEX20:
    2185             :         case HEX27:
    2186        8548 :           return 2;
    2187        4336 :         case PRISM6:
    2188        4336 :           return 1;
    2189        4912 :         case PRISM15:
    2190             :         case PRISM18:
    2191        4912 :           return 2;
    2192        2632 :         case PRISM20:
    2193             :         case PRISM21:
    2194        2632 :           return 3;
    2195        1872 :         case PYRAMID5:
    2196        1872 :           return 1;
    2197        1056 :         case PYRAMID13:
    2198             :         case PYRAMID14:
    2199        1056 :           return 2;
    2200         720 :         case PYRAMID18:
    2201         720 :           return 3;
    2202          56 :         case C0POLYHEDRON:
    2203          56 :           return 1;
    2204        4720 :         default:
    2205        4720 :           return unknown;
    2206             :         }
    2207             :       break;
    2208       11466 :     case L2_LAGRANGE_GLL:
    2209             :     case LAGRANGE_GLL:
    2210       11466 :       switch (el_t)
    2211             :         {
    2212        3276 :         case EDGE2:
    2213             :         case EDGE3:
    2214             :         case EDGE4:
    2215             :         case QUAD4:
    2216             :         case QUADSHELL4:
    2217             :         case QUAD8:
    2218             :         case QUADSHELL8:
    2219             :         case QUAD9:
    2220             :         case QUADSHELL9:
    2221             :         case HEX8:
    2222             :         case HEX20:
    2223             :         case HEX27:
    2224             :           // A basis of degree p needs p+1 Gauss-Lobatto points, and QGaussLobatto tabulates
    2225             :           // at most fe_lagrange_gll_max_points_1D
    2226        3276 :           return fe_lagrange_gll_max_points_1D - 1;
    2227           0 :         default:
    2228           0 :           return unknown;
    2229             :         }
    2230             :       break;
    2231      664920 :     case MONOMIAL:
    2232             :     case L2_LAGRANGE:
    2233             :     case L2_LAGRANGE_VEC:
    2234             :     case L2_HIERARCHIC:
    2235             :     case L2_HIERARCHIC_VEC:
    2236             :     case MONOMIAL_VEC:
    2237      332460 :       switch (el_t)
    2238             :         {
    2239      332452 :         case EDGE2:
    2240             :         case EDGE3:
    2241             :         case EDGE4:
    2242             :         case C0POLYGON:
    2243             :         case TRI3:
    2244             :         case TRISHELL3:
    2245             :         case TRI6:
    2246             :         case TRI7:
    2247             :         case QUAD4:
    2248             :         case QUADSHELL4:
    2249             :         case QUAD8:
    2250             :         case QUADSHELL8:
    2251             :         case QUAD9:
    2252             :         case QUADSHELL9:
    2253             :         case TET4:
    2254             :         case TET10:
    2255             :         case TET14:
    2256             :         case HEX8:
    2257             :         case HEX20:
    2258             :         case HEX27:
    2259             :         case PRISM6:
    2260             :         case PRISM15:
    2261             :         case PRISM18:
    2262             :         case PRISM20:
    2263             :         case PRISM21:
    2264             :         case PYRAMID5:
    2265             :         case PYRAMID13:
    2266             :         case PYRAMID14:
    2267             :         case PYRAMID18:
    2268             :         case C0POLYHEDRON:
    2269      332452 :           return unlimited;
    2270           8 :         default:
    2271           8 :           return unknown;
    2272             :         }
    2273             :       break;
    2274             : #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
    2275       85962 :     case BERNSTEIN:
    2276             :     case RATIONAL_BERNSTEIN:
    2277       85962 :       switch (el_t)
    2278             :         {
    2279         392 :         case EDGE2:
    2280             :         case EDGE3:
    2281             :         case EDGE4:
    2282         392 :           return unlimited;
    2283         224 :         case TRI3:
    2284             :         case TRISHELL3:
    2285         224 :           return 1;
    2286         672 :         case TRI6:
    2287             :         case TRI7:
    2288         672 :           return 6;
    2289         112 :         case QUAD4:
    2290             :         case QUADSHELL4:
    2291         112 :           return 1;
    2292        7408 :         case QUAD8:
    2293             :         case QUADSHELL8:
    2294             :         case QUAD9:
    2295             :         case QUADSHELL9:
    2296        7408 :           return unlimited;
    2297        2688 :         case TET4:
    2298        2688 :           return 1;
    2299        2688 :         case TET10:
    2300             :         case TET14:
    2301        2688 :           return 2;
    2302         112 :         case HEX8:
    2303         112 :           return 1;
    2304           0 :         case HEX20:
    2305           0 :           return 2;
    2306         784 :         case HEX27:
    2307         784 :           return 4;
    2308           0 :         case C0POLYGON:
    2309             :         case PRISM6:
    2310             :         case PRISM15:
    2311             :         case PRISM18:
    2312             :         case PRISM20:
    2313             :         case PRISM21:
    2314             :         case PYRAMID5:
    2315             :         case PYRAMID13:
    2316             :         case PYRAMID14:
    2317             :         case PYRAMID18:
    2318             :         case C0POLYHEDRON:
    2319           0 :           return 0;
    2320        9668 :         default:
    2321        9668 :           return unknown;
    2322             :         }
    2323             :       break;
    2324        4536 :     case SZABAB:
    2325        4536 :       switch (el_t)
    2326             :         {
    2327          56 :         case EDGE2:
    2328          56 :           return 1;
    2329         168 :         case EDGE3:
    2330             :         case EDGE4:
    2331         168 :           return 7;
    2332         112 :         case TRI3:
    2333             :         case TRISHELL3:
    2334         112 :           return 1;
    2335         736 :         case TRI6:
    2336             :         case TRI7:
    2337         736 :           return 7;
    2338          56 :         case QUAD4:
    2339             :         case QUADSHELL4:
    2340          56 :           return 1;
    2341         168 :         case QUAD8:
    2342             :         case QUADSHELL8:
    2343             :         case QUAD9:
    2344             :         case QUADSHELL9:
    2345         168 :           return 7;
    2346           0 :         case C0POLYGON:
    2347             :         case TET4:
    2348             :         case TET10:
    2349             :         case TET14:
    2350             :         case HEX8:
    2351             :         case HEX20:
    2352             :         case HEX27:
    2353             :         case PRISM6:
    2354             :         case PRISM15:
    2355             :         case PRISM18:
    2356             :         case PRISM20:
    2357             :         case PRISM21:
    2358             :         case PYRAMID5:
    2359             :         case PYRAMID13:
    2360             :         case PYRAMID14:
    2361             :         case PYRAMID18:
    2362             :         case C0POLYHEDRON:
    2363           0 :           return 0;
    2364           0 :         default:
    2365           0 :           return unknown;
    2366             :         }
    2367             :       break;
    2368             : #endif
    2369       52128 :     case XYZ:
    2370       26064 :       switch (el_t)
    2371             :         {
    2372       26064 :         case EDGE2:
    2373             :         case EDGE3:
    2374             :         case EDGE4:
    2375             :         case C0POLYGON:
    2376             :         case TRI3:
    2377             :         case TRISHELL3:
    2378             :         case TRI6:
    2379             :         case TRI7:
    2380             :         case QUAD4:
    2381             :         case QUADSHELL4:
    2382             :         case QUAD8:
    2383             :         case QUADSHELL8:
    2384             :         case QUAD9:
    2385             :         case QUADSHELL9:
    2386             :         case TET4:
    2387             :         case TET10:
    2388             :         case TET14:
    2389             :         case HEX8:
    2390             :         case HEX20:
    2391             :         case HEX27:
    2392             :         case PRISM6:
    2393             :         case PRISM15:
    2394             :         case PRISM18:
    2395             :         case PRISM20:
    2396             :         case PRISM21:
    2397             :         case PYRAMID5:
    2398             :         case PYRAMID13:
    2399             :         case PYRAMID14:
    2400             :         case PYRAMID18:
    2401             :         case C0POLYHEDRON:
    2402       26064 :           return unlimited;
    2403           0 :         default:
    2404           0 :           return unknown;
    2405             :         }
    2406             :       break;
    2407       34706 :     case CLOUGH:
    2408       34706 :       switch (el_t)
    2409             :         {
    2410           0 :         case EDGE2:
    2411             :         case EDGE3:
    2412           0 :           return 3;
    2413           0 :         case EDGE4:
    2414             :         case TRI3:
    2415             :         case TRISHELL3:
    2416           0 :           return 0;
    2417        9916 :         case TRI6:
    2418             :         case TRI7:
    2419        9916 :           return 3;
    2420           0 :         case C0POLYGON:
    2421             :         case QUAD4:
    2422             :         case QUADSHELL4:
    2423             :         case QUAD8:
    2424             :         case QUADSHELL8:
    2425             :         case QUAD9:
    2426             :         case QUADSHELL9:
    2427             :         case TET4:
    2428             :         case TET10:
    2429             :         case TET14:
    2430             :         case HEX8:
    2431             :         case HEX20:
    2432             :         case HEX27:
    2433             :         case PRISM6:
    2434             :         case PRISM15:
    2435             :         case PRISM18:
    2436             :         case PRISM20:
    2437             :         case PRISM21:
    2438             :         case PYRAMID5:
    2439             :         case PYRAMID13:
    2440             :         case PYRAMID14:
    2441             :         case PYRAMID18:
    2442             :         case C0POLYHEDRON:
    2443           0 :           return 0;
    2444           0 :         default:
    2445           0 :           return unknown;
    2446             :         }
    2447             :       break;
    2448       82604 :     case HERMITE:
    2449       82604 :       switch (el_t)
    2450             :         {
    2451       21160 :         case EDGE2:
    2452             :         case EDGE3:
    2453       21160 :           return unlimited;
    2454           0 :         case EDGE4:
    2455             :         case TRI3:
    2456             :         case TRISHELL3:
    2457             :         case TRI6:
    2458             :         case TRI7:
    2459           0 :           return 0;
    2460           0 :         case QUAD4:
    2461             :         case QUADSHELL4:
    2462           0 :           return 3;
    2463        4604 :         case QUAD8:
    2464             :         case QUADSHELL8:
    2465             :         case QUAD9:
    2466             :         case QUADSHELL9:
    2467        4604 :           return unlimited;
    2468           0 :         case TET4:
    2469             :         case TET10:
    2470             :         case TET14:
    2471           0 :           return 0;
    2472           0 :         case HEX8:
    2473           0 :           return 3;
    2474          56 :         case HEX20:
    2475             :         case HEX27:
    2476          56 :           return unlimited;
    2477           0 :         case C0POLYGON:
    2478             :         case PRISM6:
    2479             :         case PRISM15:
    2480             :         case PRISM18:
    2481             :         case PRISM20:
    2482             :         case PRISM21:
    2483             :         case PYRAMID5:
    2484             :         case PYRAMID13:
    2485             :         case PYRAMID14:
    2486             :         case PYRAMID18:
    2487             :         case C0POLYHEDRON:
    2488           0 :           return 0;
    2489           0 :         default:
    2490           0 :           return unknown;
    2491             :         }
    2492             :       break;
    2493      254004 :     case HIERARCHIC:
    2494             :     case HIERARCHIC_VEC:
    2495      254004 :       switch (el_t)
    2496             :         {
    2497         872 :         case EDGE2:
    2498             :         case EDGE3:
    2499             :         case EDGE4:
    2500         872 :           return unlimited;
    2501         112 :         case TRI3:
    2502             :         case TRISHELL3:
    2503         112 :           return 1;
    2504       27540 :         case TRI6:
    2505             :         case TRI7:
    2506       27540 :           return unlimited;
    2507          56 :         case QUAD4:
    2508             :         case QUADSHELL4:
    2509          56 :           return 1;
    2510       42096 :         case QUAD8:
    2511             :         case QUADSHELL8:
    2512             :         case QUAD9:
    2513             :         case QUADSHELL9:
    2514       42096 :           return unlimited;
    2515        1344 :         case TET4:
    2516        1344 :           return 1;
    2517        1344 :         case TET10:
    2518        1344 :           return 2;
    2519        4232 :         case TET14:
    2520        4232 :           return unlimited;
    2521          56 :         case HEX8:
    2522             :         case HEX20:
    2523          56 :           return 1;
    2524        2584 :         case HEX27:
    2525        2584 :           return unlimited;
    2526        1152 :         case PRISM6:
    2527             :         case PRISM15:
    2528             :         case PRISM18:
    2529             :         case PRISM20:
    2530             :         case PRISM21:
    2531        1152 :           return unlimited;
    2532           0 :         case C0POLYGON:
    2533             :         case PYRAMID5:
    2534             :         case PYRAMID13:
    2535             :         case PYRAMID14:
    2536             :         case PYRAMID18:
    2537             :         case C0POLYHEDRON:
    2538           0 :           return 0;
    2539           0 :         default:
    2540           0 :           return unknown;
    2541             :         }
    2542             :       break;
    2543      244660 :     case SIDE_HIERARCHIC:
    2544      244660 :       switch (el_t)
    2545             :         {
    2546         264 :         case EDGE2:
    2547             :         case EDGE3:
    2548             :         case EDGE4:
    2549         264 :           return unlimited; // although it's all the same as 0...
    2550           0 :         case TRI3:
    2551             :         case TRISHELL3:
    2552           0 :           return 0;
    2553       18568 :         case TRI6:
    2554             :         case TRI7:
    2555       18568 :           return unlimited;
    2556           0 :         case C0POLYGON:
    2557             :         case QUAD4:
    2558             :         case QUADSHELL4:
    2559           0 :           return 0;
    2560        2728 :         case QUAD8:
    2561             :         case QUADSHELL8:
    2562             :         case QUAD9:
    2563             :         case QUADSHELL9:
    2564        2728 :           return unlimited;
    2565           0 :         case TET4:
    2566             :         case TET10:
    2567           0 :           return 0;
    2568       43776 :         case TET14:
    2569       43776 :           return unlimited;
    2570           0 :         case HEX8:
    2571             :         case HEX20:
    2572           0 :           return 0;
    2573        1440 :         case HEX27:
    2574        1440 :           return unlimited;
    2575           0 :         case PRISM6:
    2576             :         case PRISM15:
    2577             :         case PRISM18:
    2578           0 :           return 0;
    2579        3200 :         case PRISM20:
    2580             :         case PRISM21:
    2581        3200 :           return unlimited;
    2582           0 :         case PYRAMID5:
    2583             :         case PYRAMID13:
    2584             :         case PYRAMID14:
    2585             :         case PYRAMID18:
    2586             :         case C0POLYHEDRON:
    2587           0 :           return 0;
    2588           0 :         default:
    2589           0 :           return unknown;
    2590             :         }
    2591             :       break;
    2592        2592 :     case SUBDIVISION:
    2593        1296 :       switch (el_t)
    2594             :         {
    2595        1296 :         case TRI3SUBDIVISION:
    2596        1296 :           return unlimited;
    2597           0 :         default:
    2598           0 :           return unknown;
    2599             :         }
    2600             :       break;
    2601      113148 :     case NEDELEC_ONE:
    2602      113148 :       switch (el_t)
    2603             :         {
    2604       11632 :         case TRI6:
    2605             :         case TRI7:
    2606             :         case QUAD8:
    2607             :         case QUAD9:
    2608       11632 :           return 5;
    2609        6400 :         case TET10:
    2610             :         case TET14:
    2611             :         case HEX20:
    2612             :         case HEX27:
    2613        6400 :           return 1;
    2614           0 :         default:
    2615           0 :           return 0;
    2616             :         }
    2617             :       break;
    2618      417488 :     case RAVIART_THOMAS:
    2619             :     case L2_RAVIART_THOMAS:
    2620      417488 :       switch (el_t)
    2621             :         {
    2622       33200 :         case TRI6:
    2623             :         case TRI7:
    2624             :         case QUAD8:
    2625             :         case QUAD9:
    2626       33200 :           return 5;
    2627       74872 :         case TET14:
    2628             :         case HEX27:
    2629       74872 :           return 1;
    2630           0 :         default:
    2631           0 :           return 0;
    2632             :         }
    2633             :       break;
    2634           0 :     default:
    2635           0 :       return 0;
    2636             :       break;
    2637             :     }
    2638             : }
    2639             : 
    2640             : 
    2641             : 
    2642    88955815 : bool FEInterface::extra_hanging_dofs(const FEType & fe_t)
    2643             : {
    2644    88955815 :   switch (fe_t.family)
    2645             :     {
    2646    19612300 :     case LAGRANGE:
    2647             :     case L2_LAGRANGE:
    2648             :     case L2_LAGRANGE_GLL:
    2649             :     case MONOMIAL:
    2650             :     case MONOMIAL_VEC:
    2651             :     case L2_HIERARCHIC:
    2652             :     case SIDE_HIERARCHIC:
    2653             :     case XYZ:
    2654             :     case SUBDIVISION:
    2655             :     case LAGRANGE_VEC:
    2656             :     case L2_LAGRANGE_VEC:
    2657             :     case NEDELEC_ONE:
    2658             :     case RAVIART_THOMAS:
    2659             :     case L2_RAVIART_THOMAS:
    2660    19612300 :       return false;
    2661    23136817 :     case CLOUGH:
    2662             :     case HERMITE:
    2663             :     case HIERARCHIC:
    2664             :     case HIERARCHIC_VEC:
    2665             :     case L2_HIERARCHIC_VEC:
    2666             :       // A mid-edge or mid-face node of this family owns the interpolation points inside its
    2667             :       // entity. Above order two, none of these points is at the node itself. At a refinement
    2668             :       // interface, the node is a vertex of the fine elements, so it needs a separate degree of
    2669             :       // freedom for that role.
    2670             :     case LAGRANGE_GLL:
    2671             :     fe_family_horder_case()
    2672             :     default:
    2673    23136817 :       return true;
    2674             :     }
    2675             : }
    2676             : 
    2677      587460 : FEFieldType FEInterface::field_type(const FEType & fe_type)
    2678             : {
    2679      587460 :   return FEInterface::field_type(fe_type.family);
    2680             : }
    2681             : 
    2682    11690321 : FEFieldType FEInterface::field_type (const FEFamily & fe_family)
    2683             : {
    2684    11690321 :   switch (fe_family)
    2685             :     {
    2686        8357 :     fe_family_vector_case()
    2687        8357 :       return TYPE_VECTOR;
    2688    11661078 :     default:
    2689    11661078 :       return TYPE_SCALAR;
    2690             :     }
    2691             : }
    2692             : 
    2693    34153943 : bool FEInterface::orientation_dependent (const FEFamily & fe_family)
    2694             : {
    2695    34153943 :   switch (fe_family)
    2696             :     {
    2697      605443 :     case HIERARCHIC:
    2698             :     case L2_HIERARCHIC:
    2699             :     case HIERARCHIC_VEC:
    2700             :     case LAGRANGE_GLL:
    2701             :     case L2_HIERARCHIC_VEC:
    2702             :     case BERNSTEIN:
    2703             :     case RATIONAL_BERNSTEIN:
    2704             :     case SZABAB:
    2705             :     case NEDELEC_ONE:
    2706             :     case RAVIART_THOMAS:
    2707      605443 :       return true;
    2708    31751603 :     default:
    2709    31751603 :       return false;
    2710             :     }
    2711             : }
    2712             : 
    2713    11086863 : unsigned int FEInterface::n_vec_dim (const MeshBase & mesh,
    2714             :                                      const FEType & fe_type)
    2715             : {
    2716             :   // We assume the number of vector components is the mesh spatial dimension.
    2717    11086863 :   return field_type(fe_type.family) == TYPE_VECTOR ? mesh.spatial_dimension() : 1;
    2718             : }
    2719             : 
    2720             : 
    2721             : 
    2722             : 
    2723             : bool
    2724        1801 : FEInterface::is_hierarchic (const FEType & fe_type)
    2725             : {
    2726        1801 :   switch (fe_type.family)
    2727             :     {
    2728         284 :     case HERMITE:
    2729             :     case HIERARCHIC:
    2730             :     case HIERARCHIC_VEC:
    2731             :     case L2_HIERARCHIC:
    2732             :     case L2_HIERARCHIC_VEC:
    2733             :     case MONOMIAL:
    2734             :     case MONOMIAL_VEC:
    2735             :     case SIDE_HIERARCHIC:
    2736             :     case SZABAB:
    2737             :     case XYZ:
    2738         284 :       return true;
    2739             : 
    2740         762 :     case BERNSTEIN:
    2741             :     case CLOUGH:  // maybe some day?
    2742             :     case LAGRANGE:
    2743             :     case LAGRANGE_VEC:
    2744             :     case LAGRANGE_GLL:
    2745             :     case L2_LAGRANGE:
    2746             :     case L2_LAGRANGE_GLL:
    2747             :     case L2_LAGRANGE_VEC:
    2748             :     case NEDELEC_ONE:
    2749             :     case RATIONAL_BERNSTEIN:
    2750             :     case RAVIART_THOMAS:
    2751             :     case L2_RAVIART_THOMAS:
    2752             :     case SCALAR:
    2753             :     case SUBDIVISION:
    2754         762 :       return false;
    2755             : 
    2756           0 :     default:
    2757           0 :       libmesh_error_msg("Unknown FE Family " << Utility::enum_to_string(fe_type.family));
    2758             :     }
    2759             : }
    2760             : 
    2761             : 
    2762             : 
    2763     1505133 : FEContinuity FEInterface::get_continuity(const FEType & fe_type)
    2764             : {
    2765     1505133 :   switch (fe_type.family)
    2766             :     {
    2767             :       // Discontinuous elements
    2768       13576 :     case MONOMIAL:
    2769             :     case MONOMIAL_VEC:
    2770             :     case L2_HIERARCHIC:
    2771             :     case L2_LAGRANGE:
    2772             :     case L2_LAGRANGE_GLL:
    2773             :     case XYZ:
    2774             :     case SCALAR:
    2775             :     case L2_RAVIART_THOMAS:
    2776             :     case L2_HIERARCHIC_VEC:
    2777             :     case L2_LAGRANGE_VEC:
    2778       13576 :       return DISCONTINUOUS;
    2779             : 
    2780             :       // C0 elements
    2781     1447104 :     case LAGRANGE:
    2782             :     case LAGRANGE_GLL:
    2783             :     case HIERARCHIC:
    2784             :     case BERNSTEIN:
    2785             :     case SZABAB:
    2786             :     case RATIONAL_BERNSTEIN:
    2787             :     case INFINITE_MAP:
    2788             :     case JACOBI_20_00:
    2789             :     case JACOBI_30_00:
    2790             :     case LEGENDRE:
    2791             :     case LAGRANGE_VEC:
    2792             :     case HIERARCHIC_VEC:
    2793     1447104 :       return C_ZERO;
    2794             : 
    2795             :       // C1 elements
    2796        4560 :     case CLOUGH:
    2797             :     case HERMITE:
    2798             :     case SUBDIVISION:
    2799        4560 :       return C_ONE;
    2800             : 
    2801         272 :     case NEDELEC_ONE:
    2802         272 :       return H_CURL;
    2803             : 
    2804         576 :     case RAVIART_THOMAS:
    2805         576 :       return H_DIV;
    2806             : 
    2807             :       // Side elements
    2808        5494 :     case SIDE_HIERARCHIC:
    2809        5494 :       return SIDE_DISCONTINUOUS;
    2810             : 
    2811           0 :     default:
    2812           0 :       libmesh_error_msg("Unknown FE Family " << Utility::enum_to_string(fe_type.family));
    2813             :     }
    2814             : }
    2815             : 
    2816             : 
    2817             : } // namespace libMesh

Generated by: LCOV version 1.14