]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Skip renumbering in tensor product kernels with template argument
authorMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Thu, 25 May 2023 14:45:55 +0000 (16:45 +0200)
committerMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Thu, 25 May 2023 15:52:17 +0000 (17:52 +0200)
include/deal.II/matrix_free/fe_point_evaluation.h
include/deal.II/matrix_free/tensor_product_kernels.h

index b3ab8942aaa90fd9a5333623273b68db19027b7f..e7e5f4b78e0be7fa5318c713e9dd6e9b7ebd5367 100644 (file)
@@ -1764,9 +1764,10 @@ FEPointEvaluation<n_components_, dim, spacedim, Number>::compute_evaluate_fast(
             dim - 1,
             scalar_value_type,
             VectorizedArrayType,
-            2>(shapes_faces.data() + qb * n_shapes,
-               n_shapes,
-               solution_renumbered.data());
+            2,
+            true>(shapes_faces.data() + qb * n_shapes,
+                  n_shapes,
+                  solution_renumbered.data());
 
       value = interpolated_value[dim - 1];
       // reorder derivative from tangential/normal derivatives into tensor in
@@ -1816,9 +1817,11 @@ FEPointEvaluation<n_components_, dim, spacedim, Number>::compute_evaluate_fast(
           internal::evaluate_tensor_product_value_and_gradient_shapes<
             dim,
             scalar_value_type,
-            VectorizedArrayType>(shapes.data() + qb * n_shapes,
-                                 n_shapes,
-                                 solution_renumbered.data());
+            VectorizedArrayType,
+            1,
+            true>(shapes.data() + qb * n_shapes,
+                  n_shapes,
+                  solution_renumbered.data());
       gradient[0] = result[0];
       if (dim > 1)
         gradient[1] = result[1];
index df3cb6cbd45c0f30c40441623690cecc4c9d858f..07d32da2fecae8b98fcac7a8d5abdf7f599d76ca 100644 (file)
@@ -3042,7 +3042,8 @@ namespace internal
             int length,
             typename Number2,
             typename Number,
-            int n_values = 1>
+            int  n_values    = 1,
+            bool no_renumber = false>
   inline
 #ifndef DEBUG
     DEAL_II_ALWAYS_INLINE
@@ -3078,7 +3079,7 @@ namespace internal
 
         // Distinguish the inner loop based on whether we have a
         // renumbering or not
-        if (renumber.empty())
+        if (no_renumber || renumber.empty())
           for (int i0 = 0; i0 < n_shapes; ++i0, ++i)
             {
               // gradient
@@ -3129,7 +3130,11 @@ namespace internal
    * Interpolates the values and gradients into the points specified in
    * @p compute_values_of_array() with help of the precomputed @p shapes.
    */
-  template <int dim, typename Number, typename Number2, int n_values = 1>
+  template <int dim,
+            typename Number,
+            typename Number2,
+            int  n_values    = 1,
+            bool no_renumber = false>
   inline std::array<typename ProductTypeNoPoint<Number, Number2>::type,
                     dim + n_values>
   evaluate_tensor_product_value_and_gradient_shapes(
@@ -3164,23 +3169,29 @@ namespace internal
         // Generate separate code with known loop bounds for the most common
         // cases
         if (n_shapes == 2)
-          inner_result = do_interpolate_xy<dim, 2, Number2, Number, n_values>(
-            values, renumber, shapes, n_shapes, i);
+          inner_result =
+            do_interpolate_xy<dim, 2, Number2, Number, n_values, no_renumber>(
+              values, renumber, shapes, n_shapes, i);
         else if (n_shapes == 3)
-          inner_result = do_interpolate_xy<dim, 3, Number2, Number, n_values>(
-            values, renumber, shapes, n_shapes, i);
+          inner_result =
+            do_interpolate_xy<dim, 3, Number2, Number, n_values, no_renumber>(
+              values, renumber, shapes, n_shapes, i);
         else if (n_shapes == 4)
-          inner_result = do_interpolate_xy<dim, 4, Number2, Number, n_values>(
-            values, renumber, shapes, n_shapes, i);
+          inner_result =
+            do_interpolate_xy<dim, 4, Number2, Number, n_values, no_renumber>(
+              values, renumber, shapes, n_shapes, i);
         else if (n_shapes == 5)
-          inner_result = do_interpolate_xy<dim, 5, Number2, Number, n_values>(
-            values, renumber, shapes, n_shapes, i);
+          inner_result =
+            do_interpolate_xy<dim, 5, Number2, Number, n_values, no_renumber>(
+              values, renumber, shapes, n_shapes, i);
         else if (n_shapes == 6)
-          inner_result = do_interpolate_xy<dim, 6, Number2, Number, n_values>(
-            values, renumber, shapes, n_shapes, i);
+          inner_result =
+            do_interpolate_xy<dim, 6, Number2, Number, n_values, no_renumber>(
+              values, renumber, shapes, n_shapes, i);
         else
-          inner_result = do_interpolate_xy<dim, -1, Number2, Number, n_values>(
-            values, renumber, shapes, n_shapes, i);
+          inner_result =
+            do_interpolate_xy<dim, -1, Number2, Number, n_values, no_renumber>(
+              values, renumber, shapes, n_shapes, i);
         if (dim == 3)
           {
             // derivative + interpolation in z direction

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.