OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
SourceClockGroups.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Caleb Buahin
3
12
13#ifndef OPENSWMM_SOURCE_CLOCK_GROUPS_HPP
14#define OPENSWMM_SOURCE_CLOCK_GROUPS_HPP
15#include "Runoff.hpp"
16#include "Climate.hpp"
18#include <array>
19#include <string>
20#include <vector>
21
22namespace openswmm::detail {
24}
25
26namespace openswmm::runoff {
27
33 double start = 0.0, end = 0.0;
34 int month = 0;
35 double infil_factor = 1.0, recovery_factor = 1.0;
36 std::vector<RunoffSourceForcing> sources;
37};
38
43 std::vector<int> subcatches, lid_usages;
44 double completed_end = 0.0;
45 std::vector<SourceForcingInterval> pending;
46};
47
55public:
73 std::string initialize(const SimulationContext& ctx, const std::vector<int>& seeds,
74 bool hydraulic_returns = false);
88 std::string stage(int group, double end, double completed_through);
94 std::string commit(int group);
99 void cancel(int group);
104 const std::vector<SourceClockGroup>& groups() const { return groups_; }
109 int groupForSubcatch(int source) const;
121 bool model); // internal accepted-boundary IO
122
123private:
124 struct RainSeries {
125 std::vector<double> times, rates;
126 double period = 0.0, override_rate = -1.0;
128 double prescribed = 0.0;
129 };
130 bool initialized_ = false, ignore_rain_ = false, dry_only_ = false;
131 double start_date_ = 0.0, duration_ = 0.0, rain_ucf_ = 1.0, evap_ucf_ = 1.0;
133 ForcingData forcing_;
134 std::array<double, 12> monthly_evap_{}, adjust_evap_{}, adjust_rain_{}, infil_{}, recovery_{};
135 std::vector<double> evap_times_, evap_values_, rain_scale_;
136 std::vector<int> source_gage_, source_group_;
137 std::vector<RainSeries> gages_;
138 std::vector<SourceClockGroup> groups_;
139};
140}
141#endif
Climate processing — evaporation, temperature, wind.
Per-element runtime forcing state — SoA layout.
Subcatchment runoff generation — batch-oriented nonlinear reservoir.
Definition CompletedSourceArchive.hpp:25
Definition SourceClockGroups.hpp:54
std::string initialize(const SimulationContext &ctx, const std::vector< int > &seeds, bool hydraulic_returns=false)
Build selected connected source groups and snapshot their forcing inputs.
Definition SourceClockGroups.cpp:50
std::string stage(int group, double end, double completed_through)
Resolve and stage contiguous forcing from a group's accepted boundary.
Definition SourceClockGroups.cpp:277
const std::vector< SourceClockGroup > & groups() const
Borrow the group membership, accepted clocks and pending forcing.
Definition SourceClockGroups.hpp:104
std::string commit(int group)
Advance a group's accepted clock to the last staged forcing endpoint.
Definition SourceClockGroups.cpp:357
void cancel(int group)
Drop staged forcing without changing the accepted clock or water stores.
Definition SourceClockGroups.cpp:365
int groupForSubcatch(int source) const
Look up selected component membership without scanning the graph.
Definition SourceClockGroups.cpp:272
void checkpoint(detail::CompletedSourceArchive &archive, bool model)
Stream model forcing/membership or accepted source-clock restart state.
Definition SourceClockCheckpoint.cpp:17
EvapMethod
Definition Climate.hpp:56
@ CONSTANT
Definition Climate.hpp:57
Definition OutfallExchange.hpp:17
Definition ExplicitInertialSolver.hpp:68
ForcingMode
Definition ForcingData.hpp:55
@ NONE
Use model-computed value (no forcing)
Definition ForcingData.hpp:56
Definition ForcingData.hpp:70
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
One weakly connected runoff/LID/snow-transfer component. subcatches/lid_usages contain model indices;...
Definition SourceClockGroups.hpp:42
std::vector< int > lid_usages
Definition SourceClockGroups.hpp:43
std::vector< SourceForcingInterval > pending
Definition SourceClockGroups.hpp:45
std::vector< int > subcatches
Definition SourceClockGroups.hpp:43
double completed_end
Definition SourceClockGroups.hpp:44
Piecewise-constant forcing over [start,end) in elapsed seconds. month is zero-based; infil_factor/rec...
Definition SourceClockGroups.hpp:32
std::vector< RunoffSourceForcing > sources
Definition SourceClockGroups.hpp:36
double recovery_factor
Definition SourceClockGroups.hpp:35
double infil_factor
Definition SourceClockGroups.hpp:35
double start
Definition SourceClockGroups.hpp:33
double end
Definition SourceClockGroups.hpp:33
int month
Definition SourceClockGroups.hpp:34