From 48e9ee0e9fbb9fbee2abff3af490ae215755b65a Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Thu, 8 Jan 2015 10:20:56 +0100 Subject: [PATCH] BACKPORT: setDeltaT with optional adjustment --- src/foam/db/Time/Time.C | 16 ++++++++++++---- src/foam/db/Time/Time.H | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/foam/db/Time/Time.C b/src/foam/db/Time/Time.C index 61bb12b58..758bd11ae 100644 --- a/src/foam/db/Time/Time.C +++ b/src/foam/db/Time/Time.C @@ -642,17 +642,25 @@ void Foam::Time::setEndTime(const scalar endTime) } -void Foam::Time::setDeltaT(const dimensionedScalar& deltaT) +void Foam::Time::setDeltaT +( + const dimensionedScalar& deltaT, + const bool bAdjustDeltaT +) { - setDeltaT(deltaT.value()); + setDeltaT(deltaT.value(), bAdjustDeltaT); } -void Foam::Time::setDeltaT(const scalar deltaT) +void Foam::Time::setDeltaT(const scalar deltaT, const bool bAdjustDeltaT) { deltaT_ = deltaT; deltaTchanged_ = true; - adjustDeltaT(); + + if (bAdjustDeltaT) + { + adjustDeltaT(); + } } diff --git a/src/foam/db/Time/Time.H b/src/foam/db/Time/Time.H index 58d2f3447..d5db057f1 100644 --- a/src/foam/db/Time/Time.H +++ b/src/foam/db/Time/Time.H @@ -445,7 +445,18 @@ public: virtual void setEndTime(const scalar); //- Reset time step - virtual void setDeltaT(const dimensionedScalar&); + virtual void setDeltaT + ( + const dimensionedScalar&, + const bool adjustDeltaT = true + ); + + //- Reset time step + virtual void setDeltaT + ( + const scalar, + const bool adjustDeltaT = true + ); //- Reset write control virtual void setWriteControl(const writeControls&); @@ -453,9 +464,6 @@ public: //- Reset write interval virtual void setWriteInterval(const scalar); - //- Reset time step - virtual void setDeltaT(const scalar); - //- Set time to sub-cycle for the given number of steps virtual TimeState subCycle(const label nSubCycles);