From: Maximilian Bergbauer Date: Fri, 21 Mar 2025 10:10:22 +0000 (+0100) Subject: Fix get/submit_normal_derivative for arbitrary number of components X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab02f3e9fcbf92f60a48ec67b9f59dcc3dcd07c4;p=dealii.git Fix get/submit_normal_derivative for arbitrary number of components --- diff --git a/include/deal.II/matrix_free/fe_point_evaluation.h b/include/deal.II/matrix_free/fe_point_evaluation.h index f0067851dd..27569a944f 100644 --- a/include/deal.II/matrix_free/fe_point_evaluation.h +++ b/include/deal.II/matrix_free/fe_point_evaluation.h @@ -3200,7 +3200,17 @@ FEPointEvaluation::get_normal_derivative( const unsigned int point_index) const { AssertIndexRange(point_index, this->gradients.size()); - return this->gradients[point_index] * normal_vector(point_index); + + value_type normal_derivative; + if constexpr (n_components == 1) + normal_derivative = + this->gradients[point_index] * normal_vector(point_index); + else + for (unsigned int comp = 0; comp < n_components; ++comp) + normal_derivative[comp] = + this->gradients[point_index][comp] * normal_vector(point_index); + + return normal_derivative; } @@ -3215,8 +3225,9 @@ FEPointEvaluation:: if constexpr (n_components == 1) this->gradients[point_index] = value * normal_vector(point_index); else - this->gradients[point_index] = - outer_product(value, normal_vector(point_index)); + for (unsigned int comp = 0; comp < n_components; ++comp) + this->gradients[point_index][comp] = + value[comp] * normal_vector(point_index); } @@ -3958,7 +3969,17 @@ FEFacePointEvaluation:: get_normal_derivative(const unsigned int point_index) const { AssertIndexRange(point_index, this->gradients.size()); - return this->gradients[point_index] * normal_vector(point_index); + + value_type normal_derivative; + if constexpr (n_components == 1) + normal_derivative = + this->gradients[point_index] * normal_vector(point_index); + else + for (unsigned int comp = 0; comp < n_components; ++comp) + normal_derivative[comp] = + this->gradients[point_index][comp] * normal_vector(point_index); + + return normal_derivative; } @@ -3973,8 +3994,9 @@ FEFacePointEvaluation:: if constexpr (n_components == 1) this->gradients[point_index] = value * normal_vector(point_index); else - this->gradients[point_index] = - outer_product(value, normal_vector(point_index)); + for (unsigned int comp = 0; comp < n_components; ++comp) + this->gradients[point_index][comp] = + value[comp] * normal_vector(point_index); } DEAL_II_NAMESPACE_CLOSE