From 6ed642beb9ed95e47af19b009a2320ccde0dbc8e Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Mon, 17 May 2010 16:06:53 +0200
Subject: [PATCH] ENH: change return type of Time::stopAt to report if the
 setting changed

---
 src/OpenFOAM/db/Time/Time.C | 4 +++-
 src/OpenFOAM/db/Time/Time.H | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C
index 0afa8d69b34..b9eebc0d7f1 100644
--- a/src/OpenFOAM/db/Time/Time.C
+++ b/src/OpenFOAM/db/Time/Time.C
@@ -552,8 +552,9 @@ bool Foam::Time::end() const
 }
 
 
-void Foam::Time::stopAt(const stopAtControls sa) const
+bool Foam::Time::stopAt(const stopAtControls sa) const
 {
+    const bool changed = (stopAt_ != sa);
     stopAt_ = sa;
 
     // adjust endTime
@@ -565,6 +566,7 @@ void Foam::Time::stopAt(const stopAtControls sa) const
     {
         endTime_ = GREAT;
     }
+    return changed;
 }
 
 
diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H
index 7596fee0c9b..55b02813c99 100644
--- a/src/OpenFOAM/db/Time/Time.H
+++ b/src/OpenFOAM/db/Time/Time.H
@@ -406,7 +406,8 @@ public:
 
             //- Adjust the current stopAtControl. Note that this value
             //  only persists until the next time the dictionary is read.
-            virtual void stopAt(const stopAtControls) const;
+            //  Return true if the stopAtControl changed.
+            virtual bool stopAt(const stopAtControls) const;
 
             //- Reset the time and time-index to those of the given time
             virtual void setTime(const Time&);
-- 
GitLab