]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add FEFaceEvaluation::at_boundary() and boundary_id() 14122/head
authorPeter Munch <peterrmuench@gmail.com>
Sun, 10 Jul 2022 18:49:06 +0000 (20:49 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Thu, 4 Aug 2022 19:59:22 +0000 (21:59 +0200)
include/deal.II/matrix_free/fe_evaluation.h
include/deal.II/matrix_free/matrix_free.h

index 07dae56eb4f17c3971683190584317e501f72fcf..b6a8f9f692a2aca5fea25f5090c45e28000dccd6 100644 (file)
@@ -2731,6 +2731,28 @@ public:
   std_cxx20::ranges::iota_view<unsigned int, unsigned int>
   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<dim,
 
 
 
+template <int dim,
+          int fe_degree,
+          int n_q_points_1d,
+          int n_components_,
+          typename Number,
+          typename VectorizedArrayType>
+bool
+FEFaceEvaluation<dim,
+                 fe_degree,
+                 n_q_points_1d,
+                 n_components_,
+                 Number,
+                 VectorizedArrayType>::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 <int dim,
+          int fe_degree,
+          int n_q_points_1d,
+          int n_components_,
+          typename Number,
+          typename VectorizedArrayType>
+types::boundary_id
+FEFaceEvaluation<dim,
+                 fe_degree,
+                 n_q_points_1d,
+                 n_components_,
+                 Number,
+                 VectorizedArrayType>::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 ------------------------- */
 
 
index d8e519ab6d3d3e11788cbc6e97fe91c8ba891fcc..b20fb5e15b3a2d9724c01f2ac7c14863c3f09d10 100644 (file)
@@ -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;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.