From ea8f2a81ae321e7fe49ddf574c0b7c8eee936f0c Mon Sep 17 00:00:00 2001
From: Rainer Backofen <rainer.backofen@tu-dresden.de>
Date: Tue, 30 Mar 2010 11:09:44 +0000
Subject: [PATCH] included new variable <lastProcessedTimestep> in AdaptInfo,
 in order to have the timestep which lead to current time in user program

---
 AMDiS/src/AdaptInfo.h          | 25 +++++++++++++++++++------
 AMDiS/src/AdaptInstationary.cc |  3 ++-
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/AMDiS/src/AdaptInfo.h b/AMDiS/src/AdaptInfo.h
index 498f8ba0..b4878c78 100644
--- a/AMDiS/src/AdaptInfo.h
+++ b/AMDiS/src/AdaptInfo.h
@@ -135,6 +135,7 @@ namespace AMDiS {
 	startTime(0.0),
 	endTime(1.0),
 	timestep(0.0),
+	lastProcessedTimestep(0.0),
 	minTimestep(0.0),
 	maxTimestep(1.0),
 	timestepNumber(0),
@@ -189,6 +190,7 @@ namespace AMDiS {
       solverResidual = 0.0;
 
       GET_PARAMETER(0, name + "->timestep", "%f", &timestep);
+      lastProcessedTimestep=timestep;
     }
 
     /// Returns whether space tolerance is reached.
@@ -478,6 +480,19 @@ namespace AMDiS {
       
       return timestep;
     }
+    /// Gets \ref timestep
+    inline double getTimestep() 
+    { 
+      return timestep; 
+    }
+
+    inline void setLastProcessedTimestep(double t){
+	lastProcessedTimestep=t;
+    } 
+
+    inline double getLastProcessedTimestep(){
+	return lastProcessedTimestep;
+    } 
 
     /** \brief
      * Returns true, if the end time is reached and no more timestep
@@ -491,11 +506,6 @@ namespace AMDiS {
       return !(time < endTime - DBL_TOL);
     }
 
-    /// Gets \ref timestep
-    inline double getTimestep() 
-    { 
-      return timestep; 
-    }
 
     /// Sets \ref minTimestep
     inline void setMinTimestep(double t) 
@@ -705,9 +715,12 @@ namespace AMDiS {
     /// Final time
     double endTime;
 
-    /// Current time step size
+    ///Time step size to be used
     double timestep;
 
+    /// Last processed time step size of finished iteration
+    double lastProcessedTimestep;
+
     /// Minimal step size
     double minTimestep;
 
diff --git a/AMDiS/src/AdaptInstationary.cc b/AMDiS/src/AdaptInstationary.cc
index e34123e0..6c68c285 100644
--- a/AMDiS/src/AdaptInstationary.cc
+++ b/AMDiS/src/AdaptInstationary.cc
@@ -121,6 +121,7 @@ namespace AMDiS {
     problemIteration_->beginIteration(adaptInfo);
     problemIteration_->oneIteration(adaptInfo, FULL_ITERATION);
     problemIteration_->endIteration(adaptInfo);
+    adaptInfo->setLastProcessedTimestep(adaptInfo->getTimestep()); 
   }
 
   void AdaptInstationary::implicitTimeStrategy()
@@ -184,7 +185,7 @@ namespace AMDiS {
     } while(!adaptInfo->timeToleranceReached() &&
 	    !(adaptInfo->getTimestep() <= adaptInfo->getMinTimestep()) && 
 	    adaptInfo->getTimestepIteration() <= adaptInfo->getMaxTimestepIteration());  
-
+    adaptInfo->setLastProcessedTimestep(adaptInfo->getTimestep()); 
     if (!fixedTimestep_ && adaptInfo->timeErrorLow()) {
       adaptInfo->setTimestep(adaptInfo->getTimestep() * time_delta_2);
       if (dbgMode) {
-- 
GitLab