From: Peter Munch Date: Thu, 17 Sep 2020 20:00:14 +0000 (+0200) Subject: Add some functions to FEEvaluation X-Git-Tag: v9.3.0-rc1~1103^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c5395858638e4764ea948ea65d5e655bf15b9f6;p=dealii.git Add some functions to FEEvaluation --- diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index e7fc1e075f..49dce2fa12 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -230,6 +230,18 @@ public: ArrayView get_scratch_data() const; + /** + * Return the number of the quadrature formula of the present cell. + */ + unsigned int + get_quadrature_index() const; + + /** + * Return index of the current cell or face. + */ + unsigned int + get_current_cell_index() const; + protected: /** * Constructor. Made protected to prevent users from directly using this @@ -643,6 +655,17 @@ public: const std::bitset &mask = std::bitset().flip()) const; + /** + * Same as set_dof_values(), but without resolving constraints. + */ + template + void + set_dof_values_plain( + VectorType & dst, + const unsigned int first_index = 0, + const std::bitset &mask = + std::bitset().flip()) const; + //@} /** @@ -3779,6 +3802,30 @@ FEEvaluationBaseData:: } + +template +inline unsigned int +FEEvaluationBaseData:: + get_quadrature_index() const +{ + return this->quad_no; +} + + + +template +inline unsigned int +FEEvaluationBaseData:: + get_current_cell_index() const +{ + if (is_face && this->dof_access_index == + internal::MatrixFreeFunctions::DoFInfo::dof_access_cell) + return this->cell * GeometryInfo::faces_per_cell + this->face_no; + else + return this->cell; +} + + /*----------------------- FEEvaluationBase ----------------------------------*/ template :: +template +template +inline void +FEEvaluationBase:: + set_dof_values_plain( + VectorType & dst, + const unsigned int first_index, + const std::bitset &mask) const +{ +# ifdef DEBUG + Assert(dof_values_initialized == true, + internal::ExcAccessToUninitializedField()); +# endif + + // select between block vectors and non-block vectors. Note that the number + // of components is checked in the internal data + typename internal::BlockVectorSelector< + VectorType, + IsBlockVector::value>::BaseVectorType *dst_data[n_components]; + for (unsigned int d = 0; d < n_components; ++d) + dst_data[d] = internal::BlockVectorSelector< + VectorType, + IsBlockVector::value>::get_vector_component(dst, + d + first_index); + + internal::VectorSetter setter; + read_write_operation(setter, dst_data, mask, false); +} + + + /*------------------------------ access to data fields ----------------------*/