]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement factory class for FEEvaluation and FEFaceEvaluation
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Thu, 17 Sep 2020 14:19:49 +0000 (16:19 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 18 Sep 2020 12:44:19 +0000 (14:44 +0200)
12 files changed:
include/deal.II/matrix_free/evaluation_kernels.h
include/deal.II/matrix_free/evaluation_template_factory.h [new file with mode: 0644]
include/deal.II/matrix_free/evaluation_template_factory.templates.h [new file with mode: 0644]
include/deal.II/matrix_free/fe_evaluation.h
source/matrix_free/CMakeLists.txt
source/matrix_free/evaluation_template_factory.cc [new file with mode: 0644]
source/matrix_free/evaluation_template_factory.inst.in [new file with mode: 0644]
source/matrix_free/evaluation_template_factory_inst2.cc [new file with mode: 0644]
source/matrix_free/evaluation_template_factory_inst3.cc [new file with mode: 0644]
source/matrix_free/evaluation_template_factory_inst4.cc [new file with mode: 0644]
source/matrix_free/evaluation_template_factory_inst5.cc [new file with mode: 0644]
source/matrix_free/evaluation_template_factory_inst6.cc [new file with mode: 0644]

index 8f40cb85d37a6310d639052a90bdbd180d6f04ef..cbe9fe3b4f977d55878d2f6286f9983671da6280 100644 (file)
@@ -1500,8 +1500,7 @@ namespace internal
                               hessians_quad,
                               scratch_data);
         }
-      else if (shape_info.element_type ==
-               internal::MatrixFreeFunctions::tensor_general)
+      else
         {
           internal::FEEvaluationImpl<
             internal::MatrixFreeFunctions::tensor_general,
@@ -1517,8 +1516,6 @@ namespace internal
                               hessians_quad,
                               scratch_data);
         }
-      else
-        AssertThrow(false, ExcNotImplemented());
 
       return false;
     }
@@ -1649,8 +1646,7 @@ namespace internal
                                scratch_data,
                                sum_into_values_array);
         }
-      else if (shape_info.element_type ==
-               internal::MatrixFreeFunctions::tensor_general)
+      else
         {
           internal::FEEvaluationImpl<
             internal::MatrixFreeFunctions::tensor_general,
@@ -1666,8 +1662,6 @@ namespace internal
                                scratch_data,
                                sum_into_values_array);
         }
-      else
-        AssertThrow(false, ExcNotImplemented());
 
       return false;
     }
diff --git a/include/deal.II/matrix_free/evaluation_template_factory.h b/include/deal.II/matrix_free/evaluation_template_factory.h
new file mode 100644 (file)
index 0000000..a7484b2
--- /dev/null
@@ -0,0 +1,180 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+#ifndef dealii_matrix_free_evaluation_template_factory_h
+#define dealii_matrix_free_evaluation_template_factory_h
+
+
+#include <deal.II/base/config.h>
+
+#include <deal.II/matrix_free/dof_info.h>
+#include <deal.II/matrix_free/evaluation_flags.h>
+#include <deal.II/matrix_free/shape_info.h>
+
+
+DEAL_II_NAMESPACE_OPEN
+
+
+template <int, typename, bool, typename>
+class FEEvaluationBaseData;
+
+
+namespace internal
+{
+  template <int dim,
+            typename Number,
+            typename VectorizedArrayType = VectorizedArray<Number>>
+  struct FEEvaluationFactory
+  {
+    static void
+    evaluate(
+      const unsigned int                     n_components,
+      const EvaluationFlags::EvaluationFlags evaluation_flag,
+      const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &shape_info,
+      VectorizedArrayType *values_dofs_actual,
+      VectorizedArrayType *values_quad,
+      VectorizedArrayType *gradients_quad,
+      VectorizedArrayType *hessians_quad,
+      VectorizedArrayType *scratch_data);
+
+    static void
+    integrate(
+      const unsigned int                     n_components,
+      const EvaluationFlags::EvaluationFlags integration_flag,
+      const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &shape_info,
+      VectorizedArrayType *values_dofs_actual,
+      VectorizedArrayType *values_quad,
+      VectorizedArrayType *gradients_quad,
+      VectorizedArrayType *scratch_data,
+      const bool           sum_into_values_array);
+  };
+
+
+
+  template <int dim,
+            typename Number,
+            typename VectorizedArrayType = VectorizedArray<Number>>
+  struct FEFaceEvaluationFactory
+  {
+    static void
+    evaluate(const unsigned int n_components,
+             const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &data,
+             const VectorizedArrayType *   values_array,
+             VectorizedArrayType *         values_quad,
+             VectorizedArrayType *         gradients_quad,
+             VectorizedArrayType *         scratch_data,
+             const bool                    evaluate_values,
+             const bool                    evaluate_gradients,
+             const unsigned int            face_no,
+             const unsigned int            subface_index,
+             const unsigned int            face_orientation,
+             const Table<2, unsigned int> &orientation_map);
+
+    static void
+    integrate(const unsigned int n_components,
+              const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &data,
+              VectorizedArrayType *         values_array,
+              VectorizedArrayType *         values_quad,
+              VectorizedArrayType *         gradients_quad,
+              VectorizedArrayType *         scratch_data,
+              const bool                    integrate_values,
+              const bool                    integrate_gradients,
+              const unsigned int            face_no,
+              const unsigned int            subface_index,
+              const unsigned int            face_orientation,
+              const Table<2, unsigned int> &orientation_map);
+
+    template <std::size_t n_face_orientations>
+    static bool
+    gather_evaluate(
+      const unsigned int                                         n_components,
+      const Number *                                             src_ptr,
+      const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &data,
+      const MatrixFreeFunctions::DoFInfo &                       dof_info,
+      VectorizedArrayType *                                      values_quad,
+      VectorizedArrayType *                                      gradients_quad,
+      VectorizedArrayType *                                      scratch_data,
+      const bool         evaluate_values,
+      const bool         evaluate_gradients,
+      const unsigned int active_fe_index,
+      const unsigned int first_selected_component,
+      const std::array<unsigned int, n_face_orientations> cells,
+      const std::array<unsigned int, n_face_orientations> face_nos,
+      const unsigned int                                  subface_index,
+      const MatrixFreeFunctions::DoFInfo::DoFAccessIndex  dof_access_index,
+      const std::array<unsigned int, n_face_orientations> face_orientations,
+      const Table<2, unsigned int> &                      orientation_map);
+
+    template <std::size_t n_face_orientations>
+    static bool
+    integrate_scatter(
+      const unsigned int                                         n_components,
+      Number *                                                   dst_ptr,
+      const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &data,
+      const MatrixFreeFunctions::DoFInfo &                       dof_info,
+      VectorizedArrayType *                                      values_array,
+      VectorizedArrayType *                                      values_quad,
+      VectorizedArrayType *                                      gradients_quad,
+      VectorizedArrayType *                                      scratch_data,
+      const bool         integrate_values,
+      const bool         integrate_gradients,
+      const unsigned int active_fe_index,
+      const unsigned int first_selected_component,
+      const std::array<unsigned int, n_face_orientations> cells,
+      const std::array<unsigned int, n_face_orientations> face_nos,
+      const unsigned int                                  subface_index,
+      const MatrixFreeFunctions::DoFInfo::DoFAccessIndex  dof_access_index,
+      const std::array<unsigned int, n_face_orientations> face_orientations,
+      const Table<2, unsigned int> &                      orientation_map);
+  };
+
+
+
+  template <int dim,
+            typename Number,
+            typename VectorizedArrayType = VectorizedArray<Number>>
+  struct CellwiseInverseMassFactory
+  {
+    static void
+    apply(const unsigned int n_components,
+          const unsigned int fe_degree,
+          const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
+            &                        fe_eval,
+          const VectorizedArrayType *in_array,
+          VectorizedArrayType *      out_array);
+
+    static void
+    apply(const unsigned int                        n_components,
+          const unsigned int                        fe_degree,
+          const AlignedVector<VectorizedArrayType> &inverse_shape,
+          const AlignedVector<VectorizedArrayType> &inverse_coefficients,
+          const VectorizedArrayType *               in_array,
+          VectorizedArrayType *                     out_array);
+
+    static void
+    transform_from_q_points_to_basis(
+      const unsigned int                        n_components,
+      const unsigned int                        fe_degree,
+      const AlignedVector<VectorizedArrayType> &inverse_shape,
+      const VectorizedArrayType *               in_array,
+      VectorizedArrayType *                     out_array);
+  };
+
+} // end of namespace internal
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif
diff --git a/include/deal.II/matrix_free/evaluation_template_factory.templates.h b/include/deal.II/matrix_free/evaluation_template_factory.templates.h
new file mode 100644 (file)
index 0000000..f89eee2
--- /dev/null
@@ -0,0 +1,367 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+#ifndef dealii_matrix_free_evaluation_template_factory_templates_h
+#define dealii_matrix_free_evaluation_template_factory_templates_h
+
+
+#include <deal.II/base/config.h>
+
+#include <deal.II/matrix_free/evaluation_kernels.h>
+#include <deal.II/matrix_free/evaluation_selector.h>
+#include <deal.II/matrix_free/evaluation_template_factory.h>
+#include <deal.II/matrix_free/fe_evaluation.h>
+
+#ifndef FE_EVAL_FACTORY_DEGREE_MAX
+#  define FE_EVAL_FACTORY_DEGREE_MAX 6
+#endif
+
+DEAL_II_NAMESPACE_OPEN
+
+namespace internal
+{
+  template <int degree, typename EvaluatorType, typename... Args>
+  bool
+  instantiation_helper_run(const unsigned int given_degree,
+                           const unsigned int n_q_points_1d,
+                           Args &... args)
+  {
+    if (given_degree == degree)
+      {
+        if (n_q_points_1d == degree + 1)
+          return EvaluatorType::template run<degree, degree + 1>(args...);
+        else if (n_q_points_1d == degree + 2)
+          return EvaluatorType::template run<degree, degree + 2>(args...);
+        else if (n_q_points_1d == degree)
+          return EvaluatorType::template run<degree, degree>(args...);
+        else
+          // slow path
+          return EvaluatorType::template run<-1, 0>(args...);
+      }
+    else if (degree < FE_EVAL_FACTORY_DEGREE_MAX)
+      return instantiation_helper_run<
+        (degree < FE_EVAL_FACTORY_DEGREE_MAX ? degree + 1 : degree),
+        EvaluatorType>(given_degree, n_q_points_1d, args...);
+    else
+      // slow path
+      return EvaluatorType::template run<-1, 0>(args...);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  void
+  FEEvaluationFactory<dim, Number, VectorizedArrayType>::evaluate(
+    const unsigned int                                         n_components,
+    const EvaluationFlags::EvaluationFlags                     evaluation_flag,
+    const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &shape_info,
+    VectorizedArrayType *values_dofs_actual,
+    VectorizedArrayType *values_quad,
+    VectorizedArrayType *gradients_quad,
+    VectorizedArrayType *hessians_quad,
+    VectorizedArrayType *scratch_data)
+  {
+    instantiation_helper_run<
+      1,
+      FEEvaluationImplEvaluateSelector<dim, VectorizedArrayType>>(
+      shape_info.data[0].fe_degree,
+      shape_info.data[0].n_q_points_1d,
+      n_components,
+      evaluation_flag,
+      shape_info,
+      values_dofs_actual,
+      values_quad,
+      gradients_quad,
+      hessians_quad,
+      scratch_data);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  void
+  FEEvaluationFactory<dim, Number, VectorizedArrayType>::integrate(
+    const unsigned int                                         n_components,
+    const EvaluationFlags::EvaluationFlags                     integration_flag,
+    const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &shape_info,
+    VectorizedArrayType *values_dofs_actual,
+    VectorizedArrayType *values_quad,
+    VectorizedArrayType *gradients_quad,
+    VectorizedArrayType *scratch_data,
+    const bool           sum_into_values_array)
+  {
+    instantiation_helper_run<
+      1,
+      FEEvaluationImplIntegrateSelector<dim, VectorizedArrayType>>(
+      shape_info.data[0].fe_degree,
+      shape_info.data[0].n_q_points_1d,
+      n_components,
+      integration_flag,
+      shape_info,
+      values_dofs_actual,
+      values_quad,
+      gradients_quad,
+      scratch_data,
+      sum_into_values_array);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  void
+  FEFaceEvaluationFactory<dim, Number, VectorizedArrayType>::evaluate(
+    const unsigned int                                         n_components,
+    const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &data,
+    const VectorizedArrayType *                                values_array,
+    VectorizedArrayType *                                      values_quad,
+    VectorizedArrayType *                                      gradients_quad,
+    VectorizedArrayType *                                      scratch_data,
+    const bool                                                 evaluate_values,
+    const bool                    evaluate_gradients,
+    const unsigned int            face_no,
+    const unsigned int            subface_index,
+    const unsigned int            face_orientation,
+    const Table<2, unsigned int> &orientation_map)
+  {
+    instantiation_helper_run<
+      1,
+      FEFaceEvaluationImplEvaluateSelector<dim, VectorizedArrayType>>(
+      data.data[0].fe_degree,
+      data.data[0].n_q_points_1d,
+      n_components,
+      data,
+      values_array,
+      values_quad,
+      gradients_quad,
+      scratch_data,
+      evaluate_values,
+      evaluate_gradients,
+      face_no,
+      subface_index,
+      face_orientation,
+      orientation_map);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  void
+  FEFaceEvaluationFactory<dim, Number, VectorizedArrayType>::integrate(
+    const unsigned int                                         n_components,
+    const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &data,
+    VectorizedArrayType *                                      values_array,
+    VectorizedArrayType *                                      values_quad,
+    VectorizedArrayType *                                      gradients_quad,
+    VectorizedArrayType *                                      scratch_data,
+    const bool                                                 integrate_values,
+    const bool                    integrate_gradients,
+    const unsigned int            face_no,
+    const unsigned int            subface_index,
+    const unsigned int            face_orientation,
+    const Table<2, unsigned int> &orientation_map)
+  {
+    instantiation_helper_run<
+      1,
+      FEFaceEvaluationImplIntegrateSelector<dim, VectorizedArrayType>>(
+      data.data[0].fe_degree,
+      data.data[0].n_q_points_1d,
+      n_components,
+      data,
+      values_array,
+      values_quad,
+      gradients_quad,
+      scratch_data,
+      integrate_values,
+      integrate_gradients,
+      face_no,
+      subface_index,
+      face_orientation,
+      orientation_map);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  template <std::size_t n_face_orientations>
+  bool
+  FEFaceEvaluationFactory<dim, Number, VectorizedArrayType>::gather_evaluate(
+    const unsigned int                                         n_components,
+    const Number *                                             src_ptr,
+    const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &data,
+    const MatrixFreeFunctions::DoFInfo &                       dof_info,
+    VectorizedArrayType *                                      values_quad,
+    VectorizedArrayType *                                      gradients_quad,
+    VectorizedArrayType *                                      scratch_data,
+    const bool                                                 evaluate_values,
+    const bool         evaluate_gradients,
+    const unsigned int active_fe_index,
+    const unsigned int first_selected_component,
+    const std::array<unsigned int, n_face_orientations> cells,
+    const std::array<unsigned int, n_face_orientations> face_nos,
+    const unsigned int                                  subface_index,
+    const MatrixFreeFunctions::DoFInfo::DoFAccessIndex  dof_access_index,
+    const std::array<unsigned int, n_face_orientations> face_orientations,
+    const Table<2, unsigned int> &                      orientation_map)
+  {
+    return instantiation_helper_run<
+      1,
+      FEFaceEvaluationImplGatherEvaluateSelector<dim,
+                                                 Number,
+                                                 VectorizedArrayType>>(
+      data.data[0].fe_degree,
+      data.data[0].n_q_points_1d,
+      n_components,
+      src_ptr,
+      data,
+      dof_info,
+      values_quad,
+      gradients_quad,
+      scratch_data,
+      evaluate_values,
+      evaluate_gradients,
+      active_fe_index,
+      first_selected_component,
+      cells,
+      face_nos,
+      subface_index,
+      dof_access_index,
+      face_orientations,
+      orientation_map);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  template <std::size_t n_face_orientations>
+  bool
+  FEFaceEvaluationFactory<dim, Number, VectorizedArrayType>::integrate_scatter(
+    const unsigned int                                         n_components,
+    Number *                                                   dst_ptr,
+    const MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> &data,
+    const MatrixFreeFunctions::DoFInfo &                       dof_info,
+    VectorizedArrayType *                                      values_array,
+    VectorizedArrayType *                                      values_quad,
+    VectorizedArrayType *                                      gradients_quad,
+    VectorizedArrayType *                                      scratch_data,
+    const bool                                                 integrate_values,
+    const bool         integrate_gradients,
+    const unsigned int active_fe_index,
+    const unsigned int first_selected_component,
+    const std::array<unsigned int, n_face_orientations> cells,
+    const std::array<unsigned int, n_face_orientations> face_nos,
+    const unsigned int                                  subface_index,
+    const MatrixFreeFunctions::DoFInfo::DoFAccessIndex  dof_access_index,
+    const std::array<unsigned int, n_face_orientations> face_orientations,
+    const Table<2, unsigned int> &                      orientation_map)
+  {
+    return instantiation_helper_run<
+      1,
+      FEFaceEvaluationImplIntegrateScatterSelector<dim,
+                                                   Number,
+                                                   VectorizedArrayType>>(
+      data.data[0].fe_degree,
+      data.data[0].n_q_points_1d,
+      n_components,
+      dst_ptr,
+      data,
+      dof_info,
+      values_array,
+      values_quad,
+      gradients_quad,
+      scratch_data,
+      integrate_values,
+      integrate_gradients,
+      active_fe_index,
+      first_selected_component,
+      cells,
+      face_nos,
+      subface_index,
+      dof_access_index,
+      face_orientations,
+      orientation_map);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  void
+  CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::apply(
+    const unsigned int n_components,
+    const unsigned int fe_degree,
+    const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
+      &                        fe_eval,
+    const VectorizedArrayType *in_array,
+    VectorizedArrayType *      out_array)
+  {
+    instantiation_helper_run<
+      1,
+      CellwiseInverseMassMatrixImplBasic<dim, VectorizedArrayType>>(
+      fe_degree, fe_degree + 1, n_components, fe_eval, in_array, out_array);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  void
+  CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::apply(
+    const unsigned int                        n_components,
+    const unsigned int                        fe_degree,
+    const AlignedVector<VectorizedArrayType> &inverse_shape,
+    const AlignedVector<VectorizedArrayType> &inverse_coefficients,
+    const VectorizedArrayType *               in_array,
+    VectorizedArrayType *                     out_array)
+  {
+    instantiation_helper_run<
+      1,
+      CellwiseInverseMassMatrixImplFlexible<dim, VectorizedArrayType>>(
+      fe_degree,
+      fe_degree + 1,
+      n_components,
+      inverse_shape,
+      inverse_coefficients,
+      in_array,
+      out_array);
+  }
+
+
+
+  template <int dim, typename Number, typename VectorizedArrayType>
+  void
+  CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
+    transform_from_q_points_to_basis(
+      const unsigned int                        n_components,
+      const unsigned int                        fe_degree,
+      const AlignedVector<VectorizedArrayType> &inverse_shape,
+      const VectorizedArrayType *               in_array,
+      VectorizedArrayType *                     out_array)
+  {
+    instantiation_helper_run<
+      1,
+      CellwiseInverseMassMatrixImplTransformFromQPoints<dim,
+                                                        VectorizedArrayType>>(
+      fe_degree,
+      fe_degree + 1,
+      n_components,
+      inverse_shape,
+      in_array,
+      out_array);
+  }
+
+} // end of namespace internal
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif
index 49dce2fa12e46067d68cc2d857a95875ae293ad9..17c444436ee4e00ff19dfe482cf7fa4f96c4cfd2 100644 (file)
@@ -32,6 +32,7 @@
 #include <deal.II/matrix_free/evaluation_flags.h>
 #include <deal.II/matrix_free/evaluation_kernels.h>
 #include <deal.II/matrix_free/evaluation_selector.h>
+#include <deal.II/matrix_free/evaluation_template_factory.h>
 #include <deal.II/matrix_free/mapping_data_on_the_fly.h>
 #include <deal.II/matrix_free/matrix_free.h>
 #include <deal.II/matrix_free/shape_info.h>
@@ -85,10 +86,7 @@ class FEEvaluation;
  *
  * @ingroup matrixfree
  */
-template <int dim,
-          typename Number,
-          bool is_face                 = false,
-          typename VectorizedArrayType = VectorizedArray<Number>>
+template <int dim, typename Number, bool is_face, typename VectorizedArrayType>
 class FEEvaluationBaseData
 {
   static_assert(
@@ -7405,15 +7403,26 @@ FEEvaluation<dim,
   evaluate(const VectorizedArrayType *            values_array,
            const EvaluationFlags::EvaluationFlags evaluation_flags)
 {
-  SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::evaluate(
-    n_components,
-    evaluation_flags,
-    *this->data,
-    const_cast<VectorizedArrayType *>(values_array),
-    this->values_quad,
-    this->gradients_quad,
-    this->hessians_quad,
-    this->scratch_data);
+  if (fe_degree > -1)
+    SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::
+      evaluate(n_components,
+               evaluation_flags,
+               *this->data,
+               const_cast<VectorizedArrayType *>(values_array),
+               this->values_quad,
+               this->gradients_quad,
+               this->hessians_quad,
+               this->scratch_data);
+  else
+    internal::FEEvaluationFactory<dim, Number, VectorizedArrayType>::evaluate(
+      n_components,
+      evaluation_flags,
+      *this->data,
+      const_cast<VectorizedArrayType *>(values_array),
+      this->values_quad,
+      this->gradients_quad,
+      this->hessians_quad,
+      this->scratch_data);
 
 #  ifdef DEBUG
   if (evaluation_flags & EvaluationFlags::values)
@@ -7595,15 +7604,27 @@ namespace internal
             dof_info->component_dof_indices_offset[active_fe_index]
                                                   [first_selected_component] *
               VectorizedArrayType::size());
-        SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::
-          integrate(n_components,
-                    integration_flag,
-                    *data,
-                    vec_values,
-                    values_quad,
-                    gradients_quad,
-                    scratch_data,
-                    true);
+        if (fe_degree > -1)
+          SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::
+            integrate(n_components,
+                      integration_flag,
+                      *data,
+                      vec_values,
+                      values_quad,
+                      gradients_quad,
+                      scratch_data,
+                      true);
+        else
+          FEEvaluationFactory<dim, Number, VectorizedArrayType>::integrate(
+            n_components,
+            integration_flag,
+            *data,
+            vec_values,
+            values_quad,
+            gradients_quad,
+            scratch_data,
+            true);
+
         return true;
       }
 
@@ -7680,6 +7701,8 @@ namespace internal
   }
 } // namespace internal
 
+
+
 template <int dim,
           int fe_degree,
           int n_q_points_1d,
@@ -7820,15 +7843,26 @@ FEEvaluation<dim,
     ExcMessage(
       "Only EvaluationFlags::values and EvaluationFlags::gradients are supported."));
 
-  SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::
-    integrate(n_components,
-              integration_flag,
-              *this->data,
-              values_array,
-              this->values_quad,
-              this->gradients_quad,
-              this->scratch_data,
-              false);
+  if (fe_degree > -1)
+    SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::
+      integrate(n_components,
+                integration_flag,
+                *this->data,
+                values_array,
+                this->values_quad,
+                this->gradients_quad,
+                this->scratch_data,
+                false);
+  else
+    internal::FEEvaluationFactory<dim, Number, VectorizedArrayType>::integrate(
+      n_components,
+      integration_flag,
+      *this->data,
+      values_array,
+      this->values_quad,
+      this->gradients_quad,
+      this->scratch_data,
+      false);
 
 #  ifdef DEBUG
   this->dof_values_initialized = true;
@@ -8187,20 +8221,37 @@ FEFaceEvaluation<dim,
       !(evaluation_flag & EvaluationFlags::gradients))
     return;
 
-  internal::FEFaceEvaluationImplEvaluateSelector<dim, VectorizedArrayType>::
-    template run<fe_degree, n_q_points_1d>(
-      n_components,
-      *this->data,
-      values_array,
-      this->begin_values(),
-      this->begin_gradients(),
-      this->scratch_data,
-      evaluation_flag & EvaluationFlags::values,
-      evaluation_flag & EvaluationFlags::gradients,
-      this->face_no,
-      this->subface_index,
-      this->face_orientation,
-      this->mapping_data->descriptor[this->active_fe_index].face_orientations);
+  if (fe_degree > -1)
+    internal::FEFaceEvaluationImplEvaluateSelector<dim, VectorizedArrayType>::
+      template run<fe_degree, n_q_points_1d>(
+        n_components,
+        *this->data,
+        values_array,
+        this->begin_values(),
+        this->begin_gradients(),
+        this->scratch_data,
+        evaluation_flag & EvaluationFlags::values,
+        evaluation_flag & EvaluationFlags::gradients,
+        this->face_no,
+        this->subface_index,
+        this->face_orientation,
+        this->mapping_data->descriptor[this->active_fe_index]
+          .face_orientations);
+  else
+    internal::FEFaceEvaluationFactory<dim, Number, VectorizedArrayType>::
+      evaluate(n_components,
+               *this->data,
+               values_array,
+               this->begin_values(),
+               this->begin_gradients(),
+               this->scratch_data,
+               evaluation_flag & EvaluationFlags::values,
+               evaluation_flag & EvaluationFlags::gradients,
+               this->face_no,
+               this->subface_index,
+               this->face_orientation,
+               this->mapping_data->descriptor[this->active_fe_index]
+                 .face_orientations);
 
 #  ifdef DEBUG
   if (evaluation_flag & EvaluationFlags::values)
@@ -8313,20 +8364,37 @@ FEFaceEvaluation<dim,
       !(evaluation_flag & EvaluationFlags::gradients))
     return;
 
-  internal::FEFaceEvaluationImplIntegrateSelector<dim, VectorizedArrayType>::
-    template run<fe_degree, n_q_points_1d>(
-      n_components,
-      *this->data,
-      values_array,
-      this->begin_values(),
-      this->begin_gradients(),
-      this->scratch_data,
-      evaluation_flag & EvaluationFlags::values,
-      evaluation_flag & EvaluationFlags::gradients,
-      this->face_no,
-      this->subface_index,
-      this->face_orientation,
-      this->mapping_data->descriptor[this->active_fe_index].face_orientations);
+  if (fe_degree > -1)
+    internal::FEFaceEvaluationImplIntegrateSelector<dim, VectorizedArrayType>::
+      template run<fe_degree, n_q_points_1d>(
+        n_components,
+        *this->data,
+        values_array,
+        this->begin_values(),
+        this->begin_gradients(),
+        this->scratch_data,
+        evaluation_flag & EvaluationFlags::values,
+        evaluation_flag & EvaluationFlags::gradients,
+        this->face_no,
+        this->subface_index,
+        this->face_orientation,
+        this->mapping_data->descriptor[this->active_fe_index]
+          .face_orientations);
+  else
+    internal::FEFaceEvaluationFactory<dim, Number, VectorizedArrayType>::
+      integrate(n_components,
+                *this->data,
+                values_array,
+                this->begin_values(),
+                this->begin_gradients(),
+                this->scratch_data,
+                evaluation_flag & EvaluationFlags::values,
+                evaluation_flag & EvaluationFlags::gradients,
+                this->face_no,
+                this->subface_index,
+                this->face_orientation,
+                this->mapping_data->descriptor[this->active_fe_index]
+                  .face_orientations);
 }
 
 
@@ -8417,29 +8485,52 @@ FEFaceEvaluation<dim,
       }
     else
       {
-        return internal::FEFaceEvaluationImplGatherEvaluateSelector<
-          dim,
-          Number,
-          VectorizedArrayType>::
-          template run<fe_degree, n_q_points_1d, 1>(
-            n_components,
-            internal::get_beginning<Number>(input_vector),
-            *this->data,
-            *this->dof_info,
-            this->begin_values(),
-            this->begin_gradients(),
-            this->scratch_data,
-            evaluation_flag & EvaluationFlags::values,
-            evaluation_flag & EvaluationFlags::gradients,
-            this->active_fe_index,
-            this->first_selected_component,
-            std::array<unsigned int, 1>{{this->cell}},
-            std::array<unsigned int, 1>{{this->face_no}},
-            this->subface_index,
-            this->dof_access_index,
-            std::array<unsigned int, 1>{{this->face_orientation}},
-            this->mapping_data->descriptor[this->active_fe_index]
-              .face_orientations);
+        if (fe_degree > -1)
+          return internal::FEFaceEvaluationImplGatherEvaluateSelector<
+            dim,
+            Number,
+            VectorizedArrayType>::
+            template run<fe_degree, n_q_points_1d, 1>(
+              n_components,
+              internal::get_beginning<Number>(input_vector),
+              *this->data,
+              *this->dof_info,
+              this->begin_values(),
+              this->begin_gradients(),
+              this->scratch_data,
+              evaluation_flag & EvaluationFlags::values,
+              evaluation_flag & EvaluationFlags::gradients,
+              this->active_fe_index,
+              this->first_selected_component,
+              std::array<unsigned int, 1>{{this->cell}},
+              std::array<unsigned int, 1>{{this->face_no}},
+              this->subface_index,
+              this->dof_access_index,
+              std::array<unsigned int, 1>{{this->face_orientation}},
+              this->mapping_data->descriptor[this->active_fe_index]
+                .face_orientations);
+        else
+          return internal::
+            FEFaceEvaluationFactory<dim, Number, VectorizedArrayType>::
+              gather_evaluate(
+                n_components,
+                internal::get_beginning<Number>(input_vector),
+                *this->data,
+                *this->dof_info,
+                this->begin_values(),
+                this->begin_gradients(),
+                this->scratch_data,
+                evaluation_flag & EvaluationFlags::values,
+                evaluation_flag & EvaluationFlags::gradients,
+                this->active_fe_index,
+                this->first_selected_component,
+                std::array<unsigned int, 1>{{this->cell}},
+                std::array<unsigned int, 1>{{this->face_no}},
+                this->subface_index,
+                this->dof_access_index,
+                std::array<unsigned int, 1>{{this->face_orientation}},
+                this->mapping_data->descriptor[this->active_fe_index]
+                  .face_orientations);
       }
   };
 
@@ -8509,36 +8600,66 @@ FEFaceEvaluation<dim,
           this->is_interior_face == false) == false,
          ExcNotImplemented());
 
-  if (!internal::FEFaceEvaluationImplIntegrateScatterSelector<
-        dim,
-        Number,
-        VectorizedArrayType>::
-        template run<fe_degree, n_q_points_1d, 1>(
-          n_components,
-          internal::get_beginning<Number>(destination),
-          *this->data,
-          *this->dof_info,
-          this->begin_dof_values(),
-          this->begin_values(),
-          this->begin_gradients(),
-          this->scratch_data,
-          evaluation_flag & EvaluationFlags::values,
-          evaluation_flag & EvaluationFlags::gradients,
-          this->active_fe_index,
-          this->first_selected_component,
-          std::array<unsigned int, 1>{{this->cell}},
-          std::array<unsigned int, 1>{{this->face_no}},
-          this->subface_index,
-          this->dof_access_index,
-          std::array<unsigned int, 1>{{this->face_orientation}},
-          this->mapping_data->descriptor[this->active_fe_index]
-            .face_orientations))
+  if (fe_degree > -1)
     {
-      // if we arrive here, writing into the destination vector did not succeed
-      // because some of the assumptions in integrate_scatter were not
-      // fulfilled (e.g. an element or degree that does not support direct
-      // writing), so we must do it here
-      this->distribute_local_to_global(destination);
+      if (!internal::FEFaceEvaluationImplIntegrateScatterSelector<
+            dim,
+            Number,
+            VectorizedArrayType>::
+            template run<fe_degree, n_q_points_1d, 1>(
+              n_components,
+              internal::get_beginning<Number>(destination),
+              *this->data,
+              *this->dof_info,
+              this->begin_dof_values(),
+              this->begin_values(),
+              this->begin_gradients(),
+              this->scratch_data,
+              evaluation_flag & EvaluationFlags::values,
+              evaluation_flag & EvaluationFlags::gradients,
+              this->active_fe_index,
+              this->first_selected_component,
+              std::array<unsigned int, 1>{{this->cell}},
+              std::array<unsigned int, 1>{{this->face_no}},
+              this->subface_index,
+              this->dof_access_index,
+              std::array<unsigned int, 1>{{this->face_orientation}},
+              this->mapping_data->descriptor[this->active_fe_index]
+                .face_orientations))
+        {
+          // if we arrive here, writing into the destination vector did not
+          // succeed because some of the assumptions in integrate_scatter were
+          // not fulfilled (e.g. an element or degree that does not support
+          // direct writing), so we must do it here
+          this->distribute_local_to_global(destination);
+        }
+    }
+  else
+    {
+      if (!internal::FEFaceEvaluationFactory<dim, Number, VectorizedArrayType>::
+            integrate_scatter(
+              n_components,
+              internal::get_beginning<Number>(destination),
+              *this->data,
+              *this->dof_info,
+              this->begin_dof_values(),
+              this->begin_values(),
+              this->begin_gradients(),
+              this->scratch_data,
+              evaluation_flag & EvaluationFlags::values,
+              evaluation_flag & EvaluationFlags::gradients,
+              this->active_fe_index,
+              this->first_selected_component,
+              std::array<unsigned int, 1>{{this->cell}},
+              std::array<unsigned int, 1>{{this->face_no}},
+              this->subface_index,
+              this->dof_access_index,
+              std::array<unsigned int, 1>{{this->face_orientation}},
+              this->mapping_data->descriptor[this->active_fe_index]
+                .face_orientations))
+        {
+          this->distribute_local_to_global(destination);
+        }
     }
 }
 
index 348e4cf6c7e825b36522f9622c4023ff9a6a070d..9249b5dd6f60b51e22207ffaedad85236b749307 100644 (file)
@@ -18,6 +18,12 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
 SET(_src
   dof_info.cc
   evaluation_selector.cc
+  evaluation_template_factory.cc
+  evaluation_template_factory_inst2.cc
+  evaluation_template_factory_inst3.cc
+  evaluation_template_factory_inst4.cc
+  evaluation_template_factory_inst5.cc
+  evaluation_template_factory_inst6.cc
   mapping_info.cc
   mapping_info_inst2.cc
   mapping_info_inst3.cc
@@ -28,6 +34,7 @@ SET(_src
 
 SET(_inst
   evaluation_selector.inst.in
+  evaluation_template_factory.inst.in
   mapping_info.inst.in
   matrix_free.inst.in
   shape_info.inst.in
diff --git a/source/matrix_free/evaluation_template_factory.cc b/source/matrix_free/evaluation_template_factory.cc
new file mode 100644 (file)
index 0000000..6bad487
--- /dev/null
@@ -0,0 +1,30 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+#define FE_EVAL_FACTORY_DEGREE_MAX 6
+
+#include <deal.II/matrix_free/evaluation_template_factory.templates.h>
+
+DEAL_II_NAMESPACE_OPEN
+
+#define SPLIT_INSTANTIATIONS_COUNT 6
+#ifndef SPLIT_INSTANTIATIONS_INDEX
+#  define SPLIT_INSTANTIATIONS_INDEX 0
+#endif
+
+#include "evaluation_template_factory.inst"
+
+DEAL_II_NAMESPACE_CLOSE
diff --git a/source/matrix_free/evaluation_template_factory.inst.in b/source/matrix_free/evaluation_template_factory.inst.in
new file mode 100644 (file)
index 0000000..a0019c9
--- /dev/null
@@ -0,0 +1,82 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+for (deal_II_dimension : DIMENSIONS;
+     deal_II_scalar_vectorized : REAL_SCALARS_VECTORIZED)
+  {
+    template struct dealii::internal::FEEvaluationFactory<
+      deal_II_dimension,
+      deal_II_scalar_vectorized::value_type,
+      deal_II_scalar_vectorized>;
+
+    template struct dealii::internal::FEFaceEvaluationFactory<
+      deal_II_dimension,
+      deal_II_scalar_vectorized::value_type,
+      deal_II_scalar_vectorized>;
+
+    // inverse mass
+    template struct dealii::internal::CellwiseInverseMassFactory<
+      deal_II_dimension,
+      deal_II_scalar_vectorized::value_type,
+      deal_II_scalar_vectorized>;
+
+    template bool dealii::internal::FEFaceEvaluationFactory<
+      deal_II_dimension,
+      deal_II_scalar_vectorized::value_type,
+      deal_II_scalar_vectorized>::
+      gather_evaluate<1>(
+        const unsigned int,
+        const deal_II_scalar_vectorized::value_type *,
+        const MatrixFreeFunctions::ShapeInfo<deal_II_scalar_vectorized> &,
+        const MatrixFreeFunctions::DoFInfo &,
+        deal_II_scalar_vectorized *,
+        deal_II_scalar_vectorized *,
+        deal_II_scalar_vectorized *,
+        const bool,
+        const bool,
+        const unsigned int,
+        const unsigned int,
+        const std::array<unsigned int, 1>,
+        const std::array<unsigned int, 1>,
+        const unsigned int,
+        const MatrixFreeFunctions::DoFInfo::DoFAccessIndex,
+        const std::array<unsigned int, 1>,
+        const Table<2, unsigned int> &);
+
+    template bool dealii::internal::FEFaceEvaluationFactory<
+      deal_II_dimension,
+      deal_II_scalar_vectorized::value_type,
+      deal_II_scalar_vectorized>::
+      integrate_scatter<1>(
+        const unsigned int,
+        deal_II_scalar_vectorized::value_type *,
+        const MatrixFreeFunctions::ShapeInfo<deal_II_scalar_vectorized> &,
+        const MatrixFreeFunctions::DoFInfo &,
+        deal_II_scalar_vectorized *,
+        deal_II_scalar_vectorized *,
+        deal_II_scalar_vectorized *,
+        deal_II_scalar_vectorized *,
+        const bool,
+        const bool,
+        const unsigned int,
+        const unsigned int,
+        const std::array<unsigned int, 1>,
+        const std::array<unsigned int, 1>,
+        const unsigned int,
+        const MatrixFreeFunctions::DoFInfo::DoFAccessIndex,
+        const std::array<unsigned int, 1>,
+        const Table<2, unsigned int> &);
+  }
diff --git a/source/matrix_free/evaluation_template_factory_inst2.cc b/source/matrix_free/evaluation_template_factory_inst2.cc
new file mode 100644 (file)
index 0000000..3c6c193
--- /dev/null
@@ -0,0 +1,17 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+#define SPLIT_INSTANTIATIONS_INDEX 1
+#include "evaluation_template_factory.cc"
diff --git a/source/matrix_free/evaluation_template_factory_inst3.cc b/source/matrix_free/evaluation_template_factory_inst3.cc
new file mode 100644 (file)
index 0000000..ddf1b77
--- /dev/null
@@ -0,0 +1,17 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+#define SPLIT_INSTANTIATIONS_INDEX 2
+#include "evaluation_template_factory.cc"
diff --git a/source/matrix_free/evaluation_template_factory_inst4.cc b/source/matrix_free/evaluation_template_factory_inst4.cc
new file mode 100644 (file)
index 0000000..5f76e3a
--- /dev/null
@@ -0,0 +1,17 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+#define SPLIT_INSTANTIATIONS_INDEX 3
+#include "evaluation_template_factory.cc"
diff --git a/source/matrix_free/evaluation_template_factory_inst5.cc b/source/matrix_free/evaluation_template_factory_inst5.cc
new file mode 100644 (file)
index 0000000..af122d3
--- /dev/null
@@ -0,0 +1,17 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+#define SPLIT_INSTANTIATIONS_INDEX 4
+#include "evaluation_template_factory.cc"
diff --git a/source/matrix_free/evaluation_template_factory_inst6.cc b/source/matrix_free/evaluation_template_factory_inst6.cc
new file mode 100644 (file)
index 0000000..8cc5006
--- /dev/null
@@ -0,0 +1,17 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+#define SPLIT_INSTANTIATIONS_INDEX 5
+#include "evaluation_template_factory.cc"

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.