OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
TimestepController.hpp
Go to the documentation of this file.
1
59
60#ifndef OPENSWMM_ENGINE_TIMESTEP_CONTROLLER_HPP
61#define OPENSWMM_ENGINE_TIMESTEP_CONTROLLER_HPP
62
63#include <algorithm>
64#include <cmath>
65
66namespace openswmm {
67 struct SimulationContext;
68}
69
70namespace openswmm::hydraulics {
71
81public:
83
84 // -----------------------------------------------------------------------
85 // Core timestep computation
86 // -----------------------------------------------------------------------
87
107 static double compute_next(const SimulationContext& ctx, double dt_cfl) noexcept;
108
109 // -----------------------------------------------------------------------
110 // Timer management
111 // -----------------------------------------------------------------------
112
126 static void advance(SimulationContext& ctx, double dt_taken) noexcept;
127
137 static void reset_output_timer(SimulationContext& ctx) noexcept;
138
139 // -----------------------------------------------------------------------
140 // State queries
141 // -----------------------------------------------------------------------
142
153 static bool output_due(const SimulationContext& ctx) noexcept;
154
159 static bool simulation_complete(const SimulationContext& ctx) noexcept;
160
161 // -----------------------------------------------------------------------
162 // Constants
163 // -----------------------------------------------------------------------
164
165
167 static constexpr double SEC_PER_DAY = 86400.0;
168};
169
170} /* namespace openswmm::hydraulics */
171
172#endif /* OPENSWMM_ENGINE_TIMESTEP_CONTROLLER_HPP */
static void advance(SimulationContext &ctx, double dt_taken) noexcept
Advance internal timers by dt_taken seconds.
Definition TimestepController.cpp:80
static double compute_next(const SimulationContext &ctx, double dt_cfl) noexcept
Compute the next simulation timestep.
Definition TimestepController.cpp:27
static bool output_due(const SimulationContext &ctx) noexcept
Returns true when the clock has reached the next report instant.
Definition TimestepController.cpp:116
static bool simulation_complete(const SimulationContext &ctx) noexcept
Returns true when the simulation has reached or passed end_time.
Definition TimestepController.cpp:125
static void reset_output_timer(SimulationContext &ctx) noexcept
Advance the report grid to the next period.
Definition TimestepController.cpp:105
static constexpr double SEC_PER_DAY
Seconds per day (exact).
Definition TimestepController.hpp:167
Definition TimestepController.cpp:21
Definition NodeCoupling.cpp:15
Central, reentrant simulation context.
Definition SimulationContext.hpp:292