FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
get_value() const
{
- return get_value(internal::compute_index<dim, n_q_points_1d>());
+ const unsigned int q_point = internal::compute_index<dim, n_q_points_1d>();
+ return values[q_point];
}
FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
get_dof_value() const
{
- return get_dof_value(internal::compute_index<dim, fe_degree + 1>());
+ const unsigned int dof = internal::compute_index<dim, fe_degree + 1>();
+ return values[dof];
}
FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
submit_value(const value_type &val_in)
{
- submit_value(val_in, internal::compute_index<dim, n_q_points_1d>());
+ const unsigned int q_point = internal::compute_index<dim, n_q_points_1d>();
+ values[q_point] = val_in * JxW[q_point];
}
FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
submit_dof_value(const value_type &val_in)
{
- submit_dof_value(val_in, internal::compute_index<dim, fe_degree + 1>());
+ const unsigned int dof = internal::compute_index<dim, fe_degree + 1>();
+ values[dof] = val_in;
}
static_assert(n_components_ == 1, "This function only supports FE with one \
components");
- return get_gradient(internal::compute_index<dim, n_q_points_1d>());
+ // TODO optimize if the mesh is uniform
+ const unsigned int q_point = internal::compute_index<dim, n_q_points_1d>();
+ const Number * inv_jacobian = &inv_jac[q_point];
+ gradient_type grad;
+ for (int d_1 = 0; d_1 < dim; ++d_1)
+ {
+ Number tmp = 0.;
+ for (int d_2 = 0; d_2 < dim; ++d_2)
+ tmp += inv_jacobian[padding_length * n_cells * (dim * d_2 + d_1)] *
+ gradients[d_2][q_point];
+ grad[d_1] = tmp;
+ }
+
+ return grad;
}
FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
submit_gradient(const gradient_type &grad_in)
{
- submit_gradient(grad_in, internal::compute_index<dim, n_q_points_1d>());
+ // TODO optimize if the mesh is uniform
+ const unsigned int q_point = internal::compute_index<dim, n_q_points_1d>();
+ const Number * inv_jacobian = &inv_jac[q_point];
+ for (int d_1 = 0; d_1 < dim; ++d_1)
+ {
+ Number tmp = 0.;
+ for (int d_2 = 0; d_2 < dim; ++d_2)
+ tmp += inv_jacobian[n_cells * padding_length * (dim * d_1 + d_2)] *
+ grad_in[d_2];
+ gradients[d_1][q_point] = tmp * JxW[q_point];
+ }
}