#include <clock.h>
Clock tracks the time in the simulation.
The basic unit is 1 fm in natural units which correspond to \(\frac{10^{-15}}{299\,792\,458}\,\mathrm{s} \approx 0.33\cdot10^{-23}\,\mathrm{s}\) in the international system of units. The resolution of the clock is \(0.000001\,\mathrm{fm}=10^{-6}\,\mathrm{fm}\), i.e. only multiples of \(0.000001\,\mathrm{fm}\) are internally representable.
Public Types | |
using | Representation = std::int64_t |
The type used for counting ticks/time. More... | |
Public Member Functions | |
virtual double | timestep_duration () const =0 |
virtual double | current_time () const =0 |
virtual double | next_time () const =0 |
virtual void | reset (double start_time, bool is_output_clock)=0 |
reset the clock to the starting time of the simulation More... | |
virtual void | remove_times_in_past (double start_time)=0 |
Remove output times before the starting time of the simulation if this is a custom clock. More... | |
Clock & | operator++ () |
Advances the clock by one tick. More... | |
Clock & | operator+= (Representation advance_several_timesteps) |
Advances the clock by an arbitrary number of ticks. More... | |
bool | operator< (const Clock &rhs) const |
Compares the internal times of two clocks. More... | |
bool | operator< (double time) const |
Compares the internal time of the clock against a fixed time. More... | |
bool | operator> (double time) const |
Compares the internal time of the clock against a fixed time. More... | |
virtual | ~Clock ()=default |
Protected Member Functions | |
virtual double | present_internal_time () const =0 |
This function always returns the clock time, even if children might attribute a different behaviour to current_time method (as UniformClock does). More... | |
Protected Attributes | |
Representation | counter_ = 0 |
Internally used to count the number of time steps. More... | |
using smash::Clock::Representation = std::int64_t |
|
virtualdefault |
|
pure virtual |
Implemented in smash::CustomClock, and smash::UniformClock.
|
pure virtual |
Implemented in smash::CustomClock, and smash::UniformClock.
|
pure virtual |
Implemented in smash::CustomClock, and smash::UniformClock.
|
pure virtual |
reset the clock to the starting time of the simulation
[in] | start_time | starting time of the simulation |
[in] | is_output_clock | whether this is an output clock rather than a lab clock |
Implemented in smash::CustomClock, and smash::UniformClock.
|
pure virtual |
Remove output times before the starting time of the simulation if this is a custom clock.
[in] | start_time | starting time of the simulation |
Implemented in smash::UniformClock, and smash::CustomClock.
|
inline |
Advances the clock by one tick.
This operator is used as ++clock
. The operator clock++
is not implemented deliberately, because that requires a copy of the clock being created.
Definition at line 118 of file clock.h.
|
inline |
Advances the clock by an arbitrary number of ticks.
[in] | advance_several_timesteps | Number of the time steps added to the clock |
OverflowError | if the number of the added time steps exceeds the maximum value. |
|
inline |
|
inline |
|
inline |
|
protectedpure virtual |
This function always returns the clock time, even if children might attribute a different behaviour to current_time
method (as UniformClock does).
Implemented in smash::CustomClock, and smash::UniformClock.
|
protected |