From 44dc9916c37dab90c232e1d9347aaecc5871d312 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Mon, 25 May 2009 16:35:10 +0000 Subject: [PATCH] Directly compute the iteration radius when no preconditioner is given [[Imported from SVN: r2452]] --- dune-solvers/solvers/tcgsolver.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dune-solvers/solvers/tcgsolver.cc b/dune-solvers/solvers/tcgsolver.cc index 20b4c199..2d96de94 100644 --- a/dune-solvers/solvers/tcgsolver.cc +++ b/dune-solvers/solvers/tcgsolver.cc @@ -108,6 +108,22 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve() << std::endl; #endif + if (preconditioner_==NULL) { + + correctionNormSquared = trustRegionScalarProduct(p,p); + solutionTimesCorrection = trustRegionScalarProduct(*x_,p); + solutionNormSquared = trustRegionScalarProduct(*x_,*x_); + + } + + if (correctionNormSquared <= 0) { + + if (this->historyBuffer_!="") + this->writeIterate(*x_, i); + return; + + } + // if energy is concave in the search direction go to the boundary and stop there if (energyNormSquared <= 0) { @@ -146,7 +162,7 @@ void TruncatedCGSolver<MatrixType, VectorType>::solve() // std::cout << "tentative radius^2: " << trustRegionScalarProduct(tentativeNewIterate,tentativeNewIterate) // << std::endl; - std::cout << "tentative length^2: " << tentativeLengthSquared << std::endl; + //std::cout << "tentative length^2: " << tentativeLengthSquared << std::endl; if (tentativeLengthSquared >= trustRegionRadius_*trustRegionRadius_) { -- GitLab