From: Peter Munch Date: Sun, 11 Jul 2021 06:01:07 +0000 (+0200) Subject: Enable different VectorTypes in MGCoarseGridIterativeSolver X-Git-Tag: v9.4.0-rc1~1139^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12562%2Fhead;p=dealii.git Enable different VectorTypes in MGCoarseGridIterativeSolver --- diff --git a/include/deal.II/multigrid/mg_coarse.h b/include/deal.II/multigrid/mg_coarse.h index 8095f24bc8..735fd91519 100644 --- a/include/deal.II/multigrid/mg_coarse.h +++ b/include/deal.II/multigrid/mg_coarse.h @@ -356,6 +356,58 @@ MGCoarseGridIterativeSolver::value, + VectorType>::type * = nullptr> + void + solve(SolverType & solver, + const MatrixType & matrix, + const PreconditionerType &preconditioner, + VectorType & dst, + const VectorType & src) + { + solver.solve(matrix, dst, src, preconditioner); + } + + template < + class VectorType, + class SolverType, + class MatrixType, + class PreconditionerType, + typename std::enable_if< + !std::is_same::value, + VectorType>::type * = nullptr> + void + solve(SolverType & solver, + const MatrixType & matrix, + const PreconditionerType &preconditioner, + VectorType & dst, + const VectorType & src) + { + typename SolverType::vector_type src_; + typename SolverType::vector_type dst_; + + src_ = src; + dst_ = dst; + + solver.solve(matrix, dst_, src_, preconditioner); + + dst = dst_; + } + } // namespace MGCoarseGridIterativeSolver +} // namespace internal + + + template solve(*matrix, dst, src, *preconditioner); + + internal::MGCoarseGridIterativeSolver::solve( + *solver, *matrix, *preconditioner, dst, src); }