]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add additional comments regarding aliasing 14253/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 12 Sep 2022 14:44:19 +0000 (16:44 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 12 Sep 2022 14:44:19 +0000 (16:44 +0200)
include/deal.II/lac/vector_operations_internal.h

index 7d4d40cecc6e7b1bbb0add5811c3015c3f569dc0..011c1285f5390fc449819b06428f41aaaaa87e02 100644 (file)
@@ -1147,7 +1147,11 @@ namespace internal
     // this is the inner working routine for the accumulation loops
     // below. This is the standard case where the loop bounds are known. We
     // pulled this function out of the regular accumulate routine because we
-    // might do this thing vectorized (see specialized function below)
+    // might do this thing vectorized (see specialized function below). As
+    // opposed to the vector add functions above, we here pass the functor
+    // 'op' by value, because we cannot create a copy of the scalar inline,
+    // and instead make sure that the numbers get local (and thus definitely
+    // not aliased) for the compiler
     template <typename Operation, typename ResultType>
     void
     accumulate_regular(
@@ -1185,7 +1189,8 @@ namespace internal
     // below. This is the specialized case where the loop bounds are known and
     // where we can vectorize. In that case, we request the 'do_vectorized'
     // routine of the operation instead of the regular one which does several
-    // operations at once.
+    // operations at once. As above, pass in the functor by value to create a
+    // local copy of the variables in the function (if there are any).
     template <typename Operation, typename Number>
     void
     accumulate_regular(

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.