#include <clock.h>
Clock with uniformly spaced time steps.
Clock stores a time step size \(\Delta t\) and a base time \(t_0\) as well as a counter \(n\). The current time is calculated from \(t = t_0 + n \cdot \Delta t\). When \(\Delta t\) is changed, \(t_0\) is reset.
Public Member Functions | |
| UniformClock ()=default | |
| default initializer: Timestep size is set to 0!  More... | |
| UniformClock (const double time, const double dt) | |
| Initialize with base time and time step size.  More... | |
| double | current_time () const override | 
| double | next_time () const override | 
| double | timestep_duration () const override | 
| void | set_timestep_duration (const double dt) | 
| Sets the time step size (and resets the counter).  More... | |
| void | reset (const double start_time, const bool is_output_clock) override | 
| Resets the time to the starting time of an event.  More... | |
| void | remove_times_in_past (double) override | 
| Remove output times before the starting time of the simulation if this is a custom clock.  More... | |
| template<typename T > | |
| std::enable_if< std::is_floating_point< T >::value, Clock & >::type | operator+= (T big_timestep) | 
| Advances the clock by an arbitrary timestep (multiple of 0.000001 fm/c).  More... | |
| Clock & | operator+= (Representation advance_several_timesteps) | 
| advances the clock by an arbitrary number of ticks.  More... | |
  Public Member Functions inherited from smash::Clock | |
| 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 | 
Static Private Member Functions | |
| static Representation | convert (double x) | 
Convert a double x into the internal int representation.  More... | |
| static double | convert (Representation x) | 
Convert an internal int value x into the double representation.  More... | |
Private Attributes | |
| Representation | timestep_duration_ = 0u | 
| The time step size \(\Delta t\) in $10^{-3}$ fm.  More... | |
| Representation | reset_time_ = 0 | 
| The time of last reset (when counter_ was set to 0).  More... | |
Static Private Attributes | |
| static constexpr double | resolution = 0.000001 | 
| Defines the resolution of the clock (i.e.  More... | |
| static constexpr double | to_double = resolution | 
| A multiplier transfering the internal integer to the real time.  More... | |
| static constexpr double | from_double = 1. / resolution | 
| A multiplier transfering the real time to the internal integer.  More... | |
Additional Inherited Members | |
  Public Types inherited from smash::Clock | |
| using | Representation = std::int64_t | 
| The type used for counting ticks/time.  More... | |
  Protected Attributes inherited from smash::Clock | |
| Representation | counter_ = 0 | 
| Internally used to count the number of time steps.  More... | |
      
  | 
  default | 
default initializer: Timestep size is set to 0!
      
  | 
  inline | 
      
  | 
  inlineoverridevirtual | 
Implements smash::Clock.
Definition at line 204 of file clock.h.
      
  | 
  inlineoverridevirtual | 
This function is needed, because current_time() + timestep_duration() is not the same as the next tick (numerically; this is due to floating point arithmetic).
Implements smash::Clock.
Definition at line 214 of file clock.h.
      
  | 
  inlineoverridevirtual | 
Implements smash::Clock.
Definition at line 222 of file clock.h.
      
  | 
  inline | 
      
  | 
  inlineoverridevirtual | 
Resets the time to the starting time of an event.
| [in] | start_time | Starting time of the simulation | 
| [in] | is_output_clock | whether this is an output clock or a lab clock | 
Implements smash::Clock.
Definition at line 245 of file clock.h.
      
  | 
  inlineoverridevirtual | 
Remove output times before the starting time of the simulation if this is a custom clock.
| [in] | start_time | starting time of the simulation | 
Implements smash::Clock.
      
  | 
  inline | 
Advances the clock by an arbitrary timestep (multiple of 0.000001 fm/c).
| T | type of the timestep | 
| [in] | big_timestep | Timestep by which the clock is advanced. | 
Definition at line 273 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. | 
      
  | 
  inlinestaticprivate | 
      
  | 
  inlinestaticprivate | 
      
  | 
  staticconstexprprivate | 
Defines the resolution of the clock (i.e.
the smallest representable time difference).
The value 0.000001 is very well suited because
      
  | 
  staticconstexprprivate | 
      
  | 
  staticconstexprprivate | 
      
  | 
  private | 
      
  | 
  private |