From: Peter Munch Date: Sun, 10 Jul 2022 18:49:06 +0000 (+0200) Subject: Add FEFaceEvaluation::at_boundary() and boundary_id() X-Git-Tag: v9.5.0-rc1~1005^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26d6ff8eaa42c3b2c10c3f3ed58525cd45b8b90d;p=dealii.git Add FEFaceEvaluation::at_boundary() and boundary_id() --- diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 07dae56eb4..b6a8f9f692 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -2731,6 +2731,28 @@ public: std_cxx20::ranges::iota_view dof_indices() const; + /** + * Return whether the face associated to this FEFaceEvaluation object + * is at the boundary. + */ + bool + at_boundary() const; + + /** + * Return the boundary indicator of the face associated to this + * FEFaceEvaluation object. + * + * If the return value is the special value + * numbers::internal_face_boundary_id, then the face is in the interior of + * the domain. + * + * @note Alternatively to this function, you can use + * MatrixFree::get_boundary_id() to get the same information if no + * FEFaceEvaluation object has been set up. + */ + types::boundary_id + boundary_id() const; + /** * The number of degrees of freedom of a single component on the cell for * the underlying evaluation object. Usually close to @@ -8881,6 +8903,63 @@ FEFaceEvaluation +bool +FEFaceEvaluation::at_boundary() const +{ + Assert(this->dof_access_index != + internal::MatrixFreeFunctions::DoFInfo::dof_access_cell, + ExcNotImplemented()); + + if (this->is_interior_face() == false) + return false; + else if (this->cell < this->matrix_free->n_inner_face_batches()) + return false; + else if (this->cell < (this->matrix_free->n_inner_face_batches() + + this->matrix_free->n_boundary_face_batches())) + return true; + else + return false; +} + + + +template +types::boundary_id +FEFaceEvaluation::boundary_id() const +{ + Assert(this->dof_access_index != + internal::MatrixFreeFunctions::DoFInfo::dof_access_cell, + ExcNotImplemented()); + + if (at_boundary()) + return this->matrix_free->get_boundary_id(this->cell); + else + return numbers::internal_face_boundary_id; +} + + + /*------------------------- end FEFaceEvaluation ------------------------- */ diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index d8e519ab6d..b20fb5e15b 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -1611,6 +1611,10 @@ public: * this method can be used to query the boundary id of a given face in the * faces' own sorting by lanes in a VectorizedArray. Only valid for an index * indicating a boundary face. + * + * @note Alternatively to this function, you can use + * FEFaceEvaluation::boundary_id() to get the same information if a + * FEFaceEvaluation object has been set up already. */ types::boundary_id get_boundary_id(const unsigned int face_batch_index) const;