]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CellwiseInverseMassMatrix::transform_from_q_points_to_basis: for degree = -1 and... 12390/head
authorPeter Munch <peterrmuench@gmail.com>
Fri, 4 Jun 2021 17:22:48 +0000 (19:22 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 4 Jun 2021 19:42:34 +0000 (21:42 +0200)
include/deal.II/matrix_free/evaluation_kernels.h
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

index b06955fa6199c3fd577fcda2ea9749800bc80331..4901a4a2df5a32f5d0f87bc6d76a0fd7c27af448 100644 (file)
@@ -4351,12 +4351,18 @@ namespace internal
   {
     template <int fe_degree, int = 0>
     static bool
-    run(const unsigned int           n_desired_components,
-        const AlignedVector<Number> &inverse_shape,
-        const Number *               in_array,
-        Number *                     out_array,
+    run(const unsigned int                  n_desired_components,
+        const FEEvaluationBaseData<dim,
+                                   typename Number::value_type,
+                                   false,
+                                   Number> &fe_eval,
+        const Number *                      in_array,
+        Number *                            out_array,
         typename std::enable_if<fe_degree != -1>::type * = nullptr)
     {
+      const AlignedVector<Number> &inverse_shape =
+        fe_eval.get_shape_info().data.front().inverse_shape_values_eo;
+
       constexpr unsigned int dofs_per_cell = Utilities::pow(fe_degree + 1, dim);
       internal::EvaluatorTensorProduct<internal::evaluate_evenodd,
                                        dim,
@@ -4391,14 +4397,54 @@ namespace internal
 
     template <int fe_degree, int = 0>
     static bool
-    run(const unsigned int,
-        const AlignedVector<Number> &,
-        const Number *,
-        Number *,
+    run(const unsigned int                  n_desired_components,
+        const FEEvaluationBaseData<dim,
+                                   typename Number::value_type,
+                                   false,
+                                   Number> &fe_eval,
+        const Number *                      in_array,
+        Number *                            out_array,
         typename std::enable_if<fe_degree == -1>::type * = nullptr)
     {
       static_assert(fe_degree == -1, "Only usable for degree -1");
-      Assert(false, ExcNotImplemented());
+
+      const AlignedVector<Number> &inverse_shape =
+        fe_eval.get_shape_info().data.front().inverse_shape_values;
+
+      const unsigned int dofs_per_component =
+        fe_eval.get_shape_info().dofs_per_component_on_cell;
+      const unsigned int n_q_points = fe_eval.get_shape_info().n_q_points;
+
+      internal::
+        EvaluatorTensorProduct<internal::evaluate_general, dim, 0, 0, Number>
+          evaluator(inverse_shape,
+                    AlignedVector<Number>(),
+                    AlignedVector<Number>(),
+                    fe_eval.get_shape_info().data.front().fe_degree + 1,
+                    fe_eval.get_shape_info().data.front().n_q_points_1d);
+
+      auto temp_1 = fe_eval.get_scratch_data().begin();
+      auto temp_2 = temp_1 + std::max(n_q_points, dofs_per_component);
+
+      for (unsigned int d = 0; d < n_desired_components; ++d)
+        {
+          const Number *in  = in_array + d * n_q_points;
+          Number *      out = out_array + d * dofs_per_component;
+
+          if (dim == 3)
+            {
+              evaluator.template values<2, false, false>(in, temp_1);
+              evaluator.template values<1, false, false>(temp_1, temp_2);
+              evaluator.template values<0, false, false>(temp_2, out);
+            }
+          if (dim == 2)
+            {
+              evaluator.template values<1, false, false>(in, temp_1);
+              evaluator.template values<0, false, false>(temp_1, out);
+            }
+          if (dim == 1)
+            evaluator.template values<0, false, false>(in, out);
+        }
       return false;
     }
   };
index 2523f20d32f5d0c4a1b840e80ec827f40b33f8a6..5b596874b3d2a32908f45347c8dfe4c0132b6772 100644 (file)
@@ -178,11 +178,12 @@ namespace internal
 
     static void
     transform_from_q_points_to_basis(
-      const unsigned int                        n_components,
-      const unsigned int                        fe_degree,
-      const AlignedVector<VectorizedArrayType> &inverse_shape,
-      const VectorizedArrayType *               in_array,
-      VectorizedArrayType *                     out_array);
+      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);
   };
 
 } // end of namespace internal
index 6256b0bca59aa9f5b2a4ae0f6c78c4c16fa8fa65..bbd5bf4443c0fea7e9743e51f6734bdc2ce62de7 100644 (file)
@@ -387,22 +387,18 @@ namespace internal
   void
   CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
     transform_from_q_points_to_basis(
-      const unsigned int                        n_components,
-      const unsigned int                        fe_degree,
-      const AlignedVector<VectorizedArrayType> &inverse_shape,
-      const VectorizedArrayType *               in_array,
-      VectorizedArrayType *                     out_array)
+      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)
   {
     instantiation_helper_run<
       1,
       CellwiseInverseMassMatrixImplTransformFromQPoints<dim,
                                                         VectorizedArrayType>>(
-      fe_degree,
-      fe_degree + 1,
-      n_components,
-      inverse_shape,
-      in_array,
-      out_array);
+      fe_degree, fe_degree + 1, n_components, fe_eval, in_array, out_array);
   }
 
 } // end of namespace internal
index 0a36f49c3bc82c0a6f5bee3a86d053e4e3f04289..971b5d9e059232ed2da1b57294eb7b9aad441c82 100644 (file)
@@ -1067,9 +1067,7 @@ namespace MatrixFreeOperators
     internal::CellwiseInverseMassMatrixImplTransformFromQPoints<
       dim,
       VectorizedArrayType>::template run<fe_degree>(n_actual_components,
-                                                    fe_eval.get_shape_info()
-                                                      .data.front()
-                                                      .inverse_shape_values_eo,
+                                                    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.