Merge pull request #64 from PhasicFlow/coupling
coupling modifictions for timeControl and iterate
This commit is contained in:
commit
df55a28b84
|
@ -144,7 +144,13 @@ public:
|
||||||
bool beforeIteration() = 0;
|
bool beforeIteration() = 0;
|
||||||
|
|
||||||
virtual
|
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"
|
#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(
|
pFlow::sphereDEMSystem::sphereDEMSystem(
|
||||||
word demSystemName,
|
word demSystemName,
|
||||||
|
@ -161,10 +191,23 @@ bool pFlow::sphereDEMSystem::beforeIteration()
|
||||||
|
|
||||||
|
|
||||||
bool pFlow::sphereDEMSystem::iterate(
|
bool pFlow::sphereDEMSystem::iterate(
|
||||||
int32 n,
|
real upToTime,
|
||||||
real timeToWrite,
|
real timeToWrite,
|
||||||
word timeName)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ protected:
|
||||||
return interaction_();
|
return interaction_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loop();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeInfo("sphereDEMSystem");
|
TypeInfo("sphereDEMSystem");
|
||||||
|
@ -128,7 +130,12 @@ public:
|
||||||
|
|
||||||
bool beforeIteration() override;
|
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;
|
real maxBounndingSphereSize()const override;
|
||||||
|
|
||||||
|
|
|
@ -102,10 +102,17 @@ pFlow::timeControl::timeControl(
|
||||||
void pFlow::timeControl::checkForOutputToFile()
|
void pFlow::timeControl::checkForOutputToFile()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(managedExternaly_) return;
|
|
||||||
|
|
||||||
bool save = false;
|
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_ )
|
if ( abs(currentTime_ - lastSaved_ - saveInterval_) < 0.5 * dt_ )
|
||||||
{
|
{
|
||||||
lastSaved_ = currentTime_;
|
lastSaved_ = currentTime_;
|
||||||
|
@ -116,6 +123,7 @@ void pFlow::timeControl::checkForOutputToFile()
|
||||||
lastSaved_ = currentTime_;
|
lastSaved_ = currentTime_;
|
||||||
save = true;
|
save = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
outputToFile_ = save;
|
outputToFile_ = save;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,9 @@ protected:
|
||||||
|
|
||||||
bool managedExternaly_ = false;
|
bool managedExternaly_ = false;
|
||||||
|
|
||||||
word timeName_ = "wrongSettings";
|
word timeName_ = "wrongSettings"; // for managedExternamly
|
||||||
|
|
||||||
|
real writeTime_ = 0; // for managedExternamly
|
||||||
|
|
||||||
realStridedRange timersReportInterval_;
|
realStridedRange timersReportInterval_;
|
||||||
|
|
||||||
|
@ -108,6 +110,15 @@ public:
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setEndTime(real eT)
|
||||||
|
{
|
||||||
|
if(managedExternaly_)
|
||||||
|
{
|
||||||
|
endTime_ = eT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
real startTime()const
|
real startTime()const
|
||||||
{
|
{
|
||||||
return startTime_;
|
return startTime_;
|
||||||
|
@ -141,6 +152,7 @@ public:
|
||||||
bool finished()const
|
bool finished()const
|
||||||
{
|
{
|
||||||
if( currentTime_ >= endTime_ ) return true;
|
if( currentTime_ >= endTime_ ) return true;
|
||||||
|
if( abs(currentTime_-endTime_) < 0.5*dt_ )return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +163,15 @@ public:
|
||||||
|
|
||||||
bool timersReportTime()const;
|
bool timersReportTime()const;
|
||||||
|
|
||||||
|
bool setOutputToFile(real writeTime, const word& timeName)
|
||||||
|
{
|
||||||
|
if(managedExternaly_)
|
||||||
|
{
|
||||||
|
timeName_ = timeName;
|
||||||
|
writeTime_ = writeTime;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator ++(int)
|
bool operator ++(int)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue