20 #include "libmesh/libmesh_config.h"
21 #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
23 #include "libmesh/elem.h"
24 #include "libmesh/fe.h"
25 #include "libmesh/fe_interface.h"
42 libmesh_error_msg(
"Rational bases require the real element \nto query nodal weighting.");
53 const bool add_p_level)
59 const Order totalorder = static_cast<Order>(order + add_p_level * elem->
p_level());
62 FEType fe_type(totalorder, _underlying_fe_family);
64 const unsigned int n_sf =
68 libmesh_assert_equal_to (n_sf,
n_nodes);
70 std::vector<Real> node_weights(
n_nodes);
73 for (
unsigned int n=0; n<
n_nodes; n++)
77 Real weighted_shape_i = 0, weighted_sum = 0;
79 for (
unsigned int sf=0; sf<n_sf; sf++)
81 Real weighted_shape = node_weights[sf] *
83 weighted_sum += weighted_shape;
85 weighted_shape_i = weighted_shape;
88 return weighted_shape_i / weighted_sum;
100 libmesh_error_msg(
"Rational bases require the real element \nto query nodal weighting.");
109 const unsigned int i,
110 const unsigned int j,
112 const bool add_p_level)
118 const Order totalorder = static_cast<Order>(order + add_p_level * elem->
p_level());
121 FEType fe_type(totalorder, _underlying_fe_family);
123 const unsigned int n_sf =
127 libmesh_assert_equal_to (n_sf,
n_nodes);
129 std::vector<Real> node_weights(
n_nodes);
132 for (
unsigned int n=0; n<
n_nodes; n++)
136 Real weighted_shape_i = 0, weighted_sum = 0,
137 weighted_grad_i = 0, weighted_grad_sum = 0;
139 for (
unsigned int sf=0; sf<n_sf; sf++)
141 Real weighted_shape = node_weights[sf] *
143 Real weighted_grad = node_weights[sf] *
145 weighted_sum += weighted_shape;
146 weighted_grad_sum += weighted_grad;
149 weighted_shape_i = weighted_shape;
150 weighted_grad_i = weighted_grad;
154 return (weighted_sum * weighted_grad_i - weighted_shape_i * weighted_grad_sum) /
155 weighted_sum / weighted_sum;
160 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
168 libmesh_error_msg(
"Rational bases require the real element \nto query nodal weighting.");
177 const unsigned int i,
178 const unsigned int j,
180 const bool add_p_level)
220 const Order totalorder = static_cast<Order>(order + add_p_level * elem->
p_level());
223 FEType fe_type(totalorder, _underlying_fe_family);
225 const unsigned int n_sf =
229 libmesh_assert_equal_to (n_sf,
n_nodes);
231 std::vector<Real> node_weights(
n_nodes);
234 for (
unsigned int n=0; n<
n_nodes; n++)
238 Real weighted_shape_i = 0, weighted_sum = 0,
239 weighted_grada_i = 0, weighted_grada_sum = 0,
240 weighted_gradb_i = 0, weighted_gradb_sum = 0,
241 weighted_hess_i = 0, weighted_hess_sum = 0;
243 for (
unsigned int sf=0; sf<n_sf; sf++)
245 Real weighted_shape = node_weights[sf] *
247 Real weighted_grada = node_weights[sf] *
249 Real weighted_hess = node_weights[sf] *
251 weighted_sum += weighted_shape;
252 weighted_grada_sum += weighted_grada;
253 Real weighted_gradb = weighted_grada;
256 weighted_gradb = (j1 == j2) ? weighted_grada :
259 weighted_grada_sum += weighted_grada;
261 weighted_hess_sum += weighted_hess;
264 weighted_shape_i = weighted_shape;
265 weighted_grada_i = weighted_grada;
266 weighted_gradb_i = weighted_gradb;
267 weighted_hess_i = weighted_hess;
272 weighted_gradb_sum = weighted_grada_sum;
274 return (weighted_sum * weighted_hess_i - weighted_grada_i * weighted_gradb_sum -
275 weighted_shape_i * weighted_hess_sum - weighted_gradb_i * weighted_grada_sum +
276 2 * weighted_grada_sum * weighted_shape_i * weighted_gradb_sum / weighted_sum) /
277 weighted_sum / weighted_sum;
285 #endif// LIBMESH_ENABLE_HIGHER_ORDER_SHAPES