]> https://gitweb.dealii.org/ - dealii.git/commitdiff
use is_vectorizable type trait in FEEvaluation classes
authorDenis Davydov <davydden@gmail.com>
Sat, 23 Feb 2019 19:14:04 +0000 (20:14 +0100)
committerDenis Davydov <davydden@gmail.com>
Sat, 23 Feb 2019 19:35:39 +0000 (20:35 +0100)
include/deal.II/matrix_free/fe_evaluation.h
tests/matrix_free/fe_evaluation_type_traits.cc
tests/matrix_free/fe_evaluation_type_traits.with_trilinos=true.output

index 3b498f167a64521d7c91caadf48cdc7492bf401f..56b5a6b2b261f0ab5b1809965112ed669c2c43d1 100644 (file)
@@ -3477,7 +3477,7 @@ namespace internal
   // if both begin() and local_element()
   // exist, then begin() + offset == local_element(offset)
   template <typename T, typename Number>
-  struct vectorizable
+  struct is_vectorizable
   {
     static constexpr bool value =
       has_begin<T>::value && has_local_element<T>::value &&
@@ -4084,6 +4084,10 @@ FEEvaluationBase<dim, n_components_, Number, is_face>::read_write_operation(
          ExcNotImplemented("Masking currently not implemented for "
                            "non-contiguous DoF storage"));
 
+  std::integral_constant<bool,
+                         internal::is_vectorizable<VectorType, Number>::value>
+    vector_selector;
+
   const unsigned int dofs_per_component =
     this->data->dofs_per_component_on_cell;
   if (dof_info->index_storage_variants
@@ -4102,28 +4106,17 @@ FEEvaluationBase<dim, n_components_, Number, is_face>::read_write_operation(
         for (unsigned int i = 0; i < dofs_per_component;
              ++i, dof_indices += n_vectorization)
           for (unsigned int comp = 0; comp < n_components; ++comp)
-            operation.process_dof_gather(
-              dof_indices,
-              *src[comp],
-              0,
-              values_dofs[comp][i],
-              std::integral_constant<
-                bool,
-                std::is_same<typename VectorType::value_type,
-                             Number>::value>());
+            operation.process_dof_gather(dof_indices,
+                                         *src[comp],
+                                         0,
+                                         values_dofs[comp][i],
+                                         vector_selector);
       else
         for (unsigned int comp = 0; comp < n_components; ++comp)
           for (unsigned int i = 0; i < dofs_per_component;
                ++i, dof_indices += n_vectorization)
             operation.process_dof_gather(
-              dof_indices,
-              *src[0],
-              0,
-              values_dofs[comp][i],
-              std::integral_constant<
-                bool,
-                std::is_same<typename VectorType::value_type,
-                             Number>::value>());
+              dof_indices, *src[0], 0, values_dofs[comp][i], vector_selector);
       return;
     }
 
@@ -4498,9 +4491,8 @@ FEEvaluationBase<dim, n_components_, Number, is_face>::
   // a vector and puts the data into the local data field or write local data
   // into the vector. Certain operations are no-ops for the given use case.
 
-  std::integral_constant<
-    bool,
-    std::is_same<typename VectorType::value_type, Number>::value>
+  std::integral_constant<bool,
+                         internal::is_vectorizable<VectorType, Number>::value>
                                                                vector_selector;
   const internal::MatrixFreeFunctions::DoFInfo::DoFAccessIndex ind =
     is_face ? dof_access_index :
@@ -7628,9 +7620,8 @@ FEFaceEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
     temp1 = this->scratch_data;
 
   internal::VectorReader<Number> reader;
-  std::integral_constant<
-    bool,
-    std::is_same<typename VectorType::value_type, Number>::value>
+  std::integral_constant<bool,
+                         internal::is_vectorizable<VectorType, Number>::value>
     vector_selector;
 
   // case 1: contiguous and interleaved indices
@@ -8188,9 +8179,8 @@ FEFaceEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
 #  endif
 
   internal::VectorDistributorLocalToGlobal<Number> writer;
-  std::integral_constant<
-    bool,
-    std::is_same<typename VectorType::value_type, Number>::value>
+  std::integral_constant<bool,
+                         internal::is_vectorizable<VectorType, Number>::value>
     vector_selector;
 
   // case 1: contiguous and interleaved indices
index 3655a18f2fad6bb942a081c41889b38a3f312d93..a5740384427150fe0251a5d7d914bf049c4df0c6 100644 (file)
@@ -137,19 +137,19 @@ main()
     << std::endl
     << "TrilinosWrappers::MPI::Vector = "
     << internal::has_begin<TrilinosWrappers::MPI::Vector>::value << std::endl;
-  // check vectorizable:
+  // check is_vectorizable:
   deallog
-    << "vectorizable:" << std::endl
+    << "is_vectorizable:" << std::endl
     << "LinearAlgebra::distributed::Vector<double> && double = "
-    << internal::vectorizable<LinearAlgebra::distributed::Vector<double>,
-                              double>::value
+    << internal::is_vectorizable<LinearAlgebra::distributed::Vector<double>,
+                                 double>::value
     << std::endl
     << "LinearAlgebra::distributed::Vector<double> && float = "
-    << internal::vectorizable<LinearAlgebra::distributed::Vector<double>,
-                              float>::value
+    << internal::is_vectorizable<LinearAlgebra::distributed::Vector<double>,
+                                 float>::value
     << std::endl
     << "TrilinosWrappers::MPI::Vector && double = "
-    << internal::vectorizable<TrilinosWrappers::MPI::Vector, double>::value
+    << internal::is_vectorizable<TrilinosWrappers::MPI::Vector, double>::value
     << std::endl;
 
   deallog << "OK" << std::endl;
index d514ab7eea0673611143de3d2a9ec59ab1f4ed17..d6140df3425535d14eb20ee38dcc4a2254a5da56 100644 (file)
@@ -13,7 +13,7 @@ DEAL::TrilinosWrappers::MPI::Vector = 0
 DEAL::has_begin:
 DEAL::LinearAlgebra::distributed::Vector = 1
 DEAL::TrilinosWrappers::MPI::Vector = 1
-DEAL::vectorizable:
+DEAL::is_vectorizable:
 DEAL::LinearAlgebra::distributed::Vector<double> && double = 1
 DEAL::LinearAlgebra::distributed::Vector<double> && float = 0
 DEAL::TrilinosWrappers::MPI::Vector && double = 0

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.