Skip to content
Snippets Groups Projects
Commit 69329dd6 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Simplify using smoother as coarse solver

Is no base solver is provided, the MutliGridStep does now
do pre- and postsmoothing on the coarse level as it does
on any other level.
parent db225bc7
No related branches found
No related tags found
No related merge requests found
...@@ -146,6 +146,8 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess() ...@@ -146,6 +146,8 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess()
// Set up base solver // Set up base solver
// ///////////////////////////////////////////// // /////////////////////////////////////////////
if (basesolver_)
{
if (this->basesolver_ == NULL) if (this->basesolver_ == NULL)
DUNE_THROW(SolverError, "You have not provided a base solver!"); DUNE_THROW(SolverError, "You have not provided a base solver!");
...@@ -191,6 +193,7 @@ else { ...@@ -191,6 +193,7 @@ else {
<< " as a base solver in a MultigridStep!"); << " as a base solver in a MultigridStep!");
} }
} }
}
template<class MatrixType, class VectorType, class BitVectorType> template<class MatrixType, class VectorType, class BitVectorType>
...@@ -226,7 +229,7 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::iterate() ...@@ -226,7 +229,7 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::iterate()
std::vector<VectorType>& rhs = this->rhsHierarchy_; std::vector<VectorType>& rhs = this->rhsHierarchy_;
// Solve directly if we're looking at the coarse problem // Solve directly if we're looking at the coarse problem
if (level == 0) { if ((level == 0) and (basesolver_)) {
basesolver_->solve(); basesolver_->solve();
return; return;
} }
...@@ -239,6 +242,8 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::iterate() ...@@ -239,6 +242,8 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::iterate()
for (int i=0; i<this->nu1_; i++) for (int i=0; i<this->nu1_; i++)
presmoother_[level]->iterate(); presmoother_[level]->iterate();
if (level>0)
{
// ///////////////////////// // /////////////////////////
// Restriction // Restriction
...@@ -271,6 +276,7 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::iterate() ...@@ -271,6 +276,7 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::iterate()
VectorType tmp; VectorType tmp;
this->mgTransfer_[level-1]->prolong(*x[level-1], tmp); this->mgTransfer_[level-1]->prolong(*x[level-1], tmp);
*x[level] += tmp; *x[level] += tmp;
}
// Postsmoothing // Postsmoothing
postsmoother_[level]->setProblem(*(mat[level]), *x[level], rhs[level]); postsmoother_[level]->setProblem(*(mat[level]), *x[level], rhs[level]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment