]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Update interface of FEPointEvaluation 11630/head
authorPeter Munch <peterrmuench@gmail.com>
Tue, 26 Jan 2021 11:20:09 +0000 (12:20 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Tue, 26 Jan 2021 18:11:15 +0000 (19:11 +0100)
Conflicts:
.github/workflows/linux.yml

include/deal.II/fe/fe_point_evaluation.h
tests/fe/point_evaluation_01.cc
tests/fe/point_evaluation_02.cc
tests/fe/point_evaluation_03.cc
tests/fe/point_evaluation_04.cc
tests/fe/point_evaluation_05.cc
tests/fe/point_evaluation_06.cc
tests/fe/point_evaluation_07.cc
tests/fe/point_evaluation_08.cc
tests/fe/point_evaluation_09.cc

index 2a637cd27ccc477bb95d4de76408459b21b136af..eeeae8efcc87ba9ff356e225bf9908a124f8eaf3 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <deal.II/fe/mapping_q_generic.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>
 
@@ -271,23 +272,36 @@ public:
    * values on the element as returned by `cell->get_dof_values(global_vector,
    * solution_values)`.
    *
-   * @param[out] values Array where the values of the evaluation of the
-   * solution interpolated to the given points is stored. The array must have
-   * the same size as the `unit_points` argument if values should be
-   * computed. If empty, values will not be computed.
-   *
-   * @param[out] gradients Array where the gradients of the evaluation of the
-   * solution interpolated to the given points is stored. The gradients are
-   * expressed in real space via the Mapping defined in the constructor. The
-   * array must have the same size as the `unit_points` argument if gradients
-   * should be computed. If empty, gradients will not be computed.
+   * @param[in] flags Flags specifying which quantities should be evaluated
+   * at the points.
    */
   void
   evaluate(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
-           const ArrayView<const Point<dim>> &unit_points,
-           const ArrayView<const double> &    solution_values,
-           const ArrayView<value_type> &      values,
-           const ArrayView<gradient_type> &   gradients = {});
+           const ArrayView<const Point<dim>> &     unit_points,
+           const ArrayView<const double> &         solution_values,
+           const EvaluationFlags::EvaluationFlags &flags);
+
+  /**
+   * Return the value at quadrature point number @p q_point after a call to
+   * FEPointEvaluation::evaluate() with EvaluationFlags::value set, or
+   * the value that has been stored there with a call to
+   * FEPointEvaluation::submit_value(). If the object is vector-valued, a
+   * vector-valued return argument is given. Note that when
+   * vectorization is enabled, values from several points are grouped together.
+   */
+  const value_type &
+  get_value(const unsigned int q_point) const;
+
+  /**
+   * Return the gradient at quadrature point number @p q_point after a call to
+   * FEPointEvaluation::evaluate() with EvaluationFlags::gradient set, or
+   * the gradient that has been stored there with a call to
+   * FEPointEvaluation::submit_gradient(). If the object is vector-valued, a
+   * vector-valued return argument is given. Note that when
+   * vectorization is enabled, values from several points are grouped together.
+   */
+  const gradient_type &
+  get_gradient(const unsigned int q_point) const;
 
 private:
   /**
@@ -326,6 +340,16 @@ private:
    */
   std::vector<value_type> solution_renumbered;
 
+  /**
+   * Temporary array to store the values at the points.
+   */
+  std::vector<value_type> values;
+
+  /**
+   * Temporary array to store the gradients at the points.
+   */
+  std::vector<gradient_type> gradients;
+
   /**
    * Number of unknowns per component, i.e., number of unique basis functions,
    * for the chosen FiniteElement (or base element).
@@ -406,11 +430,12 @@ FEPointEvaluation<n_components, dim, spacedim>::evaluate(
   const typename Triangulation<dim, spacedim>::cell_iterator &cell,
   const ArrayView<const Point<dim>> &                         unit_points,
   const ArrayView<const double> &                             solution_values,
-  const ArrayView<value_type> &                               values,
-  const ArrayView<gradient_type> &                            gradients)
+  const EvaluationFlags::EvaluationFlags &                    evaluation_flag)
 {
   AssertDimension(solution_values.size(), fe->dofs_per_cell);
-  if ((values.size() > 0 || gradients.size() > 0) && !poly.empty())
+  if (((evaluation_flag & EvaluationFlags::values) ||
+       (evaluation_flag & EvaluationFlags::gradients)) &&
+      !poly.empty())
     {
       // fast path with tensor product evaluation
       if (solution_renumbered.size() != dofs_per_component)
@@ -422,10 +447,10 @@ FEPointEvaluation<n_components, dim, spacedim>::evaluate(
                        comp,
                        solution_renumbered[i]);
 
-      if (values.size() > 0)
-        AssertDimension(unit_points.size(), values.size());
-      if (gradients.size() > 0)
-        AssertDimension(unit_points.size(), gradients.size());
+      if (evaluation_flag & EvaluationFlags::values)
+        values.resize(unit_points.size());
+      if (evaluation_flag & EvaluationFlags::gradients)
+        gradients.resize(unit_points.size());
 
       const std::size_t n_points = unit_points.size();
       const std::size_t n_lanes  = VectorizedArray<double>::size();
@@ -443,12 +468,12 @@ FEPointEvaluation<n_components, dim, spacedim>::evaluate(
               poly, solution_renumbered, vectorized_points, poly.size() == 2);
 
           // convert back to standard format
-          if (values.size() > 0)
+          if (evaluation_flag & EvaluationFlags::values)
             for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j)
               internal::FEPointEvaluation::EvaluatorTypeTraits<
                 dim,
                 n_components>::set_value(val_and_grad.first, j, values[i + j]);
-          if (gradients.size() > 0)
+          if (evaluation_flag & EvaluationFlags::gradients)
             for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j)
               internal::FEPointEvaluation::
                 EvaluatorTypeTraits<dim, n_components>::set_gradient(
@@ -456,23 +481,26 @@ FEPointEvaluation<n_components, dim, spacedim>::evaluate(
         }
 
       // let mapping compute the transformation
-      if (gradients.size() > 0)
+      if (evaluation_flag & EvaluationFlags::gradients)
         {
           Assert(mapping_q_generic != nullptr, ExcInternalError());
           mapping_q_generic->transform_variable(
             cell,
             mapping_covariant,
             unit_points,
-            ArrayView<const gradient_type>(gradients.begin(), gradients.size()),
-            gradients);
+            ArrayView<const gradient_type>(gradients.data(), gradients.size()),
+            ArrayView<gradient_type>(gradients.data(), gradients.size()));
         }
     }
-  else if (values.size() > 0 || gradients.size() > 0)
+  else if ((evaluation_flag & EvaluationFlags::values) ||
+           (evaluation_flag & EvaluationFlags::gradients))
     {
       // slow path with FEValues
       const UpdateFlags flags =
-        (values.size() > 0 ? update_values : update_default) |
-        (gradients.size() > 0 ? update_gradients : update_default);
+        ((evaluation_flag & EvaluationFlags::values) ? update_values :
+                                                       update_default) |
+        ((evaluation_flag & EvaluationFlags::gradients) ? update_gradients :
+                                                          update_default);
       FEValues<dim, spacedim> fe_values(
         *mapping,
         *fe,
@@ -481,9 +509,9 @@ FEPointEvaluation<n_components, dim, spacedim>::evaluate(
         flags);
       fe_values.reinit(cell);
 
-      if (values.size() > 0)
+      if (evaluation_flag & EvaluationFlags::values)
         {
-          AssertDimension(unit_points.size(), values.size());
+          values.resize(unit_points.size());
           std::fill(values.begin(), values.end(), value_type());
           for (unsigned int i = 0; i < fe->n_dofs_per_cell(); ++i)
             {
@@ -505,9 +533,9 @@ FEPointEvaluation<n_components, dim, spacedim>::evaluate(
             }
         }
 
-      if (gradients.size() > 0)
+      if (evaluation_flag & EvaluationFlags::gradients)
         {
-          AssertDimension(unit_points.size(), gradients.size());
+          gradients.resize(unit_points.size());
           std::fill(gradients.begin(), gradients.end(), gradient_type());
           for (unsigned int i = 0; i < fe->n_dofs_per_cell(); ++i)
             {
@@ -530,6 +558,30 @@ FEPointEvaluation<n_components, dim, spacedim>::evaluate(
     }
 }
 
+
+
+template <int n_components, int dim, int spacedim>
+inline const typename FEPointEvaluation<n_components, dim, spacedim>::value_type
+  &
+  FEPointEvaluation<n_components, dim, spacedim>::get_value(
+    const unsigned int q_point) const
+{
+  AssertIndexRange(q_point, values.size());
+  return values[q_point];
+}
+
+
+
+template <int n_components, int dim, int spacedim>
+inline const typename FEPointEvaluation<n_components, dim, spacedim>::
+  gradient_type &
+  FEPointEvaluation<n_components, dim, spacedim>::get_gradient(
+    const unsigned int q_point) const
+{
+  AssertIndexRange(q_point, gradients.size());
+  return gradients[q_point];
+}
+
 DEAL_II_NAMESPACE_CLOSE
 
 #endif
index 3fe84a69eb5851773daf7e3a2939303b0be18082..92afd4347a5667770a9cf59879ad64020d481427 100644 (file)
@@ -86,10 +86,6 @@ test(const unsigned int degree)
   std::vector<double>         function_values(unit_points.size());
   std::vector<Tensor<1, dim>> function_gradients(unit_points.size());
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-  std::vector<double>                  function_values_1(unit_points.size());
-  std::vector<Tensor<1, dim>>          function_gradients_1(unit_points.size());
-
   for (const auto &cell : dof_handler.active_cell_iterators())
     {
       fe_values.reinit(cell);
@@ -103,15 +99,14 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                << ": " << function_values_1[i] << " error value "
-                << function_values[i] - function_values_1[i] << " error grad "
-                << (function_gradients_1[i] - function_gradients[i]).norm()
+                << ": " << evaluator.get_value(i) << " error value "
+                << function_values[i] - evaluator.get_value(i) << " error grad "
+                << (evaluator.get_gradient(i) - function_gradients[i]).norm()
                 << std::endl;
       deallog << std::endl;
     }
index 678983ff55b065d6564657d08e01352e5cec335d..a6e8c07ba63b48e3f1d62ab97939116a08e38f97 100644 (file)
@@ -86,10 +86,6 @@ test(const unsigned int degree)
   std::vector<double>         function_values(unit_points.size());
   std::vector<Tensor<1, dim>> function_gradients(unit_points.size());
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-  std::vector<double>                  function_values_1(unit_points.size());
-  std::vector<Tensor<1, dim>>          function_gradients_1(unit_points.size());
-
   for (const auto &cell : dof_handler.active_cell_iterators())
     {
       fe_values.reinit(cell);
@@ -103,15 +99,14 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                << ": " << function_values_1[i] << " error value "
-                << function_values[i] - function_values_1[i] << " error grad "
-                << (function_gradients_1[i] - function_gradients[i]).norm()
+                << ": " << evaluator.get_value(i) << " error value "
+                << function_values[i] - evaluator.get_value(i) << " error grad "
+                << (evaluator.get_gradient(i) - function_gradients[i]).norm()
                 << std::endl;
       deallog << std::endl;
     }
index a7bc6e1663e17b70d0aebdd92ea836db99054e73..a51f158dd058c55eb0f562a1adf72a7312275b4a 100644 (file)
@@ -99,10 +99,7 @@ test(const unsigned int degree)
   std::vector<Tensor<1, dim>> function_values(unit_points.size());
   std::vector<Tensor<2, dim>> function_gradients(unit_points.size());
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-  std::vector<Tensor<1, dim>>          function_values_1(unit_points.size());
-  std::vector<Tensor<2, dim>>          function_gradients_1(unit_points.size());
-  FEValuesExtractors::Vector           extractor(0);
+  FEValuesExtractors::Vector extractor(0);
 
   for (const auto &cell : dof_handler.active_cell_iterators())
     {
@@ -117,16 +114,15 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                << ": " << function_values_1[i] << " error value "
-                << (function_values[i] - function_values_1[i]).norm()
+                << ": " << evaluator.get_value(i) << " error value "
+                << (function_values[i] - evaluator.get_value(i)).norm()
                 << " error grad "
-                << (function_gradients_1[i] - function_gradients[i]).norm()
+                << (evaluator.get_gradient(i) - function_gradients[i]).norm()
                 << std::endl;
       deallog << std::endl;
     }
index 5625ed676d82186a17e3b9af8561b1853ad46fcb..c9df96a3729151ff3d2ec739f70a17af8c97a774 100644 (file)
@@ -105,13 +105,6 @@ test(const unsigned int degree)
   std::vector<double>         function_values_scalar(unit_points.size());
   std::vector<Tensor<1, dim>> function_gradients_scalar(unit_points.size());
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-
-  std::vector<Tensor<1, dim>> function_values_1(unit_points.size());
-  std::vector<Tensor<2, dim>> function_gradients_1(unit_points.size());
-  std::vector<double>         function_values_scalar_1(unit_points.size());
-  std::vector<Tensor<1, dim>> function_gradients_scalar_1(unit_points.size());
-
   FEValuesExtractors::Vector extractor(0);
   FEValuesExtractors::Scalar extractor_s(dim);
 
@@ -132,26 +125,25 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
       evaluator_scalar.evaluate(cell,
                                 unit_points,
                                 solution_values,
-                                function_values_scalar_1,
-                                function_gradients_scalar_1);
+                                EvaluationFlags::values |
+                                  EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                << ": " << function_values_1[i] << " error value "
-                << (function_values[i] - function_values_1[i]).norm()
+                << ": " << evaluator.get_value(i) << " error value "
+                << (function_values[i] - evaluator.get_value(i)).norm()
                 << " error grad "
-                << (function_gradients_1[i] - function_gradients[i]).norm()
+                << (evaluator.get_gradient(i) - function_gradients[i]).norm()
                 << " error scalar value "
-                << function_values_scalar[i] - function_values_scalar_1[i]
+                << function_values_scalar[i] - evaluator_scalar.get_value(i)
                 << " error scalar grad "
                 << (function_gradients_scalar[i] -
-                    function_gradients_scalar_1[i])
+                    evaluator_scalar.get_gradient(i))
                      .norm()
                 << std::endl;
       deallog << std::endl;
index a7728cf4cc609b90116cbc6714895aae6678c71b..3f88d8100e134062e7a80a2a45f01ab0c82fbbd7 100644 (file)
@@ -94,10 +94,6 @@ test(const unsigned int degree)
   std::vector<double>         function_values(unit_points.size());
   std::vector<Tensor<1, dim>> function_gradients(unit_points.size());
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-  std::vector<double>                  function_values_1(unit_points.size());
-  std::vector<Tensor<1, dim>>          function_gradients_1(unit_points.size());
-
   for (const auto &cell : dof_handler.active_cell_iterators())
     {
       fe_values.reinit(cell);
@@ -111,15 +107,14 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                << ": " << function_values_1[i] << " error value "
-                << function_values[i] - function_values_1[i] << " error grad "
-                << (function_gradients_1[i] - function_gradients[i]).norm()
+                << ": " << evaluator.get_value(i) << " error value "
+                << function_values[i] - evaluator.get_value(i) << " error grad "
+                << (evaluator.get_gradient(i) - function_gradients[i]).norm()
                 << std::endl;
       deallog << std::endl;
     }
index b76a91971d98ac2d53cefa3b91675996d09f91ce..34516a6292dd1fbcd8c7c69d4bccf0cd6e0de1ef 100644 (file)
@@ -95,10 +95,6 @@ test(const unsigned int degree)
   std::vector<double>         function_values(unit_points.size());
   std::vector<Tensor<1, dim>> function_gradients(unit_points.size());
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-  std::vector<double>                  function_values_1(unit_points.size());
-  std::vector<Tensor<1, dim>>          function_gradients_1(unit_points.size());
-
   for (const auto &cell : dof_handler.active_cell_iterators())
     {
       fe_values.reinit(cell);
@@ -112,15 +108,14 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                << ": " << function_values_1[i] << " error value "
-                << function_values[i] - function_values_1[i] << " error grad "
-                << (function_gradients_1[i] - function_gradients[i]).norm()
+                << ": " << evaluator.get_value(i) << " error value "
+                << function_values[i] - evaluator.get_value(i) << " error grad "
+                << (evaluator.get_gradient(i) - function_gradients[i]).norm()
                 << std::endl;
       deallog << std::endl;
     }
index b921dbb17bbbe4049a307c9bc6ece7e3724afa40..cfceb9549494a89a66c5a91a3652583089d7dfa4 100644 (file)
@@ -106,10 +106,7 @@ test(const unsigned int degree)
   std::vector<Tensor<1, dim>> function_values(unit_points.size());
   std::vector<Tensor<2, dim>> function_gradients(unit_points.size());
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-  std::vector<Tensor<1, dim>>          function_values_1(unit_points.size());
-  std::vector<Tensor<2, dim>>          function_gradients_1(unit_points.size());
-  FEValuesExtractors::Vector           extractor(0);
+  FEValuesExtractors::Vector extractor(0);
 
   for (const auto &cell : dof_handler.active_cell_iterators())
     {
@@ -124,16 +121,15 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                << ": " << function_values_1[i] << " error value "
-                << (function_values[i] - function_values_1[i]).norm()
+                << ": " << evaluator.get_value(i) << " error value "
+                << (function_values[i] - evaluator.get_value(i)).norm()
                 << " error grad "
-                << (function_gradients_1[i] - function_gradients[i]).norm()
+                << (evaluator.get_gradient(i) - function_gradients[i]).norm()
                 << std::endl;
       deallog << std::endl;
     }
index 5512e2da59c1c22b60457cfef73d86753d92be6b..dbac85db7efc10473f8ddda02c5d449d52d84e75 100644 (file)
@@ -112,13 +112,6 @@ test(const unsigned int degree)
   std::vector<double>         function_values_scalar(unit_points.size());
   std::vector<Tensor<1, dim>> function_gradients_scalar(unit_points.size());
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-
-  std::vector<Tensor<1, dim>> function_values_1(unit_points.size());
-  std::vector<Tensor<2, dim>> function_gradients_1(unit_points.size());
-  std::vector<double>         function_values_scalar_1(unit_points.size());
-  std::vector<Tensor<1, dim>> function_gradients_scalar_1(unit_points.size());
-
   FEValuesExtractors::Vector extractor(0);
   FEValuesExtractors::Scalar extractor_s(dim);
 
@@ -139,26 +132,25 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
       evaluator_scalar.evaluate(cell,
                                 unit_points,
                                 solution_values,
-                                function_values_scalar_1,
-                                function_gradients_scalar_1);
+                                EvaluationFlags::values |
+                                  EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                << ": " << function_values_1[i] << " error value "
-                << (function_values[i] - function_values_1[i]).norm()
+                << ": " << evaluator.get_value(i) << " error value "
+                << (function_values[i] - evaluator.get_value(i)).norm()
                 << " error grad "
-                << (function_gradients_1[i] - function_gradients[i]).norm()
+                << (evaluator.get_gradient(i) - function_gradients[i]).norm()
                 << " error scalar value "
-                << function_values_scalar[i] - function_values_scalar_1[i]
+                << function_values_scalar[i] - evaluator_scalar.get_value(i)
                 << " error scalar grad "
                 << (function_gradients_scalar[i] -
-                    function_gradients_scalar_1[i])
+                    evaluator_scalar.get_gradient(i))
                      .norm()
                 << std::endl;
       deallog << std::endl;
index 2650e9dc0b41c0593bc83e17803e1f92f5b86d25..7df599f2a3ec1007d28ef460ce53ed866044fdd0 100644 (file)
@@ -101,11 +101,6 @@ test(const unsigned int degree)
   std::vector<std::vector<Tensor<1, dim>>> function_gradients(
     unit_points.size(), std::vector<Tensor<1, dim>>(dim + 1));
 
-  std::vector<types::global_dof_index> dof_indices(fe.dofs_per_cell);
-  std::vector<Tensor<1, dim + 1>>      function_values_1(unit_points.size());
-  std::vector<Tensor<1, dim + 1, Tensor<1, dim>>> function_gradients_1(
-    unit_points.size());
-
   for (const auto &cell : dof_handler.active_cell_iterators())
     {
       fe_values.reinit(cell);
@@ -119,22 +114,22 @@ test(const unsigned int degree)
       evaluator.evaluate(cell,
                          unit_points,
                          solution_values,
-                         function_values_1,
-                         function_gradients_1);
+                         EvaluationFlags::values | EvaluationFlags::gradients);
 
       deallog << "Cell with center " << cell->center(true) << std::endl;
-      for (unsigned int i = 0; i < function_values_1.size(); ++i)
+      for (unsigned int i = 0; i < function_values.size(); ++i)
         {
           deallog << mapping.transform_unit_to_real_cell(cell, unit_points[i])
-                  << ": " << function_values_1[i] << " error value ";
+                  << ": " << evaluator.get_value(i) << " error value ";
           double error = 0;
           for (unsigned int d = 0; d < dim + 1; ++d)
-            error += std::abs(function_values[i][d] - function_values_1[i][d]);
+            error +=
+              std::abs(function_values[i][d] - evaluator.get_value(i)[d]);
           deallog << error << " error grad ";
           error = 0;
           for (unsigned int d = 0; d < dim + 1; ++d)
             error +=
-              (function_gradients[i][d] - function_gradients_1[i][d]).norm();
+              (function_gradients[i][d] - evaluator.get_gradient(i)[d]).norm();
           deallog << error << std::endl;
         }
       deallog << std::endl;

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.