Skip to content
Snippets Groups Projects
Commit 7fc564cb authored by Markus Blatt's avatar Markus Blatt
Browse files

Fixes copying of LevelTransferPolicy and AMGInverseOperator.

Previously copying of TowLevelMethod did not compile. In addition
the coarse solver was not copied as it should. This patch fixes this.
parent 3cafec5b
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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_)
{}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment