MercuryDPM
Beta
|
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. More...
#include <MercuryTime.h>
Public Member Functions | |
void | set (Mdouble t, Mdouble tMax) |
Initialises the variable start with the current value of clock ticks, the current time and the final time of the simulation. More... | |
Mdouble | getTime2Finish (Mdouble t) |
Estimates the total time, in seconds, left to reach the end of any simulation. 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. More... | |
std::string | getFinishTime (Mdouble t) |
Returns the estimated finish time based on the amount of time left to finish. More... | |
Private Attributes | |
clock_t | startTime_ |
Stores the current number of clock ticks at the start. More... | |
Mdouble | time_ |
Stores the simulation time (DPM units) More... | |
Mdouble | timeMax_ |
Stores the total simulation time (DPM units) More... | |
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.
E.g., assume that the class has been initialized at simulation time 0, with final time 10. Then, getTime2Finish is called after 1 hour at simulation time 2. Since the code required 0.5 hours per simulation time unit and there are 8 simulation time units left, it is likely to finish in 4 hours.
Definition at line 88 of file MercuryTime.h.
|
inline |
Returns the estimated finish time based on the amount of time left to finish.
[in] | t | current simulation time |
Definition at line 142 of file MercuryTime.h.
References getTime2Finish().
Estimates the total time, in seconds, left to reach the end of any simulation. 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.
E.g., assume that the class has been initialized at simulation time 0, with final time 10. Then, getTime2Finish is called after 1 hour at simulation time 2. Since the code required 0.5 hours per simulation time unit and there are 8 simulation time units left, it is likely to finish in 4 hours.
[in] | t | current simulation time. |
Definition at line 118 of file MercuryTime.h.
References startTime_, time_, and timeMax_.
Referenced by getFinishTime().
Initialises the variable start with the current value of clock ticks, the current time and the final time of the simulation.
[in] | t | current simulation time. |
[in] | tMax | total simulation time for which the simulation is set to run. |
Definition at line 98 of file MercuryTime.h.
References startTime_, time_, and timeMax_.
|
private |
Stores the current number of clock ticks at the start.
Definition at line 165 of file MercuryTime.h.
Referenced by getTime2Finish(), and set().
|
private |
Stores the simulation time (DPM units)
Definition at line 168 of file MercuryTime.h.
Referenced by getTime2Finish(), and set().
|
private |
Stores the total simulation time (DPM units)
Definition at line 171 of file MercuryTime.h.
Referenced by getTime2Finish(), and set().