diff --git a/dune-solvers/solvers/tcgsolver.cc b/dune-solvers/solvers/tcgsolver.cc index 20b4c199df686d55fcf81e66a983903f48251b14..2d96de9466e3c31538bcbef2b724efce75b1bc4b 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_) {