From d07a8dbb2ab7da0ab2f101c148c5707ba3bf7e8c Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Fri, 6 Jun 2008 15:09:26 +0000
Subject: [PATCH] count the iteration steps that are actually taken

[[Imported from SVN: r2376]]
---
 dirneucoupling.cc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dirneucoupling.cc b/dirneucoupling.cc
index 12769459..62e61ac0 100644
--- a/dirneucoupling.cc
+++ b/dirneucoupling.cc
@@ -360,7 +360,7 @@ int main (int argc, char *argv[]) try
 
     //
     double normOfOldCorrection = 0;
-
+    int dnStepsActuallyTaken = 0;
     for (int i=0; i<maxDirichletNeumannSteps; i++) {
         
         std::cout << "----------------------------------------------------" << std::endl;
@@ -530,7 +530,7 @@ int main (int argc, char *argv[]) try
                 max3dRelCorrection = std::max(max3dRelCorrection, 
                                               std::fabs(oldSolution3d[j][k])/ std::fabs(x3d[j][k]));
 
-
+        // the rod
         RodDifferenceType rodDiff = computeRodDifference(oldSolutionRod, rodX);
         double maxRodRelCorrection = 0;
         for (size_t j=0; j<rodX.size(); j++)
@@ -538,8 +538,11 @@ int main (int argc, char *argv[]) try
                 maxRodRelCorrection = std::max(maxRodRelCorrection, 
                                               std::fabs(rodDiff[j][k])/ std::fabs(rodX[j].r[k]));
 
+        // Absolute corrections
         double maxRodCorrection = computeRodDifference(oldSolutionRod, rodX).infinity_norm();
         double max3dCorrection  = oldSolution3d.infinity_norm();
+
+
         std::cout << "rod correction: " << maxRodCorrection
                   << "    rod rel correction: " <<  maxRodRelCorrection
                   << "    3d correction: " <<  max3dCorrection
@@ -560,6 +563,8 @@ int main (int argc, char *argv[]) try
         std::cout << "DD iteration: " << i << "  --  ||u^{n+1} - u^n|| / ||u^n||: " << relativeError << ",      "
                   << "convrate " << convRate << "\n";
 
+        dnStepsActuallyTaken = i;
+
         //if (relativeError < ddTolerance)
         if (std::max(max3dRelCorrection,maxRodRelCorrection) < ddTolerance)
             break;
@@ -618,7 +623,7 @@ int main (int argc, char *argv[]) try
     std::string filename = resultPath + "convrate_" + levelAsAscii.str() + "_" + dampingAsAscii.str();
 
     int i;
-    for (i=0; i<maxDirichletNeumannSteps; i++) {
+    for (i=0; i<dnStepsActuallyTaken; i++) {
         
         // /////////////////////////////////////////////////////
         //   Read iteration from file
-- 
GitLab