diff --git a/dune/solvers/iterationsteps/truncatedblockgsstep.hh b/dune/solvers/iterationsteps/truncatedblockgsstep.hh index d68db41a5bb81abade22447e41e19e4fd1bad317..b9d41ca82bf77f61bd43373076cc571611fbdf13 100644 --- a/dune/solvers/iterationsteps/truncatedblockgsstep.hh +++ b/dune/solvers/iterationsteps/truncatedblockgsstep.hh @@ -27,11 +27,14 @@ class TruncatedBlockGSStep public: //! Default constructor. Doesn't init anything - TruncatedBlockGSStep() {} + TruncatedBlockGSStep(int innerLoops=1) : + innerLoops_(innerLoops) + {} //! Constructor with a linear problem - TruncatedBlockGSStep(MatrixType& mat, VectorType& x, VectorType& rhs) - : LinearIterationStep<MatrixType,VectorType>(mat, x, rhs) + TruncatedBlockGSStep(MatrixType& mat, VectorType& x, VectorType& rhs, int innerLoops=1) + : LinearIterationStep<MatrixType,VectorType>(mat, x, rhs), + innerLoops_(innerLoops) {} virtual VectorType getSol() @@ -42,8 +45,11 @@ public: //! Perform one iteration virtual void iterate() { - TruncatedBlockGSStepNS::RecursiveGSStep<MatrixType::blocklevel>::apply(*this->mat_, *this->rhs_, *this->ignoreNodes_, *this->x_); + TruncatedBlockGSStepNS::RecursiveGSStep<MatrixType::blocklevel>::apply(*this->mat_, *this->rhs_, *this->ignoreNodes_, *this->x_, innerLoops_); } + +protected: + int innerLoops_; }; @@ -58,7 +64,7 @@ template<int blocklevel> struct RecursiveGSStep { template<class MType, class VType, class BVType> - static void apply(const MType& mat, const VType& rhs, const BVType& ignore, VType& x) + static void apply(const MType& mat, const VType& rhs, const BVType& ignore, VType& x, int innerLoops) { typedef typename MType::row_type::ConstIterator ColumnIterator; typedef typename MType::block_type MBlock; @@ -81,7 +87,8 @@ struct RecursiveGSStep } if (Aii!=0) - RecursiveGSStep<MBlock::blocklevel>::apply(*Aii, r, ignore[row], x[row]); + for(int i=0; i<innerLoops; ++i) + RecursiveGSStep<MBlock::blocklevel>::apply(*Aii, r, ignore[row], x[row], innerLoops); } } }; @@ -92,7 +99,7 @@ template<> struct RecursiveGSStep<1> { template<class MType, class VType, class BVType> - static void apply(const MType& mat, const VType& rhs, const BVType& ignore, VType& x) + static void apply(const MType& mat, const VType& rhs, const BVType& ignore, VType& x, int innerLoops) { typedef typename MType::block_type MBlock;