]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Weight kernel for multigrid: Simplify aliasing analysis for compiler 15185/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 8 May 2023 13:47:50 +0000 (15:47 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 8 May 2023 13:47:50 +0000 (15:47 +0200)
include/deal.II/matrix_free/tensor_product_kernels.h

index 99b69eb97f0688fb2c67987137f2e655484c4006..38c44f4762cd09bbe9a5ebe536554f8e2fa7f0e6 100644 (file)
@@ -3693,8 +3693,9 @@ namespace internal
             data[0] *= weights[shift];
             // loop bound as int avoids compiler warnings in case n_points_1d
             // == 1 (polynomial degree 0)
+            const Number weight = weights[shift + 1];
             for (int i = 1; i < n_points_1d - 1; ++i)
-              data[i] *= weights[shift + 1];
+              data[i] *= weight;
             data[n_points_1d - 1] *= weights[shift + 2];
             data += n_points_1d;
           }
@@ -3735,12 +3736,14 @@ namespace internal
             const unsigned int shift =
               9 * compressed_index[k] + 3 * compressed_index[j];
 
-            unsigned int c = 0;
+            unsigned int c       = 0;
+            const Number weight1 = weights[shift];
             for (int i = 0; i < n_inside_1d; ++i)
-              data[c++] *= weights[shift];
+              data[c++] *= weight1;
             data[c++] *= weights[shift + 1];
+            const Number weight2 = weights[shift + 2];
             for (int i = 0; i < n_inside_1d; ++i)
-              data[c++] *= weights[shift + 2];
+              data[c++] *= weight2;
             data += n_points_1d;
           }
   }

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.