};
+ // type trait for vector T and Number to see if
+ // we can do vectorized load/save.
+ // for VectorReader and VectorDistributorLocalToGlobal we assume that
+ // if both begin() and local_element()
+ // exist, then begin() + offset == local_element(offset)
+ template <typename T, typename Number>
+ struct vectorizable
+ {
+ static constexpr bool value =
+ has_begin<T>::value && has_local_element<T>::value &&
+ std::is_same<typename T::value_type, Number>::value;
+ };
+
+
+
// access to generic vectors that have operator ().
// FIXME: this is wrong for Trilinos/Petsc MPI vectors
+ // where we should first do Partitioner::local_to_global()
template <typename VectorType,
typename std::enable_if<!has_local_element<VectorType>::value,
VectorType>::type * = nullptr>
TrilinosWrappers::MPI::Vector>::value
<< std::endl;
- // check has_begin():
+ // check has_begin:
deallog
<< "has_begin:" << std::endl
<< "LinearAlgebra::distributed::Vector = "
<< std::endl
<< "TrilinosWrappers::MPI::Vector = "
<< internal::has_begin<TrilinosWrappers::MPI::Vector>::value << std::endl;
+ // check vectorizable:
+ deallog
+ << "vectorizable:" << std::endl
+ << "LinearAlgebra::distributed::Vector<double> && double = "
+ << internal::vectorizable<LinearAlgebra::distributed::Vector<double>,
+ double>::value
+ << std::endl
+ << "LinearAlgebra::distributed::Vector<double> && float = "
+ << internal::vectorizable<LinearAlgebra::distributed::Vector<double>,
+ float>::value
+ << std::endl
+ << "TrilinosWrappers::MPI::Vector && double = "
+ << internal::vectorizable<TrilinosWrappers::MPI::Vector, double>::value
+ << std::endl;
deallog << "OK" << std::endl;
}
DEAL::has_begin:
DEAL::LinearAlgebra::distributed::Vector = 1
DEAL::TrilinosWrappers::MPI::Vector = 1
+DEAL::vectorizable:
+DEAL::LinearAlgebra::distributed::Vector<double> && double = 1
+DEAL::LinearAlgebra::distributed::Vector<double> && float = 0
+DEAL::TrilinosWrappers::MPI::Vector && double = 0
DEAL::OK