From 8e23d2305f0a32676bfc58b0b4853f7999db0a27 Mon Sep 17 00:00:00 2001 From: Magdalena Schreter Date: Mon, 22 Mar 2021 18:50:15 +0100 Subject: [PATCH] added get_divergence and submit_gradient of a rank-2 tensor, both in 1d; improved formatting --- doc/news/changes/minor/20210322Schreter | 8 ++ include/deal.II/matrix_free/fe_evaluation.h | 130 +++++++++++++++----- 2 files changed, 106 insertions(+), 32 deletions(-) create mode 100644 doc/news/changes/minor/20210322Schreter diff --git a/doc/news/changes/minor/20210322Schreter b/doc/news/changes/minor/20210322Schreter new file mode 100644 index 0000000000..ba7d0ef9c9 --- /dev/null +++ b/doc/news/changes/minor/20210322Schreter @@ -0,0 +1,8 @@ +New: The getter function for the divergence in +FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>::get_divergence() +is now also implemented for dim==1 and n_components==1. The function +FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>::submit_gradient() +now also takes a rank 2 tensor as input argument. +
+(Magdalena Schreter, Peter Munch, Martin Kronbichler, 2021/03/22) + diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 61118c6b15..5f4be8d93b 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -1484,69 +1484,82 @@ public: using BaseClass = FEEvaluationBase; - /** @copydoc FEEvaluationBase::get_dof_value() + /** + * @copydoc FEEvaluationBase::get_dof_value() */ value_type get_dof_value(const unsigned int dof) const; - /** @copydoc FEEvaluationBase::submit_dof_value() + /** + * @copydoc FEEvaluationBase::submit_dof_value() */ void submit_dof_value(const value_type val_in, const unsigned int dof); - /** @copydoc FEEvaluationBase::get_value() + /** + * @copydoc FEEvaluationBase::get_value() */ value_type get_value(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::submit_value() + /** + * @copydoc FEEvaluationBase::submit_value() */ void submit_value(const value_type val_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase::submit_value() + /** + * @copydoc FEEvaluationBase::submit_value() */ void submit_value(const Tensor<1, 1, VectorizedArrayType> val_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase::get_gradient() + /** + * @copydoc FEEvaluationBase::get_gradient() */ gradient_type get_gradient(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::get_normal_derivative() + /** + * @copydoc FEEvaluationBase::get_normal_derivative() */ value_type get_normal_derivative(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::submit_gradient() + /** + * @copydoc FEEvaluationBase::submit_gradient() */ void submit_gradient(const gradient_type grad_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase::submit_normal_derivative() + /** + * @copydoc FEEvaluationBase::submit_normal_derivative() */ void submit_normal_derivative(const value_type grad_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase::get_hessian() + /** + * @copydoc FEEvaluationBase::get_hessian() */ Tensor<2, dim, VectorizedArrayType> get_hessian(unsigned int q_point) const; - /** @copydoc FEEvaluationBase::get_hessian_diagonal() + /** + * @copydoc FEEvaluationBase::get_hessian_diagonal() */ gradient_type get_hessian_diagonal(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::get_laplacian() + /** + * @copydoc FEEvaluationBase::get_laplacian() */ value_type get_laplacian(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::integrate_value() + /** + * @copydoc FEEvaluationBase::integrate_value() */ value_type integrate_value() const; @@ -1624,7 +1637,8 @@ public: using BaseClass = FEEvaluationBase; - /** @copydoc FEEvaluationBase::get_gradient() + /** + * @copydoc FEEvaluationBase::get_gradient() */ gradient_type get_gradient(const unsigned int q_point) const; @@ -1652,17 +1666,20 @@ public: Tensor<1, (dim == 2 ? 1 : dim), VectorizedArrayType> get_curl(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::get_hessian() + /** + * @copydoc FEEvaluationBase::get_hessian() */ Tensor<3, dim, VectorizedArrayType> get_hessian(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::get_hessian_diagonal() + /** + * @copydoc FEEvaluationBase::get_hessian_diagonal() */ gradient_type get_hessian_diagonal(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::submit_gradient() + /** + * @copydoc FEEvaluationBase::submit_gradient() */ void submit_gradient(const gradient_type grad_in, const unsigned int q_point); @@ -1783,79 +1800,107 @@ public: using BaseClass = FEEvaluationBase<1, 1, Number, is_face, VectorizedArrayType>; - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::get_dof_value() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::get_dof_value() */ value_type get_dof_value(const unsigned int dof) const; - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_dof_value() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_dof_value() */ void submit_dof_value(const value_type val_in, const unsigned int dof); - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::get_value() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::get_value() */ value_type get_value(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_value() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_value() */ void submit_value(const value_type val_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_value() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_value() */ void submit_value(const gradient_type val_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::get_gradient() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::get_gradient() */ gradient_type get_gradient(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase::get_normal_derivative() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::get_divergence() + */ + value_type + get_divergence(const unsigned int q_point) const; + + /** + * @copydoc FEEvaluationBase::get_normal_derivative() */ value_type get_normal_derivative(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_gradient() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_gradient() */ void submit_gradient(const gradient_type grad_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_gradient() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_gradient() */ void submit_gradient(const value_type grad_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_normal_derivative() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_gradient() + */ + void + submit_gradient(const Tensor<2, 1, VectorizedArrayType> grad_in, + const unsigned int q_point); + + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_normal_derivative() */ void submit_normal_derivative(const value_type grad_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_normal_derivative() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::submit_normal_derivative() */ void submit_normal_derivative(const gradient_type grad_in, const unsigned int q_point); - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::get_hessian() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::get_hessian() */ Tensor<2, 1, VectorizedArrayType> get_hessian(unsigned int q_point) const; - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::get_hessian_diagonal() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::get_hessian_diagonal() */ gradient_type get_hessian_diagonal(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::get_laplacian() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::get_laplacian() */ value_type get_laplacian(const unsigned int q_point) const; - /** @copydoc FEEvaluationBase<1,1,Number,is_face>::integrate_value() + /** + * @copydoc FEEvaluationBase<1,1,Number,is_face>::integrate_value() */ value_type integrate_value() const; @@ -7120,6 +7165,16 @@ inline DEAL_II_ALWAYS_INLINE Tensor<1, 1, VectorizedArrayType> +template +inline DEAL_II_ALWAYS_INLINE VectorizedArrayType + FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>::get_divergence( + const unsigned int q_point) const +{ + return get_gradient(q_point)[0]; +} + + + template inline DEAL_II_ALWAYS_INLINE VectorizedArrayType FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>:: @@ -7249,6 +7304,17 @@ FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>::submit_gradient( +template +inline DEAL_II_ALWAYS_INLINE void +FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>::submit_gradient( + const Tensor<2, 1, VectorizedArrayType> grad_in, + const unsigned int q_point) +{ + submit_gradient(grad_in[0][0], q_point); +} + + + template inline DEAL_II_ALWAYS_INLINE void FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>:: -- 2.39.5