From d337ecccd2ce682e604c2f1a48f53638274f7cec Mon Sep 17 00:00:00 2001 From: kanschat Date: Mon, 18 Mar 2013 14:56:11 +0000 Subject: [PATCH] support mixed accuracy preconditioning git-svn-id: https://svn.dealii.org/trunk@28930 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/iterative_inverse.h | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/deal.II/include/deal.II/lac/iterative_inverse.h b/deal.II/include/deal.II/lac/iterative_inverse.h index 9d0d38e8da..a93dd3369d 100644 --- a/deal.II/include/deal.II/lac/iterative_inverse.h +++ b/deal.II/include/deal.II/lac/iterative_inverse.h @@ -77,7 +77,7 @@ public: /** * Initialization * function. Provide a matrix and - * preconditioner for th solve in + * preconditioner for the solve in * vmult(). */ template @@ -94,6 +94,14 @@ public: */ void vmult (VECTOR &dst, const VECTOR &src) const; + /** + * Solve for right hand side src, but allow for the fact + * that the vectors given to this function have different type from + * the vectors used by the inner solver. + */ + template + void vmult (VECTOR2 &dst, const VECTOR2 &src) const; + /** * The solver, which allows * selection of the actual solver @@ -144,10 +152,28 @@ IterativeInverse::vmult (VECTOR &dst, const VECTOR &src) const { Assert(matrix.get() != 0, ExcNotInitialized()); Assert(preconditioner.get() != 0, ExcNotInitialized()); + dst = 0.; solver.solve(*matrix, dst, src, *preconditioner); } +template +template +inline void +IterativeInverse::vmult (VECTOR2 &dst, const VECTOR2 &src) const +{ + Assert(matrix.get() != 0, ExcNotInitialized()); + Assert(preconditioner.get() != 0, ExcNotInitialized()); + GrowingVectorMemory mem; + typename VectorMemory::Pointer sol(mem); + typename VectorMemory::Pointer rhs(mem); + sol->reinit(dst); + *rhs = src; + solver.solve(*matrix, *sol, *rhs, *preconditioner); + dst = *sol; +} + + DEAL_II_NAMESPACE_CLOSE -- 2.39.5