diff --git a/dune/solvers/iterationsteps/multigridstep.cc b/dune/solvers/iterationsteps/multigridstep.cc index 407421bf2c1b89dcdc4aebcf420f65999c80f70b..f80256371477a91436f3d049dd9cc681c1ab0ebb 100644 --- a/dune/solvers/iterationsteps/multigridstep.cc +++ b/dune/solvers/iterationsteps/multigridstep.cc @@ -5,16 +5,9 @@ #include <dune/solvers/transferoperators/multigridtransfer.hh> #include <dune/solvers/solvers/loopsolver.hh> +#include <dune/solvers/solvers/linearsolver.hh> #include <dune/solvers/common/genericvectortools.hh> -#if HAVE_IPOPT -#include <dune/solvers/solvers/quadraticipopt.hh> -#endif - -#if HAVE_UMFPACK -#include <dune/solvers/solvers/umfpacksolver.hh> -#endif - //template<class MatrixType, class VectorType, class BitVectorType> //inline //const MatrixType* MultigridStep<MatrixType, VectorType, BitVectorType>:: @@ -164,26 +157,12 @@ void MultigridStep<MatrixType, VectorType, BitVectorType>::preprocess() dynamic_cast<SmootherType*>(loopBaseSolver->iterationStep_)->ignoreNodes_ = ignoreNodesHierarchy_[0]; } - // TODO: The following two #if-clauses do the exactly the same thing: they call setProblem - // However, we cannot write the code generically because there is no general abstraction - // for solvers that I can call 'setProblem' for. -#if HAVE_IPOPT - else if (typeid(*this->basesolver_) == typeid(QuadraticIPOptSolver<MatrixType,VectorType>)) { - - QuadraticIPOptSolver<MatrixType,VectorType>* ipoptBaseSolver = dynamic_cast<QuadraticIPOptSolver<MatrixType,VectorType>*> (this->basesolver_); - - ipoptBaseSolver->setProblem(*(this->matrixHierarchy_[0]), *this->xHierarchy_[0], this->rhsHierarchy_[0]); - } -#endif -#if HAVE_UMFPACK - else if (typeid(*this->basesolver_) == typeid(Dune::Solvers::UMFPackSolver<MatrixType,VectorType>)) { + else if (typeid(*this->basesolver_) == typeid(LinearSolver<MatrixType,VectorType>)) { - Dune::Solvers::UMFPackSolver<MatrixType,VectorType>* umfpackBaseSolver - = dynamic_cast<Dune::Solvers::UMFPackSolver<MatrixType,VectorType>*> (this->basesolver_); + LinearSolver<MatrixType,VectorType>* linearBaseSolver = dynamic_cast<LinearSolver<MatrixType,VectorType>*> (this->basesolver_); - umfpackBaseSolver->setProblem(*(this->matrixHierarchy_[0]), *this->xHierarchy_[0], this->rhsHierarchy_[0]); + linearBaseSolver->setProblem(*(this->matrixHierarchy_[0]), *this->xHierarchy_[0], this->rhsHierarchy_[0]); } -#endif else { DUNE_THROW(SolverError, "You can't use " << typeid(*this->basesolver_).name() << " as a base solver in a MultigridStep!");