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)
117 libmesh_assert_less (o, 2);
118 libmesh_fallthrough();
127 libmesh_error_msg(
"ERROR: Invalid Order " <<
Utility::enum_to_string(o) <<
" selected for BERNSTEIN FE family!");
131 return ((o+1)*(o+1));
133 libmesh_assert_less (o, 2);
134 libmesh_fallthrough();
142 libmesh_error_msg(
"ERROR: Invalid Order " <<
Utility::enum_to_string(o) <<
" selected for BERNSTEIN FE family!");
145 return ((o+1)*(o+1)*(o+1));
148 libmesh_assert_less (o, 2);
149 libmesh_fallthrough();
152 return ((o+1)*(o+2)/2);
154 libmesh_assert_less (o, 2);
155 libmesh_fallthrough();
158 libmesh_assert_less (o, 3);
159 return ((o+1)*(o+2)*(o+3)/6);
163 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
169unsigned int BERNSTEIN_n_dofs(
const Elem * e,
const Order o)
172 return BERNSTEIN_n_dofs(e->type(), o);
177unsigned 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();
205 libmesh_assert_less (n, 6);
206 libmesh_fallthrough();
221 return ((o-1)*(o-2)/2);
223 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TRI!");
226 libmesh_assert_less (n, 4);
227 libmesh_assert_less (o, 2);
228 libmesh_fallthrough();
230 libmesh_assert_less (n, 8);
231 libmesh_assert_less (o, 3);
232 libmesh_fallthrough();
250 return ((o-1)*(o-1));
253 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for QUAD9!");
257 libmesh_assert_less (n, 8);
258 libmesh_assert_less (o, 2);
259 libmesh_fallthrough();
261 libmesh_assert_less (n, 20);
262 libmesh_assert_less (o, 3);
263 libmesh_fallthrough();
297 return ((o-1)*(o-1));
300 return ((o-1)*(o-1)*(o-1));
303 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for HEX27!");
306 libmesh_assert_less (n, 4);
307 libmesh_assert_less (o, 2);
308 libmesh_fallthrough();
310 libmesh_assert_less (n, 10);
311 libmesh_fallthrough();
313 libmesh_assert_less (o, 3);
337 libmesh_error_msg(
"ERROR: Invalid node ID " << n <<
" selected for TET4/10/14!");
342 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
348unsigned int BERNSTEIN_n_dofs_at_node(
const Elem & e,
350 const unsigned int n)
352 return BERNSTEIN_n_dofs_at_node(e.type(), o, n);
357unsigned int BERNSTEIN_n_dofs_per_elem(
const ElemType t,
const Order o)
371 return ((o-1)*(o-2)/2);
378 libmesh_fallthrough();
383 libmesh_assert_less (o, 2);
386 libmesh_assert_less (o, 3);
391 libmesh_assert_less (o, 2);
392 libmesh_fallthrough();
395 libmesh_assert_less (o, 3);
400 libmesh_error_msg(
"ERROR: Invalid ElemType " <<
Utility::enum_to_string(t) <<
" selected for BERNSTEIN FE family!");
406unsigned int BERNSTEIN_n_dofs_per_elem(
const Elem & e,
const Order o)
408 return BERNSTEIN_n_dofs_per_elem(e.type(), o);
433#ifdef LIBMESH_ENABLE_AMR
438 const unsigned int variable_number,
440{ compute_proj_constraints(constraints, dof_map, variable_number, elem); }
445 const unsigned int variable_number,
447{ 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