diff --git a/dune/solvers/solvers/tcgsolver.cc b/dune/solvers/solvers/tcgsolver.cc index 787dfc0b661bb344bf0c26303ef1d8e5219a78fc..88553ebf527c7c6e7999d2fa850886d6c79b28d8 100644 --- a/dune/solvers/solvers/tcgsolver.cc +++ b/dune/solvers/solvers/tcgsolver.cc @@ -11,9 +11,6 @@ void TruncatedCGSolver<MatrixType, VectorType>::check() const if (preconditioner_) preconditioner_->check(); - if (!errorNorm_) - DUNE_THROW(SolverError, "You need to supply a norm to a CG solver!"); - } template <class MatrixType, class VectorType> @@ -221,10 +218,10 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve() // ////////////////////////////////////////////////// // Compute error // ////////////////////////////////////////////////// - field_type oldNorm = errorNorm_->operator()(oldSolution); + field_type oldNorm = (errorNorm_) ? errorNorm_->operator()(oldSolution) : oldSolution.two_norm(); oldSolution -= *x_; - field_type normOfCorrection = errorNorm_->operator()(oldSolution); + field_type normOfCorrection = (errorNorm_) ? errorNorm_->operator()(oldSolution) : oldSolution.two_norm(); if (this->useRelativeError_) error = normOfCorrection / oldNorm;