]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add process_dofs_vectorized_transpose() variants with constant_offset 14346/head
authorPeter Munch <peterrmuench@gmail.com>
Mon, 10 Oct 2022 13:59:58 +0000 (15:59 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 2 Jun 2023 07:32:56 +0000 (09:32 +0200)
include/deal.II/matrix_free/vector_access_internal.h

index abc647baab40daaf960e503117000777e56c780a..ca9f738a3c78e7c989cc652894e7a961af12f23d 100644 (file)
@@ -348,11 +348,12 @@ namespace internal
     process_dofs_vectorized_transpose(const unsigned int   dofs_per_cell,
                                       const unsigned int * dof_indices,
                                       VectorType &         vec,
+                                      const unsigned int   constant_offset,
                                       VectorizedArrayType *dof_values,
                                       std::integral_constant<bool, true>) const
     {
       dealii::vectorized_load_and_transpose(dofs_per_cell,
-                                            vec.begin(),
+                                            vec.begin() + constant_offset,
                                             dof_indices,
                                             dof_values);
     }
@@ -364,12 +365,44 @@ namespace internal
     process_dofs_vectorized_transpose(const unsigned int   dofs_per_cell,
                                       const unsigned int * dof_indices,
                                       const VectorType &   vec,
+                                      const unsigned int   constant_offset,
                                       VectorizedArrayType *dof_values,
                                       std::integral_constant<bool, false>) const
     {
       for (unsigned int d = 0; d < dofs_per_cell; ++d)
         for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
-          dof_values[d][v] = vector_access(vec, dof_indices[v] + d);
+          dof_values[d][v] =
+            vector_access(vec, dof_indices[v] + constant_offset + d);
+    }
+
+
+
+    template <typename VectorType>
+    void
+    process_dofs_vectorized_transpose(
+      const unsigned int                 dofs_per_cell,
+      const unsigned int *               dof_indices,
+      VectorType &                       vec,
+      VectorizedArrayType *              dof_values,
+      std::integral_constant<bool, true> type) const
+    {
+      process_dofs_vectorized_transpose(
+        dofs_per_cell, dof_indices, vec, 0, dof_values, type);
+    }
+
+
+
+    template <typename VectorType>
+    void
+    process_dofs_vectorized_transpose(
+      const unsigned int                  dofs_per_cell,
+      const unsigned int *                dof_indices,
+      const VectorType &                  vec,
+      VectorizedArrayType *               dof_values,
+      std::integral_constant<bool, false> type) const
+    {
+      process_dofs_vectorized_transpose(
+        dofs_per_cell, dof_indices, vec, 0, dof_values, type);
     }
 
 
@@ -556,11 +589,15 @@ namespace internal
     process_dofs_vectorized_transpose(const unsigned int   dofs_per_cell,
                                       const unsigned int * dof_indices,
                                       VectorType &         vec,
+                                      const unsigned int   constant_offset,
                                       VectorizedArrayType *dof_values,
                                       std::integral_constant<bool, true>) const
     {
-      vectorized_transpose_and_store(
-        true, dofs_per_cell, dof_values, dof_indices, vec.begin());
+      vectorized_transpose_and_store(true,
+                                     dofs_per_cell,
+                                     dof_values,
+                                     dof_indices,
+                                     vec.begin() + constant_offset);
     }
 
 
@@ -570,12 +607,45 @@ namespace internal
     process_dofs_vectorized_transpose(const unsigned int   dofs_per_cell,
                                       const unsigned int * dof_indices,
                                       VectorType &         vec,
+                                      const unsigned int   constant_offset,
                                       VectorizedArrayType *dof_values,
                                       std::integral_constant<bool, false>) const
     {
       for (unsigned int d = 0; d < dofs_per_cell; ++d)
         for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
-          vector_access_add(vec, dof_indices[v] + d, dof_values[d][v]);
+          vector_access_add(vec,
+                            dof_indices[v] + constant_offset + d,
+                            dof_values[d][v]);
+    }
+
+
+
+    template <typename VectorType>
+    void
+    process_dofs_vectorized_transpose(
+      const unsigned int                 dofs_per_cell,
+      const unsigned int *               dof_indices,
+      VectorType &                       vec,
+      VectorizedArrayType *              dof_values,
+      std::integral_constant<bool, true> type) const
+    {
+      process_dofs_vectorized_transpose(
+        dofs_per_cell, dof_indices, vec, 0, dof_values, type);
+    }
+
+
+
+    template <typename VectorType>
+    void
+    process_dofs_vectorized_transpose(
+      const unsigned int                  dofs_per_cell,
+      const unsigned int *                dof_indices,
+      VectorType &                        vec,
+      VectorizedArrayType *               dof_values,
+      std::integral_constant<bool, false> type) const
+    {
+      process_dofs_vectorized_transpose(
+        dofs_per_cell, dof_indices, vec, 0, dof_values, type);
     }
 
 
@@ -752,11 +822,15 @@ namespace internal
     process_dofs_vectorized_transpose(const unsigned int   dofs_per_cell,
                                       const unsigned int * dof_indices,
                                       VectorType &         vec,
+                                      const unsigned int   constant_offset,
                                       VectorizedArrayType *dof_values,
                                       std::integral_constant<bool, true>) const
     {
-      vectorized_transpose_and_store(
-        false, dofs_per_cell, dof_values, dof_indices, vec.begin());
+      vectorized_transpose_and_store(false,
+                                     dofs_per_cell,
+                                     dof_values,
+                                     dof_indices,
+                                     vec.begin() + constant_offset);
     }
 
 
@@ -766,12 +840,44 @@ namespace internal
     process_dofs_vectorized_transpose(const unsigned int   dofs_per_cell,
                                       const unsigned int * dof_indices,
                                       VectorType &         vec,
+                                      const unsigned int   constant_offset,
                                       VectorizedArrayType *dof_values,
                                       std::integral_constant<bool, false>) const
     {
       for (unsigned int i = 0; i < dofs_per_cell; ++i)
         for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
-          vector_access(vec, dof_indices[v] + i) = dof_values[i][v];
+          vector_access(vec, constant_offset + dof_indices[v] + i) =
+            dof_values[i][v];
+    }
+
+
+
+    template <typename VectorType>
+    void
+    process_dofs_vectorized_transpose(
+      const unsigned int                 dofs_per_cell,
+      const unsigned int *               dof_indices,
+      VectorType &                       vec,
+      VectorizedArrayType *              dof_values,
+      std::integral_constant<bool, true> type) const
+    {
+      process_dofs_vectorized_transpose(
+        dofs_per_cell, dof_indices, vec, 0, dof_values, type);
+    }
+
+
+
+    template <typename VectorType, bool booltype>
+    void
+    process_dofs_vectorized_transpose(
+      const unsigned int                  dofs_per_cell,
+      const unsigned int *                dof_indices,
+      VectorType &                        vec,
+      VectorizedArrayType *               dof_values,
+      std::integral_constant<bool, false> type) const
+    {
+      process_dofs_vectorized_transpose(
+        dofs_per_cell, dof_indices, vec, 0, dof_values, type);
     }
 
 

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.