diff --git a/dune/istl/paamg/test/twolevelmethodtest.cc b/dune/istl/paamg/test/twolevelmethodtest.cc index 75d4fe19f131312cf4f841074cb99319078b8501..68216a8b286b73ffa1a015d986b665167e2e54d6 100644 --- a/dune/istl/paamg/test/twolevelmethodtest.cc +++ b/dune/istl/paamg/test/twolevelmethodtest.cc @@ -83,6 +83,7 @@ void testTwoLevelMethod() transferPolicy, coarsePolicy); Dune::GeneralizedPCGSolver<Vector> amgCG(fop,preconditioner,1e-8,80,2); + Dune::Amg::TwoLevelMethod<Operator,Operator,FSmoother> preconditioner1(preconditioner); Dune::InverseOperatorResult res; amgCG.apply(x,b,res); } diff --git a/dune/istl/paamg/twolevelmethod.hh b/dune/istl/paamg/twolevelmethod.hh index 0f226cb1ffbda13bf0734c0842a6e6fe17f180ee..b6be5ee18e3d134c725572db32ee217e4c806cfa 100644 --- a/dune/istl/paamg/twolevelmethod.hh +++ b/dune/istl/paamg/twolevelmethod.hh @@ -262,13 +262,17 @@ private: : amg_(amg), first_(true) {} + AMGInverseOperator(const AMGInverseOperator& other) + : x_(other.x_), amg_(new AMGType(*other.amg_)), first_(other.first_) + {} + void apply(X& x, X& b, double reduction, InverseOperatorResult& res) { if(first_) { amg_->pre(x,b); first_=false; - x_.reset(new X(x)); + x_=&x; } amg_->apply(x,b); } @@ -284,8 +288,8 @@ private: amg_->post(*x_); } private: - shared_ptr<X> x_; - shared_ptr<AMGType> amg_; + X* x_; + AMGType* amg_; bool first_; }; @@ -387,7 +391,7 @@ public: TwoLevelMethod(const TwoLevelMethod& other) : operator_(other.operator_), coarseSolver_(other.coarseSolver_), - smoother_(other.smoother_), policy_(other.policy_.clone()), + smoother_(other.smoother_), policy_(other.policy_->clone()), preSteps_(preSteps_), postSteps_(postSteps_) {}