From: Karl Ljungkvist Date: Fri, 27 Jan 2017 13:08:17 +0000 (+0100) Subject: templatize interface operator wrt vector type X-Git-Tag: v8.5.0-rc1~197^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3857%2Fhead;p=dealii.git templatize interface operator wrt vector type This allows MGInterfaceOperator to work with all valid vector types, and not just LinearAlgebra::distributed::Vector --- 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());