]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Deprecate FEEvaluation::fill_JxW_values 8074/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 10 May 2019 16:52:28 +0000 (18:52 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 10 May 2019 16:52:28 +0000 (18:52 +0200)
include/deal.II/matrix_free/fe_evaluation.h
include/deal.II/matrix_free/operators.h
tests/matrix_free/jxw_values.cc
tests/matrix_free/jxw_values.output

index 0a8e2c29e2599f21ab1ae06f655310edd20bdd1a..3018e2f4adfb52aad4392c98ed1b9e1fb3644bb2 100644 (file)
@@ -546,8 +546,10 @@ public:
 
   /**
    * Fills the JxW values currently used into the given array.
+   *
+   * @deprecated Use JxW() instead.
    */
-  void
+  DEAL_II_DEPRECATED void
   fill_JxW_values(AlignedVector<VectorizedArray<Number>> &JxW_values) const;
 
   /**
index 3d5e13ef9fcb93c49de11e8f0a0e8fdf827abe63..4e2398e1c3978b87cbce75df83332b96b4744f24 100644 (file)
@@ -946,24 +946,20 @@ namespace MatrixFreeOperators
     fill_inverse_JxW_values(
       AlignedVector<VectorizedArray<Number>> &inverse_jxw) const
   {
-    constexpr unsigned int dofs_per_cell = Utilities::pow(fe_degree + 1, dim);
-    Assert(inverse_jxw.size() > 0 && inverse_jxw.size() % dofs_per_cell == 0,
+    constexpr unsigned int dofs_per_component_on_cell =
+      Utilities::pow(fe_degree + 1, dim);
+    Assert(inverse_jxw.size() > 0 &&
+             inverse_jxw.size() % dofs_per_component_on_cell == 0,
            ExcMessage(
              "Expected diagonal to be a multiple of scalar dof per cells"));
 
     // temporarily reduce size of inverse_jxw to dofs_per_cell to get JxW values
     // from fe_eval (will not reallocate any memory)
-    const unsigned int previous_size = inverse_jxw.size();
-    inverse_jxw.resize(dofs_per_cell);
-    fe_eval.fill_JxW_values(inverse_jxw);
-
-    // invert
-    inverse_jxw.resize_fast(previous_size);
-    for (unsigned int q = 0; q < dofs_per_cell; ++q)
-      inverse_jxw[q] = 1. / inverse_jxw[q];
+    for (unsigned int q = 0; q < dofs_per_component_on_cell; ++q)
+      inverse_jxw[q] = 1. / fe_eval.JxW(q);
     // copy values to rest of vector
-    for (unsigned int q = dofs_per_cell; q < previous_size;)
-      for (unsigned int i = 0; i < dofs_per_cell; ++i, ++q)
+    for (unsigned int q = dofs_per_component_on_cell; q < inverse_jxw.size();)
+      for (unsigned int i = 0; i < dofs_per_component_on_cell; ++i, ++q)
         inverse_jxw[q] = inverse_jxw[i];
   }
 
index 7ea5a0d5e8377ed666cda82bc4cd4cbe533953f0..54eda6743a7d1032f7128c8236b3d94b7d5c97df 100644 (file)
@@ -76,14 +76,12 @@ test()
 
   double error = 0, error2 = 0, abs = 0;
 
-  QGauss<dim>                            quad(2);
-  FEValues<dim>                          fe_values(fe, quad, update_JxW_values);
-  FEEvaluation<dim, 1>                   fe_eval(mf_data);
-  AlignedVector<VectorizedArray<double>> jxw_values_manual(fe_eval.n_q_points);
+  QGauss<dim>          quad(2);
+  FEValues<dim>        fe_values(fe, quad, update_JxW_values);
+  FEEvaluation<dim, 1> fe_eval(mf_data);
   for (unsigned int cell = 0; cell < mf_data.n_macro_cells(); ++cell)
     {
       fe_eval.reinit(cell);
-      fe_eval.fill_JxW_values(jxw_values_manual);
       for (unsigned int v = 0; v < mf_data.n_components_filled(cell); ++v)
         {
           fe_values.reinit(mf_data.get_cell_iterator(cell, v));
@@ -91,14 +89,11 @@ test()
             {
               abs += fe_values.JxW(q);
               error += std::abs(fe_values.JxW(q) - fe_eval.JxW(q)[v]);
-              error2 += std::abs(fe_values.JxW(q) - jxw_values_manual[q][v]);
             }
         }
     }
 
-  deallog << "Norm of difference: " << error / abs << " " << error2 / abs
-          << std::endl
-          << std::endl;
+  deallog << "Norm of difference: " << error / abs << std::endl << std::endl;
 }
 
 
index eb1bf849db902a6f40a37f6d1f57a71d818c68a9..298361bb84d4fddc637e7affa5a591341b3764de 100644 (file)
@@ -1,5 +1,5 @@
 
-DEAL::Norm of difference: 0 0
+DEAL::Norm of difference: 6.71e-16
 DEAL::
-DEAL::Norm of difference: 0 0
+DEAL::Norm of difference: 4.79e-16
 DEAL::

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.