From b86b84f068d8a2db073ec90e36be65daa6a9820f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz>
Date: Tue, 1 Dec 2015 14:27:28 +0100
Subject: [PATCH] Fixed bug in GMRES solver.

The nextIteration() method should not be called here because it
increments the iteration counter.
---
 src/solvers/linear/krylov/tnlGMRESSolver_impl.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/solvers/linear/krylov/tnlGMRESSolver_impl.h b/src/solvers/linear/krylov/tnlGMRESSolver_impl.h
index 770cb26b31..5b1e4fc90d 100644
--- a/src/solvers/linear/krylov/tnlGMRESSolver_impl.h
+++ b/src/solvers/linear/krylov/tnlGMRESSolver_impl.h
@@ -251,14 +251,14 @@ bool tnlGMRESSolver< Matrix, Preconditioner > :: solve( const Vector& b, Vector&
                              sn[ i ] );
 
          this->setResidue( fabs( s[ i + 1 ] ) / normb );
-         if( this->nextIteration() ) {
-            this->refreshSolverMonitor();
-         }
-         else {
+         if( this->getIterations() > this->getMinIterations() && this->getResidue() < this->getConvergenceResidue() ) {
             update( i, m, _H, _s, _v, x );
             this->refreshSolverMonitor( true );
             return this->checkConvergence();
          }
+         else {
+            this->refreshSolverMonitor();
+         }
       }
       update( m - 1, m, _H, _s, _v, x );
 
-- 
GitLab