Skip to content

Commit

Permalink
Fix gradient layout in FE evaluation according to deal.II v 9.6 (#63)
Browse files Browse the repository at this point in the history
* Fix gradient layout in FE evaluation according to deal.II v 9.6

* Backwards compatibility

* Typo
  • Loading branch information
davidscn committed Sep 20, 2023
1 parent e6ffeff commit 24e1111
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/solid_mechanics/mf_nh_operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -871,10 +871,18 @@ NeoHookOperator<dim, Number>::do_operation_on_cell(FECellIntegrator &phi) const
{
VectorizedArrayType sum =
inv_jac[e][0] *
#if DEAL_II_VERSION_GTE(9, 6, 0)
ref_grads[(d * n_q_points + q) * dim + 0];
#else
ref_grads[(d * dim + 0) * n_q_points + q];
#endif
for (unsigned int f = 1; f < dim; ++f)
sum += inv_jac[e][f] *
#if DEAL_II_VERSION_GTE(9, 6, 0)
ref_grads[(d * n_q_points + q) * dim + f];
#else
ref_grads[(d * dim + f) * n_q_points + q];
#endif
F[d][e] = sum;

// since we already have the inverse Jacobian,
Expand All @@ -883,10 +891,18 @@ NeoHookOperator<dim, Number>::do_operation_on_cell(FECellIntegrator &phi) const
// same otherwise)
VectorizedArrayType sum2 =
inv_jac[e][0] *
#if DEAL_II_VERSION_GTE(9, 6, 0)
x_grads[(d * n_q_points + q) * dim + 0];
#else
x_grads[(d * dim + 0) * n_q_points + q];
#endif
for (unsigned int f = 1; f < dim; ++f)
sum2 += inv_jac[e][f] *
#if DEAL_II_VERSION_GTE(9, 6, 0)
x_grads[(d * n_q_points + q) * dim + f];
#else
x_grads[(d * dim + f) * n_q_points + q];
#endif
grad_Nx_v[d][e] = sum2;
}
F[d][d] += one;
Expand Down

0 comments on commit 24e1111

Please sign in to comment.