diff --git a/dune/solvers/iterationsteps/blockgsstep.cc b/dune/solvers/iterationsteps/blockgsstep.cc index dacb54608baeb2d1566b115a22922d898c8e3fd3..73b48c8ebcf509d7debdefdf81cd0072b5469f77 100644 --- a/dune/solvers/iterationsteps/blockgsstep.cc +++ b/dune/solvers/iterationsteps/blockgsstep.cc @@ -16,19 +16,15 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>:: residual(int index, VectorBlock& r) const { const MatrixType& mat = *this->mat_; - - typedef typename MatrixType::row_type RowType; - const RowType& row = mat[index]; - - typedef typename RowType::ConstIterator ColumnIterator; + const auto& row = mat[index]; r = (*this->rhs_)[index]; /* The following loop subtracts * \f[ sum_i = \sum_j A_{ij}w_j \f] */ - ColumnIterator cIt = row.begin(); - ColumnIterator cEndIt = row.end(); + auto cIt = row.begin(); + auto cEndIt = row.end(); for (; cIt!=cEndIt; ++cIt) { // r_i -= A_ij x_j @@ -64,14 +60,14 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate_step(int i) VectorBlock r; residual(i, r); + const auto& mat_ii = mat[i][i]; - // Compute x_i += A_{i,i}^{-1} r[i] + // Compute correction v = A_{i,i}^{-1} r[i] VectorBlock v; - VectorBlock& x = (*this->x_)[i]; if (count == 0) { // No degree of freedom shall be ignored --> solve linear problem - mat[i][i].solve(v, r); + mat_ii.solve(v, r); } else { // Copy the matrix and adjust rhs and matrix so that dofs given in ignoreNodes[i] // are not touched @@ -83,11 +79,12 @@ void BlockGSStep<MatrixType, DiscFuncType, BitVectorType>::iterate_step(int i) for (int k = 0; k < BlockSize; ++k) matRes[j][k] = (k == j); } else - matRes[j] = mat[i][i][j]; + matRes[j] = mat_ii[j]; } matRes.solve(v, r); } - // Add correction; + // Add correction + VectorBlock& x = (*this->x_)[i]; x += v; } diff --git a/dune/solvers/iterationsteps/blockgsstep.hh b/dune/solvers/iterationsteps/blockgsstep.hh index ded95ccd5cde666810899afefd1b602351d4d265..5858adcc4d2c156269b9b3ada8a7d9d426c6b307 100644 --- a/dune/solvers/iterationsteps/blockgsstep.hh +++ b/dune/solvers/iterationsteps/blockgsstep.hh @@ -20,7 +20,7 @@ template<class MatrixType, class BlockGSStep : public LinearIterationStep<MatrixType, DiscFuncType, BitVectorType> { - typedef typename DiscFuncType::block_type VectorBlock; + using VectorBlock = typename DiscFuncType::block_type; enum {BlockSize = VectorBlock::dimension};