![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Central, reentrant simulation context. More...
#include <SimulationContext.hpp>
Classes | |
| struct | MassBalance |
| Cumulative mass balance totals for runoff and routing. More... | |
| struct | RoutingStepStats |
Public Member Functions | |
| void | reset () |
| Fully reset the context to a CREATED state. | |
| void | save_state () noexcept |
| Snapshot current state into old-step arrays before solving. | |
| void | reset_state () noexcept |
| Reset all state variables to initial conditions (cold start). | |
| void | allocate_objects () |
| Allocate all object arrays after input parsing is complete. | |
| int | n_nodes () const noexcept |
| Number of nodes. | |
| int | n_links () const noexcept |
| Number of links. | |
| int | n_subcatches () const noexcept |
| Number of subcatchments. | |
| int | n_gages () const noexcept |
| Number of rain gages. | |
| int | n_pollutants () const noexcept |
| Number of pollutants. | |
| int | n_landuses () const noexcept |
| int | n_tables () const noexcept |
| Number of tables (time series + curves). | |
Public Attributes | |
| EngineState | state = EngineState::CREATED |
| Current lifecycle state of the engine. | |
| SimulationOptions | options |
| Parsed simulation options (from [OPTIONS] section). | |
| double | current_time = 0.0 |
| Current simulation time (decimal days from start_date). | |
| double | current_date = 0.0 |
| Absolute current date/time (decimal days, Julian date). | |
| double | dt_output_remaining = 0.0 |
| Time remaining until the next output boundary (seconds). | |
| double | dt_controls_remaining = 0.0 |
| Time remaining until the next control rule event (seconds). | |
| NodeData | nodes |
| All node state and properties. | |
| LinkData | links |
| All link state and properties. | |
| SubcatchData | subcatches |
| All subcatchment state and properties. | |
| GageData | gages |
| All rain gage state and properties. | |
| PollutantData | pollutants |
| Pollutant definitions and per-object quality state. | |
| TableData | tables |
| All time series and rating curves. | |
| NameIndex | node_names |
| Node name → node index. | |
| NameIndex | link_names |
| Link name → link index. | |
| NameIndex | subcatch_names |
| Subcatchment name → subcatchment index. | |
| NameIndex | gage_names |
| Rain gage name → gage index. | |
| NameIndex | pollutant_names |
| Pollutant name → pollutant index. | |
| NameIndex | table_names |
| Time series / curve name → table index. | |
| NameIndex | landuse_names |
| LanduseData | landuses |
| BuildupData | buildup |
| WashoffData | washoff |
| TreatmentData | treatment |
| ExtInflowData | ext_inflows |
| DwfData | dwf_inflows |
| RDIIAssignData | rdii_assigns |
| PatternData | patterns |
| TransectStore | transects |
| StreetStore | streets |
| InletStore | inlets |
| InletUsageStore | inlet_usages |
| ControlRuleStore | control_rules |
| SnowpackStore | snowpacks |
| NameIndex | snowpack_names |
| AquiferStore | aquifers |
| NameIndex | aquifer_names |
| LidControlStore | lid_controls |
| NameIndex | lid_names |
| LidUsageStore | lid_usage |
| SpatialFrame | spatial |
| Coordinate reference system and georeferenced coordinates. | |
| UserFlags | user_flags |
| User-defined flags from [USER_FLAGS] section. | |
| ForcingData | forcing |
| Per-element runtime forcing state (lateral inflows, head boundaries, rainfall, evap, link settings, quality mass fluxes). | |
| std::vector< PluginSpec > | plugin_specs |
| Plugin library specs parsed from [PLUGINS]. | |
| int | error_code = 0 |
| Most recent error code (0 = no error). | |
| int | warning_code = 0 |
| Most recent warning code (0 = no warning). | |
| std::string | error_message |
| Human-readable message for the last error/warning. | |
| struct openswmm::SimulationContext::MassBalance | mass_balance |
| struct openswmm::SimulationContext::RoutingStepStats | routing_stats |
| std::string | inp_file_path |
| Path to the input .inp file (empty if not opened from a file). | |
Central, reentrant simulation context.
Owns all simulation data. Passed by (non-const) reference to every solver function. One context per concurrent simulation.
|
inline |
Allocate all object arrays after input parsing is complete.
Called by InputReader after all [JUNCTIONS], [CONDUITS], etc. sections have been parsed and the final object counts are known. Resizes SoA arrays and pollutant quality matrices.
|
inlinenoexcept |
Number of rain gages.
|
inlinenoexcept |
|
inlinenoexcept |
Number of links.
|
inlinenoexcept |
Number of nodes.
|
inlinenoexcept |
Number of pollutants.
|
inlinenoexcept |
Number of subcatchments.
|
inlinenoexcept |
Number of tables (time series + curves).
|
inline |
Fully reset the context to a CREATED state.
Clears all object data and name indices. Does NOT free the option structs (they are re-parsed from the input file). Call this before re-running or re-opening a simulation.
|
inlinenoexcept |
Reset all state variables to initial conditions (cold start).
Sets all current and old-step arrays to zero. Invert elevations and static properties are NOT changed.
|
inlinenoexcept |
Snapshot current state into old-step arrays before solving.
Must be called at the start of each timestep, before the hydraulic and quality solvers update the state.
| NameIndex openswmm::SimulationContext::aquifer_names |
| AquiferStore openswmm::SimulationContext::aquifers |
| BuildupData openswmm::SimulationContext::buildup |
| ControlRuleStore openswmm::SimulationContext::control_rules |
| double openswmm::SimulationContext::current_date = 0.0 |
Absolute current date/time (decimal days, Julian date).
= options.start_date + current_time
| double openswmm::SimulationContext::current_time = 0.0 |
Current simulation time (decimal days from start_date).
Updated by TimestepController::advance(). The value 0.0 corresponds to options.start_date.
| double openswmm::SimulationContext::dt_controls_remaining = 0.0 |
Time remaining until the next control rule event (seconds).
0.0 means no control step scheduled; updated by the control rule processor.
| double openswmm::SimulationContext::dt_output_remaining = 0.0 |
Time remaining until the next output boundary (seconds).
Managed by TimestepController. Decremented each step; reset to options.report_step by reset_output_timer().
| DwfData openswmm::SimulationContext::dwf_inflows |
| int openswmm::SimulationContext::error_code = 0 |
| std::string openswmm::SimulationContext::error_message |
Human-readable message for the last error/warning.
| ExtInflowData openswmm::SimulationContext::ext_inflows |
| ForcingData openswmm::SimulationContext::forcing |
Per-element runtime forcing state (lateral inflows, head boundaries, rainfall, evap, link settings, quality mass fluxes).
Set via swmm_forcing_*() API. Applied by applyForcings() in the step loop. Auto-cleared by clear_reset_entries() at end of each step (for RESET-persistence entries).
| NameIndex openswmm::SimulationContext::gage_names |
Rain gage name → gage index.
| GageData openswmm::SimulationContext::gages |
| InletUsageStore openswmm::SimulationContext::inlet_usages |
| InletStore openswmm::SimulationContext::inlets |
| std::string openswmm::SimulationContext::inp_file_path |
Path to the input .inp file (empty if not opened from a file).
| NameIndex openswmm::SimulationContext::landuse_names |
| LanduseData openswmm::SimulationContext::landuses |
| LidControlStore openswmm::SimulationContext::lid_controls |
| NameIndex openswmm::SimulationContext::lid_names |
| LidUsageStore openswmm::SimulationContext::lid_usage |
| NameIndex openswmm::SimulationContext::link_names |
Link name → link index.
| LinkData openswmm::SimulationContext::links |
| struct openswmm::SimulationContext::MassBalance openswmm::SimulationContext::mass_balance |
| NameIndex openswmm::SimulationContext::node_names |
Node name → node index.
| NodeData openswmm::SimulationContext::nodes |
| SimulationOptions openswmm::SimulationContext::options |
Parsed simulation options (from [OPTIONS] section).
| PatternData openswmm::SimulationContext::patterns |
| std::vector<PluginSpec> openswmm::SimulationContext::plugin_specs |
Plugin library specs parsed from [PLUGINS].
Consumed by PluginFactory::load_plugins() during open(). New in 6.0.0 — no legacy equivalent.
| NameIndex openswmm::SimulationContext::pollutant_names |
Pollutant name → pollutant index.
| PollutantData openswmm::SimulationContext::pollutants |
| RDIIAssignData openswmm::SimulationContext::rdii_assigns |
| struct openswmm::SimulationContext::RoutingStepStats openswmm::SimulationContext::routing_stats |
| NameIndex openswmm::SimulationContext::snowpack_names |
| SnowpackStore openswmm::SimulationContext::snowpacks |
| SpatialFrame openswmm::SimulationContext::spatial |
Coordinate reference system and georeferenced coordinates.
| EngineState openswmm::SimulationContext::state = EngineState::CREATED |
Current lifecycle state of the engine.
| StreetStore openswmm::SimulationContext::streets |
| NameIndex openswmm::SimulationContext::subcatch_names |
Subcatchment name → subcatchment index.
| SubcatchData openswmm::SimulationContext::subcatches |
All subcatchment state and properties.
| NameIndex openswmm::SimulationContext::table_names |
Time series / curve name → table index.
| TableData openswmm::SimulationContext::tables |
| TransectStore openswmm::SimulationContext::transects |
| TreatmentData openswmm::SimulationContext::treatment |
| UserFlags openswmm::SimulationContext::user_flags |
User-defined flags from [USER_FLAGS] section.
New in 6.0.0. No legacy equivalent.
| int openswmm::SimulationContext::warning_code = 0 |
Most recent warning code (0 = no warning).
| WashoffData openswmm::SimulationContext::washoff |