]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use pre-compiled code for CellwiseInverseMassMatrix 13003/head
authorMartin Kronbichler <martin.kronbichler@it.uu.se>
Mon, 29 Nov 2021 10:18:02 +0000 (11:18 +0100)
committerMartin Kronbichler <martin.kronbichler@it.uu.se>
Mon, 29 Nov 2021 14:11:10 +0000 (15:11 +0100)
doc/news/changes/minor/20211129MartinKronbichler [new file with mode: 0644]
include/deal.II/matrix_free/evaluation_template_factory.h
include/deal.II/matrix_free/evaluation_template_factory.templates.h
include/deal.II/matrix_free/operators.h

diff --git a/doc/news/changes/minor/20211129MartinKronbichler b/doc/news/changes/minor/20211129MartinKronbichler
new file mode 100644 (file)
index 0000000..eea4c28
--- /dev/null
@@ -0,0 +1,6 @@
+Fixed: MatrixFreeOperators::CellwiseInverseMassMatrix with template argument
+`-1` for the polynomial degree now chooses the pre-compiled code with fast
+tensor-product algorithms if available, rather than a slower general-purpose
+code.
+<br>
+(Martin Kronbichler, 2021/11/29)
index 8afb37d0925bb5f95bd67393e0fc00e747eb2759..50ac727c8755cb232bd58f227ad40e513d6f719a 100644 (file)
@@ -172,7 +172,6 @@ namespace internal
   {
     static void
     apply(const unsigned int n_components,
-          const unsigned int fe_degree,
           const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
             &                        fe_eval,
           const VectorizedArrayType *in_array,
@@ -189,8 +188,6 @@ namespace internal
     static void
     transform_from_q_points_to_basis(
       const unsigned int n_components,
-      const unsigned int fe_degree,
-      const unsigned int n_q_points_1d,
       const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
         &                        fe_eval,
       const VectorizedArrayType *in_array,
index b246ee4e445bfcc6a6ba72ac443b3d9c9372d190..5a98c3781b270a5dafd5ae1b289c881d81585589 100644 (file)
@@ -330,12 +330,12 @@ namespace internal
   void
   CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::apply(
     const unsigned int n_components,
-    const unsigned int fe_degree,
     const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
       &                        fe_eval,
     const VectorizedArrayType *in_array,
     VectorizedArrayType *      out_array)
   {
+    const unsigned int fe_degree = fe_eval.get_shape_info().data[0].fe_degree;
     instantiation_helper_run<
       1,
       CellwiseInverseMassMatrixImplBasic<dim, VectorizedArrayType>>(
@@ -373,13 +373,14 @@ namespace internal
   CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
     transform_from_q_points_to_basis(
       const unsigned int n_components,
-      const unsigned int fe_degree,
-      const unsigned int n_q_points_1d,
       const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
         &                        fe_eval,
       const VectorizedArrayType *in_array,
       VectorizedArrayType *      out_array)
   {
+    const unsigned int fe_degree = fe_eval.get_shape_info().data[0].fe_degree;
+    const unsigned int n_q_points_1d =
+      fe_eval.get_shape_info().data[0].n_q_points_1d;
     instantiation_helper_run<
       1,
       CellwiseInverseMassMatrixImplTransformFromQPoints<dim,
index 017af8daa43c65a66ccfd3aa3ef715f9a412e5c5..319e35ccb546699bbd0116d4bbb5c0f5b5269043 100644 (file)
@@ -1063,8 +1063,12 @@ namespace MatrixFreeOperators
     VectorizedArrayType>::apply(const VectorizedArrayType *in_array,
                                 VectorizedArrayType *      out_array) const
   {
-    internal::CellwiseInverseMassMatrixImplBasic<dim, VectorizedArrayType>::
-      template run<fe_degree>(n_components, fe_eval, in_array, out_array);
+    if (fe_degree > -1)
+      internal::CellwiseInverseMassMatrixImplBasic<dim, VectorizedArrayType>::
+        template run<fe_degree>(n_components, fe_eval, in_array, out_array);
+    else
+      internal::CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
+        apply(n_components, fe_eval, in_array, out_array);
   }
 
 
@@ -1085,13 +1089,25 @@ namespace MatrixFreeOperators
           const VectorizedArrayType *               in_array,
           VectorizedArrayType *                     out_array) const
   {
-    internal::CellwiseInverseMassMatrixImplFlexible<dim, VectorizedArrayType>::
-      template run<fe_degree>(
-        n_actual_components,
-        fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
-        inverse_coefficients,
-        in_array,
-        out_array);
+    const unsigned int given_degree =
+      fe_eval.get_shape_info().data[0].fe_degree;
+    if (fe_degree > -1)
+      internal::CellwiseInverseMassMatrixImplFlexible<dim,
+                                                      VectorizedArrayType>::
+        template run<fe_degree>(
+          n_actual_components,
+          fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
+          inverse_coefficients,
+          in_array,
+          out_array);
+    else
+      internal::CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
+        apply(n_actual_components,
+              given_degree,
+              fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
+              inverse_coefficients,
+              in_array,
+              out_array);
   }
 
 
@@ -1124,8 +1140,6 @@ namespace MatrixFreeOperators
     else
       internal::CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
         transform_from_q_points_to_basis(n_actual_components,
-                                         fe_degree,
-                                         n_q_points_1d,
                                          fe_eval,
                                          in_array,
                                          out_array);

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.