]> https://gitweb.dealii.org/ - dealii.git/commitdiff
FEEvaluationImplHangingNodes: use ShapeInfo as input argument 13046/head
authorPeter Munch <peterrmuench@gmail.com>
Wed, 8 Dec 2021 19:49:51 +0000 (20:49 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Wed, 8 Dec 2021 20:22:24 +0000 (21:22 +0100)
include/deal.II/matrix_free/evaluation_kernels_hanging_nodes.h
include/deal.II/matrix_free/evaluation_template_factory.h
include/deal.II/matrix_free/evaluation_template_factory_hanging_nodes.templates.h
include/deal.II/matrix_free/fe_evaluation.h
include/deal.II/matrix_free/tools.h
tests/matrix_free/hanging_node_kernels_01.cc

index 850ce2f5b421f685c7cbff0a1a47b4ca44f58d26..9999b81172e31d88b9245a95464c1e3c1fc55b9d 100644 (file)
@@ -23,6 +23,7 @@
 #include <deal.II/base/vectorization.h>
 
 #include <deal.II/matrix_free/hanging_nodes_internal.h>
+#include <deal.II/matrix_free/shape_info.h>
 
 
 DEAL_II_NAMESPACE_OPEN
@@ -80,19 +81,17 @@ namespace internal
   template <FEEvaluationImplHangingNodesRunnerTypes,
             int dim,
             int fe_degree,
-            typename Number,
-            bool is_face>
+            typename Number>
   class FEEvaluationImplHangingNodesRunner;
 
 
 
-  template <int dim, int fe_degree, typename Number, bool is_face>
+  template <int dim, int fe_degree, typename Number>
   class FEEvaluationImplHangingNodesRunner<
     FEEvaluationImplHangingNodesRunnerTypes::vectorized,
     dim,
     fe_degree,
-    Number,
-    is_face>
+    Number>
   {
   private:
     template <int structdim, unsigned int direction, bool transpose>
@@ -187,29 +186,21 @@ namespace internal
   public:
     template <bool transpose>
     static void
-    run_internal(const unsigned int                  n_components,
-                 const FEEvaluationBaseData<dim,
-                                            typename Number::value_type,
-                                            is_face,
-                                            Number> &fe_eval,
+    run_internal(const unsigned int                            n_components,
+                 const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
                  const std::array<MatrixFreeFunctions::ConstraintKinds,
-                                  Number::size()> &  constraint_mask,
-                 Number *                            values)
+                                  Number::size()> &            constraint_mask,
+                 Number *                                      values)
     {
       using Kinds = MatrixFreeFunctions::ConstraintKinds;
       const unsigned int given_degree =
-        fe_degree != -1 ? fe_degree :
-                          fe_eval.get_shape_info().data.front().fe_degree;
+        fe_degree != -1 ? fe_degree : shape_info.data.front().fe_degree;
 
       const Number *DEAL_II_RESTRICT weights =
-        fe_eval.get_shape_info()
-          .data.front()
-          .subface_interpolation_matrices[0]
-          .data();
+        shape_info.data.front().subface_interpolation_matrices[0].data();
 
       const unsigned int points = given_degree + 1;
-      const unsigned int n_dofs =
-        fe_eval.get_shape_info().dofs_per_component_on_cell;
+      const unsigned int n_dofs = shape_info.dofs_per_component_on_cell;
 
       if (dim == 2)
         {
@@ -479,11 +470,9 @@ namespace internal
 
     template <typename T>
     static inline const std::array<AlignedVector<interpolation_type>, 2> &
-    get_interpolation_matrix(const T &fe_eval)
+    get_interpolation_matrix(const T &shape_info)
     {
-      return fe_eval.get_shape_info()
-        .data.front()
-        .subface_interpolation_matrices_scalar;
+      return shape_info.data.front().subface_interpolation_matrices_scalar;
     }
 
     static inline DEAL_II_ALWAYS_INLINE_RELEASE unsigned int
@@ -553,11 +542,9 @@ namespace internal
 
     template <typename T>
     static inline const std::array<AlignedVector<T1>, 2> &
-    get_interpolation_matrix(const T &fe_eval)
+    get_interpolation_matrix(const T &shape_info)
     {
-      return fe_eval.get_shape_info()
-        .data.front()
-        .subface_interpolation_matrices;
+      return shape_info.data.front().subface_interpolation_matrices;
     }
 
     static inline DEAL_II_ALWAYS_INLINE_RELEASE bool
@@ -620,11 +607,9 @@ namespace internal
 
     template <typename T>
     static inline const std::array<AlignedVector<T1>, 2> &
-    get_interpolation_matrix(const T &fe_eval)
+    get_interpolation_matrix(const T &shape_info)
     {
-      return fe_eval.get_shape_info()
-        .data.front()
-        .subface_interpolation_matrices;
+      return shape_info.data.front().subface_interpolation_matrices;
     }
 
     static inline DEAL_II_ALWAYS_INLINE_RELEASE bool
@@ -694,11 +679,9 @@ namespace internal
 
     template <typename T>
     static inline const std::array<AlignedVector<T1>, 2> &
-    get_interpolation_matrix(const T &fe_eval)
+    get_interpolation_matrix(const T &shape_info)
     {
-      return fe_eval.get_shape_info()
-        .data.front()
-        .subface_interpolation_matrices;
+      return shape_info.data.front().subface_interpolation_matrices;
     }
 
     static inline DEAL_II_ALWAYS_INLINE_RELEASE bool
@@ -1469,13 +1452,12 @@ namespace internal
   };
 
 
-  template <int dim, int fe_degree, typename Number, bool is_face>
+  template <int dim, int fe_degree, typename Number>
   class FEEvaluationImplHangingNodesRunner<
     FEEvaluationImplHangingNodesRunnerTypes::scalar,
     dim,
     fe_degree,
-    Number,
-    is_face>
+    Number>
   {
   public:
     static const VectorizationTypes VectorizationType =
@@ -1537,21 +1519,17 @@ namespace internal
   public:
     template <bool transpose>
     static void
-    run_internal(const unsigned int                  n_desired_components,
-                 const FEEvaluationBaseData<dim,
-                                            typename Number::value_type,
-                                            is_face,
-                                            Number> &fe_eval,
+    run_internal(const unsigned int n_desired_components,
+                 const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
                  const std::array<MatrixFreeFunctions::ConstraintKinds,
-                                  Number::size()> &  constraint_mask,
-                 Number *                            values)
+                                  Number::size()> &            constraint_mask,
+                 Number *                                      values)
     {
       const unsigned int given_degree =
-        fe_degree != -1 ? fe_degree :
-                          fe_eval.get_shape_info().data.front().fe_degree;
+        fe_degree != -1 ? fe_degree : shape_info.data.front().fe_degree;
 
       const auto &interpolation_matrices =
-        Trait<Number, VectorizationType>::get_interpolation_matrix(fe_eval);
+        Trait<Number, VectorizationType>::get_interpolation_matrix(shape_info);
 
       const auto constraint_mask_sorted =
         Trait<Number, VectorizationType>::create_mask(constraint_mask);
@@ -1720,25 +1698,22 @@ namespace internal
                 }
             }
 
-          values += fe_eval.get_shape_info().dofs_per_component_on_cell;
+          values += shape_info.dofs_per_component_on_cell;
         }
     }
   };
 
 
 
-  template <int dim, typename Number, bool is_face>
+  template <int dim, typename Number>
   struct FEEvaluationImplHangingNodes
   {
   public:
     template <int fe_degree, int n_q_points_1d>
     static bool
-    run(const unsigned int                  n_desired_components,
-        const FEEvaluationBaseData<dim,
-                                   typename Number::value_type,
-                                   is_face,
-                                   Number> &fe_eval,
-        const bool                          transpose,
+    run(const unsigned int                            n_desired_components,
+        const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+        const bool                                    transpose,
         const std::array<MatrixFreeFunctions::ConstraintKinds, Number::size()>
           &     c_mask,
         Number *values)
@@ -1747,17 +1722,16 @@ namespace internal
         FEEvaluationImplHangingNodesRunner<used_runner_type<fe_degree>(),
                                            dim,
                                            fe_degree,
-                                           Number,
-                                           is_face>;
+                                           Number>;
 
       if (transpose)
         RunnerType::template run_internal<true>(n_desired_components,
-                                                fe_eval,
+                                                shape_info,
                                                 c_mask,
                                                 values);
       else
         RunnerType::template run_internal<false>(n_desired_components,
-                                                 fe_eval,
+                                                 shape_info,
                                                  c_mask,
                                                  values);
 
index 50ac727c8755cb232bd58f227ad40e513d6f719a..1dbeef01a360ae19c9ac48ee63dc305a50358171 100644 (file)
@@ -199,33 +199,14 @@ namespace internal
             typename VectorizedArrayType = VectorizedArray<Number>>
   struct FEEvaluationHangingNodesFactory
   {
-    /**
-     * For cells.
-     */
     static void
     apply(const unsigned int n_components,
           const unsigned int fe_degree,
-          const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
-            &                                            fe_eval,
-          const bool                                     transpose,
-          const std::array<MatrixFreeFunctions::ConstraintKinds,
-                           VectorizedArrayType::size()> &c_mask,
-          VectorizedArrayType *                          values);
-
-    /**
-     * For faces.
-     *
-     * @note Not implemented.
-     */
-    static void
-    apply(const unsigned int n_components,
-          const unsigned int fe_degree,
-          const FEEvaluationBaseData<dim, Number, true, VectorizedArrayType>
-            &                                            fe_eval,
-          const bool                                     transpose,
+          const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &shape_info,
+          const bool                                                 transpose,
           const std::array<MatrixFreeFunctions::ConstraintKinds,
-                           VectorizedArrayType::size()> &c_mask,
-          VectorizedArrayType *                          values);
+                           VectorizedArrayType::size()> &            c_mask,
+          VectorizedArrayType *                                      values);
   };
 
 } // end of namespace internal
index 3c37bdd3391eeb2cff3d4c14da04ed5e0d0ac029..c1622f2859ef8ceab0b127e75520b0a3de11ec51 100644 (file)
@@ -23,7 +23,7 @@
 #include <deal.II/matrix_free/evaluation_kernels_hanging_nodes.h>
 #include <deal.II/matrix_free/evaluation_template_factory.h>
 #include <deal.II/matrix_free/evaluation_template_factory_internal.h>
-#include <deal.II/matrix_free/fe_evaluation_base_data.h>
+#include <deal.II/matrix_free/shape_info.h>
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -32,38 +32,18 @@ namespace internal
   template <int dim, typename Number, typename VectorizedArrayType>
   void
   FEEvaluationHangingNodesFactory<dim, Number, VectorizedArrayType>::apply(
-    const unsigned int n_components,
-    const unsigned int fe_degree,
-    const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
-      &                                            fe_eval,
-    const bool                                     transpose,
+    const unsigned int                                         n_components,
+    const unsigned int                                         fe_degree,
+    const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &shape_info,
+    const bool                                                 transpose,
     const std::array<MatrixFreeFunctions::ConstraintKinds,
-                     VectorizedArrayType::size()> &c_mask,
-    VectorizedArrayType *                          values)
+                     VectorizedArrayType::size()> &            c_mask,
+    VectorizedArrayType *                                      values)
   {
     instantiation_helper_degree_run<
       1,
-      FEEvaluationImplHangingNodes<dim, VectorizedArrayType, false>>(
-      fe_degree, n_components, fe_eval, transpose, c_mask, values);
-  }
-
-
-
-  template <int dim, typename Number, typename VectorizedArrayType>
-  void
-  FEEvaluationHangingNodesFactory<dim, Number, VectorizedArrayType>::apply(
-    const unsigned int n_components,
-    const unsigned int fe_degree,
-    const FEEvaluationBaseData<dim, Number, true, VectorizedArrayType> &fe_eval,
-    const bool                                     transpose,
-    const std::array<MatrixFreeFunctions::ConstraintKinds,
-                     VectorizedArrayType::size()> &c_mask,
-    VectorizedArrayType *                          values)
-  {
-    instantiation_helper_degree_run<
-      1,
-      FEEvaluationImplHangingNodes<dim, VectorizedArrayType, true>>(
-      fe_degree, n_components, fe_eval, transpose, c_mask, values);
+      FEEvaluationImplHangingNodes<dim, VectorizedArrayType>>(
+      fe_degree, n_components, shape_info, transpose, c_mask, values);
   }
 } // end of namespace internal
 
index ca1be236f11c5d08e8779a7f195934ebb7555325..954113378dd1f753c3210a5a24821df44c33f4e3 100644 (file)
@@ -4495,7 +4495,7 @@ FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
   internal::FEEvaluationHangingNodesFactory<dim, Number, VectorizedArrayType>::
     apply(n_components,
           this->data->data.front().fe_degree,
-          *this,
+          this->get_shape_info(),
           transpose,
           constraint_mask,
           this->values_dofs);
index cc2cf6aa883d669405d2386575ebf40988950123..ef1a1c5e1afc36cdf0bbcaac81a9cacec2de95b7 100644 (file)
@@ -489,7 +489,7 @@ namespace MatrixFreeTools
                                                           phi.get_shape_info()
                                                             .data.front()
                                                             .fe_degree,
-                                                          phi,
+                                                          phi.get_shape_info(),
                                                           false,
                                                           constraint_mask,
                                                           values_dofs.data());
index 3569d72c7724ca0f6bc62da934f3976428b346f5..c51c9377381c959fb2bed468c9d691642d791d17 100644 (file)
@@ -487,10 +487,9 @@ test(const unsigned int                                           degree,
         dim,
         VectorizedArray<double>,
         false>::template run<-1, -1>(eval, b == 1, cmask, values1.data());
-      internal::FEEvaluationImplHangingNodes<
-        dim,
-        VectorizedArray<double>,
-        false>::template run<-1, -1>(1, eval, b == 1, cmask, values2.data());
+      internal::FEEvaluationImplHangingNodes<dim, VectorizedArray<double>>::
+        template run<-1, -1>(
+          1, eval.get_shape_info(), b == 1, cmask, values2.data());
 
       for (const auto i : values1)
         deallog << i[0] << " ";

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.