]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove n_components template argument from FEEvaluationImpl 10820/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 12 Aug 2020 12:03:41 +0000 (14:03 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 28 Aug 2020 05:32:20 +0000 (07:32 +0200)
include/deal.II/matrix_free/evaluation_flags.h [new file with mode: 0644]
include/deal.II/matrix_free/evaluation_kernels.h
include/deal.II/matrix_free/evaluation_selector.h
include/deal.II/matrix_free/fe_evaluation.h
include/deal.II/matrix_free/mapping_info.templates.h
include/deal.II/matrix_free/operators.h
source/fe/mapping_q_generic.cc
source/matrix_free/evaluation_selector.inst.in
source/multigrid/mg_transfer_matrix_free.cc

diff --git a/include/deal.II/matrix_free/evaluation_flags.h b/include/deal.II/matrix_free/evaluation_flags.h
new file mode 100644 (file)
index 0000000..14dad21
--- /dev/null
@@ -0,0 +1,130 @@
+// ---------------------------------------------------------------------
+//
+// 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_flags_h
+#define dealii_matrix_free_evaluation_flags_h
+
+#include <deal.II/base/config.h>
+
+
+DEAL_II_NAMESPACE_OPEN
+
+
+
+/**
+ * @brief The namespace for the EvaluationFlags enum
+ *
+ * This namespace contains the enum EvaluationFlags used in FEEvaluation
+ * to control evaluation and integration of values, gradients, etc..
+ */
+namespace EvaluationFlags
+{
+  /**
+   * @brief The EvaluationFlags enum
+   *
+   * This enum contains a set of flags used by FEEvaluation::integrate(),
+   * FEEvaluation::evaluate() and others to determine if values, gradients,
+   * hessians, or a combination of them is being used.
+   */
+  enum EvaluationFlags
+  {
+    /**
+     * Do not use or compute anything.
+     */
+    nothing = 0,
+    /**
+     * Use or evaluate values.
+     */
+    values = 0x1,
+    /**
+     * Use or evaluate gradients.
+     */
+    gradients = 0x2,
+    /**
+     * Use or evaluate hessians.
+     */
+    hessians = 0x4
+  };
+
+
+  /**
+   * Global operator which returns an object in which all bits are set which are
+   * either set in the first or the second argument. This operator exists since
+   * if it did not then the result of the bit-or <tt>operator |</tt> would be an
+   * integer which would in turn trigger a compiler warning when we tried to
+   * assign it to an object of type UpdateFlags.
+   *
+   * @ref EvaluationFlags
+   */
+  inline EvaluationFlags
+  operator|(const EvaluationFlags f1, const EvaluationFlags f2)
+  {
+    return static_cast<EvaluationFlags>(static_cast<unsigned int>(f1) |
+                                        static_cast<unsigned int>(f2));
+  }
+
+
+
+  /**
+   * Global operator which sets the bits from the second argument also in the
+   * first one.
+   *
+   * @ref EvaluationFlags
+   */
+  inline EvaluationFlags &
+  operator|=(EvaluationFlags &f1, const EvaluationFlags f2)
+  {
+    f1 = f1 | f2;
+    return f1;
+  }
+
+
+  /**
+   * Global operator which returns an object in which all bits are set which are
+   * set in the first as well as the second argument. This operator exists since
+   * if it did not then the result of the bit-and <tt>operator &</tt> would be
+   * an integer which would in turn trigger a compiler warning when we tried to
+   * assign it to an object of type UpdateFlags.
+   *
+   * @ref EvaluationFlags
+   */
+  inline EvaluationFlags operator&(const EvaluationFlags f1,
+                                   const EvaluationFlags f2)
+  {
+    return static_cast<EvaluationFlags>(static_cast<unsigned int>(f1) &
+                                        static_cast<unsigned int>(f2));
+  }
+
+
+  /**
+   * Global operator which clears all the bits in the first argument if they are
+   * not also set in the second argument.
+   *
+   * @ref EvaluationFlags
+   */
+  inline EvaluationFlags &
+  operator&=(EvaluationFlags &f1, const EvaluationFlags f2)
+  {
+    f1 = f1 & f2;
+    return f1;
+  }
+
+} // namespace EvaluationFlags
+
+
+DEAL_II_NAMESPACE_CLOSE
+
+#endif
index 76256a27e23d3a681691a351157282ccff209308..4451027de45a7f0636fe133e7648300b382f1441 100644 (file)
@@ -23,6 +23,7 @@
 #include <deal.II/base/vectorization.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>
 #include <deal.II/matrix_free/tensor_product_kernels.h>
 
@@ -104,29 +105,27 @@ namespace internal
             int                              dim,
             int                              fe_degree,
             int                              n_q_points_1d,
-            int                              n_components,
             typename Number>
   struct FEEvaluationImpl
   {
     static void
-    evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    evaluate(const unsigned int                            n_components,
+             const EvaluationFlags::EvaluationFlags        evaluation_flag,
+             const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
              const Number *                                values_dofs_actual,
              Number *                                      values_quad,
              Number *                                      gradients_quad,
              Number *                                      hessians_quad,
-             Number *                                      scratch_data,
-             const bool                                    evaluate_values,
-             const bool                                    evaluate_gradients,
-             const bool                                    evaluate_hessians);
+             Number *                                      scratch_data);
 
     static void
-    integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    integrate(const unsigned int                            n_components,
+              const EvaluationFlags::EvaluationFlags        integration_flag,
+              const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
               Number *                                      values_dofs_actual,
               Number *                                      values_quad,
               Number *                                      gradients_quad,
               Number *                                      scratch_data,
-              const bool                                    integrate_values,
-              const bool                                    integrate_gradients,
               const bool add_into_values_array);
   };
 
@@ -136,22 +135,19 @@ namespace internal
             int                              dim,
             int                              fe_degree,
             int                              n_q_points_1d,
-            int                              n_components,
             typename Number>
   inline void
-  FEEvaluationImpl<type, dim, fe_degree, n_q_points_1d, n_components, Number>::
-    evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
-             const Number *                                values_dofs_actual,
-             Number *                                      values_quad,
-             Number *                                      gradients_quad,
-             Number *                                      hessians_quad,
-             Number *                                      scratch_data,
-             const bool                                    evaluate_values,
-             const bool                                    evaluate_gradients,
-             const bool                                    evaluate_hessians)
+  FEEvaluationImpl<type, dim, fe_degree, n_q_points_1d, Number>::evaluate(
+    const unsigned int                            n_components,
+    const EvaluationFlags::EvaluationFlags        evaluation_flag,
+    const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    const Number *                                values_dofs_actual,
+    Number *                                      values_quad,
+    Number *                                      gradients_quad,
+    Number *                                      hessians_quad,
+    Number *                                      scratch_data)
   {
-    if (evaluate_values == false && evaluate_gradients == false &&
-        evaluate_hessians == false)
+    if (evaluation_flag == EvaluationFlags::nothing)
       return;
 
     const EvaluatorVariant variant =
@@ -209,27 +205,26 @@ namespace internal
                                        shape_info.n_q_points));
         const int degree =
           fe_degree != -1 ? fe_degree : shape_info.data.front().fe_degree;
-        unsigned int count_p = 0, count_q = 0;
-        for (int i = 0; i < (dim > 2 ? degree + 1 : 1); ++i)
-          {
-            for (int j = 0; j < (dim > 1 ? degree + 1 - i : 1); ++j)
-              {
-                for (int k = 0; k < degree + 1 - j - i;
-                     ++k, ++count_p, ++count_q)
-                  for (unsigned int c = 0; c < n_components; ++c)
+        for (unsigned int c = 0; c < n_components; ++c)
+          for (int i = 0, count_p = 0, count_q = 0;
+               i < (dim > 2 ? degree + 1 : 1);
+               ++i)
+            {
+              for (int j = 0; j < (dim > 1 ? degree + 1 - i : 1); ++j)
+                {
+                  for (int k = 0; k < degree + 1 - j - i;
+                       ++k, ++count_p, ++count_q)
                     values_dofs_tmp[c * dofs_per_comp + count_q] =
                       values_dofs_actual
                         [c * shape_info.dofs_per_component_on_cell + count_p];
-                for (int k = degree + 1 - j - i; k < degree + 1; ++k, ++count_q)
-                  for (unsigned int c = 0; c < n_components; ++c)
+                  for (int k = degree + 1 - j - i; k < degree + 1;
+                       ++k, ++count_q)
                     values_dofs_tmp[c * dofs_per_comp + count_q] = Number();
-              }
-            for (int j = degree + 1 - i; j < degree + 1; ++j)
-              for (int k = 0; k < degree + 1; ++k, ++count_q)
-                for (unsigned int c = 0; c < n_components; ++c)
+                }
+              for (int j = degree + 1 - i; j < degree + 1; ++j)
+                for (int k = 0; k < degree + 1; ++k, ++count_q)
                   values_dofs_tmp[c * dofs_per_comp + count_q] = Number();
-          }
-        AssertDimension(count_q, dofs_per_comp);
+            }
         values_dofs = values_dofs_tmp;
       }
 
@@ -238,12 +233,12 @@ namespace internal
         case 1:
           for (unsigned int c = 0; c < n_components; c++)
             {
-              if (evaluate_values == true)
+              if (evaluation_flag & EvaluationFlags::values)
                 eval.template values<0, true, false>(values_dofs, values_quad);
-              if (evaluate_gradients == true)
+              if (evaluation_flag & EvaluationFlags::gradients)
                 eval.template gradients<0, true, false>(values_dofs,
                                                         gradients_quad);
-              if (evaluate_hessians == true)
+              if (evaluation_flag & EvaluationFlags::hessians)
                 eval.template hessians<0, true, false>(values_dofs,
                                                        hessians_quad);
 
@@ -259,15 +254,15 @@ namespace internal
           for (unsigned int c = 0; c < n_components; c++)
             {
               // grad x
-              if (evaluate_gradients == true)
+              if (evaluation_flag & EvaluationFlags::gradients)
                 {
                   eval.template gradients<0, true, false>(values_dofs, temp1);
                   eval.template values<1, true, false>(temp1, gradients_quad);
                 }
-              if (evaluate_hessians == true)
+              if (evaluation_flag & EvaluationFlags::hessians)
                 {
                   // grad xy
-                  if (evaluate_gradients == false)
+                  if (!(evaluation_flag & EvaluationFlags::gradients))
                     eval.template gradients<0, true, false>(values_dofs, temp1);
                   eval.template gradients<1, true, false>(temp1,
                                                           hessians_quad +
@@ -280,19 +275,19 @@ namespace internal
 
               // grad y
               eval.template values<0, true, false>(values_dofs, temp1);
-              if (evaluate_gradients == true)
+              if (evaluation_flag & EvaluationFlags::gradients)
                 eval.template gradients<1, true, false>(temp1,
                                                         gradients_quad +
                                                           n_q_points);
 
               // grad yy
-              if (evaluate_hessians == true)
+              if (evaluation_flag & EvaluationFlags::hessians)
                 eval.template hessians<1, true, false>(temp1,
                                                        hessians_quad +
                                                          n_q_points);
 
               // val: can use values applied in x
-              if (evaluate_values == true)
+              if (evaluation_flag & EvaluationFlags::values)
                 eval.template values<1, true, false>(temp1, values_quad);
 
               // advance to the next component in 1D array
@@ -306,7 +301,7 @@ namespace internal
         case 3:
           for (unsigned int c = 0; c < n_components; c++)
             {
-              if (evaluate_gradients == true)
+              if (evaluation_flag & EvaluationFlags::gradients)
                 {
                   // grad x
                   eval.template gradients<0, true, false>(values_dofs, temp1);
@@ -314,10 +309,10 @@ namespace internal
                   eval.template values<2, true, false>(temp2, gradients_quad);
                 }
 
-              if (evaluate_hessians == true)
+              if (evaluation_flag & EvaluationFlags::hessians)
                 {
                   // grad xz
-                  if (evaluate_gradients == false)
+                  if (!(evaluation_flag & EvaluationFlags::gradients))
                     {
                       eval.template gradients<0, true, false>(values_dofs,
                                                               temp1);
@@ -341,7 +336,7 @@ namespace internal
 
               // grad y
               eval.template values<0, true, false>(values_dofs, temp1);
-              if (evaluate_gradients == true)
+              if (evaluation_flag & EvaluationFlags::gradients)
                 {
                   eval.template gradients<1, true, false>(temp1, temp2);
                   eval.template values<2, true, false>(temp2,
@@ -349,10 +344,10 @@ namespace internal
                                                          n_q_points);
                 }
 
-              if (evaluate_hessians == true)
+              if (evaluation_flag & EvaluationFlags::hessians)
                 {
                   // grad yz
-                  if (evaluate_gradients == false)
+                  if (!(evaluation_flag & EvaluationFlags::gradients))
                     eval.template gradients<1, true, false>(temp1, temp2);
                   eval.template gradients<2, true, false>(temp2,
                                                           hessians_quad +
@@ -368,21 +363,21 @@ namespace internal
               // grad z: can use the values applied in x direction stored in
               // temp1
               eval.template values<1, true, false>(temp1, temp2);
-              if (evaluate_gradients == true)
+              if (evaluation_flag & EvaluationFlags::gradients)
                 eval.template gradients<2, true, false>(temp2,
                                                         gradients_quad +
                                                           2 * n_q_points);
 
               // grad zz: can use the values applied in x and y direction stored
               // in temp2
-              if (evaluate_hessians == true)
+              if (evaluation_flag & EvaluationFlags::hessians)
                 eval.template hessians<2, true, false>(temp2,
                                                        hessians_quad +
                                                          2 * n_q_points);
 
               // val: can use the values applied in x & y direction stored in
               // temp2
-              if (evaluate_values == true)
+              if (evaluation_flag & EvaluationFlags::values)
                 eval.template values<2, true, false>(temp2, values_quad);
 
               // advance to the next component in 1D array
@@ -400,7 +395,7 @@ namespace internal
     // case additional dof for FE_Q_DG0: add values; gradients and second
     // derivatives evaluate to zero
     if (type == MatrixFreeFunctions::tensor_symmetric_plus_dg0 &&
-        evaluate_values)
+        (evaluation_flag & EvaluationFlags::values))
       {
         values_quad -= n_components * n_q_points;
         values_dofs -= n_components * dofs_per_comp;
@@ -417,18 +412,17 @@ namespace internal
             int                              dim,
             int                              fe_degree,
             int                              n_q_points_1d,
-            int                              n_components,
             typename Number>
   inline void
-  FEEvaluationImpl<type, dim, fe_degree, n_q_points_1d, n_components, Number>::
-    integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
-              Number *                                      values_dofs_actual,
-              Number *                                      values_quad,
-              Number *                                      gradients_quad,
-              Number *                                      scratch_data,
-              const bool                                    integrate_values,
-              const bool                                    integrate_gradients,
-              const bool add_into_values_array)
+  FEEvaluationImpl<type, dim, fe_degree, n_q_points_1d, Number>::integrate(
+    const unsigned int                            n_components,
+    const EvaluationFlags::EvaluationFlags        integration_flag,
+    const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    Number *                                      values_dofs_actual,
+    Number *                                      values_quad,
+    Number *                                      gradients_quad,
+    Number *                                      scratch_data,
+    const bool                                    add_into_values_array)
   {
     const EvaluatorVariant variant =
       EvaluatorSelector<type, (fe_degree + n_q_points_1d > 4)>::variant;
@@ -489,7 +483,7 @@ namespace internal
         case 1:
           for (unsigned int c = 0; c < n_components; c++)
             {
-              if (integrate_values == true)
+              if (integration_flag & EvaluationFlags::values)
                 {
                   if (add_into_values_array == false)
                     eval.template values<0, false, false>(values_quad,
@@ -498,9 +492,10 @@ namespace internal
                     eval.template values<0, false, true>(values_quad,
                                                          values_dofs);
                 }
-              if (integrate_gradients == true)
+              if (integration_flag & EvaluationFlags::gradients)
                 {
-                  if (integrate_values == true || add_into_values_array == true)
+                  if (integration_flag & EvaluationFlags::values ||
+                      add_into_values_array == true)
                     eval.template gradients<0, false, true>(gradients_quad,
                                                             values_dofs);
                   else
@@ -518,7 +513,8 @@ namespace internal
         case 2:
           for (unsigned int c = 0; c < n_components; c++)
             {
-              if (integrate_values == true && integrate_gradients == false)
+              if ((integration_flag & EvaluationFlags::values) &&
+                  !(integration_flag & EvaluationFlags::gradients))
                 {
                   eval.template values<1, false, false>(values_quad, temp1);
                   if (add_into_values_array == false)
@@ -526,12 +522,12 @@ namespace internal
                   else
                     eval.template values<0, false, true>(temp1, values_dofs);
                 }
-              if (integrate_gradients == true)
+              if (integration_flag & EvaluationFlags::gradients)
                 {
                   eval.template gradients<1, false, false>(gradients_quad +
                                                              n_q_points,
                                                            temp1);
-                  if (integrate_values)
+                  if (integration_flag & EvaluationFlags::values)
                     eval.template values<1, false, true>(values_quad, temp1);
                   if (add_into_values_array == false)
                     eval.template values<0, false, false>(temp1, values_dofs);
@@ -551,7 +547,8 @@ namespace internal
         case 3:
           for (unsigned int c = 0; c < n_components; c++)
             {
-              if (integrate_values == true && integrate_gradients == false)
+              if ((integration_flag & EvaluationFlags::values) &&
+                  !(integration_flag & EvaluationFlags::gradients))
                 {
                   eval.template values<2, false, false>(values_quad, temp1);
                   eval.template values<1, false, false>(temp1, temp2);
@@ -560,12 +557,12 @@ namespace internal
                   else
                     eval.template values<0, false, true>(temp2, values_dofs);
                 }
-              if (integrate_gradients == true)
+              if (integration_flag & EvaluationFlags::gradients)
                 {
                   eval.template gradients<2, false, false>(gradients_quad +
                                                              2 * n_q_points,
                                                            temp1);
-                  if (integrate_values)
+                  if (integration_flag & EvaluationFlags::values)
                     eval.template values<2, false, true>(values_quad, temp1);
                   eval.template values<1, false, false>(temp1, temp2);
                   eval.template values<2, false, false>(gradients_quad +
@@ -598,7 +595,7 @@ namespace internal
         values_dofs -= n_components * dofs_per_comp -
                        shape_info.dofs_per_component_on_cell + 1;
         values_quad -= n_components * n_q_points;
-        if (integrate_values)
+        if (integration_flag & EvaluationFlags::values)
           for (unsigned int c = 0; c < n_components; ++c)
             {
               values_dofs[0] = values_quad[0];
@@ -618,28 +615,25 @@ namespace internal
     if (type == MatrixFreeFunctions::truncated_tensor)
       {
         values_dofs -= dofs_per_comp * n_components;
-        unsigned int count_p = 0, count_q = 0;
-        const int    degree =
+        const int degree =
           fe_degree != -1 ? fe_degree : shape_info.data.front().fe_degree;
-        for (int i = 0; i < (dim > 2 ? degree + 1 : 1); ++i)
-          {
-            for (int j = 0; j < (dim > 1 ? degree + 1 - i : 1); ++j)
-              {
-                for (int k = 0; k < degree + 1 - j - i;
-                     ++k, ++count_p, ++count_q)
-                  {
-                    for (unsigned int c = 0; c < n_components; ++c)
-                      values_dofs_actual
-                        [c * shape_info.dofs_per_component_on_cell + count_p] =
-                          values_dofs[c * dofs_per_comp + count_q];
-                  }
-                count_q += j + i;
-              }
-            count_q += i * (degree + 1);
-          }
-        AssertDimension(count_q,
-                        Utilities::fixed_power<dim>(
-                          shape_info.data.front().fe_degree + 1));
+        for (unsigned int c = 0; c < n_components; ++c)
+          for (int i = 0, count_p = 0, count_q = 0;
+               i < (dim > 2 ? degree + 1 : 1);
+               ++i)
+            {
+              for (int j = 0; j < (dim > 1 ? degree + 1 - i : 1); ++j)
+                {
+                  for (int k = 0; k < degree + 1 - j - i;
+                       ++k, ++count_p, ++count_q)
+                    values_dofs_actual[c *
+                                         shape_info.dofs_per_component_on_cell +
+                                       count_p] =
+                      values_dofs[c * dofs_per_comp + count_q];
+                  count_q += j + i;
+                }
+              count_q += i * (degree + 1);
+            }
       }
   }
 
@@ -658,7 +652,6 @@ namespace internal
             int              dim,
             int              basis_size_1,
             int              basis_size_2,
-            int              n_components,
             typename Number,
             typename Number2>
   struct FEEvaluationImplBasisChange
@@ -692,6 +685,7 @@ namespace internal
 #endif
     static void
     do_forward(
+      const unsigned int            n_components,
       const AlignedVector<Number2> &transformation_matrix,
       const Number *                values_in,
       Number *                      values_out,
@@ -748,9 +742,9 @@ namespace internal
                 next_dim,
                 basis_size_1,
                 basis_size_2,
-                1,
                 Number,
-                Number2>::do_forward(transformation_matrix,
+                Number2>::do_forward(1,
+                                     transformation_matrix,
                                      values_in +
                                        (q - 1) *
                                          Utilities::fixed_power<next_dim>(np_1),
@@ -811,6 +805,7 @@ namespace internal
 #endif
     static void
     do_backward(
+      const unsigned int            n_components,
       const AlignedVector<Number2> &transformation_matrix,
       const bool                    add_into_result,
       Number *                      values_in,
@@ -879,10 +874,10 @@ namespace internal
                                           next_dim,
                                           basis_size_1,
                                           basis_size_2,
-                                          1,
                                           Number,
                                           Number2>::
-                do_backward(transformation_matrix,
+                do_backward(1,
+                            transformation_matrix,
                             add_into_result,
                             values_in +
                               q * Utilities::fixed_power<next_dim>(np_2),
@@ -916,7 +911,8 @@ namespace internal
      *                     the values_in array.
      */
     static void
-    do_mass(const AlignedVector<Number2> &transformation_matrix,
+    do_mass(const unsigned int            n_components,
+            const AlignedVector<Number2> &transformation_matrix,
             const AlignedVector<Number> & coefficients,
             const Number *                values_in,
             Number *                      scratch_data,
@@ -939,9 +935,9 @@ namespace internal
           next_dim,
           basis_size_1,
           basis_size_2,
-          n_components,
           Number,
-          Number2>::do_forward(transformation_matrix,
+          Number2>::do_forward(n_components,
+                               transformation_matrix,
                                values_in +
                                  (q - 1) *
                                    Utilities::pow(basis_size_1, dim - 1),
@@ -979,9 +975,9 @@ namespace internal
           next_dim,
           basis_size_1,
           basis_size_2,
-          n_components,
           Number,
-          Number2>::do_backward(transformation_matrix,
+          Number2>::do_backward(n_components,
+                                transformation_matrix,
                                 false,
                                 my_scratch +
                                   q * Utilities::pow(basis_size_2, dim - 1),
@@ -1004,45 +1000,43 @@ namespace internal
    * evaluation, spectral collocation or simply collocation, meaning the same
    * location for shape functions and evaluation space (quadrature points).
    */
-  template <int dim, int fe_degree, int n_components, typename Number>
+  template <int dim, int fe_degree, typename Number>
   struct FEEvaluationImplCollocation
   {
     static void
-    evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    evaluate(const unsigned int                            n_components,
+             const EvaluationFlags::EvaluationFlags        evaluation_flag,
+             const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
              const Number *                                values_dofs,
              Number *                                      values_quad,
              Number *                                      gradients_quad,
              Number *                                      hessians_quad,
-             Number *                                      scratch_data,
-             const bool                                    evaluate_values,
-             const bool                                    evaluate_gradients,
-             const bool                                    evaluate_hessians);
+             Number *                                      scratch_data);
 
     static void
-    integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    integrate(const unsigned int                            n_components,
+              const EvaluationFlags::EvaluationFlags        integration_flag,
+              const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
               Number *                                      values_dofs,
               Number *                                      values_quad,
               Number *                                      gradients_quad,
               Number *                                      scratch_data,
-              const bool                                    integrate_values,
-              const bool                                    integrate_gradients,
               const bool add_into_values_array);
   };
 
 
 
-  template <int dim, int fe_degree, int n_components, typename Number>
+  template <int dim, int fe_degree, typename Number>
   inline void
-  FEEvaluationImplCollocation<dim, fe_degree, n_components, Number>::evaluate(
+  FEEvaluationImplCollocation<dim, fe_degree, Number>::evaluate(
+    const unsigned int                            n_components,
+    const EvaluationFlags::EvaluationFlags        evaluation_flag,
     const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
     const Number *                                values_dofs,
     Number *                                      values_quad,
     Number *                                      gradients_quad,
     Number *                                      hessians_quad,
-    Number *,
-    const bool evaluate_values,
-    const bool evaluate_gradients,
-    const bool evaluate_hessians)
+    Number *)
   {
     AssertDimension(
       shape_info.data.front().shape_gradients_collocation_eo.size(),
@@ -1060,10 +1054,11 @@ namespace internal
 
     for (unsigned int c = 0; c < n_components; c++)
       {
-        if (evaluate_values == true)
+        if (evaluation_flag & EvaluationFlags::values)
           for (unsigned int i = 0; i < n_q_points; ++i)
             values_quad[i] = values_dofs[i];
-        if (evaluate_gradients == true || evaluate_hessians == true)
+        if (evaluation_flag &
+            (EvaluationFlags::gradients | EvaluationFlags::hessians))
           {
             eval.template gradients<0, true, false>(values_dofs,
                                                     gradients_quad);
@@ -1076,7 +1071,7 @@ namespace internal
                                                       gradients_quad +
                                                         2 * n_q_points);
           }
-        if (evaluate_hessians == true)
+        if (evaluation_flag & EvaluationFlags::hessians)
           {
             eval.template hessians<0, true, false>(values_dofs, hessians_quad);
             if (dim > 1)
@@ -1109,16 +1104,16 @@ namespace internal
 
 
 
-  template <int dim, int fe_degree, int n_components, typename Number>
+  template <int dim, int fe_degree, typename Number>
   inline void
-  FEEvaluationImplCollocation<dim, fe_degree, n_components, Number>::integrate(
+  FEEvaluationImplCollocation<dim, fe_degree, Number>::integrate(
+    const unsigned int                            n_components,
+    const EvaluationFlags::EvaluationFlags        integration_flag,
     const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
     Number *                                      values_dofs,
     Number *                                      values_quad,
     Number *                                      gradients_quad,
     Number *,
-    const bool integrate_values,
-    const bool integrate_gradients,
     const bool add_into_values_array)
   {
     AssertDimension(
@@ -1137,15 +1132,19 @@ namespace internal
 
     for (unsigned int c = 0; c < n_components; c++)
       {
-        if (integrate_values == true && add_into_values_array == false)
-          for (unsigned int i = 0; i < n_q_points; ++i)
-            values_dofs[i] = values_quad[i];
-        else if (integrate_values == true)
-          for (unsigned int i = 0; i < n_q_points; ++i)
-            values_dofs[i] += values_quad[i];
-        if (integrate_gradients == true)
+        if (integration_flag & EvaluationFlags::values)
           {
-            if (integrate_values == true || add_into_values_array == true)
+            if (add_into_values_array == false)
+              for (unsigned int i = 0; i < n_q_points; ++i)
+                values_dofs[i] = values_quad[i];
+            else
+              for (unsigned int i = 0; i < n_q_points; ++i)
+                values_dofs[i] += values_quad[i];
+          }
+        if (integration_flag & EvaluationFlags::gradients)
+          {
+            if (integration_flag & EvaluationFlags::values ||
+                add_into_values_array == true)
               eval.template gradients<0, false, true>(gradients_quad,
                                                       values_dofs);
             else
@@ -1178,57 +1177,46 @@ namespace internal
    * the evaluation of the first and second derivatives in this transformed
    * space, using the identity operation for the shape values.
    */
-  template <int dim,
-            int fe_degree,
-            int n_q_points_1d,
-            int n_components,
-            typename Number>
+  template <int dim, int fe_degree, int n_q_points_1d, typename Number>
   struct FEEvaluationImplTransformToCollocation
   {
     static void
-    evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    evaluate(const unsigned int                            n_components,
+             const EvaluationFlags::EvaluationFlags        evaluation_flag,
+             const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
              const Number *                                values_dofs,
              Number *                                      values_quad,
              Number *                                      gradients_quad,
              Number *                                      hessians_quad,
-             Number *                                      scratch_data,
-             const bool                                    evaluate_values,
-             const bool                                    evaluate_gradients,
-             const bool                                    evaluate_hessians);
+             Number *                                      scratch_data);
 
     static void
-    integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    integrate(const unsigned int                            n_components,
+              const EvaluationFlags::EvaluationFlags        evaluation_flag,
+              const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
               Number *                                      values_dofs,
               Number *                                      values_quad,
               Number *                                      gradients_quad,
               Number *                                      scratch_data,
-              const bool                                    integrate_values,
-              const bool                                    integrate_gradients,
               const bool add_into_values_array);
   };
 
 
 
-  template <int dim,
-            int fe_degree,
-            int n_q_points_1d,
-            int n_components,
-            typename Number>
+  template <int dim, int fe_degree, int n_q_points_1d, typename Number>
   inline void
   FEEvaluationImplTransformToCollocation<
     dim,
     fe_degree,
     n_q_points_1d,
-    n_components,
-    Number>::evaluate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    Number>::evaluate(const unsigned int                     n_components,
+                      const EvaluationFlags::EvaluationFlags evaluation_flag,
+                      const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
                       const Number *                                values_dofs,
                       Number *                                      values_quad,
                       Number *gradients_quad,
                       Number *hessians_quad,
-                      Number *,
-                      const bool,
-                      const bool evaluate_gradients,
-                      const bool evaluate_hessians)
+                      Number *)
   {
     Assert(n_q_points_1d > fe_degree,
            ExcMessage("You lose information when going to a collocation space "
@@ -1244,24 +1232,25 @@ namespace internal
           dim,
           (fe_degree >= n_q_points_1d ? n_q_points_1d : fe_degree + 1),
           n_q_points_1d,
-          1,
           Number,
-          Number>::do_forward(shape_info.data.front().shape_values_eo,
+          Number>::do_forward(1,
+                              shape_info.data.front().shape_values_eo,
                               values_dofs,
                               values_quad);
 
         // apply derivatives in the collocation space
-        if (evaluate_gradients == true || evaluate_hessians == true)
-          FEEvaluationImplCollocation<dim, n_q_points_1d - 1, 1, Number>::
-            evaluate(shape_info,
-                     values_quad,
-                     nullptr,
-                     gradients_quad,
-                     hessians_quad,
-                     nullptr,
-                     false,
-                     evaluate_gradients,
-                     evaluate_hessians);
+        if (evaluation_flag &
+            (EvaluationFlags::gradients | EvaluationFlags::hessians))
+          FEEvaluationImplCollocation<dim, n_q_points_1d - 1, Number>::evaluate(
+            1,
+            evaluation_flag &
+              (EvaluationFlags::gradients | EvaluationFlags::hessians),
+            shape_info,
+            values_quad,
+            nullptr,
+            gradients_quad,
+            hessians_quad,
+            nullptr);
 
         values_dofs += shape_info.dofs_per_component_on_cell;
         values_quad += n_q_points;
@@ -1272,24 +1261,19 @@ namespace internal
 
 
 
-  template <int dim,
-            int fe_degree,
-            int n_q_points_1d,
-            int n_components,
-            typename Number>
+  template <int dim, int fe_degree, int n_q_points_1d, typename Number>
   inline void
   FEEvaluationImplTransformToCollocation<
     dim,
     fe_degree,
     n_q_points_1d,
-    n_components,
-    Number>::integrate(const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+    Number>::integrate(const unsigned int                     n_components,
+                       const EvaluationFlags::EvaluationFlags integration_flag,
+                       const MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
                        Number *values_dofs,
                        Number *values_quad,
                        Number *gradients_quad,
                        Number *,
-                       const bool integrate_values,
-                       const bool integrate_gradients,
                        const bool add_into_values_array)
   {
     Assert(n_q_points_1d > fe_degree,
@@ -1305,16 +1289,17 @@ namespace internal
     for (unsigned int c = 0; c < n_components; c++)
       {
         // apply derivatives in collocation space
-        if (integrate_gradients == true)
-          FEEvaluationImplCollocation<dim, n_q_points_1d - 1, 1, Number>::
-            integrate(shape_info,
+        if (integration_flag & EvaluationFlags::gradients)
+          FEEvaluationImplCollocation<dim, n_q_points_1d - 1, Number>::
+            integrate(1,
+                      integration_flag & EvaluationFlags::gradients,
+                      shape_info,
                       values_quad,
                       nullptr,
                       gradients_quad,
                       nullptr,
-                      false,
-                      integrate_gradients,
-                      /*add_into_values_array=*/integrate_values);
+                      /*add_into_values_array=*/integration_flag &
+                        EvaluationFlags::values);
 
         // transform back to the original space
         FEEvaluationImplBasisChange<
@@ -1322,9 +1307,9 @@ namespace internal
           dim,
           (fe_degree >= n_q_points_1d ? n_q_points_1d : fe_degree + 1),
           n_q_points_1d,
-          1,
           Number,
-          Number>::do_backward(shape_info.data.front().shape_values_eo,
+          Number>::do_backward(1,
+                               shape_info.data.front().shape_values_eo,
                                add_into_values_array,
                                values_quad,
                                values_dofs);
@@ -3135,12 +3120,13 @@ namespace internal
   /**
    * This struct implements the action of the inverse mass matrix operation
    */
-  template <int dim, int fe_degree, int n_components, typename Number>
+  template <int dim, int fe_degree, typename Number>
   struct CellwiseInverseMassMatrixImpl
   {
     template <typename FEEvaluationType>
     static void
-    apply(const FEEvaluationType &fe_eval,
+    apply(const unsigned int      n_components,
+          const FEEvaluationType &fe_eval,
           const Number *          in_array,
           Number *                out_array)
     {
@@ -3192,9 +3178,9 @@ namespace internal
     }
 
     static void
-    apply(const AlignedVector<Number> &inverse_shape,
+    apply(const unsigned int           n_desired_components,
+          const AlignedVector<Number> &inverse_shape,
           const AlignedVector<Number> &inverse_coefficients,
-          const unsigned int           n_desired_components,
           const Number *               in_array,
           Number *                     out_array)
     {
@@ -3249,10 +3235,10 @@ namespace internal
     }
 
     static void
-    transform_from_q_points_to_basis(const AlignedVector<Number> &inverse_shape,
-                                     const unsigned int n_desired_components,
-                                     const Number *     in_array,
-                                     Number *           out_array)
+    transform_from_q_points_to_basis(const unsigned int n_desired_components,
+                                     const AlignedVector<Number> &inverse_shape,
+                                     const Number *               in_array,
+                                     Number *                     out_array)
     {
       constexpr unsigned int dofs_per_cell = Utilities::pow(fe_degree + 1, dim);
       internal::EvaluatorTensorProduct<internal::evaluate_evenodd,
index 13ac6b5d06ba5dd18045d8908769050124a3e94f..08089ceabf6cf858d240d09d196743601836409d 100644 (file)
@@ -48,47 +48,44 @@ namespace internal
      * This class serves as a fallback in case we don't have the appropriate
      * template specialization for the run time and template parameters given.
      */
-    template <int dim, int n_components, typename Number>
+    template <int dim, typename Number>
     struct Default
     {
       static inline void
       evaluate(
+        const unsigned int                                      n_components,
+        const EvaluationFlags::EvaluationFlags                  evaluation_flag,
         const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
-        Number *   values_dofs_actual,
-        Number *   values_quad,
-        Number *   gradients_quad,
-        Number *   hessians_quad,
-        Number *   scratch_data,
-        const bool evaluate_values,
-        const bool evaluate_gradients,
-        const bool evaluate_hessians)
+        Number *values_dofs_actual,
+        Number *values_quad,
+        Number *gradients_quad,
+        Number *hessians_quad,
+        Number *scratch_data)
       {
         internal::FEEvaluationImpl<
           internal::MatrixFreeFunctions::tensor_general,
           dim,
           -1,
           0,
-          n_components,
-          Number>::evaluate(shape_info,
+          Number>::evaluate(n_components,
+                            evaluation_flag,
+                            shape_info,
                             values_dofs_actual,
                             values_quad,
                             gradients_quad,
                             hessians_quad,
-                            scratch_data,
-                            evaluate_values,
-                            evaluate_gradients,
-                            evaluate_hessians);
+                            scratch_data);
       }
 
       static inline void
       integrate(
+        const unsigned int                     n_components,
+        const EvaluationFlags::EvaluationFlags integration_flag,
         const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
         Number *   values_dofs_actual,
         Number *   values_quad,
         Number *   gradients_quad,
         Number *   scratch_data,
-        const bool integrate_values,
-        const bool integrate_gradients,
         const bool sum_into_values_array = false)
       {
         internal::FEEvaluationImpl<
@@ -96,14 +93,13 @@ namespace internal
           dim,
           -1,
           0,
-          n_components,
-          Number>::integrate(shape_info,
+          Number>::integrate(n_components,
+                             integration_flag,
+                             shape_info,
                              values_dofs_actual,
                              values_quad,
                              gradients_quad,
                              scratch_data,
-                             integrate_values,
-                             integrate_gradients,
                              sum_into_values_array);
       }
     };
@@ -113,13 +109,12 @@ namespace internal
      * This class implements the actual choice of the template specialization.
      */
     template <int dim,
-              int n_components,
               typename Number,
               int DEPTH         = 0,
               int degree        = 0,
               int n_q_points_1d = 0,
               class Enable      = void>
-    struct Factory : Default<dim, n_components, Number>
+    struct Factory : Default<dim, Number>
     {};
 
     /**
@@ -127,9 +122,8 @@ namespace internal
      * which we want to determine the correct template parameters based at
      * runtime.
      */
-    template <int n_q_points_1d, int dim, int n_components, typename Number>
-    struct Factory<dim, n_components, Number, 0, 10, n_q_points_1d>
-      : Default<dim, n_components, Number>
+    template <int n_q_points_1d, int dim, typename Number>
+    struct Factory<dim, Number, 0, 10, n_q_points_1d> : Default<dim, Number>
     {};
 
     /**
@@ -137,102 +131,90 @@ namespace internal
      * which we want to determine the correct template parameters based at
      * runtime.
      */
-    template <int degree,
-              int n_q_points_1d,
-              int dim,
-              int n_components,
-              typename Number>
+    template <int degree, int n_q_points_1d, int dim, typename Number>
     struct Factory<dim,
-                   n_components,
                    Number,
                    1,
                    degree,
                    n_q_points_1d,
                    typename std::enable_if<n_q_points_1d == degree + 3>::type>
-      : Default<dim, n_components, Number>
+      : Default<dim, Number>
     {};
 
     /**
      * This class chooses the correct template degree.
      */
-    template <int degree,
-              int n_q_points_1d,
-              int dim,
-              int n_components,
-              typename Number>
-    struct Factory<dim, n_components, Number, 0, degree, n_q_points_1d>
+    template <int degree, int n_q_points_1d, int dim, typename Number>
+    struct Factory<dim, Number, 0, degree, n_q_points_1d>
     {
       static inline void
       evaluate(
+        const unsigned int                                      n_components,
+        const EvaluationFlags::EvaluationFlags                  evaluation_flag,
         const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
-        Number *   values_dofs_actual,
-        Number *   values_quad,
-        Number *   gradients_quad,
-        Number *   hessians_quad,
-        Number *   scratch_data,
-        const bool evaluate_values,
-        const bool evaluate_gradients,
-        const bool evaluate_hessians)
+        Number *values_dofs_actual,
+        Number *values_quad,
+        Number *gradients_quad,
+        Number *hessians_quad,
+        Number *scratch_data)
       {
         const unsigned int runtime_degree = shape_info.data.front().fe_degree;
         constexpr unsigned int start_n_q_points = degree + 1;
         if (runtime_degree == degree)
-          Factory<dim, n_components, Number, 1, degree, start_n_q_points>::
-            evaluate(shape_info,
-                     values_dofs_actual,
-                     values_quad,
-                     gradients_quad,
-                     hessians_quad,
-                     scratch_data,
-                     evaluate_values,
-                     evaluate_gradients,
-                     evaluate_hessians);
+          Factory<dim, Number, 1, degree, start_n_q_points>::evaluate(
+            n_components,
+            evaluation_flag,
+            shape_info,
+            values_dofs_actual,
+            values_quad,
+            gradients_quad,
+            hessians_quad,
+            scratch_data);
         else
-          Factory<dim, n_components, Number, 0, degree + 1, n_q_points_1d>::
-            evaluate(shape_info,
-                     values_dofs_actual,
-                     values_quad,
-                     gradients_quad,
-                     hessians_quad,
-                     scratch_data,
-                     evaluate_values,
-                     evaluate_gradients,
-                     evaluate_hessians);
+          Factory<dim, Number, 0, degree + 1, n_q_points_1d>::evaluate(
+            n_components,
+            evaluation_flag,
+            shape_info,
+            values_dofs_actual,
+            values_quad,
+            gradients_quad,
+            hessians_quad,
+            scratch_data);
       }
 
       static inline void
       integrate(
+        const unsigned int                     n_components,
+        const EvaluationFlags::EvaluationFlags integration_flag,
         const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
         Number *   values_dofs_actual,
         Number *   values_quad,
         Number *   gradients_quad,
         Number *   scratch_data,
-        const bool integrate_values,
-        const bool integrate_gradients,
         const bool sum_into_values_array = false)
       {
         const int runtime_degree = shape_info.data.front().fe_degree;
         constexpr unsigned int start_n_q_points = degree + 1;
         if (runtime_degree == degree)
-          Factory<dim, n_components, Number, 1, degree, start_n_q_points>::
-            integrate(shape_info,
-                      values_dofs_actual,
-                      values_quad,
-                      gradients_quad,
-                      scratch_data,
-                      integrate_values,
-                      integrate_gradients,
-                      sum_into_values_array);
+          Factory<dim, Number, 1, degree, start_n_q_points>::integrate(
+            n_components,
+            integration_flag,
+            shape_info,
+            values_dofs_actual,
+            values_quad,
+            gradients_quad,
+            scratch_data,
+            sum_into_values_array);
         else
-          Factory<dim, n_components, Number, 0, degree + 1, n_q_points_1d>::
-            integrate(shape_info,
-                      values_dofs_actual,
-                      values_quad,
-                      gradients_quad,
-                      scratch_data,
-                      integrate_values,
-                      integrate_gradients,
-                      sum_into_values_array);
+          Factory<dim, Number, 0, degree + 1, n_q_points_1d>::integrate(
+            n_components,
+            integration_flag,
+            shape_info,
+            values_dofs_actual,
+            values_quad,
+            gradients_quad,
+            scratch_data,
+            sum_into_values_array);
       }
     };
 
@@ -240,13 +222,8 @@ namespace internal
      * This class chooses the correct template n_q_points_1d after degree was
      * chosen.
      */
-    template <int degree,
-              int n_q_points_1d,
-              int dim,
-              int n_components,
-              typename Number>
+    template <int degree, int n_q_points_1d, int dim, typename Number>
     struct Factory<dim,
-                   n_components,
                    Number,
                    1,
                    degree,
@@ -266,15 +243,14 @@ namespace internal
 
       static inline void
       evaluate(
+        const unsigned int                                      n_components,
+        const EvaluationFlags::EvaluationFlags                  evaluation_flag,
         const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
-        Number *   values_dofs_actual,
-        Number *   values_quad,
-        Number *   gradients_quad,
-        Number *   hessians_quad,
-        Number *   scratch_data,
-        const bool evaluate_values,
-        const bool evaluate_gradients,
-        const bool evaluate_hessians)
+        Number *values_dofs_actual,
+        Number *values_quad,
+        Number *gradients_quad,
+        Number *hessians_quad,
+        Number *scratch_data)
       {
         const int runtime_n_q_points_1d = shape_info.data.front().n_q_points_1d;
         if (runtime_n_q_points_1d == n_q_points_1d)
@@ -282,71 +258,64 @@ namespace internal
             if (n_q_points_1d == degree + 1 &&
                 shape_info.element_type ==
                   internal::MatrixFreeFunctions::tensor_symmetric_collocation)
-              internal::
-                FEEvaluationImplCollocation<dim, degree, n_components, Number>::
-                  evaluate(shape_info,
-                           values_dofs_actual,
-                           values_quad,
-                           gradients_quad,
-                           hessians_quad,
-                           scratch_data,
-                           evaluate_values,
-                           evaluate_gradients,
-                           evaluate_hessians);
+              internal::FEEvaluationImplCollocation<dim, degree, Number>::
+                evaluate(n_components,
+                         evaluation_flag,
+                         shape_info,
+                         values_dofs_actual,
+                         values_quad,
+                         gradients_quad,
+                         hessians_quad,
+                         scratch_data);
             else if (use_collocation)
               internal::FEEvaluationImplTransformToCollocation<
                 dim,
                 degree,
                 n_q_points_1d,
-                n_components,
-                Number>::evaluate(shape_info,
+                Number>::evaluate(n_components,
+                                  evaluation_flag,
+                                  shape_info,
                                   values_dofs_actual,
                                   values_quad,
                                   gradients_quad,
                                   hessians_quad,
-                                  scratch_data,
-                                  evaluate_values,
-                                  evaluate_gradients,
-                                  evaluate_hessians);
+                                  scratch_data);
             else
               internal::FEEvaluationImpl<
                 internal::MatrixFreeFunctions::tensor_symmetric,
                 dim,
                 degree,
                 n_q_points_1d,
-                n_components,
-                Number>::evaluate(shape_info,
+                Number>::evaluate(n_components,
+                                  evaluation_flag,
+                                  shape_info,
                                   values_dofs_actual,
                                   values_quad,
                                   gradients_quad,
                                   hessians_quad,
-                                  scratch_data,
-                                  evaluate_values,
-                                  evaluate_gradients,
-                                  evaluate_hessians);
+                                  scratch_data);
           }
         else
-          Factory<dim, n_components, Number, 1, degree, n_q_points_1d + 1>::
-            evaluate(shape_info,
-                     values_dofs_actual,
-                     values_quad,
-                     gradients_quad,
-                     hessians_quad,
-                     scratch_data,
-                     evaluate_values,
-                     evaluate_gradients,
-                     evaluate_hessians);
+          Factory<dim, Number, 1, degree, n_q_points_1d + 1>::evaluate(
+            n_components,
+            evaluation_flag,
+            shape_info,
+            values_dofs_actual,
+            values_quad,
+            gradients_quad,
+            hessians_quad,
+            scratch_data);
       }
 
       static inline void
       integrate(
+        const unsigned int                     n_components,
+        const EvaluationFlags::EvaluationFlags integration_flag,
         const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
         Number *   values_dofs_actual,
         Number *   values_quad,
         Number *   gradients_quad,
         Number *   scratch_data,
-        const bool integrate_values,
-        const bool integrate_gradients,
         const bool sum_into_values_array)
       {
         const int runtime_n_q_points_1d = shape_info.data.front().n_q_points_1d;
@@ -355,29 +324,27 @@ namespace internal
             if (n_q_points_1d == degree + 1 &&
                 shape_info.element_type ==
                   internal::MatrixFreeFunctions::tensor_symmetric_collocation)
-              internal::
-                FEEvaluationImplCollocation<dim, degree, n_components, Number>::
-                  integrate(shape_info,
-                            values_dofs_actual,
-                            values_quad,
-                            gradients_quad,
-                            scratch_data,
-                            integrate_values,
-                            integrate_gradients,
-                            sum_into_values_array);
+              internal::FEEvaluationImplCollocation<dim, degree, Number>::
+                integrate(n_components,
+                          integration_flag,
+                          shape_info,
+                          values_dofs_actual,
+                          values_quad,
+                          gradients_quad,
+                          scratch_data,
+                          sum_into_values_array);
             else if (use_collocation)
               internal::FEEvaluationImplTransformToCollocation<
                 dim,
                 degree,
                 n_q_points_1d,
-                n_components,
-                Number>::integrate(shape_info,
+                Number>::integrate(n_components,
+                                   integration_flag,
+                                   shape_info,
                                    values_dofs_actual,
                                    values_quad,
                                    gradients_quad,
                                    scratch_data,
-                                   integrate_values,
-                                   integrate_gradients,
                                    sum_into_values_array);
             else
               internal::FEEvaluationImpl<
@@ -385,26 +352,25 @@ namespace internal
                 dim,
                 degree,
                 n_q_points_1d,
-                n_components,
-                Number>::integrate(shape_info,
+                Number>::integrate(n_components,
+                                   integration_flag,
+                                   shape_info,
                                    values_dofs_actual,
                                    values_quad,
                                    gradients_quad,
                                    scratch_data,
-                                   integrate_values,
-                                   integrate_gradients,
                                    sum_into_values_array);
           }
         else
-          Factory<dim, n_components, Number, 1, degree, n_q_points_1d + 1>::
-            integrate(shape_info,
-                      values_dofs_actual,
-                      values_quad,
-                      gradients_quad,
-                      scratch_data,
-                      integrate_values,
-                      integrate_gradients,
-                      sum_into_values_array);
+          Factory<dim, Number, 1, degree, n_q_points_1d + 1>::integrate(
+            n_components,
+            integration_flag,
+            shape_info,
+            values_dofs_actual,
+            values_quad,
+            gradients_quad,
+            scratch_data,
+            sum_into_values_array);
       }
     };
 
@@ -414,31 +380,29 @@ namespace internal
      * This is the entry point for choosing the correct runtime parameters
      * for the 'evaluate' function.
      */
-    template <int dim, int n_components, typename Number>
+    template <int dim, typename Number>
     void
     symmetric_selector_evaluate(
+      const unsigned int                                      n_components,
+      const EvaluationFlags::EvaluationFlags                  evaluation_flag,
       const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
-      Number *   values_dofs_actual,
-      Number *   values_quad,
-      Number *   gradients_quad,
-      Number *   hessians_quad,
-      Number *   scratch_data,
-      const bool evaluate_values,
-      const bool evaluate_gradients,
-      const bool evaluate_hessians)
+      Number *values_dofs_actual,
+      Number *values_quad,
+      Number *gradients_quad,
+      Number *hessians_quad,
+      Number *scratch_data)
     {
       Assert(shape_info.element_type <=
                internal::MatrixFreeFunctions::tensor_symmetric,
              ExcInternalError());
-      Factory<dim, n_components, Number>::evaluate(shape_info,
-                                                   values_dofs_actual,
-                                                   values_quad,
-                                                   gradients_quad,
-                                                   hessians_quad,
-                                                   scratch_data,
-                                                   evaluate_values,
-                                                   evaluate_gradients,
-                                                   evaluate_hessians);
+      Factory<dim, Number>::evaluate(n_components,
+                                     evaluation_flag,
+                                     shape_info,
+                                     values_dofs_actual,
+                                     values_quad,
+                                     gradients_quad,
+                                     hessians_quad,
+                                     scratch_data);
     }
 
 
@@ -447,29 +411,29 @@ namespace internal
      * This is the entry point for choosing the correct runtime parameters
      * for the 'integrate' function.
      */
-    template <int dim, int n_components, typename Number>
+    template <int dim, typename Number>
     void
     symmetric_selector_integrate(
+      const unsigned int                                      n_components,
+      const EvaluationFlags::EvaluationFlags                  integration_flag,
       const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
       Number *   values_dofs_actual,
       Number *   values_quad,
       Number *   gradients_quad,
       Number *   scratch_data,
-      const bool integrate_values,
-      const bool integrate_gradients,
       const bool sum_into_values_array = false)
     {
       Assert(shape_info.element_type <=
                internal::MatrixFreeFunctions::tensor_symmetric,
              ExcInternalError());
-      Factory<dim, n_components, Number>::integrate(shape_info,
-                                                    values_dofs_actual,
-                                                    values_quad,
-                                                    gradients_quad,
-                                                    scratch_data,
-                                                    integrate_values,
-                                                    integrate_gradients,
-                                                    sum_into_values_array);
+      Factory<dim, Number>::integrate(n_components,
+                                      integration_flag,
+                                      shape_info,
+                                      values_dofs_actual,
+                                      values_quad,
+                                      gradients_quad,
+                                      scratch_data,
+                                      sum_into_values_array);
     }
   } // namespace EvaluationSelectorImplementation
 } // namespace internal
@@ -487,11 +451,7 @@ namespace internal
  * $0\leq fe\_degree \leq 9$ and $degree+1\leq n\_q\_points\_1d\leq
  * fe\_degree+2$.
  */
-template <int dim,
-          int fe_degree,
-          int n_q_points_1d,
-          int n_components,
-          typename Number>
+template <int dim, int fe_degree, int n_q_points_1d, typename Number>
 struct SelectEvaluator
 {
   /**
@@ -513,15 +473,14 @@ struct SelectEvaluator
    * appropriate template parameters.
    */
   static void
-  evaluate(const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
-           Number *   values_dofs_actual,
-           Number *   values_quad,
-           Number *   gradients_quad,
-           Number *   hessians_quad,
-           Number *   scratch_data,
-           const bool evaluate_values,
-           const bool evaluate_gradients,
-           const bool evaluate_hessians);
+  evaluate(const unsigned int                     n_components,
+           const EvaluationFlags::EvaluationFlags evaluation_flag,
+           const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+           Number *values_dofs_actual,
+           Number *values_quad,
+           Number *gradients_quad,
+           Number *hessians_quad,
+           Number *scratch_data);
 
   /**
    * Chooses an appropriate evaluation strategy for the integrate function, i.e.
@@ -531,13 +490,13 @@ struct SelectEvaluator
    * appropriate template parameters.
    */
   static void
-  integrate(const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+  integrate(const unsigned int                     n_components,
+            const EvaluationFlags::EvaluationFlags integration_flag,
+            const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
             Number *   values_dofs_actual,
             Number *   values_quad,
             Number *   gradients_quad,
             Number *   scratch_data,
-            const bool integrate_values,
-            const bool integrate_gradients,
             const bool sum_into_values_array = false);
 };
 
@@ -551,8 +510,8 @@ struct SelectEvaluator
  * $degree+1\leq n\_q\_points\_1d\leq fe\_degree+2$, a non-optimized fallback
  * is used.
  */
-template <int dim, int n_q_points_1d, int n_components, typename Number>
-struct SelectEvaluator<dim, -1, n_q_points_1d, n_components, Number>
+template <int dim, int n_q_points_1d, typename Number>
+struct SelectEvaluator<dim, -1, n_q_points_1d, Number>
 {
   /**
    * Based on the run time parameters stored in @p shape_info this function
@@ -563,15 +522,14 @@ struct SelectEvaluator<dim, -1, n_q_points_1d, n_components, Number>
    * appropriate template parameters.
    */
   static void
-  evaluate(const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
-           Number *   values_dofs_actual,
-           Number *   values_quad,
-           Number *   gradients_quad,
-           Number *   hessians_quad,
-           Number *   scratch_data,
-           const bool evaluate_values,
-           const bool evaluate_gradients,
-           const bool evaluate_hessians);
+  evaluate(const unsigned int                     n_components,
+           const EvaluationFlags::EvaluationFlags evaluation_flag,
+           const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+           Number *values_dofs_actual,
+           Number *values_quad,
+           Number *gradients_quad,
+           Number *hessians_quad,
+           Number *scratch_data);
 
   /**
    * Based on the run time parameters stored in @p shape_info this function
@@ -582,35 +540,30 @@ struct SelectEvaluator<dim, -1, n_q_points_1d, n_components, Number>
    * appropriate template parameters.
    */
   static void
-  integrate(const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
+  integrate(const unsigned int                     n_components,
+            const EvaluationFlags::EvaluationFlags integration_flag,
+            const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
             Number *   values_dofs_actual,
             Number *   values_quad,
             Number *   gradients_quad,
             Number *   scratch_data,
-            const bool integrate_values,
-            const bool integrate_gradients,
             const bool sum_into_values_array = false);
 };
 
 //----------------------Implementation for SelectEvaluator---------------------
 #ifndef DOXYGEN
 
-template <int dim,
-          int fe_degree,
-          int n_q_points_1d,
-          int n_components,
-          typename Number>
+template <int dim, int fe_degree, int n_q_points_1d, typename Number>
 inline void
-SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
+SelectEvaluator<dim, fe_degree, n_q_points_1d, Number>::evaluate(
+  const unsigned int                                      n_components,
+  const EvaluationFlags::EvaluationFlags                  evaluation_flag,
   const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
   Number *                                                values_dofs_actual,
   Number *                                                values_quad,
   Number *                                                gradients_quad,
   Number *                                                hessians_quad,
-  Number *                                                scratch_data,
-  const bool                                              evaluate_values,
-  const bool                                              evaluate_gradients,
-  const bool                                              evaluate_hessians)
+  Number *                                                scratch_data)
 {
   Assert(fe_degree >= 0 && n_q_points_1d > 0, ExcInternalError());
 
@@ -618,17 +571,15 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
       shape_info.element_type ==
         internal::MatrixFreeFunctions::tensor_symmetric_collocation)
     {
-      internal::
-        FEEvaluationImplCollocation<dim, fe_degree, n_components, Number>::
-          evaluate(shape_info,
-                   values_dofs_actual,
-                   values_quad,
-                   gradients_quad,
-                   hessians_quad,
-                   scratch_data,
-                   evaluate_values,
-                   evaluate_gradients,
-                   evaluate_hessians);
+      internal::FEEvaluationImplCollocation<dim, fe_degree, Number>::evaluate(
+        n_components,
+        evaluation_flag,
+        shape_info,
+        values_dofs_actual,
+        values_quad,
+        gradients_quad,
+        hessians_quad,
+        scratch_data);
     }
   // '<=' on type means tensor_symmetric or tensor_symmetric_hermite, see
   // shape_info.h for more details
@@ -639,16 +590,14 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
         dim,
         fe_degree,
         n_q_points_1d,
-        n_components,
-        Number>::evaluate(shape_info,
+        Number>::evaluate(n_components,
+                          evaluation_flag,
+                          shape_info,
                           values_dofs_actual,
                           values_quad,
                           gradients_quad,
                           hessians_quad,
-                          scratch_data,
-                          evaluate_values,
-                          evaluate_gradients,
-                          evaluate_hessians);
+                          scratch_data);
     }
   else if (shape_info.element_type <=
            internal::MatrixFreeFunctions::tensor_symmetric)
@@ -658,16 +607,14 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
         dim,
         fe_degree,
         n_q_points_1d,
-        n_components,
-        Number>::evaluate(shape_info,
+        Number>::evaluate(n_components,
+                          evaluation_flag,
+                          shape_info,
                           values_dofs_actual,
                           values_quad,
                           gradients_quad,
                           hessians_quad,
-                          scratch_data,
-                          evaluate_values,
-                          evaluate_gradients,
-                          evaluate_hessians);
+                          scratch_data);
     }
   else if (shape_info.element_type ==
            internal::MatrixFreeFunctions::tensor_symmetric_plus_dg0)
@@ -677,16 +624,14 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
         dim,
         fe_degree,
         n_q_points_1d,
-        n_components,
-        Number>::evaluate(shape_info,
+        Number>::evaluate(n_components,
+                          evaluation_flag,
+                          shape_info,
                           values_dofs_actual,
                           values_quad,
                           gradients_quad,
                           hessians_quad,
-                          scratch_data,
-                          evaluate_values,
-                          evaluate_gradients,
-                          evaluate_hessians);
+                          scratch_data);
     }
   else if (shape_info.element_type ==
            internal::MatrixFreeFunctions::truncated_tensor)
@@ -696,16 +641,14 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
         dim,
         fe_degree,
         n_q_points_1d,
-        n_components,
-        Number>::evaluate(shape_info,
+        Number>::evaluate(n_components,
+                          evaluation_flag,
+                          shape_info,
                           values_dofs_actual,
                           values_quad,
                           gradients_quad,
                           hessians_quad,
-                          scratch_data,
-                          evaluate_values,
-                          evaluate_gradients,
-                          evaluate_hessians);
+                          scratch_data);
     }
   else if (shape_info.element_type ==
            internal::MatrixFreeFunctions::tensor_general)
@@ -714,16 +657,14 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
                                  dim,
                                  fe_degree,
                                  n_q_points_1d,
-                                 n_components,
-                                 Number>::evaluate(shape_info,
+                                 Number>::evaluate(n_components,
+                                                   evaluation_flag,
+                                                   shape_info,
                                                    values_dofs_actual,
                                                    values_quad,
                                                    gradients_quad,
                                                    hessians_quad,
-                                                   scratch_data,
-                                                   evaluate_values,
-                                                   evaluate_gradients,
-                                                   evaluate_hessians);
+                                                   scratch_data);
     }
   else
     AssertThrow(false, ExcNotImplemented());
@@ -731,20 +672,16 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::evaluate(
 
 
 
-template <int dim,
-          int fe_degree,
-          int n_q_points_1d,
-          int n_components,
-          typename Number>
+template <int dim, int fe_degree, int n_q_points_1d, typename Number>
 inline void
-SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
+SelectEvaluator<dim, fe_degree, n_q_points_1d, Number>::integrate(
+  const unsigned int                                      n_components,
+  const EvaluationFlags::EvaluationFlags                  integration_flag,
   const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
   Number *                                                values_dofs_actual,
   Number *                                                values_quad,
   Number *                                                gradients_quad,
   Number *                                                scratch_data,
-  const bool                                              integrate_values,
-  const bool                                              integrate_gradients,
   const bool                                              sum_into_values_array)
 {
   Assert(fe_degree >= 0 && n_q_points_1d > 0, ExcInternalError());
@@ -753,16 +690,15 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
       shape_info.element_type ==
         internal::MatrixFreeFunctions::tensor_symmetric_collocation)
     {
-      internal::
-        FEEvaluationImplCollocation<dim, fe_degree, n_components, Number>::
-          integrate(shape_info,
-                    values_dofs_actual,
-                    values_quad,
-                    gradients_quad,
-                    scratch_data,
-                    integrate_values,
-                    integrate_gradients,
-                    sum_into_values_array);
+      internal::FEEvaluationImplCollocation<dim, fe_degree, Number>::integrate(
+        n_components,
+        integration_flag,
+        shape_info,
+        values_dofs_actual,
+        values_quad,
+        gradients_quad,
+        scratch_data,
+        sum_into_values_array);
     }
   // '<=' on type means tensor_symmetric or tensor_symmetric_hermite, see
   // shape_info.h for more details
@@ -773,14 +709,13 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
         dim,
         fe_degree,
         n_q_points_1d,
-        n_components,
-        Number>::integrate(shape_info,
+        Number>::integrate(n_components,
+                           integration_flag,
+                           shape_info,
                            values_dofs_actual,
                            values_quad,
                            gradients_quad,
                            scratch_data,
-                           integrate_values,
-                           integrate_gradients,
                            sum_into_values_array);
     }
   else if (shape_info.element_type <=
@@ -791,14 +726,13 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
         dim,
         fe_degree,
         n_q_points_1d,
-        n_components,
-        Number>::integrate(shape_info,
+        Number>::integrate(n_components,
+                           integration_flag,
+                           shape_info,
                            values_dofs_actual,
                            values_quad,
                            gradients_quad,
                            scratch_data,
-                           integrate_values,
-                           integrate_gradients,
                            sum_into_values_array);
     }
   else if (shape_info.element_type ==
@@ -809,14 +743,13 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
         dim,
         fe_degree,
         n_q_points_1d,
-        n_components,
-        Number>::integrate(shape_info,
+        Number>::integrate(n_components,
+                           integration_flag,
+                           shape_info,
                            values_dofs_actual,
                            values_quad,
                            gradients_quad,
                            scratch_data,
-                           integrate_values,
-                           integrate_gradients,
                            sum_into_values_array);
     }
   else if (shape_info.element_type ==
@@ -827,14 +760,13 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
         dim,
         fe_degree,
         n_q_points_1d,
-        n_components,
-        Number>::integrate(shape_info,
+        Number>::integrate(n_components,
+                           integration_flag,
+                           shape_info,
                            values_dofs_actual,
                            values_quad,
                            gradients_quad,
                            scratch_data,
-                           integrate_values,
-                           integrate_gradients,
                            sum_into_values_array);
     }
   else if (shape_info.element_type ==
@@ -844,14 +776,13 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
                                  dim,
                                  fe_degree,
                                  n_q_points_1d,
-                                 n_components,
-                                 Number>::integrate(shape_info,
+                                 Number>::integrate(n_components,
+                                                    integration_flag,
+                                                    shape_info,
                                                     values_dofs_actual,
                                                     values_quad,
                                                     gradients_quad,
                                                     scratch_data,
-                                                    integrate_values,
-                                                    integrate_gradients,
                                                     sum_into_values_array);
     }
   else
@@ -860,18 +791,17 @@ SelectEvaluator<dim, fe_degree, n_q_points_1d, n_components, Number>::integrate(
 
 
 
-template <int dim, int dummy, int n_components, typename Number>
+template <int dim, int dummy, typename Number>
 inline void
-SelectEvaluator<dim, -1, dummy, n_components, Number>::evaluate(
+SelectEvaluator<dim, -1, dummy, Number>::evaluate(
+  const unsigned int                                      n_components,
+  const EvaluationFlags::EvaluationFlags                  evaluation_flag,
   const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
   Number *                                                values_dofs_actual,
   Number *                                                values_quad,
   Number *                                                gradients_quad,
   Number *                                                hessians_quad,
-  Number *                                                scratch_data,
-  const bool                                              evaluate_values,
-  const bool                                              evaluate_gradients,
-  const bool                                              evaluate_hessians)
+  Number *                                                scratch_data)
 {
   if (shape_info.element_type ==
       internal::MatrixFreeFunctions::tensor_symmetric_plus_dg0)
@@ -881,16 +811,14 @@ SelectEvaluator<dim, -1, dummy, n_components, Number>::evaluate(
         dim,
         -1,
         0,
-        n_components,
-        Number>::evaluate(shape_info,
+        Number>::evaluate(n_components,
+                          evaluation_flag,
+                          shape_info,
                           values_dofs_actual,
                           values_quad,
                           gradients_quad,
                           hessians_quad,
-                          scratch_data,
-                          evaluate_values,
-                          evaluate_gradients,
-                          evaluate_hessians);
+                          scratch_data);
     }
   else if (shape_info.element_type ==
            internal::MatrixFreeFunctions::truncated_tensor)
@@ -900,16 +828,14 @@ SelectEvaluator<dim, -1, dummy, n_components, Number>::evaluate(
         dim,
         -1,
         0,
-        n_components,
-        Number>::evaluate(shape_info,
+        Number>::evaluate(n_components,
+                          evaluation_flag,
+                          shape_info,
                           values_dofs_actual,
                           values_quad,
                           gradients_quad,
                           hessians_quad,
-                          scratch_data,
-                          evaluate_values,
-                          evaluate_gradients,
-                          evaluate_hessians);
+                          scratch_data);
     }
   else if (shape_info.element_type ==
            internal::MatrixFreeFunctions::tensor_general)
@@ -917,41 +843,38 @@ SelectEvaluator<dim, -1, dummy, n_components, Number>::evaluate(
                                dim,
                                -1,
                                0,
-                               n_components,
-                               Number>::evaluate(shape_info,
+                               Number>::evaluate(n_components,
+                                                 evaluation_flag,
+                                                 shape_info,
                                                  values_dofs_actual,
                                                  values_quad,
                                                  gradients_quad,
                                                  hessians_quad,
-                                                 scratch_data,
-                                                 evaluate_values,
-                                                 evaluate_gradients,
-                                                 evaluate_hessians);
+                                                 scratch_data);
   else
     internal::EvaluationSelectorImplementation::
-      symmetric_selector_evaluate<dim, n_components, Number>(shape_info,
-                                                             values_dofs_actual,
-                                                             values_quad,
-                                                             gradients_quad,
-                                                             hessians_quad,
-                                                             scratch_data,
-                                                             evaluate_values,
-                                                             evaluate_gradients,
-                                                             evaluate_hessians);
+      symmetric_selector_evaluate<dim, Number>(n_components,
+                                               evaluation_flag,
+                                               shape_info,
+                                               values_dofs_actual,
+                                               values_quad,
+                                               gradients_quad,
+                                               hessians_quad,
+                                               scratch_data);
 }
 
 
 
-template <int dim, int dummy, int n_components, typename Number>
+template <int dim, int dummy, typename Number>
 inline void
-SelectEvaluator<dim, -1, dummy, n_components, Number>::integrate(
+SelectEvaluator<dim, -1, dummy, Number>::integrate(
+  const unsigned int                                      n_components,
+  const EvaluationFlags::EvaluationFlags                  integration_flag,
   const internal::MatrixFreeFunctions::ShapeInfo<Number> &shape_info,
   Number *                                                values_dofs_actual,
   Number *                                                values_quad,
   Number *                                                gradients_quad,
   Number *                                                scratch_data,
-  const bool                                              integrate_values,
-  const bool                                              integrate_gradients,
   const bool                                              sum_into_values_array)
 {
   if (shape_info.element_type ==
@@ -962,14 +885,13 @@ SelectEvaluator<dim, -1, dummy, n_components, Number>::integrate(
         dim,
         -1,
         0,
-        n_components,
-        Number>::integrate(shape_info,
+        Number>::integrate(n_components,
+                           integration_flag,
+                           shape_info,
                            values_dofs_actual,
                            values_quad,
                            gradients_quad,
                            scratch_data,
-                           integrate_values,
-                           integrate_gradients,
                            sum_into_values_array);
     }
   else if (shape_info.element_type ==
@@ -980,14 +902,13 @@ SelectEvaluator<dim, -1, dummy, n_components, Number>::integrate(
         dim,
         -1,
         0,
-        n_components,
-        Number>::integrate(shape_info,
+        Number>::integrate(n_components,
+                           integration_flag,
+                           shape_info,
                            values_dofs_actual,
                            values_quad,
                            gradients_quad,
                            scratch_data,
-                           integrate_values,
-                           integrate_gradients,
                            sum_into_values_array);
     }
   else if (shape_info.element_type ==
@@ -996,26 +917,24 @@ SelectEvaluator<dim, -1, dummy, n_components, Number>::integrate(
                                dim,
                                -1,
                                0,
-                               n_components,
-                               Number>::integrate(shape_info,
+                               Number>::integrate(n_components,
+                                                  integration_flag,
+                                                  shape_info,
                                                   values_dofs_actual,
                                                   values_quad,
                                                   gradients_quad,
                                                   scratch_data,
-                                                  integrate_values,
-                                                  integrate_gradients,
                                                   sum_into_values_array);
   else
     internal::EvaluationSelectorImplementation::
-      symmetric_selector_integrate<dim, n_components, Number>(
-        shape_info,
-        values_dofs_actual,
-        values_quad,
-        gradients_quad,
-        scratch_data,
-        integrate_values,
-        integrate_gradients,
-        sum_into_values_array);
+      symmetric_selector_integrate<dim, Number>(n_components,
+                                                integration_flag,
+                                                shape_info,
+                                                values_dofs_actual,
+                                                values_quad,
+                                                gradients_quad,
+                                                scratch_data,
+                                                sum_into_values_array);
 }
 #endif // DOXYGEN
 
index 62d225bfd13ffa96cb35216aa4b09b7351853cd3..560d7954effeae34d4de1099bb0fcbc208123c28 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <deal.II/lac/vector_operation.h>
 
+#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/mapping_data_on_the_fly.h>
@@ -57,105 +58,6 @@ template <int dim,
 class FEEvaluation;
 
 
-/**
- * @brief The namespace for the EvaluationFlags enum
- *
- * This namespace contains the enum EvaluationFlags used in FEEvaluation
- * to control evaluation and integration of values, gradients, etc..
- */
-namespace EvaluationFlags
-{
-  /**
-   * @brief The EvaluationFlags enum
-   *
-   * This enum contains a set of flags used by FEEvaluation::integrate(),
-   * FEEvaluation::evaluate() and others to determine if values, gradients,
-   * hessians, or a combination of them is being used.
-   */
-  enum EvaluationFlags
-  {
-    /**
-     * Do not use or compute anything.
-     */
-    nothing = 0,
-    /**
-     * Use or evaluate values.
-     */
-    values = 0x1,
-    /**
-     * Use or evaluate gradients.
-     */
-    gradients = 0x2,
-    /**
-     * Use or evaluate hessians.
-     */
-    hessians = 0x4
-  };
-
-
-  /**
-   * Global operator which returns an object in which all bits are set which are
-   * either set in the first or the second argument. This operator exists since
-   * if it did not then the result of the bit-or <tt>operator |</tt> would be an
-   * integer which would in turn trigger a compiler warning when we tried to
-   * assign it to an object of type UpdateFlags.
-   *
-   * @ref EvaluationFlags
-   */
-  inline EvaluationFlags
-  operator|(const EvaluationFlags f1, const EvaluationFlags f2)
-  {
-    return static_cast<EvaluationFlags>(static_cast<unsigned int>(f1) |
-                                        static_cast<unsigned int>(f2));
-  }
-
-
-
-  /**
-   * Global operator which sets the bits from the second argument also in the
-   * first one.
-   *
-   * @ref EvaluationFlags
-   */
-  inline EvaluationFlags &
-  operator|=(EvaluationFlags &f1, const EvaluationFlags f2)
-  {
-    f1 = f1 | f2;
-    return f1;
-  }
-
-
-  /**
-   * Global operator which returns an object in which all bits are set which are
-   * set in the first as well as the second argument. This operator exists since
-   * if it did not then the result of the bit-and <tt>operator &</tt> would be
-   * an integer which would in turn trigger a compiler warning when we tried to
-   * assign it to an object of type UpdateFlags.
-   *
-   * @ref EvaluationFlags
-   */
-  inline EvaluationFlags operator&(const EvaluationFlags f1,
-                                   const EvaluationFlags f2)
-  {
-    return static_cast<EvaluationFlags>(static_cast<unsigned int>(f1) &
-                                        static_cast<unsigned int>(f2));
-  }
-
-
-  /**
-   * Global operator which clears all the bits in the first argument if they are
-   * not also set in the second argument.
-   *
-   * @ref EvaluationFlags
-   */
-  inline EvaluationFlags &
-  operator&=(EvaluationFlags &f1, const EvaluationFlags f2)
-  {
-    f1 = f1 & f2;
-    return f1;
-  }
-
-} // namespace EvaluationFlags
 
 /**
  * This is the base class for the FEEvaluation classes. This class is a base
@@ -440,8 +342,9 @@ public:
 
   /**
    * Return the value of a finite element function at quadrature point number
-   * @p q_point after a call to @p evaluate() with EvaluationFlags::value set, or the value that has
-   * been stored there with a call to @p submit_value. If the object is
+   * @p q_point after a call to FEEvaluation::evaluate() with
+   * EvaluationFlags::value set, or the value that has been stored there with
+   * a call to FEEvaluationBase::submit_value(). If the object is
    * vector-valued, a vector-valued return argument is given. Note that when
    * vectorization is enabled, values from several cells are grouped together.
    *
@@ -454,10 +357,11 @@ public:
 
   /**
    * Write a value to the field containing the values on quadrature points
-   * with component @p q_point. Access to the same field as through @p
-   * get_value. If applied before the function @p integrate() with EvaluationFlags::values set is
-   * called, this specifies the value which is tested by all basis function on
-   * the current cell and integrated over.
+   * with component @p q_point. Access to the same field as through
+   * get_value(). If applied before the function FEEvaluation::integrate()
+   * with EvaluationFlags::values set is called, this specifies the value
+   * which is tested by all basis function on the current cell and integrated
+   * over.
    *
    * Note that the derived class FEEvaluationAccess overloads this operation
    * with specializations for the scalar case (n_components == 1) and for the
@@ -468,8 +372,9 @@ public:
 
   /**
    * Return the gradient of a finite element function at quadrature point
-   * number @p q_point after a call to @p evaluate() with EvaluationFlags::gradients, or the value
-   * that has been stored there with a call to @p submit_gradient.
+   * number @p q_point after a call to FEEvaluation::evaluate() with
+   * EvaluationFlags::gradients, or the value that has been stored there with
+   * a call to FEEvaluationBase::submit_gradient().
    *
    * Note that the derived class FEEvaluationAccess overloads this operation
    * with specializations for the scalar case (n_components == 1) and for the
@@ -480,11 +385,12 @@ public:
 
   /**
    * Return the derivative of a finite element function at quadrature point
-   * number @p q_point after a call to @p evaluate(...,true,...) in the
-   * direction normal to the face:
-   * $\boldsymbol \nabla u(\mathbf x_q) \cdot \mathbf n(\mathbf x_q)$
+   * number @p q_point after a call to
+   * FEEvaluation::evaluate(EvaluationFlags::gradients) the direction normal
+   * to the face: $\boldsymbol \nabla u(\mathbf x_q) \cdot \mathbf n(\mathbf
+   * x_q)$
    *
-   * This call is equivalent to calling `get_gradient() * get_normal_vector()`
+   * This call is equivalent to calling get_gradient() * get_normal_vector()
    * but will use a more efficient internal representation of data.
    *
    * Note that the derived class FEEvaluationAccess overloads this operation
@@ -497,10 +403,10 @@ public:
   /**
    * Write a contribution that is tested by the gradient to the field
    * containing the values on quadrature points with component @p q_point.
-   * Access to the same field as through get_gradient(). If applied before
-   * the function @p integrate(...,true) is called, this specifies what is
-   * tested by all basis function gradients on the current cell and integrated
-   * over.
+   * Access to the same field as through get_gradient(). If applied before the
+   * function FEEvaluation::integrate(EvaluationFlags::gradients) is called,
+   * this specifies what is tested by all basis function gradients on the
+   * current cell and integrated over.
    *
    * Note that the derived class FEEvaluationAccess overloads this operation
    * with specializations for the scalar case (n_components == 1) and for the
@@ -513,9 +419,10 @@ public:
    * Write a contribution that is tested by the gradient to the field
    * containing the values on quadrature points with component @p
    * q_point. Access to the same field as through get_gradient() or
-   * get_normal_derivative(). If applied before the function @p
-   * integrate(...,true) is called, this specifies what is tested by all basis
-   * function gradients on the current cell and integrated over.
+   * get_normal_derivative(). If applied before the function
+   * FEEvaluation::integrate(EvaluationFlags::gradients) is called, this
+   * specifies what is tested by all basis function gradients on the current
+   * cell and integrated over.
    *
    * @note This operation writes the data to the same field as
    * submit_gradient(). As a consequence, only one of these two can be
@@ -532,9 +439,10 @@ public:
 
   /**
    * Return the Hessian of a finite element function at quadrature point
-   * number @p q_point after a call to @p evaluate(...,true). If only the
-   * diagonal or even the trace of the Hessian, the Laplacian, is needed, use
-   * the other functions below.
+   * number @p q_point after a call to
+   * FEEvaluation::evaluate(EvaluationFlags::hessians). If only the diagonal
+   * or even the trace of the Hessian, the Laplacian, is needed, use the other
+   * functions below.
    *
    * Note that the derived class FEEvaluationAccess overloads this operation
    * with specializations for the scalar case (n_components == 1) and for the
@@ -545,7 +453,8 @@ public:
 
   /**
    * Return the diagonal of the Hessian of a finite element function at
-   * quadrature point number @p q_point after a call to @p evaluate(...,true).
+   * quadrature point number @p q_point after a call to
+   * FEEvaluation::evaluate(EvaluationFlags::hessians).
    *
    * Note that the derived class FEEvaluationAccess overloads this operation
    * with specializations for the scalar case (n_components == 1) and for the
@@ -555,10 +464,11 @@ public:
   get_hessian_diagonal(const unsigned int q_point) const;
 
   /**
-   * Return the Laplacian (i.e., the trace of the Hessian) of a finite
-   * element function at quadrature point number @p q_point after a call to @p
-   * evaluate(...,true). Compared to the case when computing the full Hessian,
-   * some operations can be saved when only the Laplacian is requested.
+   * Return the Laplacian (i.e., the trace of the Hessian) of a finite element
+   * function at quadrature point number @p q_point after a call to
+   * FEEvaluation::evaluate(EvaluationFlags::hessians). Compared to the case
+   * when computing the full Hessian, some operations can be saved when only
+   * the Laplacian is requested.
    *
    * Note that the derived class FEEvaluationAccess overloads this operation
    * with specializations for the scalar case (n_components == 1) and for the
@@ -7326,30 +7236,14 @@ FEEvaluation<dim,
                                             const bool evaluate_gradients,
                                             const bool evaluate_hessians)
 {
-  SelectEvaluator<
-    dim,
-    fe_degree,
-    n_q_points_1d,
-    n_components,
-    VectorizedArrayType>::evaluate(*this->data,
-                                   const_cast<VectorizedArrayType *>(
-                                     values_array),
-                                   this->values_quad,
-                                   this->gradients_quad,
-                                   this->hessians_quad,
-                                   this->scratch_data,
-                                   evaluate_values,
-                                   evaluate_gradients,
-                                   evaluate_hessians);
+  const EvaluationFlags::EvaluationFlags flag =
+    ((evaluate_values) ? EvaluationFlags::values : EvaluationFlags::nothing) |
+    ((evaluate_gradients) ? EvaluationFlags::gradients :
+                            EvaluationFlags::nothing) |
+    ((evaluate_hessians) ? EvaluationFlags::hessians :
+                           EvaluationFlags::nothing);
 
-#  ifdef DEBUG
-  if (evaluate_values == true)
-    this->values_quad_initialized = true;
-  if (evaluate_gradients == true)
-    this->gradients_quad_initialized = true;
-  if (evaluate_hessians == true)
-    this->hessians_quad_initialized = true;
-#  endif
+  evaluate(values_array, flag);
 }
 
 
@@ -7370,20 +7264,15 @@ FEEvaluation<dim,
   evaluate(const VectorizedArrayType *            values_array,
            const EvaluationFlags::EvaluationFlags evaluation_flags)
 {
-  SelectEvaluator<dim,
-                  fe_degree,
-                  n_q_points_1d,
-                  n_components,
-                  VectorizedArrayType>::
-    evaluate(*this->data,
-             const_cast<VectorizedArrayType *>(values_array),
-             this->values_quad,
-             this->gradients_quad,
-             this->hessians_quad,
-             this->scratch_data,
-             evaluation_flags & EvaluationFlags::values,
-             evaluation_flags & EvaluationFlags::gradients,
-             evaluation_flags & EvaluationFlags::hessians);
+  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);
 
 #  ifdef DEBUG
   if (evaluation_flags & EvaluationFlags::values)
@@ -7412,10 +7301,9 @@ FEEvaluation<
   n_components_,
   Number,
   VectorizedArrayType>::gather_evaluate(const VectorType &input_vector,
-
-                                        const bool evaluate_values,
-                                        const bool evaluate_gradients,
-                                        const bool evaluate_hessians)
+                                        const bool        evaluate_values,
+                                        const bool        evaluate_gradients,
+                                        const bool        evaluate_hessians)
 {
   const EvaluationFlags::EvaluationFlags flag =
     ((evaluate_values) ? EvaluationFlags::values : EvaluationFlags::nothing) |
@@ -7472,18 +7360,12 @@ FEEvaluation<dim,
                                             [this->first_selected_component] *
             VectorizedArrayType::size());
 
-      evaluate(vec_values,
-               evaluation_flag & EvaluationFlags::values,
-               evaluation_flag & EvaluationFlags::gradients,
-               evaluation_flag & EvaluationFlags::hessians);
+      evaluate(vec_values, evaluation_flag);
     }
   else
     {
       this->read_dof_values(input_vector);
-      evaluate(this->begin_dof_values(),
-               evaluation_flag & EvaluationFlags::values,
-               evaluation_flag & EvaluationFlags::gradients,
-               evaluation_flag & EvaluationFlags::hessians);
+      evaluate(this->begin_dof_values(), evaluation_flag);
     }
 }
 
@@ -7553,34 +7435,11 @@ FEEvaluation<dim,
                                              const bool integrate_gradients,
                                              VectorizedArrayType *values_array)
 {
-#  ifdef DEBUG
-  if (integrate_values == true)
-    Assert(this->values_quad_submitted == true,
-           internal::ExcAccessToUninitializedField());
-  if (integrate_gradients == true)
-    Assert(this->gradients_quad_submitted == true,
-           internal::ExcAccessToUninitializedField());
-#  endif
-  Assert(this->matrix_info != nullptr ||
-           this->mapped_geometry->is_initialized(),
-         ExcNotInitialized());
-
-  SelectEvaluator<dim,
-                  fe_degree,
-                  n_q_points_1d,
-                  n_components,
-                  VectorizedArrayType>::integrate(*this->data,
-                                                  values_array,
-                                                  this->values_quad,
-                                                  this->gradients_quad,
-                                                  this->scratch_data,
-                                                  integrate_values,
-                                                  integrate_gradients,
-                                                  false);
-
-#  ifdef DEBUG
-  this->dof_values_initialized = true;
-#  endif
+  EvaluationFlags::EvaluationFlags flag =
+    (integrate_values ? EvaluationFlags::values : EvaluationFlags::nothing) |
+    (integrate_gradients ? EvaluationFlags::gradients :
+                           EvaluationFlags::nothing);
+  integrate(flag, values_array);
 }
 
 
@@ -7619,20 +7478,15 @@ FEEvaluation<dim,
     ExcMessage(
       "Only EvaluationFlags::values and EvaluationFlags::gradients are supported."));
 
-  SelectEvaluator<dim,
-                  fe_degree,
-                  n_q_points_1d,
-                  n_components,
-                  VectorizedArrayType>::integrate(*this->data,
-                                                  values_array,
-                                                  this->values_quad,
-                                                  this->gradients_quad,
-                                                  this->scratch_data,
-                                                  integration_flag &
-                                                    EvaluationFlags::values,
-                                                  integration_flag &
-                                                    EvaluationFlags::gradients,
-                                                  false);
+  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);
 
 #  ifdef DEBUG
   this->dof_values_initialized = true;
@@ -7683,7 +7537,7 @@ FEEvaluation<dim,
              n_components_,
              Number,
              VectorizedArrayType>::
-  integrate_scatter(const EvaluationFlags::EvaluationFlags evaluation_flag,
+  integrate_scatter(const EvaluationFlags::EvaluationFlags integration_flag,
                     VectorType &                           destination)
 {
   // If the index storage is interleaved and contiguous and the vector storage
@@ -7713,27 +7567,19 @@ FEEvaluation<dim,
             ->component_dof_indices_offset[this->active_fe_index]
                                           [this->first_selected_component] *
           VectorizedArrayType::size());
-      SelectEvaluator<
-        dim,
-        fe_degree,
-        n_q_points_1d,
-        n_components,
-        VectorizedArrayType>::integrate(*this->data,
-                                        vec_values,
-                                        this->values_quad,
-                                        this->gradients_quad,
-                                        this->scratch_data,
-                                        evaluation_flag &
-                                          EvaluationFlags::values,
-                                        evaluation_flag &
-                                          EvaluationFlags::gradients,
-                                        true);
+      SelectEvaluator<dim, fe_degree, n_q_points_1d, VectorizedArrayType>::
+        integrate(n_components,
+                  integration_flag,
+                  *this->data,
+                  vec_values,
+                  this->values_quad,
+                  this->gradients_quad,
+                  this->scratch_data,
+                  true);
     }
   else
     {
-      integrate(evaluation_flag & EvaluationFlags::values,
-                evaluation_flag & EvaluationFlags::gradients,
-                this->begin_dof_values());
+      integrate(integration_flag, this->begin_dof_values());
       this->distribute_local_to_global(destination);
     }
 }
index 0ed71677c962c86735f430b1d0da49f18cee883c..0bb14d8b78b1b4158d9d29dbb51f680b480a556f 100644 (file)
@@ -1302,16 +1302,18 @@ namespace internal
                                                 start_indices,
                                                 cell_points.data());
 
-                  SelectEvaluator<dim, -1, 0, dim, VectorizedDouble>::evaluate(
+                  SelectEvaluator<dim, -1, 0, VectorizedDouble>::evaluate(
+                    dim,
+                    EvaluationFlags::values | EvaluationFlags::gradients |
+                      (update_flags_cells & update_jacobian_grads ?
+                         EvaluationFlags::hessians :
+                         EvaluationFlags::nothing),
                     shape_info,
                     cell_points.data(),
                     cell_quads.data(),
                     cell_grads.data(),
                     cell_grad_grads.data(),
-                    scratch_data.data(),
-                    true,
-                    true,
-                    update_flags_cells & update_jacobian_grads);
+                    scratch_data.data());
                 }
               if (update_flags_cells & update_quadrature_points)
                 {
index 16c85505e5d816b3a779aa03c82f5deb4bf306f5..9e68e74c9809fec2d0b339ab445a047a4db95086 100644 (file)
@@ -1016,11 +1016,9 @@ namespace MatrixFreeOperators
     VectorizedArrayType>::apply(const VectorizedArrayType *in_array,
                                 VectorizedArrayType *      out_array) const
   {
-    internal::CellwiseInverseMassMatrixImpl<
-      dim,
-      fe_degree,
-      n_components,
-      VectorizedArrayType>::apply(fe_eval, in_array, out_array);
+    internal::
+      CellwiseInverseMassMatrixImpl<dim, fe_degree, VectorizedArrayType>::apply(
+        n_components, fe_eval, in_array, out_array);
   }
 
 
@@ -1041,15 +1039,13 @@ namespace MatrixFreeOperators
           const VectorizedArrayType *               in_array,
           VectorizedArrayType *                     out_array) const
   {
-    internal::CellwiseInverseMassMatrixImpl<dim,
-                                            fe_degree,
-                                            n_components,
-                                            VectorizedArrayType>::
-      apply(fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
-            inverse_coefficients,
-            n_actual_components,
-            in_array,
-            out_array);
+    internal::
+      CellwiseInverseMassMatrixImpl<dim, fe_degree, VectorizedArrayType>::apply(
+        n_actual_components,
+        fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
+        inverse_coefficients,
+        in_array,
+        out_array);
   }
 
 
@@ -1069,15 +1065,13 @@ namespace MatrixFreeOperators
                                      const VectorizedArrayType *in_array,
                                      VectorizedArrayType *      out_array) const
   {
-    internal::CellwiseInverseMassMatrixImpl<dim,
-                                            fe_degree,
-                                            n_components,
-                                            VectorizedArrayType>::
-      transform_from_q_points_to_basis(
-        fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
-        n_actual_components,
-        in_array,
-        out_array);
+    internal::
+      CellwiseInverseMassMatrixImpl<dim, fe_degree, VectorizedArrayType>::
+        transform_from_q_points_to_basis(
+          n_actual_components,
+          fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
+          in_array,
+          out_array);
   }
 
 
index 49a0eea8e4455cbc5136a3edc9eb9c0d1df7aada..fa08b3466af64effdf9f6caced8fbbf801cae151 100644 (file)
@@ -1477,27 +1477,36 @@ namespace internal
         constexpr unsigned int n_comp         = 1 + (spacedim - 1) / n_lanes;
         constexpr unsigned int n_hessians     = (dim * (dim + 1)) / 2;
 
-        const bool evaluate_values = update_flags & update_quadrature_points;
-        const bool evaluate_gradients =
-          (cell_similarity != CellSimilarity::translation) &&
-          (update_flags & update_contravariant_transformation);
-        const bool evaluate_hessians =
-          (cell_similarity != CellSimilarity::translation) &&
-          (update_flags & update_jacobian_grads);
-
-        Assert(!evaluate_values || n_q_points > 0, ExcInternalError());
-        Assert(!evaluate_values || n_q_points == quadrature_points.size(),
+        EvaluationFlags::EvaluationFlags evaluation_flag =
+          (update_flags & update_quadrature_points ? EvaluationFlags::values :
+                                                     EvaluationFlags::nothing) |
+          ((cell_similarity != CellSimilarity::translation) &&
+               (update_flags & update_contravariant_transformation) ?
+             EvaluationFlags::gradients :
+             EvaluationFlags::nothing) |
+          ((cell_similarity != CellSimilarity::translation) &&
+               (update_flags & update_jacobian_grads) ?
+             EvaluationFlags::hessians :
+             EvaluationFlags::nothing);
+
+        Assert(!(evaluation_flag & EvaluationFlags::values) || n_q_points > 0,
+               ExcInternalError());
+        Assert(!(evaluation_flag & EvaluationFlags::values) ||
+                 n_q_points == quadrature_points.size(),
                ExcDimensionMismatch(n_q_points, quadrature_points.size()));
-        Assert(!evaluate_gradients || data.n_shape_functions > 0,
+        Assert(!(evaluation_flag & EvaluationFlags::gradients) ||
+                 data.n_shape_functions > 0,
                ExcInternalError());
-        Assert(!evaluate_gradients || n_q_points == data.contravariant.size(),
+        Assert(!(evaluation_flag & EvaluationFlags::gradients) ||
+                 n_q_points == data.contravariant.size(),
                ExcDimensionMismatch(n_q_points, data.contravariant.size()));
-        Assert(!evaluate_hessians || n_q_points == jacobian_grads.size(),
+        Assert(!(evaluation_flag & EvaluationFlags::hessians) ||
+                 n_q_points == jacobian_grads.size(),
                ExcDimensionMismatch(n_q_points, jacobian_grads.size()));
 
         // shortcut in case we have an identity interpolation and only request
         // the quadrature points
-        if (evaluate_values && !evaluate_gradients & !evaluate_hessians &&
+        if (evaluation_flag == EvaluationFlags::values &&
             data.shape_info.element_type ==
               internal::MatrixFreeFunctions::tensor_symmetric_collocation)
           {
@@ -1509,14 +1518,14 @@ namespace internal
           }
 
         // prepare arrays
-        if (evaluate_values || evaluate_gradients || evaluate_hessians)
+        if (evaluation_flag != EvaluationFlags::nothing)
           {
             data.values_dofs.resize(n_comp * n_shape_values);
             data.values_quad.resize(n_comp * n_q_points);
             data.gradients_quad.resize(n_comp * n_q_points * dim);
             data.scratch.resize(2 * std::max(n_q_points, n_shape_values));
 
-            if (evaluate_hessians)
+            if (evaluation_flag & EvaluationFlags::hessians)
               data.hessians_quad.resize(n_comp * n_q_points * n_hessians);
 
             const std::vector<unsigned int> &renumber_to_lexicographic =
@@ -1532,20 +1541,19 @@ namespace internal
                 }
 
             // do the actual tensorized evaluation
-            SelectEvaluator<dim, -1, 0, n_comp, VectorizedArray<double>>::
-              evaluate(data.shape_info,
-                       data.values_dofs.begin(),
-                       data.values_quad.begin(),
-                       data.gradients_quad.begin(),
-                       data.hessians_quad.begin(),
-                       data.scratch.begin(),
-                       evaluate_values,
-                       evaluate_gradients,
-                       evaluate_hessians);
+            SelectEvaluator<dim, -1, 0, VectorizedArray<double>>::evaluate(
+              n_comp,
+              evaluation_flag,
+              data.shape_info,
+              data.values_dofs.begin(),
+              data.values_quad.begin(),
+              data.gradients_quad.begin(),
+              data.hessians_quad.begin(),
+              data.scratch.begin());
           }
 
         // do the postprocessing
-        if (evaluate_values)
+        if (evaluation_flag & EvaluationFlags::values)
           {
             for (unsigned int out_comp = 0; out_comp < n_comp; ++out_comp)
               for (unsigned int i = 0; i < n_q_points; ++i)
@@ -1557,7 +1565,7 @@ namespace internal
                     data.values_quad[out_comp * n_q_points + i][in_comp];
           }
 
-        if (evaluate_gradients)
+        if (evaluation_flag & EvaluationFlags::gradients)
           {
             std::fill(data.contravariant.begin(),
                       data.contravariant.end(),
@@ -1593,7 +1601,7 @@ namespace internal
               data.volume_elements[point] =
                 data.contravariant[point].determinant();
 
-        if (evaluate_hessians)
+        if (evaluation_flag & EvaluationFlags::hessians)
           {
             constexpr int desymmetrize_3d[6][2] = {
               {0, 0}, {1, 1}, {2, 2}, {0, 1}, {0, 2}, {1, 2}};
index e456056bb490c90494496b80f2dea49ca7adb4fc..1a856fc64006c8f82dc5e06c78e3035d145bb4fd 100644 (file)
 // ---------------------------------------------------------------------
 
 
-for (deal_II_dimension : DIMENSIONS; components : SPACE_DIMENSIONS;
-     scalar_type : REAL_SCALARS)
+for (deal_II_dimension : DIMENSIONS; scalar_type : REAL_SCALARS)
   {
-    template void SelectEvaluator<deal_II_dimension,
-                                  -1,
-                                  0,
-                                  components,
-                                  VectorizedArray<scalar_type>>::
-      integrate(const internal::MatrixFreeFunctions::ShapeInfo<
+    template void
+    SelectEvaluator<deal_II_dimension, -1, 0, VectorizedArray<scalar_type>>::
+      integrate(const unsigned int,
+                const EvaluationFlags::EvaluationFlags,
+                const internal::MatrixFreeFunctions::ShapeInfo<
                   VectorizedArray<scalar_type>> &shape_info,
                 VectorizedArray<scalar_type> *,
                 VectorizedArray<scalar_type> *,
                 VectorizedArray<scalar_type> *,
                 VectorizedArray<scalar_type> *,
-                const bool,
-                const bool,
                 const bool);
 
-    template void SelectEvaluator<deal_II_dimension,
-                                  -1,
-                                  0,
-                                  components,
-                                  VectorizedArray<scalar_type>>::
-      evaluate(const internal::MatrixFreeFunctions::ShapeInfo<
+    template void
+    SelectEvaluator<deal_II_dimension, -1, 0, VectorizedArray<scalar_type>>::
+      evaluate(const unsigned int,
+               const EvaluationFlags::EvaluationFlags,
+               const internal::MatrixFreeFunctions::ShapeInfo<
                  VectorizedArray<scalar_type>> &shape_info,
                VectorizedArray<scalar_type> *,
                VectorizedArray<scalar_type> *,
                VectorizedArray<scalar_type> *,
                VectorizedArray<scalar_type> *,
-               VectorizedArray<scalar_type> *,
-               const bool,
-               const bool,
-               const bool);
+               VectorizedArray<scalar_type> *);
   }
index 13dd1c1a2135b9413a9389917dc439272c051d07..153f0d28b694724d14ae24e6df57535c3e139976 100644 (file)
@@ -462,10 +462,10 @@ MGTransferMatrixFree<dim, Number>::do_prolongate_add(
                                                   dim,
                                                   degree + 1,
                                                   2 * degree + 1,
-                                                  1,
                                                   VectorizedArray<Number>,
                                                   VectorizedArray<Number>>::
-              do_forward(prolongation_matrix_1d,
+              do_forward(1,
+                         prolongation_matrix_1d,
                          evaluation_data.begin() +
                            c * Utilities::fixed_power<dim>(degree_size),
                          evaluation_data.begin() + c * n_scalar_cell_dofs,
@@ -484,10 +484,10 @@ MGTransferMatrixFree<dim, Number>::do_prolongate_add(
                                                   dim,
                                                   degree + 1,
                                                   2 * degree + 2,
-                                                  1,
                                                   VectorizedArray<Number>,
                                                   VectorizedArray<Number>>::
-              do_forward(prolongation_matrix_1d,
+              do_forward(1,
+                         prolongation_matrix_1d,
                          evaluation_data.begin() +
                            c * Utilities::fixed_power<dim>(degree_size),
                          evaluation_data.begin() + c * n_scalar_cell_dofs,
@@ -560,10 +560,10 @@ MGTransferMatrixFree<dim, Number>::do_restrict_add(
                                                   dim,
                                                   degree + 1,
                                                   2 * degree + 1,
-                                                  1,
                                                   VectorizedArray<Number>,
                                                   VectorizedArray<Number>>::
-              do_backward(prolongation_matrix_1d,
+              do_backward(1,
+                          prolongation_matrix_1d,
                           false,
                           evaluation_data.begin() + c * n_scalar_cell_dofs,
                           evaluation_data.begin() +
@@ -578,10 +578,10 @@ MGTransferMatrixFree<dim, Number>::do_restrict_add(
                                                   dim,
                                                   degree + 1,
                                                   2 * degree + 2,
-                                                  1,
                                                   VectorizedArray<Number>,
                                                   VectorizedArray<Number>>::
-              do_backward(prolongation_matrix_1d,
+              do_backward(1,
+                          prolongation_matrix_1d,
                           false,
                           evaluation_data.begin() + c * n_scalar_cell_dofs,
                           evaluation_data.begin() +

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.