20 #include "libmesh/fe.h"    21 #include "libmesh/elem.h"    22 #include "libmesh/fe_interface.h"    23 #include "libmesh/number_lookups.h"    24 #include "libmesh/enum_to_string.h"    31 void hermite_compute_coefs(
const Elem * elem, std::vector<std::vector<Real>> & dxdxi
    33                            , std::vector<Real> & dxdeta, std::vector<Real> & dydxi
    42   const int n_mapping_shape_functions =
    50   for (
int p = 0; p != 2; ++p)
    58       for (
int i = 0; i != n_mapping_shape_functions; ++i)
    60           const Real ddxi = shape_deriv_ptr
    61             (map_fe_type, elem, i, 0, dofpt[p], 
false);
    62           const Real ddeta = shape_deriv_ptr
    63             (map_fe_type, elem, i, 1, dofpt[p], 
false);
    65           dxdxi[0][p] += elem->
point(i)(0) * ddxi;
    66           dxdxi[1][p] += elem->
point(i)(1) * ddeta;
    69           dxdeta[p] += elem->
point(i)(0) * ddeta;
    70           dydxi[p] += elem->
point(i)(1) * ddxi;
    78       libmesh_assert_less (std::abs(dxdeta[p]), 1e-9);
    79       libmesh_assert_less (std::abs(dydxi[p]), 1e-9);
    86 Real hermite_bases_2D (std::vector<unsigned int> & bases1D,
    87                        const std::vector<std::vector<Real>> & dxdxi,
   115           libmesh_error_msg(
"Invalid basis node = " << i/4);
   118       unsigned int basisnum = i%4;
   125           coef = dxdxi[0][bases1D[0]];
   126           bases1D[0] += 2; 
break;
   128           coef = dxdxi[1][bases1D[1]];
   129           bases1D[1] += 2; 
break;
   131           coef = dxdxi[0][bases1D[0]] * dxdxi[1][bases1D[1]];
   132           bases1D[0] += 2; bases1D[1] += 2; 
break;
   134           libmesh_error_msg(
"Invalid basisnum = " << basisnum);
   138   else if (i < 16 + 4*2*e)
   140       unsigned int basisnum = (i - 16) % (2*e);
   141       switch ((i - 16) / (2*e))
   144           bases1D[0] = basisnum/2 + 4;
   145           bases1D[1] = basisnum%2*2;
   150           bases1D[0] = basisnum%2*2 + 1;
   151           bases1D[1] = basisnum/2 + 4;
   156           bases1D[0] = basisnum/2 + 4;
   157           bases1D[1] = basisnum%2*2 + 1;
   162           bases1D[0] = basisnum%2*2;
   163           bases1D[1] = basisnum/2 + 4;
   168           libmesh_error_msg(
"Invalid basisnum = " << basisnum);
   174       unsigned int basisnum = i - 16 - 8*e;
   197                           const unsigned int i,
   199                           const bool add_p_level)
   203   std::vector<std::vector<Real>> dxdxi(2, std::vector<Real>(2, 0));
   206   std::vector<Real> dxdeta(2), dydxi(2);
   209   hermite_compute_coefs(elem,dxdxi
   217   const Order totalorder =
   218     order + add_p_level*elem->
p_level();
   224       libmesh_assert_less (totalorder, 4);
   225       libmesh_fallthrough();
   231         libmesh_assert_less (i, (totalorder+1u)*(totalorder+1u));
   233         std::vector<unsigned int> bases1D;
   235         Real coef = hermite_bases_2D(bases1D, dxdxi, totalorder, i);
   253   libmesh_error_msg(
"Hermite elements require the real element \nto construct gradient-based degrees of freedom.");
   261                           const unsigned int i,
   263                           const bool add_p_level)
   272                                 const unsigned int i,
   273                                 const unsigned int j,
   275                                 const bool add_p_level)
   280   std::vector<std::vector<Real>> dxdxi(2, std::vector<Real>(2, 0));
   283   std::vector<Real> dxdeta(2), dydxi(2);
   286   hermite_compute_coefs(elem,dxdxi
   294   const Order totalorder =
   295     order + add_p_level*elem->
p_level();
   301       libmesh_assert_less (totalorder, 4);
   302       libmesh_fallthrough();
   308         libmesh_assert_less (i, (totalorder+1u)*(totalorder+1u));
   310         std::vector<unsigned int> bases1D;
   312         Real coef = hermite_bases_2D(bases1D, dxdxi, totalorder, i);
   325             libmesh_error_msg(
"Invalid derivative index j = " << j);
   341   libmesh_error_msg(
"Hermite elements require the real element \nto construct gradient-based degrees of freedom.");
   349                                 const unsigned int i,
   350                                 const unsigned int j,
   352                                 const bool add_p_level)
   360 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES   366                                        const unsigned int i,
   367                                        const unsigned int j,
   369                                        const bool add_p_level)
   374   std::vector<std::vector<Real>> dxdxi(2, std::vector<Real>(2, 0));
   377   std::vector<Real> dxdeta(2), dydxi(2);
   380   hermite_compute_coefs(elem,dxdxi
   388   const Order totalorder =
   389     order + add_p_level*elem->
p_level();
   395       libmesh_assert_less (totalorder, 4);
   396       libmesh_fallthrough();
   402         libmesh_assert_less (i, (totalorder+1u)*(totalorder+1u));
   404         std::vector<unsigned int> bases1D;
   406         Real coef = hermite_bases_2D(bases1D, dxdxi, totalorder, i);
   423             libmesh_error_msg(
"Invalid derivative index j = " << j);
   439   libmesh_error_msg(
"Hermite elements require the real element \nto construct gradient-based degrees of freedom.");
   447                                        const unsigned int i,
   448                                        const unsigned int j,
   450                                        const bool add_p_level)
 Real(* shape_deriv_ptr)(const FEType fet, const Elem *elem, const unsigned int i, const unsigned int j, const Point &p, const bool add_p_level)
Typedef for pointer to a function that returns FE shape function derivative values. 
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
ElemType
Defines an enum for geometric element types. 
Order
defines an enum for polynomial orders. 
static OutputShape shape(const ElemType t, const Order o, const unsigned int i, const Point &p)
This is the base class from which all geometric element types are derived. 
static OutputShape shape_deriv(const ElemType t, const Order o, const unsigned int i, const unsigned int j, const Point &p)
unsigned int p_level() const
OrderWrapper order
The approximation order of the element. 
The libMesh namespace provides an interface to certain functionality in the library. 
static Real hermite_raw_shape_second_deriv(const unsigned int basis_num, const Real xi)
1D hermite functions on unit interval 
static Real hermite_raw_shape(const unsigned int basis_num, const Real xi)
const unsigned char square_number_column[]
LIBMESH_DEFAULT_VECTORIZED_FE(template<>Real FE< 0, BERNSTEIN)
static unsigned int n_shape_functions(const unsigned int dim, const FEType &fe_t, const ElemType t)
static shape_deriv_ptr shape_deriv_function(const unsigned int dim, const FEType &fe_t, const ElemType t)
std::string enum_to_string(const T e)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const unsigned char square_number_row[]
static Real hermite_raw_shape_deriv(const unsigned int basis_num, const Real xi)
FEFamily
defines an enum for finite element families. 
virtual Order default_order() const =0
virtual ElemType type() const =0
A Point defines a location in LIBMESH_DIM dimensional Real space. 
const Point & point(const unsigned int i) const
static OutputShape shape_second_deriv(const ElemType t, const Order o, const unsigned int i, const unsigned int j, const Point &p)
static FEFamily map_fe_type(const Elem &elem)