From 0804715bf1cd446a383fc86128c979fc8c05ace1 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Thu, 20 Jan 2022 22:13:19 +0100 Subject: [PATCH] Add ifdefs for is_reinitialized in FEEval --- include/deal.II/matrix_free/fe_evaluation.h | 20 ++++++++++++++++++- .../deal.II/matrix_free/fe_evaluation_data.h | 16 ++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 6d9b4290a7..1e2c7760a2 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -4987,7 +4987,9 @@ FEEvaluationBase:: submit_value(const Tensor<1, n_components_, VectorizedArrayType> val_in, const unsigned int q_point) { +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); Assert(this->J_value != nullptr, internal::ExcMatrixFreeAccessToUninitializedMappingField( @@ -5025,7 +5027,9 @@ FEEvaluationBase:: const Tensor<1, n_components_, Tensor<1, dim, VectorizedArrayType>> grad_in, const unsigned int q_point) { +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); Assert(this->J_value != nullptr, internal::ExcMatrixFreeAccessToUninitializedMappingField( @@ -5137,7 +5141,9 @@ FEEvaluationBase:: hessian_in, const unsigned int q_point) { +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); Assert(this->J_value != nullptr, internal::ExcMatrixFreeAccessToUninitializedMappingField( @@ -5285,8 +5291,8 @@ inline Tensor<1, n_components_, VectorizedArrayType> FEEvaluationBase:: integrate_value() const { - Assert(this->is_reinitialized, ExcNotInitialized()); # ifdef DEBUG + Assert(this->is_reinitialized, ExcNotInitialized()); Assert(this->values_quad_submitted == true, internal::ExcAccessToUninitializedField()); # endif @@ -5622,7 +5628,9 @@ FEEvaluationAccess::submit_value( const VectorizedArrayType val_in, const unsigned int q_point) { +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); Assert(this->J_value != nullptr, internal::ExcMatrixFreeAccessToUninitializedMappingField( @@ -5675,7 +5683,9 @@ FEEvaluationAccess:: submit_gradient(const Tensor<1, dim, VectorizedArrayType> grad_in, const unsigned int q_point) { +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); Assert(this->J_value != nullptr, internal::ExcMatrixFreeAccessToUninitializedMappingField( @@ -5992,7 +6002,9 @@ FEEvaluationAccess:: submit_divergence(const VectorizedArrayType div_in, const unsigned int q_point) { +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); Assert(this->J_value != nullptr, internal::ExcMatrixFreeAccessToUninitializedMappingField( @@ -6054,7 +6066,9 @@ FEEvaluationAccess:: // could have used base class operator, but that involves some overhead // which is inefficient. it is nice to have the symmetric tensor because // that saves some operations +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); Assert(this->J_value != nullptr, internal::ExcMatrixFreeAccessToUninitializedMappingField( @@ -6348,7 +6362,9 @@ FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>::submit_value( const VectorizedArrayType val_in, const unsigned int q_point) { +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); # ifdef DEBUG this->values_quad_submitted = true; @@ -6397,7 +6413,9 @@ FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType>::submit_gradient( const VectorizedArrayType grad_in, const unsigned int q_point) { +# ifdef DEBUG Assert(this->is_reinitialized, ExcNotInitialized()); +# endif AssertIndexRange(q_point, this->n_quadrature_points); # ifdef DEBUG this->gradients_quad_submitted = true; diff --git a/include/deal.II/matrix_free/fe_evaluation_data.h b/include/deal.II/matrix_free/fe_evaluation_data.h index b645f2edbb..7de101a44f 100644 --- a/include/deal.II/matrix_free/fe_evaluation_data.h +++ b/include/deal.II/matrix_free/fe_evaluation_data.h @@ -478,8 +478,10 @@ public: const std::array & get_cell_ids() const { - // implemented inline to avoid compilation problems on Windows +// implemented inline to avoid compilation problems on Windows +#ifdef DEBUG Assert(is_reinitialized, ExcNotInitialized()); +#endif return cell_ids; } @@ -490,8 +492,11 @@ public: unsigned int get_cell_or_face_batch_id() const { - // implemented inline to avoid compilation problems on Windows +// implemented inline to avoid compilation problems on Windows +#ifdef DEBUG Assert(is_reinitialized, ExcNotInitialized()); +#endif + return cell; } @@ -502,8 +507,11 @@ public: const std::array & get_cell_or_face_ids() const { - // implemented inline to avoid compilation problems on Windows +// implemented inline to avoid compilation problems on Windows +#ifdef DEBUG Assert(is_reinitialized, ExcNotInitialized()); +#endif + if (!is_face || dof_access_index == internal::MatrixFreeFunctions::DoFInfo::dof_access_cell) return cell_ids; @@ -1318,7 +1326,9 @@ template inline internal::MatrixFreeFunctions::GeometryType FEEvaluationData::get_cell_type() const { +# ifdef DEBUG Assert(is_reinitialized, ExcNotInitialized()); +# endif return cell_type; } -- 2.39.5