21 #include "libmesh/elem.h" 22 #include "libmesh/enum_to_string.h" 23 #include "libmesh/fe.h" 24 #include "libmesh/fe_interface.h" 25 #include "libmesh/fe_macro.h" 36 void hermite_nodal_soln(
const Elem * elem,
38 const std::vector<Number> & elem_soln,
39 std::vector<Number> & nodal_soln,
40 const bool add_p_level)
42 const unsigned int n_nodes = elem->n_nodes();
44 const ElemType elem_type = elem->type();
51 const unsigned int n_sf =
54 std::vector<Point> refspace_nodes;
56 libmesh_assert_equal_to (refspace_nodes.size(),
n_nodes);
57 libmesh_assert_equal_to (elem_soln.size(), n_sf);
60 std::fill(nodal_soln.begin(), nodal_soln.end(), 0);
62 for (
unsigned int n=0; n<
n_nodes; n++)
64 for (
unsigned int i=0; i<n_sf; i++)
65 nodal_soln[n] += elem_soln[i] *
75 libmesh_error_msg_if(o < 3, "Error: Hermite elements require order>=3, but you asked
for order=
" << o); 78 // Piecewise (bi/tri)cubic C1 Hermite splines 84 libmesh_assert_less (o, 4); 85 libmesh_fallthrough(); 93 libmesh_assert_less (o, 4); 94 libmesh_fallthrough(); 101 libmesh_assert_less (o, 4); 102 libmesh_fallthrough(); 104 return ((o+1)*(o+1)*(o+1)); 110 libmesh_error_msg("ERROR: Bad
ElemType =
" << Utility::enum_to_string(t) << " for " << Utility::enum_to_string(o) << " order approximation!
"); 112 } // HERMITE_n_dofs() 116 unsigned int HERMITE_n_dofs(const Elem * e, const Order o) 119 return HERMITE_n_dofs(e->type(), o); 124 unsigned int HERMITE_n_dofs_at_node(const ElemType t, 126 const unsigned int n) 128 libmesh_assert_greater (o, 2); 129 // Piecewise (bi/tri)cubic C1 Hermite splines 143 // Interior DoFs are carried on Elems 148 libmesh_error_msg("ERROR: Invalid node ID
" << n << " selected
for EDGE2/3!
"); 154 libmesh_assert_less (o, 4); 155 libmesh_fallthrough(); 176 // Interior DoFs are carried on Elems 177 // return ((o-3)*(o-3)); 181 libmesh_error_msg("ERROR: Invalid node ID
" << n << " selected
for QUAD4/8/9!
"); 187 libmesh_assert_less (o, 4); 188 libmesh_fallthrough(); 224 return (2*(o-3)*(o-3)); 226 // Interior DoFs are carried on Elems 227 // return ((o-3)*(o-3)*(o-3)); 231 libmesh_error_msg("ERROR: Invalid node ID
" << n << " selected
for HEX8/20/27!
"); 239 libmesh_error_msg("ERROR: Bad
ElemType =
" << Utility::enum_to_string(t) << " for " << Utility::enum_to_string(o) << " order approximation!
"); 241 } // HERMITE_n_dofs_at_node() 245 unsigned int HERMITE_n_dofs_at_node(const Elem & e, 247 const unsigned int n) 249 return HERMITE_n_dofs_at_node(e.type(), o, n); 254 unsigned int HERMITE_n_dofs_per_elem(const ElemType t, 257 libmesh_assert_greater (o, 2); 268 libmesh_assert_less (o, 4); 269 libmesh_fallthrough(); 274 return ((o-3)*(o-3)); 276 libmesh_assert_less (o, 4); 277 libmesh_fallthrough(); 280 return ((o-3)*(o-3)*(o-3)); 286 libmesh_error_msg("ERROR: Bad
ElemType =
" << Utility::enum_to_string(t) << " for " << Utility::enum_to_string(o) << " order approximation!
"); 288 } // HERMITE_n_dofs_per_elem() 292 unsigned int HERMITE_n_dofs_per_elem(const Elem & e, 295 return HERMITE_n_dofs_per_elem(e.type(), o); 299 } // anonymous namespace 302 // Instantiate (side_) nodal_soln() function for every dimension 303 LIBMESH_FE_NODAL_SOLN(HERMITE, hermite_nodal_soln) 304 LIBMESH_FE_SIDE_NODAL_SOLN(HERMITE) 307 // Instantiate n_dofs*() functions for every dimension 308 LIBMESH_DEFAULT_NDOFS(HERMITE) 311 // Hermite FEMs are C^1 continuous 312 template <> FEContinuity FE<0,HERMITE>::get_continuity() const { return C_ONE; } 313 template <> FEContinuity FE<1,HERMITE>::get_continuity() const { return C_ONE; } 314 template <> FEContinuity FE<2,HERMITE>::get_continuity() const { return C_ONE; } 315 template <> FEContinuity FE<3,HERMITE>::get_continuity() const { return C_ONE; } 317 // Hermite FEMs are hierarchic 318 template <> bool FE<0,HERMITE>::is_hierarchic() const { return true; } 319 template <> bool FE<1,HERMITE>::is_hierarchic() const { return true; } 320 template <> bool FE<2,HERMITE>::is_hierarchic() const { return true; } 321 template <> bool FE<3,HERMITE>::is_hierarchic() const { return true; } 324 #ifdef LIBMESH_ENABLE_AMR 325 // compute_constraints() specializations are only needed for 2 and 3D 327 void FE<2,HERMITE>::compute_constraints (DofConstraints & constraints, 329 const unsigned int variable_number, 331 { compute_proj_constraints(constraints, dof_map, variable_number, elem); } 334 void FE<3,HERMITE>::compute_constraints (DofConstraints & constraints, 336 const unsigned int variable_number, 338 { compute_proj_constraints(constraints, dof_map, variable_number, elem); } 339 #endif // #ifdef LIBMESH_ENABLE_AMR 341 // Hermite FEM shapes need reinit 342 template <> bool FE<0,HERMITE>::shapes_need_reinit() const { return true; } 343 template <> bool FE<1,HERMITE>::shapes_need_reinit() const { return true; } 344 template <> bool FE<2,HERMITE>::shapes_need_reinit() const { return true; } 345 template <> bool FE<3,HERMITE>::shapes_need_reinit() const { return true; } 347 } // namespace libMesh ElemType
Defines an enum for geometric element types.
Order
defines an enum for polynomial orders.
The libMesh namespace provides an interface to certain functionality in the library.
const dof_id_type n_nodes
static unsigned int n_shape_functions(const unsigned int dim, const FEType &fe_t, const ElemType t)
static Real shape(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const Point &p)
static void get_refspace_nodes(const ElemType t, std::vector< Point > &nodes)