From ca9f536307b0efd93cff0e0e9337f8f146ceece8 Mon Sep 17 00:00:00 2001 From: Andreas Ritthaler Date: Tue, 17 Sep 2024 15:13:12 +0200 Subject: [PATCH] fix normal_hessian n_comp --- include/deal.II/matrix_free/fe_evaluation.h | 27 ++++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 5246d5ac29..6ce0b9b646 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -4888,18 +4888,23 @@ FEEvaluationBase:: DEAL_II_NOT_IMPLEMENTED(); } } - - if constexpr (n_components == 1) - return hessian_out[0]; - else - return hessian_out; } // cell with general Jacobian else { - const auto normal = this->normal_vector(q_point); - return get_hessian(q_point) * normal * normal; + const auto normal = this->normal_vector(q_point); + const auto hessian = get_hessian(q_point); + + if constexpr (n_components == 1) + hessian_out[0] = hessian * normal * normal; + else + for (unsigned int comp = 0; comp < n_components; ++comp) + hessian_out[comp] = hessian[comp] * normal * normal; } + if constexpr (n_components == 1) + return hessian_out[0]; + else + return hessian_out; } @@ -5626,8 +5631,12 @@ FEEvaluationBase:: if constexpr (n_components == 1) submit_hessian(normal_hessian_in * normal_projector, q_point); else - submit_hessian(outer_product(normal_hessian_in, normal_projector), - q_point); + { + hessian_type tmp; + for (unsigned int comp = 0; comp < n_components; ++comp) + tmp[comp] = normal_hessian_in[comp] * normal_projector; + submit_hessian(tmp, q_point); + } } } -- 2.39.5