From 94577d70151a1511215cb7183aaea3fc2d0fe5c8 Mon Sep 17 00:00:00 2001
From: Ansgar Burchardt <Ansgar.Burchardt@tu-dresden.de>
Date: Tue, 3 Jul 2018 17:09:37 +0200
Subject: [PATCH] AMGStep: override `apply`

The generic version doesn't know about the `residual_` member.

It would be better if the generic version would call
`setProblem(x, rhs)`, but this variant of `setProblem` doesn't exist.
---
 dune/solvers/iterationsteps/amgstep.hh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dune/solvers/iterationsteps/amgstep.hh b/dune/solvers/iterationsteps/amgstep.hh
index b08a9347..fb68fde9 100644
--- a/dune/solvers/iterationsteps/amgstep.hh
+++ b/dune/solvers/iterationsteps/amgstep.hh
@@ -74,6 +74,8 @@ public:
     /** \brief Perform one iteration */
     void iterate() override;
 
+    void apply(VectorType& x, const VectorType& rhs) override;
+
     /** \brief Arguments for the smoother.  See the dune-istl documentation for details */
     SmootherArgs smootherArgs_;
 
@@ -114,6 +116,16 @@ void AMGStep<MatrixType,VectorType>::iterate()
     amg_->apply(*this->x_, residual_);
 }
 
+template <class MatrixType, class VectorType>
+void AMGStep<MatrixType,VectorType>::apply(VectorType& x, const VectorType& rhs)
+{
+    x = 0;
+    this->x_ = &x;
+    residual_ = rhs;
+    preprocess();
+    iterate();
+}
+
 } /* namespace Solvers */
 } /* namespace Dune */
 
-- 
GitLab