Skip to content
Snippets Groups Projects
Commit 18f98962 authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

AMGStep: always setup dune-istl's AMG in `preprocess`

The `amg_` member initialized in the constructor is never used as
`preprocess()` unconditionally resets it.

We also create `fop_` only in `preprocess()` to have only one place
when it is initialized.
parent a4141401
No related branches found
No related tags found
No related merge requests found
...@@ -47,10 +47,6 @@ public: ...@@ -47,10 +47,6 @@ public:
const Criterion& coarseningCriterion) const Criterion& coarseningCriterion)
{ {
setProblem(*stiffnessMatrix, x, rhs); setProblem(*stiffnessMatrix, x, rhs);
fop_ = std::unique_ptr<Operator>(new Operator(*stiffnessMatrix));
amg_ = std::unique_ptr<AMG>(new AMG(*fop_, coarseningCriterion, smootherArgs));
amg_->pre(*this->x_, residual_);
} }
/** \brief Initialize the iteration step but don't actually build the matrix hierarchy yet */ /** \brief Initialize the iteration step but don't actually build the matrix hierarchy yet */
...@@ -68,7 +64,6 @@ public: ...@@ -68,7 +64,6 @@ public:
{ {
LinearIterationStep<MatrixType, VectorType>::setProblem(stiffnessMatrix, x, rhs); LinearIterationStep<MatrixType, VectorType>::setProblem(stiffnessMatrix, x, rhs);
fop_ = std::unique_ptr<Operator>(new Operator(stiffnessMatrix));
residual_ = rhs; residual_ = rhs;
} }
...@@ -108,6 +103,7 @@ template <class MatrixType, class VectorType> ...@@ -108,6 +103,7 @@ template <class MatrixType, class VectorType>
void AMGStep<MatrixType,VectorType>::preprocess() void AMGStep<MatrixType,VectorType>::preprocess()
{ {
setupCoarseningCriterion(); setupCoarseningCriterion();
fop_ = std::unique_ptr<Operator>(new Operator(*this->getMatrix()));
amg_ = std::unique_ptr<AMG>(new AMG(*fop_, coarseningCriterion_, smootherArgs_)); amg_ = std::unique_ptr<AMG>(new AMG(*fop_, coarseningCriterion_, smootherArgs_));
amg_->pre(*this->x_, residual_); amg_->pre(*this->x_, residual_);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment