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" 26 #include "libmesh/int_range.h" 27 #include "libmesh/libmesh_logging.h" 38 void xyz_nodal_soln(
const Elem * elem,
40 const std::vector<Number> & elem_soln,
41 std::vector<Number> & nodal_soln,
42 const bool add_p_level)
44 const unsigned int n_nodes = elem->n_nodes();
48 const Order totalorder = order + add_p_level*elem->p_level();
55 libmesh_assert_equal_to (elem_soln.size(), 1);
57 std::fill(nodal_soln.begin(), nodal_soln.end(), elem_soln[0]);
68 FEType fe_type(order,
XYZ);
70 const unsigned int n_sf =
72 libmesh_assert_equal_to (elem_soln.size(), n_sf);
75 std::fill(nodal_soln.begin(), nodal_soln.end(), 0);
77 for (
unsigned int n=0; n<
n_nodes; n++)
79 for (
unsigned int i=0; i<n_sf; i++)
80 nodal_soln[n] += elem_soln[i] *
97 template <
unsigned int Dim>
105 this->determine_calculations();
108 LOG_SCOPE(
"init_shape_functions()",
"FE");
111 const std::size_t n_qp = qp.size();
115 const unsigned int n_approx_shape_functions =
123 if (this->calculate_phi)
124 this->phi.resize (n_approx_shape_functions);
125 if (this->calculate_dphi)
127 this->dphi.resize (n_approx_shape_functions);
128 this->dphidx.resize (n_approx_shape_functions);
129 this->dphidy.resize (n_approx_shape_functions);
130 this->dphidz.resize (n_approx_shape_functions);
133 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 134 if (this->calculate_d2phi)
136 this->d2phi.resize (n_approx_shape_functions);
137 this->d2phidx2.resize (n_approx_shape_functions);
138 this->d2phidxdy.resize (n_approx_shape_functions);
139 this->d2phidxdz.resize (n_approx_shape_functions);
140 this->d2phidy2.resize (n_approx_shape_functions);
141 this->d2phidydz.resize (n_approx_shape_functions);
142 this->d2phidz2.resize (n_approx_shape_functions);
143 this->d2phidxi2.resize (n_approx_shape_functions);
145 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 147 for (
unsigned int i=0; i<n_approx_shape_functions; i++)
149 if (this->calculate_phi)
150 this->phi[i].resize (n_qp);
151 if (this->calculate_dphi)
153 this->dphi[i].resize (n_qp);
154 this->dphidx[i].resize (n_qp);
155 this->dphidy[i].resize (n_qp);
156 this->dphidz[i].resize (n_qp);
158 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 159 if (this->calculate_d2phi)
161 this->d2phi[i].resize (n_qp);
162 this->d2phidx2[i].resize (n_qp);
163 this->d2phidxdy[i].resize (n_qp);
164 this->d2phidxdz[i].resize (n_qp);
165 this->d2phidy2[i].resize (n_qp);
166 this->d2phidydz[i].resize (n_qp);
167 this->d2phidz2[i].resize (n_qp);
169 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 175 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 183 this->
weight.resize (n_qp);
184 this->dweight.resize (n_qp);
185 this->dphase.resize (n_qp);
187 for (
unsigned int p=0; p<n_qp; p++)
190 this->dweight[p].zero();
191 this->dphase[p].zero();
195 #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 197 if (this->calculate_dual)
198 this->init_dual_shape_functions(n_approx_shape_functions, n_qp);
204 template <
unsigned int Dim>
206 const std::vector<Point> &)
216 LOG_SCOPE(
"compute_shape_functions()",
"FE");
218 const std::vector<Point> & xyz_qp = this->get_xyz();
226 if (this->calculate_phi)
231 if (this->calculate_dphi)
235 this->dphi[i][p](0) =
238 this->dphi[i][p](1) = this->dphidy[i][p] = 0.;
239 this->dphi[i][p](2) = this->dphidz[i][p] = 0.;
241 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 242 if (this->calculate_d2phi)
246 this->d2phi[i][p](0,0) =
250 this->d2phi[i][p](0,1) = this->d2phidxdy[i][p] =
251 this->d2phi[i][p](1,0) = 0.;
252 this->d2phi[i][p](1,1) = this->d2phidy2[i][p] = 0.;
254 this->d2phi[i][p](0,2) = this->d2phidxdz[i][p] =
255 this->d2phi[i][p](2,0) = 0.;
256 this->d2phi[i][p](1,2) = this->d2phidydz[i][p] =
257 this->d2phi[i][p](2,1) = 0.;
258 this->d2phi[i][p](2,2) = this->d2phidz2[i][p] = 0.;
262 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 270 if (this->calculate_phi)
275 if (this->calculate_dphi)
279 this->dphi[i][p](0) =
282 this->dphi[i][p](1) =
286 this->dphi[i][p](2) =
288 this->dphidz[i][p] = 0.;
290 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 291 if (this->calculate_d2phi)
295 this->d2phi[i][p](0,0) =
298 this->d2phi[i][p](0,1) = this->d2phidxdy[i][p] =
300 this->d2phi[i][p](1,1) =
303 this->d2phi[i][p](0,2) = this->d2phidxdz[i][p] =
304 this->d2phi[i][p](2,0) = 0.;
305 this->d2phi[i][p](1,2) = this->d2phidydz[i][p] =
306 this->d2phi[i][p](2,1) = 0.;
307 this->d2phi[i][p](2,2) = this->d2phidz2[i][p] = 0.;
310 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 318 if (this->calculate_phi)
323 if (this->calculate_dphi)
327 this->dphi[i][p](0) =
330 this->dphi[i][p](1) =
333 this->dphi[i][p](2) =
336 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 337 if (this->calculate_d2phi)
341 this->d2phi[i][p](0,0) =
344 this->d2phi[i][p](0,1) = this->d2phidxdy[i][p] =
346 this->d2phi[i][p](1,1) =
348 this->d2phi[i][p](0,2) = this->d2phidxdz[i][p] =
350 this->d2phi[i][p](1,2) = this->d2phidydz[i][p] =
354 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES 361 libmesh_error_msg(
"ERROR: Invalid dimension " << this->
dim);
418 #ifdef LIBMESH_ENABLE_AMR 426 #endif // #ifdef LIBMESH_ENABLE_AMR static unsigned int n_dofs(const ElemType t, const Order o)
ElemType
Defines an enum for geometric element types.
Order
defines an enum for polynomial orders.
static OutputShape shape(const ElemType t, const Order o, const unsigned int i, const Point &p)
This is the base class from which all geometric element types are derived.
static unsigned int n_dofs_at_node(const ElemType t, const Order o, const unsigned int n)
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 void compute_shape_functions(const Elem *elem, const std::vector< Point > &qp) override
After having updated the jacobian and the transformation from local to global coordinates in FEAbstra...
virtual bool is_hierarchic() const override
This class handles the numbering of degrees of freedom on a mesh.
A specific instantiation of the FEBase class.
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)
unsigned int monomial_n_dofs(const ElemType t, const Order o)
Helper functions for Discontinuous-Pn type basis functions.
static unsigned int n_dofs_per_elem(const ElemType t, const Order o)
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...
FEContinuity
defines an enum for finite element types to libmesh_assert a certain level (or type? Hcurl?) of continuity.
virtual void init_shape_functions(const std::vector< Point > &qp, const Elem *e) override
Update the various member data fields phi, dphidxi, dphideta, dphidzeta, etc.
The constraint matrix storage format.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
static OutputShape shape_second_deriv(const ElemType t, const Order o, const unsigned int i, const unsigned int j, const Point &p)