21 #include "libmesh/libmesh_config.h"
23 #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
25 #include "libmesh/fe.h"
26 #include "libmesh/elem.h"
27 #include "libmesh/fe_interface.h"
28 #include "libmesh/enum_to_string.h"
39 void bernstein_nodal_soln(
const Elem * elem,
41 const std::vector<Number> & elem_soln,
42 std::vector<Number> & nodal_soln,
45 const unsigned int n_nodes = elem->n_nodes();
47 const ElemType elem_type = elem->type();
51 const Order totalorder = static_cast<Order>(order + elem->p_level());
61 libmesh_assert_equal_to (elem_soln.size(), 1);
63 const Number val = elem_soln[0];
65 for (
unsigned int n=0; n<
n_nodes; n++)
82 const unsigned int n_sf =
86 std::vector<Point> refspace_nodes;
88 libmesh_assert_equal_to (refspace_nodes.size(),
n_nodes);
90 for (
unsigned int n=0; n<
n_nodes; n++)
92 libmesh_assert_equal_to (elem_soln.size(), n_sf);
98 for (
unsigned int i=0; i<n_sf; i++)
99 nodal_soln[n] += elem_soln[i] *
108 libmesh_error_msg(
"ERROR: Invalid total order " << totalorder);
114 unsigned int bernstein_n_dofs(
const ElemType t,
const Order o)
125 libmesh_assert_less (o, 2);
126 libmesh_fallthrough();
135 libmesh_error_msg(
"ERROR: Invalid Order " <<
Utility::enum_to_string(o) <<
" selected for BERNSTEIN FE family!");
138 return ((o+1)*(o+1));
140 libmesh_assert_less (o, 2);
141 libmesh_fallthrough();
149 libmesh_error_msg(
"ERROR: Invalid Order " <<
Utility::enum_to_string(o) <<
" selected for BERNSTEIN FE family!");
152 return ((o+1)*(o+1)*(o+1));
155 libmesh_assert_less (o, 2);
156 libmesh_fallthrough();
158 return ((o+1)*(o+2)/2);
160 libmesh_assert_less (o, 2);
161 libmesh_fallthrough();
164 libmesh_assert_less (o, 3);
165 return ((o+1)*(o+2)*(o+3)/6);
170 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
177 unsigned int bernstein_n_dofs_at_node(
const ElemType t,
179 const unsigned int n)
197 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for EDGE2/3!");
200 libmesh_assert_less (n, 3);
201 libmesh_assert_less (o, 2);
202 libmesh_fallthrough();
217 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TRI6!");
220 libmesh_assert_less (n, 4);
221 libmesh_assert_less (o, 2);
222 libmesh_fallthrough();
224 libmesh_assert_less (n, 8);
225 libmesh_assert_less (o, 3);
226 libmesh_fallthrough();
248 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for QUAD9!");
252 libmesh_assert_less (n, 8);
253 libmesh_assert_less (o, 2);
254 libmesh_fallthrough();
256 libmesh_assert_less (n, 20);
257 libmesh_assert_less (o, 3);
258 libmesh_fallthrough();
292 return ((o-1)*(o-1));
299 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for HEX27!");
302 libmesh_assert_less (n, 4);
303 libmesh_assert_less (o, 2);
304 libmesh_fallthrough();
306 libmesh_assert_less (o, 3);
307 libmesh_assert_less (n, 10);
325 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TET10!");
330 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
337 unsigned int bernstein_n_dofs_per_elem(
const ElemType t,
const Order o)
351 return ((o-1)*(o-2)/2);
356 libmesh_fallthrough();
358 return ((o-1)*(o-1));
360 libmesh_assert_less (o, 2);
361 libmesh_fallthrough();
363 libmesh_assert_less (o, 3);
366 return ((o-1)*(o-1)*(o-1));
368 libmesh_assert_less (o, 2);
369 libmesh_fallthrough();
371 libmesh_assert_less (o, 3);
376 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
392 const std::vector<Number> & elem_soln,
393 std::vector<Number> & nodal_soln)
394 { bernstein_nodal_soln(elem, order, elem_soln, nodal_soln, 0); }
399 const std::vector<Number> & elem_soln,
400 std::vector<Number> & nodal_soln)
401 { bernstein_nodal_soln(elem, order, elem_soln, nodal_soln, 1); }
406 const std::vector<Number> & elem_soln,
407 std::vector<Number> & nodal_soln)
408 { bernstein_nodal_soln(elem, order, elem_soln, nodal_soln, 2); }
413 const std::vector<Number> & elem_soln,
414 std::vector<Number> & nodal_soln)
415 { bernstein_nodal_soln(elem, order, elem_soln, nodal_soln, 3); }
448 #ifdef LIBMESH_ENABLE_AMR
453 const unsigned int variable_number,
455 { compute_proj_constraints(constraints, dof_map, variable_number, elem); }
460 const unsigned int variable_number,
462 { compute_proj_constraints(constraints, dof_map, variable_number, elem); }
463 #endif // #ifdef LIBMESH_ENABLE_AMR
474 #endif //LIBMESH_ENABLE_HIGHER_ORDER_SHAPES