From 2b43402ec932207659c6a6224dee6ac7d9016f2a Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Mon, 9 Dec 2013 14:36:24 +0000 Subject: [PATCH] Do not require the user to set an error norm If no norm is given, the error is measured in the l^2 norm [[Imported from SVN: r12439]] --- dune/solvers/solvers/tcgsolver.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dune/solvers/solvers/tcgsolver.cc b/dune/solvers/solvers/tcgsolver.cc index 787dfc0..88553eb 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; -- GitLab