correction for timeFolder save
This commit is contained in:
parent
4f44fe5e4c
commit
aa4ac3372c
|
@ -197,7 +197,7 @@ bool pFlow::sphereDEMSystem::iterate(
|
|||
word timeName)
|
||||
{
|
||||
|
||||
Control().time().setEndTime(upToTime);
|
||||
Control().time().setStopAt(upToTime);
|
||||
Control().time().setOutputToFile(timeToWrite, timeName);
|
||||
|
||||
loop();
|
||||
|
@ -207,7 +207,7 @@ bool pFlow::sphereDEMSystem::iterate(
|
|||
|
||||
bool pFlow::sphereDEMSystem::iterate(real upToTime)
|
||||
{
|
||||
Control().time().setEndTime(upToTime);
|
||||
Control().time().setStopAt(upToTime);
|
||||
loop();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ pFlow::timeControl::timeControl
|
|||
(
|
||||
dict.getVal<real>("endTime")
|
||||
),
|
||||
stopAt_(endTime_),
|
||||
currentTime_(startTime_),
|
||||
saveInterval_
|
||||
(
|
||||
|
@ -79,6 +80,7 @@ pFlow::timeControl::timeControl(
|
|||
),
|
||||
startTime_(startTime),
|
||||
endTime_(endTime),
|
||||
stopAt_(endTime_),
|
||||
currentTime_(startTime_),
|
||||
saveInterval_(saveInterval),
|
||||
lastSaved_(startTime_),
|
||||
|
|
|
@ -50,6 +50,9 @@ protected:
|
|||
// - end time of simulation
|
||||
real endTime_;
|
||||
|
||||
// - stopAt
|
||||
real stopAt_;
|
||||
|
||||
// - current time of simulation
|
||||
real currentTime_;
|
||||
|
||||
|
@ -110,13 +113,12 @@ public:
|
|||
return tmp;
|
||||
}
|
||||
|
||||
void setEndTime(real eT)
|
||||
void setStopAt(real sT)
|
||||
{
|
||||
if(managedExternaly_)
|
||||
{
|
||||
endTime_ = eT;
|
||||
stopAt_ = sT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
real startTime()const
|
||||
|
@ -131,17 +133,18 @@ public:
|
|||
|
||||
word currentTimeWord(bool forSave = true)const
|
||||
{
|
||||
if(forSave)
|
||||
return real2FixedStripZeros( currentTime(), timePrecision());
|
||||
/*if(forSave)
|
||||
{
|
||||
if(!managedExternaly_)
|
||||
return real2FixedStripZeros( currentTime(), timePrecision());
|
||||
|
||||
else
|
||||
return timeName_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return real2FixedStripZeros( currentTime(), timePrecision());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
int32 currentIter()const
|
||||
|
@ -149,10 +152,16 @@ public:
|
|||
return currentIter_;
|
||||
}
|
||||
|
||||
bool finished()const
|
||||
bool finalTime()const
|
||||
{
|
||||
if( currentTime_ >= endTime_ ) return true;
|
||||
if( abs(currentTime_-endTime_) < 0.5*dt_ )return true;
|
||||
return false;
|
||||
}
|
||||
bool reachedStopAt()const
|
||||
{
|
||||
if( currentTime_ >= stopAt_ ) return true;
|
||||
if( abs(currentTime_-stopAt_) < 0.5*dt_ )return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -176,7 +185,7 @@ public:
|
|||
bool operator ++(int)
|
||||
{
|
||||
|
||||
if( finished() ) return false;
|
||||
if( reachedStopAt() ) return false;
|
||||
// increament iteration number
|
||||
currentIter_++;
|
||||
|
||||
|
|
|
@ -233,7 +233,9 @@ pFlow::systemControl::systemControl(
|
|||
bool pFlow::systemControl::operator ++(int)
|
||||
{
|
||||
|
||||
// skip writing to file for the first iteration
|
||||
// skip writing to file for the first iteration
|
||||
auto finished = time()++;
|
||||
|
||||
writeToFileTimer_.start();
|
||||
if(time().currentIter() != 0)
|
||||
{
|
||||
|
@ -244,8 +246,9 @@ bool pFlow::systemControl::operator ++(int)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if( time().finished() )
|
||||
else if( time().finalTime() )
|
||||
{
|
||||
output<<"****************************************************************"<<endl;
|
||||
if( !time().write() )
|
||||
{
|
||||
fatalErrorInFunction;
|
||||
|
@ -260,8 +263,7 @@ bool pFlow::systemControl::operator ++(int)
|
|||
timers_.write(output, true);
|
||||
}
|
||||
|
||||
return time()++;
|
||||
|
||||
return finished;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue