From: Andreas Ritthaler Date: Tue, 17 Sep 2024 13:13:12 +0000 (+0200) Subject: fix normal_hessian n_comp X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca9f536307b0efd93cff0e0e9337f8f146ceece8;p=dealii.git fix normal_hessian n_comp --- 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); + } } }