#include <clock.h>
Clock tracks the time in the simulation.
The basic unit is 1 fm/c = \(1 / 2.99798542 \cdot 10^{-23}\)s \(\approx 0.33 \cdot 10^{-24}\) s. The resolution of the clock is 0.000001 fm/c. I.e. only multiples of 0.000001 fm/c are representable internally.
Possible actions for Clock are:
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, const 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 times between two clocks. More... | |
bool | operator< (double time) const |
Compares the time of the clock against a fixed time. More... | |
bool | operator> (double time) const |
Compares the time of the clock against a fixed time. More... | |
virtual | ~Clock ()=default |
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 imulation |
[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::CustomClock, and smash::UniformClock.
|
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 101 of file clock.h.
|
inline |
advances the clock by an arbitrary number of ticks.
[in] | advance_several_timesteps | Number of the timesteps added to the clock |
OverflowError | if the number of the added timesteps exceeds the maximum value. |
Definition at line 118 of file clock.h.
|
inline |
|
inline |
|
inline |
|
protected |