From: Martin Kronbichler Date: Mon, 25 Mar 2024 12:33:21 +0000 (+0100) Subject: Add compatibility layer for 1D access X-Git-Tag: v9.6.0-rc1~455^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dc07252bc034ffd818f9c2190cd2c91dd65b591;p=dealii.git Add compatibility layer for 1D access --- diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index afff5148bd..913a8418f0 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -340,6 +340,19 @@ public: void submit_value(const value_type val_in, const unsigned int q_point); + /** + * In 1D, the value_type and gradient_type can be unintentionally be mixed + * up because FEEvaluationBase does not distinguish between scalar accessors + * and vector-valued accessors and the respective types, but solely in terms + * of the number of components and dimension. Thus, enable the use of + * submit_value in that case as well. + */ + template > + void + submit_value(const Tensor<1, 1, VectorizedArrayType> val_in, + const unsigned int q_point); + /** * Return the gradient of a finite element function at quadrature point * number @p q_point after a call to FEEvaluation::evaluate() with @@ -373,6 +386,19 @@ public: void submit_gradient(const gradient_type grad_in, const unsigned int q_point); + /** + * In 1D, the value_type and gradient_type can be unintentionally be mixed + * up because FEEvaluationBase does not distinguish between scalar accessors + * and vector-valued accessors and the respective types, but solely in terms + * of the number of components and dimension. Thus, enable the use of + * submit_value in that case as well. + */ + template > + void + submit_gradient(const Tensor<2, 1, VectorizedArrayType> val_in, + const unsigned int q_point); + /** * Write a contribution that is tested by the gradient to the field * containing the values on quadrature points with component @p @@ -4832,6 +4858,22 @@ FEEvaluationBase:: +template +template +inline DEAL_II_ALWAYS_INLINE void +FEEvaluationBase:: + submit_value(const Tensor<1, 1, VectorizedArrayType> val_in, + const unsigned int q_point) +{ + submit_value(val_in[0], q_point); +} + + + template :: +template +template +inline DEAL_II_ALWAYS_INLINE void +FEEvaluationBase:: + submit_gradient(const Tensor<2, 1, VectorizedArrayType> grad_in, + const unsigned int q_point) +{ + submit_value(grad_in[0], q_point); +} + + + template