PRISMS-PF Manual
Loading...
Searching...
No Matches
simulation_timer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2026 PRISMS Center at the University of Michigan
2// SPDX-License-Identifier: GNU Lesser General Public Version 2.1
3
4#pragma once
5
7
8#include <prismspf/config.h>
9
11
13{
14public:
15 SimulationTimer() = default;
16
17 explicit SimulationTimer(double step_size, double start_time = 0.0)
18 : time_step_size(step_size)
19 , current_time(start_time)
20 {}
21
22 [[nodiscard]] unsigned int
24 {
25 return current_increment;
26 }
27
28 [[nodiscard]] double
29 get_time() const
30 {
31 return current_time;
32 }
33
34 [[nodiscard]] double
36 {
37 return time_step_size;
38 }
39
40 void
41 increment(double step_size)
42 {
44 current_time += step_size;
45 }
46
47 void
52
53 void
54 set_timestep(double step_size)
55 {
56 time_step_size = step_size;
57 }
58
59 void
60 set_time(double time)
61 {
62 current_time = time;
63 }
64
65 void
67 {
69 }
70
71 void
73 {
75 current_time = 0.0;
76 }
77
78private:
79 unsigned int current_increment = 0;
80 double current_time = 0.0;
81 double time_step_size = 0.0;
82};
83
84PRISMS_PF_END_NAMESPACE
SimulationTimer()=default
double current_time
Definition simulation_timer.h:80
unsigned int get_increment() const
Definition simulation_timer.h:23
void increment(double step_size)
Definition simulation_timer.h:41
SimulationTimer(double step_size, double start_time=0.0)
Definition simulation_timer.h:17
unsigned int current_increment
Definition simulation_timer.h:79
void set_time(double time)
Definition simulation_timer.h:60
double time_step_size
Definition simulation_timer.h:81
double get_timestep() const
Definition simulation_timer.h:35
void set_increment(unsigned int increment)
Definition simulation_timer.h:66
void increment()
Definition simulation_timer.h:48
double get_time() const
Definition simulation_timer.h:29
void set_timestep(double step_size)
Definition simulation_timer.h:54
void reset()
Definition simulation_timer.h:72
Definition conditional_ostreams.cc:20