21#include "libmesh/libmesh_config.h"
23#ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
25#include "libmesh/elem.h"
26#include "libmesh/enum_to_string.h"
27#include "libmesh/fe.h"
28#include "libmesh/fe_interface.h"
29#include "libmesh/fe_macro.h"
40void bernstein_nodal_soln(
const Elem * elem,
42 const std::vector<Number> & elem_soln,
43 std::vector<Number> & nodal_soln,
44 const bool add_p_level)
46 const unsigned int n_nodes = elem->n_nodes();
48 const ElemType elem_type = elem->type();
52 const Order totalorder = order + add_p_level*elem->p_level();
62 libmesh_assert_equal_to (elem_soln.size(), 1);
64 std::fill(nodal_soln.begin(), nodal_soln.end(), elem_soln[0]);
79 const unsigned int n_sf =
82 std::vector<Point> refspace_nodes;
84 libmesh_assert_equal_to (refspace_nodes.size(),
n_nodes);
85 libmesh_assert_equal_to (elem_soln.size(), n_sf);
88 std::fill(nodal_soln.begin(), nodal_soln.end(), 0);
90 for (
unsigned int n=0; n<
n_nodes; n++)
92 for (
unsigned int i=0; i<n_sf; i++)
93 nodal_soln[n] += elem_soln[i] *
100 libmesh_error_msg(
"ERROR: Invalid total order " << totalorder);
106unsigned int BERNSTEIN_n_dofs(
const ElemType t,
const Order o)
118 libmesh_assert_less (o, 2);
119 libmesh_fallthrough();
128 libmesh_error_msg(
"ERROR: Invalid Order " <<
Utility::enum_to_string(o) <<
" selected for BERNSTEIN FE family!");
132 return ((o+1)*(o+1));
134 libmesh_assert_less (o, 2);
135 libmesh_fallthrough();
143 libmesh_error_msg(
"ERROR: Invalid Order " <<
Utility::enum_to_string(o) <<
" selected for BERNSTEIN FE family!");
146 return ((o+1)*(o+1)*(o+1));
149 libmesh_assert_less (o, 2);
150 libmesh_fallthrough();
153 return ((o+1)*(o+2)/2);
155 libmesh_assert_less (o, 2);
156 libmesh_fallthrough();
159 libmesh_assert_less (o, 3);
160 return ((o+1)*(o+2)*(o+3)/6);
164 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
170unsigned int BERNSTEIN_n_dofs(
const Elem * e,
const Order o)
173 return BERNSTEIN_n_dofs(e->type(), o);
178unsigned int BERNSTEIN_n_dofs_at_node(
const ElemType t,
180 const unsigned int n)
198 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for EDGE2/3!");
213 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for EDGE4!");
216 libmesh_assert_less (n, 3);
217 libmesh_assert_less (o, 2);
218 libmesh_fallthrough();
221 libmesh_assert_less (n, 6);
222 libmesh_fallthrough();
237 return ((o-1)*(o-2)/2);
239 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TRI!");
242 libmesh_assert_less (n, 4);
243 libmesh_assert_less (o, 2);
244 libmesh_fallthrough();
246 libmesh_assert_less (n, 8);
247 libmesh_assert_less (o, 3);
248 libmesh_fallthrough();
266 return ((o-1)*(o-1));
269 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for QUAD9!");
273 libmesh_assert_less (n, 8);
274 libmesh_assert_less (o, 2);
275 libmesh_fallthrough();
277 libmesh_assert_less (n, 20);
278 libmesh_assert_less (o, 3);
279 libmesh_fallthrough();
313 return ((o-1)*(o-1));
316 return ((o-1)*(o-1)*(o-1));
319 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for HEX27!");
322 libmesh_assert_less (n, 4);
323 libmesh_assert_less (o, 2);
324 libmesh_fallthrough();
326 libmesh_assert_less (n, 10);
327 libmesh_fallthrough();
329 libmesh_assert_less (o, 3);
353 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TET4/10/14!");
358 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
364unsigned int BERNSTEIN_n_dofs_at_node(
const Elem & e,
366 const unsigned int n)
368 return BERNSTEIN_n_dofs_at_node(e.type(), o, n);
373unsigned int BERNSTEIN_n_dofs_per_elem(
const ElemType t,
const Order o)
388 return ((o-1)*(o-2)/2);
395 libmesh_fallthrough();
400 libmesh_assert_less (o, 2);
403 libmesh_assert_less (o, 3);
408 libmesh_assert_less (o, 2);
409 libmesh_fallthrough();
412 libmesh_assert_less (o, 3);
417 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
423unsigned int BERNSTEIN_n_dofs_per_elem(
const Elem & e,
const Order o)
425 return BERNSTEIN_n_dofs_per_elem(e.type(), o);
450#ifdef LIBMESH_ENABLE_AMR
455 const unsigned int variable_number,
457{ compute_proj_constraints(constraints, dof_map, variable_number, elem); }
462 const unsigned int variable_number,
464{ compute_proj_constraints(constraints, dof_map, variable_number, elem); }
The constraint matrix storage format.
This class handles the numbering of degrees of freedom on a mesh.
This is the base class from which all geometric element types are derived.
static void get_refspace_nodes(const ElemType t, std::vector< Point > &nodes)
static Real shape(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const Point &p)
static unsigned int n_shape_functions(const unsigned int dim, const FEType &fe_t, const ElemType t)
virtual bool is_hierarchic() const override
virtual FEContinuity get_continuity() const override
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...
virtual bool shapes_need_reinit() const override
std::string enum_to_string(const T e)
The libMesh namespace provides an interface to certain functionality in the library.
LIBMESH_FE_NODAL_SOLN(BERNSTEIN, bernstein_nodal_soln)
ElemType
Defines an enum for geometric element types.
LIBMESH_FE_SIDE_NODAL_SOLN(HIERARCHIC_VEC)
const dof_id_type n_nodes