From: Maximilian Bergbauer Date: Thu, 18 Jul 2024 11:08:53 +0000 (+0200) Subject: Implement normal_derivative for FEPointEvaluation X-Git-Tag: v9.6.0-rc1~71^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63dbf3ef101e566abfd8e68eab3a13baf56b25a4;p=dealii.git Implement normal_derivative for FEPointEvaluation --- diff --git a/include/deal.II/matrix_free/fe_point_evaluation.h b/include/deal.II/matrix_free/fe_point_evaluation.h index ef56931f7e..b8c28ad587 100644 --- a/include/deal.II/matrix_free/fe_point_evaluation.h +++ b/include/deal.II/matrix_free/fe_point_evaluation.h @@ -1349,6 +1349,22 @@ public: Tensor<1, spacedim, Number> normal_vector(const unsigned int point_index) const; + /** + * Return the normal gradient in real coordinates at the point with index + * `point_index` after a call to FEPointEvaluation::evaluate() with + * EvaluationFlags::gradients set. + */ + const value_type + get_normal_derivative(const unsigned int point_index) const; + + /** + * Write a contribution that is tested by the normal gradient to the field + * containing the values on points with the given `point_index`. Access to + * the same field as through set_gradient()/get_gradient. + */ + void + submit_normal_derivative(const value_type &, const unsigned int point_index); + private: static constexpr std::size_t n_lanes_user_interface = internal::VectorizedArrayTrait::width(); @@ -1707,6 +1723,22 @@ public: Tensor<1, spacedim, Number> normal_vector(const unsigned int point_index) const; + /** + * Return the normal gradient in real coordinates at the point with index + * `point_index` after a call to FEFacePointEvaluation::evaluate() with + * EvaluationFlags::gradients set. + */ + const value_type + get_normal_derivative(const unsigned int point_index) const; + + /** + * Write a contribution that is tested by the normal gradient to the field + * containing the values on points with the given `point_index`. Access to + * the same field as through set_gradient()/get_gradient. + */ + void + submit_normal_derivative(const value_type &, const unsigned int point_index); + private: static constexpr std::size_t n_lanes_user_interface = internal::VectorizedArrayTrait::width(); @@ -3086,6 +3118,36 @@ FEPointEvaluation::normal_vector( +template +inline const typename FEPointEvaluation::value_type +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); +} + + + +template +inline void +FEPointEvaluation:: + submit_normal_derivative(const value_type &value, + const unsigned int point_index) +{ + AssertIndexRange(point_index, this->gradients.size()); + 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)); +} + + + template FEFacePointEvaluation:: FEFacePointEvaluation( @@ -3817,6 +3879,36 @@ FEFacePointEvaluation::normal_vector( } } + + +template +inline const typename FEFacePointEvaluation::value_type +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); +} + + + +template +inline void +FEFacePointEvaluation:: + submit_normal_derivative(const value_type &value, + const unsigned int point_index) +{ + AssertIndexRange(point_index, this->gradients.size()); + 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)); +} + DEAL_II_NAMESPACE_CLOSE #endif