21 #include "libmesh/libmesh_config.h"
22 #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/elem.h"
26 #include "libmesh/fe.h"
27 #include "libmesh/fe_interface.h"
44 libmesh_error_msg(
"Rational bases require the real element \nto query nodal weighting.");
55 const bool add_p_level)
61 const Order totalorder = static_cast<Order>(order + add_p_level * elem->
p_level());
64 FEType fe_type(totalorder, _underlying_fe_family);
66 const unsigned int n_sf =
70 libmesh_assert_equal_to (n_sf,
n_nodes);
72 std::vector<Real> node_weights(
n_nodes);
75 for (
unsigned int n=0; n<
n_nodes; n++)
79 Real weighted_shape_i = 0, weighted_sum = 0;
81 for (
unsigned int sf=0; sf<n_sf; sf++)
83 Real weighted_shape = node_weights[sf] *
85 weighted_sum += weighted_shape;
87 weighted_shape_i = weighted_shape;
90 return weighted_shape_i / weighted_sum;
102 libmesh_error_msg(
"Rational bases require the real element \nto query nodal weighting.");
111 const unsigned int i,
112 const unsigned int libmesh_dbg_var(j),
114 const bool add_p_level)
117 libmesh_assert_equal_to (j, 0);
123 const Order totalorder = static_cast<Order>(order + add_p_level * elem->
p_level());
126 FEType fe_type(totalorder, _underlying_fe_family);
128 const unsigned int n_sf =
132 libmesh_assert_equal_to (n_sf,
n_nodes);
134 std::vector<Real> node_weights(
n_nodes);
137 for (
unsigned int n=0; n<
n_nodes; n++)
141 Real weighted_shape_i = 0, weighted_sum = 0,
142 weighted_grad_i = 0, weighted_grad_sum = 0;
144 for (
unsigned int sf=0; sf<n_sf; sf++)
146 Real weighted_shape = node_weights[sf] *
148 Real weighted_grad = node_weights[sf] *
150 weighted_sum += weighted_shape;
151 weighted_grad_sum += weighted_grad;
154 weighted_shape_i = weighted_shape;
155 weighted_grad_i = weighted_grad;
159 return (weighted_sum * weighted_grad_i - weighted_shape_i * weighted_grad_sum) /
160 weighted_sum / weighted_sum;
164 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
173 libmesh_error_msg(
"Rational bases require the real element \nto query nodal weighting.");
183 const unsigned int i,
184 const unsigned int libmesh_dbg_var(j),
186 const bool add_p_level)
190 libmesh_assert_equal_to (j, 0);
196 const Order totalorder = static_cast<Order>(order + add_p_level * elem->
p_level());
199 FEType fe_type(totalorder, _underlying_fe_family);
201 const unsigned int n_sf =
205 libmesh_assert_equal_to (n_sf,
n_nodes);
207 std::vector<Real> node_weights(
n_nodes);
210 for (
unsigned int n=0; n<
n_nodes; n++)
214 Real weighted_shape_i = 0, weighted_sum = 0,
215 weighted_grad_i = 0, weighted_grad_sum = 0,
216 weighted_hess_i = 0, weighted_hess_sum = 0;
218 for (
unsigned int sf=0; sf<n_sf; sf++)
220 Real weighted_shape = node_weights[sf] *
222 Real weighted_grad = node_weights[sf] *
224 Real weighted_hess = node_weights[sf] *
226 weighted_sum += weighted_shape;
227 weighted_grad_sum += weighted_grad;
228 weighted_hess_sum += weighted_hess;
231 weighted_shape_i = weighted_shape;
232 weighted_grad_i = weighted_grad;
233 weighted_hess_i = weighted_hess;
237 return (weighted_sum * weighted_sum *
238 (weighted_sum * weighted_hess_i - weighted_shape_i * weighted_hess_sum) -
239 (weighted_sum * weighted_grad_i - weighted_shape_i * weighted_grad_sum) *
240 2 * weighted_sum * weighted_grad_sum) /
241 (weighted_sum * weighted_sum * weighted_sum * weighted_sum);
249 #endif //LIBMESH_ENABLE_HIGHER_ORDER_SHAPES