From 1ce3a1c4de85f3c3da42f5eecf9f4d23ac83b837 Mon Sep 17 00:00:00 2001 From: Karl Ljungkvist Date: Fri, 27 Jan 2017 14:08:17 +0100 Subject: [PATCH] templatize interface operator wrt vector type This allows MGInterfaceOperator to work with all valid vector types, and not just LinearAlgebra::distributed::Vector --- include/deal.II/matrix_free/operators.h | 36 +++++++++++++++++++------ 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index 4e4d63e15c..fa27b7bee1 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -313,14 +313,16 @@ namespace MatrixFreeOperators /** * vmult operator, see class description for more info. */ - void vmult (LinearAlgebra::distributed::Vector &dst, - const LinearAlgebra::distributed::Vector &src) const; + template + void vmult (VectorType &dst, + const VectorType &src) const; /** * Tvmult operator, see class description for more info. */ - void Tvmult (LinearAlgebra::distributed::Vector &dst, - const LinearAlgebra::distributed::Vector &src) const; + template + void Tvmult (VectorType &dst, + const VectorType &src) const; private: /** @@ -1090,10 +1092,19 @@ namespace MatrixFreeOperators template + template void - MGInterfaceOperator::vmult (LinearAlgebra::distributed::Vector::value_type> &dst, - const LinearAlgebra::distributed::Vector::value_type> &src) const + MGInterfaceOperator::vmult (VectorType &dst, + const VectorType &src) const { +#ifdef DEAL_II_WITH_CXX11 +#ifndef DEAL_II_MSVC + static_assert (std::is_same::value, + "The vector type must be based on the same value type as this" + "operator"); +#endif +#endif + Assert(mf_base_operator != NULL, ExcNotInitialized()); @@ -1103,10 +1114,19 @@ namespace MatrixFreeOperators template + template void - MGInterfaceOperator::Tvmult (LinearAlgebra::distributed::Vector::value_type> &dst, - const LinearAlgebra::distributed::Vector::value_type> &src) const + MGInterfaceOperator::Tvmult (VectorType &dst, + const VectorType &src) const { +#ifdef DEAL_II_WITH_CXX11 +#ifndef DEAL_II_MSVC + static_assert (std::is_same::value, + "The vector type must be based on the same value type as this" + "operator"); +#endif +#endif + Assert(mf_base_operator != NULL, ExcNotInitialized()); -- 2.39.5