coupling modifictions for timeControl and iterate
This commit is contained in:
parent
fef0c4fe96
commit
782c0d5667
|
@ -144,7 +144,13 @@ public:
|
|||
bool beforeIteration() = 0;
|
||||
|
||||
virtual
|
||||
bool iterate(int32 n, real timeToWrite, word timeName) = 0;
|
||||
bool iterate(
|
||||
real upToTime,
|
||||
real timeToWrite,
|
||||
word timeName) = 0;
|
||||
|
||||
virtual
|
||||
bool iterate(real upToTime) = 0;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,36 @@ Licence:
|
|||
|
||||
#include "sphereDEMSystem.hpp"
|
||||
|
||||
void pFlow::sphereDEMSystem::loop()
|
||||
{
|
||||
|
||||
do
|
||||
{
|
||||
Control().timers().start();
|
||||
|
||||
geometry_->beforeIteration();
|
||||
|
||||
interaction_->beforeIteration();
|
||||
|
||||
particles_->beforeIteration();
|
||||
|
||||
|
||||
interaction_->iterate();
|
||||
|
||||
particles_->iterate();
|
||||
|
||||
geometry_->iterate();
|
||||
|
||||
particles_->afterIteration();
|
||||
|
||||
geometry_->afterIteration();
|
||||
|
||||
|
||||
Control().timers().end();
|
||||
|
||||
}while(Control()++);
|
||||
|
||||
}
|
||||
|
||||
pFlow::sphereDEMSystem::sphereDEMSystem(
|
||||
word demSystemName,
|
||||
|
@ -161,10 +191,23 @@ bool pFlow::sphereDEMSystem::beforeIteration()
|
|||
|
||||
|
||||
bool pFlow::sphereDEMSystem::iterate(
|
||||
int32 n,
|
||||
real upToTime,
|
||||
real timeToWrite,
|
||||
word timeName)
|
||||
{
|
||||
|
||||
Control().time().setEndTime(upToTime);
|
||||
Control().time().setOutputToFile(timeToWrite, timeName);
|
||||
|
||||
loop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pFlow::sphereDEMSystem::iterate(real upToTime)
|
||||
{
|
||||
Control().time().setEndTime(upToTime);
|
||||
loop();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ protected:
|
|||
return interaction_();
|
||||
}
|
||||
|
||||
void loop();
|
||||
|
||||
public:
|
||||
|
||||
TypeInfo("sphereDEMSystem");
|
||||
|
@ -128,7 +130,12 @@ public:
|
|||
|
||||
bool beforeIteration() override;
|
||||
|
||||
bool iterate(int32 n, real timeToWrite, word timeName) override;
|
||||
bool iterate(
|
||||
real upToTime,
|
||||
real timeToWrite,
|
||||
word timeName) override;
|
||||
|
||||
bool iterate(real upToTime) override;
|
||||
|
||||
real maxBounndingSphereSize()const override;
|
||||
|
||||
|
|
|
@ -102,10 +102,17 @@ pFlow::timeControl::timeControl(
|
|||
void pFlow::timeControl::checkForOutputToFile()
|
||||
{
|
||||
|
||||
if(managedExternaly_) return;
|
||||
|
||||
bool save = false;
|
||||
|
||||
if(managedExternaly_)
|
||||
{
|
||||
if( abs(currentTime_-writeTime_) < 0.5*dt_)
|
||||
{
|
||||
save = true;
|
||||
lastSaved_ = currentTime_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( abs(currentTime_ - lastSaved_ - saveInterval_) < 0.5 * dt_ )
|
||||
{
|
||||
lastSaved_ = currentTime_;
|
||||
|
@ -116,6 +123,7 @@ void pFlow::timeControl::checkForOutputToFile()
|
|||
lastSaved_ = currentTime_;
|
||||
save = true;
|
||||
}
|
||||
}
|
||||
|
||||
outputToFile_ = save;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,9 @@ protected:
|
|||
|
||||
bool managedExternaly_ = false;
|
||||
|
||||
word timeName_ = "wrongSettings";
|
||||
word timeName_ = "wrongSettings"; // for managedExternamly
|
||||
|
||||
real writeTime_ = 0; // for managedExternamly
|
||||
|
||||
realStridedRange timersReportInterval_;
|
||||
|
||||
|
@ -108,6 +110,15 @@ public:
|
|||
return tmp;
|
||||
}
|
||||
|
||||
void setEndTime(real eT)
|
||||
{
|
||||
if(managedExternaly_)
|
||||
{
|
||||
endTime_ = eT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
real startTime()const
|
||||
{
|
||||
return startTime_;
|
||||
|
@ -141,6 +152,7 @@ public:
|
|||
bool finished()const
|
||||
{
|
||||
if( currentTime_ >= endTime_ ) return true;
|
||||
if( abs(currentTime_-endTime_) < 0.5*dt_ )return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -151,6 +163,15 @@ public:
|
|||
|
||||
bool timersReportTime()const;
|
||||
|
||||
bool setOutputToFile(real writeTime, const word& timeName)
|
||||
{
|
||||
if(managedExternaly_)
|
||||
{
|
||||
timeName_ = timeName;
|
||||
writeTime_ = writeTime;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator ++(int)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue