21 #include "libmesh/libmesh_config.h" 
   22 #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES 
   27 #include "libmesh/libmesh_common.h" 
   28 #include "libmesh/fe.h" 
   29 #include "libmesh/elem.h" 
   30 #include "libmesh/utility.h" 
   57           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
   65           return (1./4.)*pow<2>(1.-xi);
 
   67           return (1./4.)*pow<2>(1.+xi);
 
   69           return (1./2.)*(1.-xi)*(1.+xi);
 
   71           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
   79           return (1./8.)*pow<3>(1.-xi);
 
   81           return (1./8.)*pow<3>(1.+xi);
 
   83           return (3./8.)*(1.+xi)*pow<2>(1.-xi);
 
   85           return (3./8.)*pow<2>(1.+xi)*(1.-xi);
 
   87           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
   95           return (1./16.)*pow<4>(1.-xi);
 
   97           return (1./16.)*pow<4>(1.+xi);
 
   99           return (1./ 4.)*(1.+xi)*pow<3>(1.-xi);
 
  101           return (3./ 8.)*pow<2>(1.+xi)*pow<2>(1.-xi);
 
  103           return (1./ 4.)*pow<3>(1.+xi)*(1.-xi);
 
  105           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  114           return (1./32.)*pow<5>(1.-xi);
 
  116           return (1./32.)*pow<5>(1.+xi);
 
  118           return (5./32.)*(1.+xi)*pow<4>(1.-xi);
 
  120           return (5./16.)*pow<2>(1.+xi)*pow<3>(1.-xi);
 
  122           return (5./16.)*pow<3>(1.+xi)*pow<2>(1.-xi);
 
  124           return (5./32.)*pow<4>(1.+xi)*(1.-xi);
 
  126           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  135           return ( 1./64.)*pow<6>(1.-xi);
 
  137           return ( 1./64.)*pow<6>(1.+xi);
 
  139           return ( 3./32.)*(1.+xi)*pow<5>(1.-xi);
 
  141           return (15./64.)*pow<2>(1.+xi)*pow<4>(1.-xi);
 
  143           return ( 5./16.)*pow<3>(1.+xi)*pow<3>(1.-xi);
 
  145           return (15./64.)*pow<4>(1.+xi)*pow<2>(1.-xi);
 
  147           return ( 3./32.)*pow<5>(1.+xi)*(1.-xi);
 
  149           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  158         const int p_order = static_cast<int>(order);
 
  159         const int m       = p_order-i+1;
 
  162         Real binomial_p_i = 1;
 
  169                                                 static_cast<unsigned long>(n)));
 
  174             return binomial_p_i * 
std::pow((1-xi)/2, p_order);
 
  176             return binomial_p_i * 
std::pow((1+xi)/2, p_order);
 
  179               return binomial_p_i * 
std::pow((1+xi)/2,n)
 
  192                             const unsigned int i,
 
  194                             const bool add_p_level)
 
  200      static_cast<Order>(order + add_p_level*elem->
p_level()), i, p);
 
  208                                   const unsigned int i,
 
  209                                   const unsigned int libmesh_dbg_var(j),
 
  214   libmesh_assert_equal_to (j, 0);
 
  216   const Real xi = p(0);
 
  231           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  245           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  253           return -0.375*pow<2>(1.-xi);
 
  255           return  0.375*pow<2>(1.+xi);
 
  257           return -0.375 -.75*xi +1.125*pow<2>(xi);
 
  259           return  0.375 -.75*xi -1.125*pow<2>(xi);
 
  261           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  269           return -0.25*pow<3>(1.-xi);
 
  271           return  0.25*pow<3>(1.+xi);
 
  273           return -0.5 +1.5*pow<2>(xi)-pow<3>(xi);
 
  275           return  1.5*(pow<3>(xi)-xi);
 
  277           return  0.5 -1.5*pow<2>(xi)-pow<3>(xi);
 
  279           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  287           return -(5./32.)*pow<4>(xi-1.);
 
  289           return  (5./32.)*pow<4>(xi+1.);
 
  291           return  (5./32.)*pow<4>(1.-xi)         -(5./8.)*(1.+xi)*pow<3>(1.-xi);
 
  293           return  (5./ 8.)*(1.+xi)*pow<3>(1.-xi) -(15./16.)*pow<2>(1.+xi)*pow<2>(1.-xi);
 
  295           return -(5./ 8.)*pow<3>(1.+xi)*(1.-xi) +(15./16.)*pow<2>(1.+xi)*pow<2>(1.-xi);
 
  297           return  (5./ 8.)*pow<3>(1.+xi)*(1.-xi) -(5./32.)*pow<4>(1.+xi);
 
  299           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  307           return -( 3./32.)*pow<5>(1.-xi);
 
  309           return  ( 3./32.)*pow<5>(1.+xi);
 
  311           return  ( 3./32.)*pow<5>(1.-xi)-(15./32.)*(1.+xi)*pow<4>(1.-xi);
 
  313           return  (15./32.)*(1.+xi)*pow<4>(1.-xi)-(15./16.)*pow<2>(1.+xi)*pow<3>(1.-xi);
 
  315           return -(15./ 8.)*xi +(15./4.)*pow<3>(xi)-(15./8.)*pow<5>(xi);
 
  317           return -(15./32.)*(1.-xi)*pow<4>(1.+xi)+(15./16.)*pow<2>(1.-xi)*pow<3>(1.+xi);
 
  319           return  (15./32.)*pow<4>(1.+xi)*(1.-xi)-(3./32.)*pow<5>(1.+xi);
 
  321           libmesh_error_msg(
"Invalid shape function index i = " << i);
 
  330         const int p_order = static_cast<int>(order);
 
  331         const int m       = p_order-(i-1);
 
  334         Real binomial_p_i = 1;
 
  341                                                 static_cast<unsigned long>(n)));
 
  346             return binomial_p_i * (-1./2.) * p_order * 
std::pow((1-xi)/2, p_order-1);
 
  348             return binomial_p_i * ( 1./2.) * p_order * 
std::pow((1+xi)/2, p_order-1);
 
  352               return binomial_p_i * (1./2. * n * 
std::pow((1+xi)/2,n-1) * 
std::pow((1-xi)/2,m)
 
  366                                   const unsigned int i,
 
  367                                   const unsigned int j,
 
  369                                   const bool add_p_level)
 
  375      static_cast<Order>(order + add_p_level*elem->
p_level()), i, j, p);
 
  379 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 
  388   static bool warning_given = 
false;
 
  391     libMesh::err << 
"Second derivatives for Bernstein elements " 
  392                  << 
"are not yet implemented!" 
  395   warning_given = 
true;
 
  410   static bool warning_given = 
false;
 
  413     libMesh::err << 
"Second derivatives for Bernstein elements " 
  414                  << 
"are not yet implemented!" 
  417   warning_given = 
true;
 
  426 #endif //LIBMESH_ENABLE_HIGHER_ORDER_SHAPES