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)
206 const Order totalorder = static_cast<Order>(order + add_p_level * elem->
p_level());
209 FEType fe_type(totalorder, _underlying_fe_family);
211 const unsigned int n_sf =
215 libmesh_assert_equal_to (n_sf,
n_nodes);
217 std::vector<Real> node_weights(
n_nodes);
219 for (
unsigned int n=0; n<
n_nodes; n++)
222 Real weighted_shape_i = 0, weighted_sum = 0,
223 weighted_grada_i = 0, weighted_grada_sum = 0,
224 weighted_gradb_i = 0, weighted_gradb_sum = 0,
225 weighted_hess_i = 0, weighted_hess_sum = 0;
227 for (
unsigned int sf=0; sf<n_sf; sf++)
229 Real weighted_shape = node_weights[sf] *
231 Real weighted_grada = node_weights[sf] *
233 Real weighted_hess = node_weights[sf] *
235 weighted_sum += weighted_shape;
236 weighted_grada_sum += weighted_grada;
237 Real weighted_gradb = weighted_grada;
240 weighted_gradb = (j1 == j2) ? weighted_grada :
243 weighted_grada_sum += weighted_grada;
245 weighted_hess_sum += weighted_hess;
248 weighted_shape_i = weighted_shape;
249 weighted_grada_i = weighted_grada;
250 weighted_gradb_i = weighted_gradb;
251 weighted_hess_i = weighted_hess;
256 weighted_gradb_sum = weighted_grada_sum;
258 return (weighted_sum * weighted_hess_i - weighted_grada_i * weighted_gradb_sum -
259 weighted_shape_i * weighted_hess_sum - weighted_gradb_i * weighted_grada_sum +
260 2 * weighted_grada_sum * weighted_shape_i * weighted_gradb_sum / weighted_sum) /
261 weighted_sum / weighted_sum;
269 #endif// LIBMESH_ENABLE_HIGHER_ORDER_SHAPES