]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use narrowest possible SIMD vector for MappingQ::InternalData
authorMartin Kronbichler <martin.kronbichler@it.uu.se>
Tue, 30 Nov 2021 08:14:35 +0000 (09:14 +0100)
committerMartin Kronbichler <martin.kronbichler@it.uu.se>
Tue, 30 Nov 2021 08:14:35 +0000 (09:14 +0100)
include/deal.II/fe/mapping_q.h
include/deal.II/fe/mapping_q_internal.h

index 7cf23032516b2fc58adb8ddefb4b59a21f583255..15be913847b3ae9748411275eaf6fed87fd96daf 100644 (file)
@@ -474,43 +474,51 @@ public:
      */
     QGaussLobatto<1> line_support_points;
 
+    /**
+     * A vectorized array type to reflect the necessary number of components
+     * for all interpolations to be done by this class.
+     */
+    using VectorizedArrayType =
+      VectorizedArray<double,
+                      std::min<std::size_t>(VectorizedArray<double>::size(),
+                                            (dim <= 2 ? 2 : 4))>;
+
     /**
      * In case the quadrature rule given represents a tensor product
      * we need to store the evaluations of the 1d polynomials at
      * the 1d quadrature points. That is what this variable is for.
      */
-    internal::MatrixFreeFunctions::ShapeInfo<VectorizedArray<double>>
-      shape_info;
+    internal::MatrixFreeFunctions::ShapeInfo<VectorizedArrayType> shape_info;
 
     /**
      * In case the quadrature rule given represents a tensor product
      * we need to store temporary data in this object.
      */
-    mutable AlignedVector<VectorizedArray<double>> scratch;
+    mutable AlignedVector<VectorizedArrayType> scratch;
 
     /**
      * In case the quadrature rule given represents a tensor product
      * the values at the mapped support points are stored in this object.
      */
-    mutable AlignedVector<VectorizedArray<double>> values_dofs;
+    mutable AlignedVector<VectorizedArrayType> values_dofs;
 
     /**
      * In case the quadrature rule given represents a tensor product
      * the values at the quadrature points are stored in this object.
      */
-    mutable AlignedVector<VectorizedArray<double>> values_quad;
+    mutable AlignedVector<VectorizedArrayType> values_quad;
 
     /**
      * In case the quadrature rule given represents a tensor product
      * the gradients at the quadrature points are stored in this object.
      */
-    mutable AlignedVector<VectorizedArray<double>> gradients_quad;
+    mutable AlignedVector<VectorizedArrayType> gradients_quad;
 
     /**
      * In case the quadrature rule given represents a tensor product
      * the hessians at the quadrature points are stored in this object.
      */
-    mutable AlignedVector<VectorizedArray<double>> hessians_quad;
+    mutable AlignedVector<VectorizedArrayType> hessians_quad;
 
     /**
      * Indicates whether the given Quadrature object is a tensor product.
index 3f432f3bcd1282f9f854f0693b93b2d253d3213c..9df99a0404480d82cdaedaab865a84d599d6fd5e 100644 (file)
@@ -1079,9 +1079,12 @@ namespace internal
     {
       const UpdateFlags update_flags = data.update_each;
 
+      using VectorizedArrayType =
+        typename dealii::MappingQ<dim,
+                                  spacedim>::InternalData::VectorizedArrayType;
       const unsigned int     n_shape_values = data.n_shape_functions;
       const unsigned int     n_q_points     = data.shape_info.n_q_points;
-      constexpr unsigned int n_lanes        = VectorizedArray<double>::size();
+      constexpr unsigned int n_lanes        = VectorizedArrayType::size();
       constexpr unsigned int n_comp         = 1 + (spacedim - 1) / n_lanes;
       constexpr unsigned int n_hessians     = (dim * (dim + 1)) / 2;
 
@@ -1148,7 +1151,7 @@ namespace internal
               }
 
           // do the actual tensorized evaluation
-          internal::FEEvaluationFactory<dim, double, VectorizedArray<double>>::
+          internal::FEEvaluationFactory<dim, double, VectorizedArrayType>::
             evaluate(n_comp,
                      evaluation_flag,
                      data.shape_info,

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.