120 clock_t finish = clock();
123 if (fabs(
time_ - t) < 1.e-9)
125 std::cout <<
"Choose an other value for t" << std::endl;
148 time_t finish = time(
nullptr) + time2Finish;
150 std::stringstream ss;
153 ss << ctime(&finish);
156 ss.seekp((
long) ss.tellp() - 1);
159 ss <<
" (" << time2Finish / 3600 <<
"h)";
void set(Mdouble t, Mdouble tMax)
Initialises the variable start with the current value of clock ticks, the current time and the final ...
Mdouble getTime2Finish(Mdouble t)
Estimates the total time, in seconds, left to reach the end of any simulation. After the class is ini...
clock_t startTime_
Stores the current number of clock ticks at the start.
clock_t start
Stores the number of clock ticks, called by Time::tic().
Allows for timing the algorithms; accurate up to 0.01 sec.
Mdouble time_
Stores the simulation time (DPM units)
std::string getFinishTime(Mdouble t)
Returns the estimated finish time based on the amount of time left to finish.
void tic()
This is like a start button of a stopwatch. Assigns the variable start with the current number of clo...
clock_t finish
Stores the number of clock ticks, called by Time::toc().
Mdouble toc()
This is like a stop button of a stopwatch. Assigns the variable finish to the current value of ticks ...
Estimates the total time, in seconds, left to reach the end of any simulation. First, the class needs to be initialized by calling set. After the class is initialized, an estimate of the total remaining time of the simulation can be found by calling getTime2Finish. The estimate is based on rate at which the simulation time progressed since initialization.
Mdouble timeMax_
Stores the total simulation time (DPM units)