]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Reduce the number of casts 15303/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 5 Jun 2023 12:48:44 +0000 (14:48 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Thu, 15 Jun 2023 18:22:48 +0000 (20:22 +0200)
include/deal.II/matrix_free/tensor_product_kernels.h

index 79e23021c938dafbe4a6c7f7ab14d0b2370a2472..c489f5ef84430fc4eaea293bb57b0603662c1b6b 100644 (file)
@@ -3272,7 +3272,7 @@ namespace internal
     else if (dim == 1)
       {
         // gradient
-        result[0] = Number3(values[1]) - Number3(values[0]);
+        result[0] = Number3(values[1] - values[0]);
         // values
         result[1] = Number3(values[0]) + p[0] * result[0];
         if (n_values > 1)
@@ -3280,8 +3280,8 @@ namespace internal
       }
     else if (dim == 2)
       {
-        const Number3 val10 = Number3(values[1]) - Number3(values[0]);
-        const Number3 val32 = Number3(values[3]) - Number3(values[2]);
+        const Number3 val10 = Number3(values[1] - values[0]);
+        const Number3 val32 = Number3(values[3] - values[2]);
         const Number3 tmp0  = Number3(values[0]) + p[0] * val10;
         const Number3 tmp1  = Number3(values[2]) + p[0] * val32;
 
@@ -3303,15 +3303,15 @@ namespace internal
       }
     else if (dim == 3)
       {
-        const Number3 val10 = Number3(values[1]) - Number3(values[0]);
-        const Number3 val32 = Number3(values[3]) - Number3(values[2]);
+        const Number3 val10 = Number3(values[1] - values[0]);
+        const Number3 val32 = Number3(values[3] - values[2]);
         const Number3 tmp0  = Number3(values[0]) + p[0] * val10;
         const Number3 tmp1  = Number3(values[2]) + p[0] * val32;
         const Number3 tmp10 = tmp1 - tmp0;
         const Number3 tmpy0 = tmp0 + p[1] * tmp10;
 
-        const Number3 val54 = Number3(values[5]) - Number3(values[4]);
-        const Number3 val76 = Number3(values[7]) - Number3(values[6]);
+        const Number3 val54 = Number3(values[5] - values[4]);
+        const Number3 val76 = Number3(values[7] - values[6]);
         const Number3 tmp2  = Number3(values[4]) + p[0] * val54;
         const Number3 tmp3  = Number3(values[6]) + p[0] * val76;
         const Number3 tmp32 = tmp3 - tmp2;
@@ -3536,27 +3536,26 @@ namespace internal
       }
     else if (dim == 1)
       {
-        return Number3(values[0]) +
-               p[0] * (Number3(values[1]) - Number3(values[0]));
+        return Number3(values[0]) + p[0] * Number3(values[1] - values[0]);
       }
     else if (dim == 2)
       {
-        const Number3 val10 = Number3(values[1]) - Number3(values[0]);
-        const Number3 val32 = Number3(values[3]) - Number3(values[2]);
+        const Number3 val10 = Number3(values[1] - values[0]);
+        const Number3 val32 = Number3(values[3] - values[2]);
         const Number3 tmp0  = Number3(values[0]) + p[0] * val10;
         const Number3 tmp1  = Number3(values[2]) + p[0] * val32;
         return tmp0 + p[1] * (tmp1 - tmp0);
       }
     else if (dim == 3)
       {
-        const Number3 val10 = Number3(values[1]) - Number3(values[0]);
-        const Number3 val32 = Number3(values[3]) - Number3(values[2]);
+        const Number3 val10 = Number3(values[1] - values[0]);
+        const Number3 val32 = Number3(values[3] - values[2]);
         const Number3 tmp0  = Number3(values[0]) + p[0] * val10;
         const Number3 tmp1  = Number3(values[2]) + p[0] * val32;
         const Number3 tmpy0 = tmp0 + p[1] * (tmp1 - tmp0);
 
-        const Number3 val54 = Number3(values[5]) - Number3(values[4]);
-        const Number3 val76 = Number3(values[7]) - Number3(values[6]);
+        const Number3 val54 = Number3(values[5] - values[4]);
+        const Number3 val76 = Number3(values[7] - values[6]);
         const Number3 tmp2  = Number3(values[4]) + p[0] * val54;
         const Number3 tmp3  = Number3(values[6]) + p[0] * val76;
         const Number3 tmpy1 = tmp2 + p[1] * (tmp3 - tmp2);

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.