diff --git a/dune/solvers/iterationsteps/amgstep.hh b/dune/solvers/iterationsteps/amgstep.hh index b08a9347438b0e11627dc994442845aefc617b5b..fb68fde966ace7990219e680d21a6dd70b3f7908 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 */