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 hierarchic_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();
48 const Order totalorder = order + add_p_level*elem->p_level();
58 libmesh_assert_equal_to (elem_soln.size(), 1);
60 std::fill(nodal_soln.begin(), nodal_soln.end(), elem_soln[0]);
70 const unsigned int n_sf =
73 std::vector<Point> refspace_nodes;
75 libmesh_assert_equal_to (refspace_nodes.size(),
n_nodes);
76 libmesh_assert_equal_to (elem_soln.size(), n_sf);
79 std::fill(nodal_soln.begin(), nodal_soln.end(), 0);
81 for (
unsigned int n=0; n<
n_nodes; n++)
83 for (
unsigned int i=0; i<n_sf; i++)
84 nodal_soln[n] += elem_soln[i] *
94 unsigned int HIERARCHIC_n_dofs(
const ElemType t,
const Order o)
96 libmesh_assert_greater (o, 0);
106 libmesh_assert_less (o, 2);
107 libmesh_fallthrough();
112 return ((o+1)*(o+1));
115 libmesh_assert_less (o, 2);
116 libmesh_fallthrough();
118 return ((o+1)*(o+1)*(o+1));
121 libmesh_assert_less (o, 2);
122 libmesh_fallthrough();
124 libmesh_assert_less (o, 3);
125 libmesh_fallthrough();
128 return ((o+1)*(o+1)*(o+2)/2);
130 libmesh_assert_less (o, 2);
131 libmesh_fallthrough();
134 return ((o+1)*(o+2)/2);
136 libmesh_assert_less (o, 2);
137 libmesh_fallthrough();
139 libmesh_assert_less (o, 3);
140 libmesh_fallthrough();
142 return ((o+1)*(o+2)*(o+3)/6);
146 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for HIERARCHIC FE family!");
152 unsigned int HIERARCHIC_n_dofs(
const Elem * e,
const Order o)
155 return HIERARCHIC_n_dofs(e->type(), o);
160 unsigned int HIERARCHIC_n_dofs_at_node(
const ElemType t,
162 const unsigned int n)
164 libmesh_assert_greater (o, 0);
178 libmesh_assert_equal_to(t,
EDGE3);
181 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for EDGE2/3!");
184 libmesh_assert_less (n, 3);
185 libmesh_assert_less (o, 2);
186 libmesh_fallthrough();
189 libmesh_assert_less (n, 6);
190 libmesh_fallthrough();
205 return ((o-1)*(o-2)/2);
207 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TRI!");
211 libmesh_assert_less (n, 4);
212 libmesh_assert_less (o, 2);
213 libmesh_fallthrough();
237 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for QUAD4/8/9!");
240 libmesh_assert_less (n, 8);
241 libmesh_assert_less (o, 2);
242 libmesh_fallthrough();
244 libmesh_assert_less (n, 20);
245 libmesh_assert_less (o, 2);
246 libmesh_fallthrough();
280 return ((o-1)*(o-1));
286 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for HEX8/20/27!");
290 libmesh_assert_less (n, 6);
291 libmesh_fallthrough();
293 libmesh_assert_less (n, 15);
294 libmesh_assert_less (o, 2);
295 libmesh_fallthrough();
297 libmesh_assert_less (n, 18);
298 libmesh_assert_less (o, 3);
299 libmesh_fallthrough();
303 libmesh_assert_less (n, 20);
304 libmesh_fallthrough();
306 libmesh_assert_less (n, 21);
331 return ((o-1)*(o-1));
335 return ((o-1)*(o-2)/2);
337 return ((o-1)*(o-1)*(o-2)/2);
339 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TRI!");
343 libmesh_assert_less (o, 2);
344 libmesh_assert_less (n, 4);
345 libmesh_fallthrough();
347 libmesh_assert_less (o, 3);
348 libmesh_assert_less (n, 10);
349 libmesh_fallthrough();
351 libmesh_assert_less (n, 14);
372 return ((o-1)*(o-2)/2);
375 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TET!");
389 unsigned int HIERARCHIC_n_dofs_at_node(
const Elem & e,
391 const unsigned int n)
393 return HIERARCHIC_n_dofs_at_node(e.type(), o, n);
398 unsigned int HIERARCHIC_n_dofs_per_elem(
const ElemType t,
401 libmesh_assert_greater (o, 0);
415 return ((o-1)*(o-2)/2);
422 return ((o-1)*(o-1));
425 libmesh_assert_less (o, 2);
428 return ((o-1)*(o-1)*(o-1));
431 libmesh_assert_less (o, 2);
432 libmesh_fallthrough();
434 libmesh_assert_less (o, 3);
437 return ((o-1)*(o-1)*(o-2)/2);
441 libmesh_assert_less (o, 2);
442 libmesh_fallthrough();
444 libmesh_assert_less (o, 3);
445 libmesh_fallthrough();
447 return ((o-3)*(o-2)*(o-1)/6);
457 unsigned int HIERARCHIC_n_dofs_per_elem(
const Elem & e,
460 return HIERARCHIC_n_dofs_per_elem(e.type(), o);
487 #ifdef LIBMESH_ENABLE_AMR 492 const unsigned int variable_number,
494 { compute_proj_constraints(constraints, dof_map, variable_number, elem); }
499 const unsigned int variable_number,
501 { compute_proj_constraints(constraints, dof_map, variable_number, elem); }
502 #endif // #ifdef LIBMESH_ENABLE_AMR ElemType
Defines an enum for geometric element types.
Order
defines an enum for polynomial orders.
This is the base class from which all geometric element types are derived.
virtual bool shapes_need_reinit() const override
The libMesh namespace provides an interface to certain functionality in the library.
LIBMESH_FE_NODAL_SOLN(LIBMESH_FE_SIDE_NODAL_SOLN() LIBMESH_DEFAULT_NDOFS(BERNSTEIN) template<> FEContinuity FE< 0 BERNSTEIN, bernstein_nodal_soln)
virtual bool is_hierarchic() const override
This class handles the numbering of degrees of freedom on a mesh.
LIBMESH_FE_SIDE_NODAL_SOLN(HIERARCHIC_VEC)
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)
virtual FEContinuity get_continuity() const override
std::string enum_to_string(const T e)
static void compute_constraints(DofConstraints &constraints, DofMap &dof_map, const unsigned int variable_number, const Elem *elem)
Computes the constraint matrix contributions (for non-conforming adapted meshes) corresponding to var...
FEContinuity
defines an enum for finite element types to libmesh_assert a certain level (or type? Hcurl?) of continuity.
The constraint matrix storage format.