From 0e9f7eb076e80d34cceaafca15972a5a26e33167 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Mon, 12 Sep 2022 16:44:19 +0200 Subject: [PATCH] Add additional comments regarding aliasing --- include/deal.II/lac/vector_operations_internal.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index 7d4d40cecc..011c1285f5 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -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 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 void accumulate_regular( -- 2.39.5