]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: Use the general vector interface 6431/head
authorMatthias Maier <tamiko@43-1.org>
Thu, 3 May 2018 18:40:15 +0000 (13:40 -0500)
committerMatthias Maier <tamiko@43-1.org>
Thu, 3 May 2018 19:09:26 +0000 (14:09 -0500)
We should really try hard to avoid using implementation specific low
level access via operator[].

include/deal.II/lac/linear_operator.h

index 874d795d5afab582c69b0f73a288e782a1226f81..97a5a20946765f040ac0ec38c53470487cdf660b 100644 (file)
@@ -866,15 +866,17 @@ mean_value_filter(const std::function<void(Range &, bool)> &reinit_vector)
   return_op.vmult = [](Range &v, const Range &u)
   {
     const auto mean = u.mean_value();
-    for (types::global_dof_index i = 0; i<v.size(); ++i)
-      v(i) = u(i) - mean;
+
+    v = u;
+    v.add(-mean);
   };
 
   return_op.vmult_add = [](Range &v, const Range &u)
   {
     const auto mean = u.mean_value();
-    for (types::global_dof_index i = 0; i<v.size(); ++i)
-      v(i) += u(i) - mean;
+
+    v += u;
+    v.add(-mean);
   };
 
   return_op.Tvmult = return_op.vmult_add;

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.