![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Classes | |
| class | InputReader |
| Reads and parses a SWMM .inp file into a SimulationContext. More... | |
| class | MultiColumnFileCache |
| Per-resolve-pass cache keyed by resolved path. More... | |
| struct | NwsFileSpec |
| struct | ParsedLine |
| One data row together with its associated object comment. More... | |
| struct | ParsedSeriesFile |
| One fully parsed multi-column series file (raw file-unit values). More... | |
| class | SectionRegistry |
| Registry that maps section tags (e.g., "[JUNCTIONS]") to handlers. More... | |
| class | Tokenizer |
| Stateless multi-delimiter tokenizer for SWMM input lines. More... | |
Typedefs | |
| using | SectionHandler |
| Handler function type for input file sections. | |
Enumerations | |
| enum class | SeriesFileStatus { OK , OPEN_FAILED , FORMAT_FAILED } |
| Why a parse failed (or that it did not). More... | |
| enum class | NwsFormat { NONE , TAPE , SPACE_DELIMITED , COMMA_DELIMITED , ONLINE_60 , ONLINE_15 } |
| enum class | NwsCondition { NONE , ACCUMULATED , DELETED , MISSING } |
| legacy setCondition (rain.c). More... | |
| enum | WarnCode |
Functions | |
| void | handle_subcatchments (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse subcatchment geometry and authored outlet/gage/snow references. | |
| void | handle_subareas (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign surface roughness/depression storage and inter-subarea routing. | |
| void | handle_infiltration (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign and check authored subcatchment infiltration parameters. | |
| void | handle_raingages (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse rain-gage recording format, source references and file filters. | |
| void | handle_controls (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append raw nonempty control-rule blocks split at RULE rows. | |
| void | handle_report (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Update recognized report flags and per-category object selectors. | |
| void | handle_files (SimulationContext &ctx, const std::vector< std::string > &lines) |
Parse the [FILES] section into ctx.files. | |
| void | handle_evaporation (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Update evaporation source/options, monthly values and recovery flags. | |
| void | handle_temperature (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Update climate/snow forcing source and environmental authoring options. | |
| void | handle_snowpacks (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Merge snowpack surface/removal rows or delegate UEB authoring. | |
| void | handle_ueb_options (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Apply authored UEB option rows to snow configuration. | |
| void | handle_mesh_snow_options (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse mesh-snow option rows through the shared dispatch. | |
| void | handle_mesh_snow_defaults (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse mesh-snow default/tag rows through the shared dispatch. | |
| void | handle_mesh_snow_cells (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse explicit mesh-snow cell rows through the shared dispatch. | |
| void | handle_aquifers (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append named legacy aquifer parameter sets and optional evaporation pattern. | |
| void | handle_groundwater (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign subcatchment groundwater exchange coefficients and optional overrides. | |
| void | handle_gwf (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Validate and retain custom LATERAL/DEEP groundwater flow expressions. | |
| void | handle_lid_controls (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Merge conventional or NODE LID type/layer/removal authoring. | |
| void | handle_lid_usage (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append conventional LID deployment rows for known subcatchment/control names. | |
| void | handle_patterns (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append multiplier factors to named temporal patterns. | |
| void | handle_inflows (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append raw external inflow rows for later reference/constituent resolution. | |
| void | handle_dwf (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append dry-weather inflow definitions with optional pattern names. | |
| void | handle_rdii (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append node-to-unit-hydrograph RDII assignments. | |
| void | handle_hydrographs (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append unit-hydrograph gage bindings and month/response parameters. | |
| void | handle_rdii_decay (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append exponential RDII abstraction/recovery parameters and optional degree-day snow. | |
| void | handle_streets (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append street cross-section definitions with optional back/gutter parameters. | |
| void | handle_inlets (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append inlet designs or merge one GRATE/CURB pair into a combination. | |
| void | handle_inlet_usage (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append conduit-host inlet placements after parsing optional capture parameters. | |
| void | handle_inlet_junctions (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Create inlet-junction nodes and deferred design/capture usage references. | |
| void | handle_adjustments (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign monthly climate multipliers/offsets or subcatchment pattern references. | |
| void | handle_events (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append accepted routing-event date/time windows. | |
| void | handle_conduits (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse conduit length/roughness, offsets and optional initial/limited flow. | |
| void | handle_pumps (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse pump curves, initial status and start/shutoff depths. | |
| void | handle_orifices (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse orifice orientation, offset, discharge coefficient and gate timing. | |
| void | handle_weirs (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse weir type, crest/coefficient, surcharge and roadway authoring. | |
| void | handle_outlets (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse functional/tabular outlet ratings and optional flap gate. | |
| void | handle_xsections (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign raw link cross-sections and defer unresolved referenced names. | |
| void | handle_losses (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign conduit loss/seepage parameters and a shared link flap flag. | |
| void | handle_transects (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append transects from stateful NC, X1 and GR authoring records. | |
| void | handle_junctions (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse ordinary junction definitions and retained object comments. | |
| void | handle_virtual_junctions (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse virtual-junction authoring flags and optional drawing rim depth. | |
| void | handle_outfalls (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse outfall boundary type, stage/reference and optional gate/route target. | |
| void | handle_dividers (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse divider methods, deferred references and type-specific hydraulic fields. | |
| void | handle_storage (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse storage geometry, raw shape parameters and optional exfiltration. | |
| void | handle_coordinates (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign node map coordinates and mark explicit coordinate presence. | |
| void | handle_options (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse the [OPTIONS] section into ctx.options. | |
| void | handle_plugins (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append external plugin library paths and initialization arguments. | |
| void | handle_process_components (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append process-component registrations and parsed key/value arguments. | |
| void | handle_pollutants (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Register pollutant names and populate definition columns in two passes. | |
| void | handle_landuses (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append named land uses with optional sweep parameters/comments. | |
| void | handle_coverages (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign land-use percentages for each named subcatchment. | |
| void | handle_buildup (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign pollutant buildup functions or defer nonpollutant species rows. | |
| void | handle_washoff (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign pollutant washoff functions or defer nonpollutant species rows. | |
| void | handle_treatment (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Store authored treatment expressions by node/pollutant key. | |
| void | handle_loadings (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign initial pollutant surface buildup and defer MSX loading rows. | |
| void | handle_initial_quality (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append per-node/link initial-quality rows or record a CSV sidecar reference. | |
| void | handle_map (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Update map extents and map-unit metadata from recognized rows. | |
| void | handle_vertices (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Rebuild each link's ordered intermediate-vertex lists. | |
| void | handle_polygons (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Rebuild each subcatchment's ordered polygon coordinate lists. | |
| void | handle_symbols (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Update rain-gage symbol coordinates from known-name rows. | |
| void | handle_tags (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Assign per-object tags for known NODE, LINK and SUBCATCH rows. | |
| void | handle_timeseries (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append inline time-series samples or retain external-file references. | |
| void | handle_curves (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Append curve coordinate pairs to kind-scoped named tables. | |
| void | handle_title (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Replace title notes with an exact copy of supplied section lines. | |
| void | handle_user_flags (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse flag-schema names, types and optional descriptions. | |
| void | handle_user_flag_values (SimulationContext &ctx, const std::vector< std::string > &lines) |
| Parse and assign per-object flag values using the currently registered schema. | |
| double | to_double (std::string_view sv, double def=0.0) noexcept |
| Parse a numeric prefix, retaining a supplied default when conversion fails. | |
| bool | parse_double_strict (std::string_view sv, double &out) noexcept |
| Parse a complete token while preserving the output on refusal. | |
| int | to_int (std::string_view sv, int def=0) noexcept |
| Parse a signed integer prefix using decimal from_chars. | |
| double | parse_date (std::string_view sv) |
| Parse month/day/year or month-day-year input into SWMM decimal days. | |
| double | parse_time_seconds (std::string_view sv) |
| Parse a duration as decimal seconds or permissive hour/minute/second fields. | |
| double | parse_time_day_fraction (std::string_view sv) |
| Parse decimal hours or permissive clock fields into elapsed days. | |
| double | parse_datetime (std::string_view date_sv, std::string_view time_sv) |
| Combine the permissive date and decimal-hour/clock parsers. | |
| int | add_unique (NameIndex ®, const std::string &name, std::vector< std::string > &errors) |
| Register a one-definition object name or append a duplicate diagnostic. | |
| bool | parse_series_datetime (const std::string &cell, double &out) |
| Parse supported date/clock syntax into SWMM decimal days. | |
| bool | looks_like_multicolumn_series_file (const std::string &abs_path) |
| Open a file and sniff its first nonblank/noncomment row. | |
| bool | split_series_file_token (std::string_view token, std::string &path_out, std::string &column_out) |
| Split the last eligible column-suffix colon from an external-file token. | |
| bool | parse_multicolumn_series_file (const std::string &abs_path, ParsedSeriesFile &out, std::vector< std::string > &errors, SeriesFileStatus *status=nullptr) |
| Parse CSV/TSV/TSF columns into owned sorted raw-value arrays. | |
| long | multicolumn_parse_count_total () noexcept |
| Read the relaxed atomic process-wide parse-entry count. | |
| void | resolve_external_file_slots (SimulationContext &ctx, const std::string &anchor_dir) |
Slice IO-3: Resolve every external-file slot's .original token against an anchor directory and populate .absolute. | |
| void | load_external_rain_files (SimulationContext &ctx) |
| Reload all external rain files using a fresh shared parse cache. | |
| double | conduit_manning_n (const SimulationContext &ctx, int j) |
| Resolve effective conduit Manning roughness for the current routing/section model. | |
| double | conduit_true_length (const SimulationContext &ctx, int j) |
| Read the physical conduit length with irregular-channel meander correction. | |
| void | recompute_conduit_flow_properties (SimulationContext &ctx, int j) |
| Recompute a single conduit's derived dynamic-wave flow properties. | |
| void | convert_internal_to_display (SimulationContext &ctx) |
Convert the input fields the reader scaled to internal units back to display units (matching ctx.options.flow_units). | |
| bool | needs_authored_conversion (const SimulationContext &ctx) |
| Detect hydraulic input normalizations requiring inverse serialization conversion. | |
| int | restore_authored_orientation (SimulationContext &ctx) |
| Undo adverse-slope conduit reversal in a context used for authoring. | |
| void | convert_internal_to_authored (SimulationContext &ctx) |
| Undo conduit orientation, sediment offsets and elevation-offset normalization. | |
| void | resolve_cross_references (SimulationContext &ctx) |
| Resolve all cross-references in ctx after all sections are parsed. | |
| std::vector< ParsedLine > | parse_section (const std::vector< std::string > &raw_lines) |
| Pair raw section data rows with preceding object-comment text. | |
| std::string | format_error (int code, std::string_view name="") |
| Format an error message with object name substitution. | |
| std::string | format_warning (int code, std::string_view name="") |
| Format a warning message with object name substitution. | |
Handler function type for input file sections.
Called for each dispatched section batch, including deferred-row replay. InputReader can retain leading comment rows for object comments. The handler is responsible for parsing each line and populating the SimulationContext.
| ctx | Simulation context to populate. |
| lines | All non-blank, non-comment lines in the section (after comment stripping but before tokenization). |
|
strong |
legacy setCondition (rain.c).
| Enumerator | |
|---|---|
| NONE | |
| ACCUMULATED | |
| DELETED | |
| MISSING | |
|
strong |
|
strong |
| enum openswmm::WarnCode : int |
|
inline |
Register a one-definition object name or append a duplicate diagnostic.
Use only for one-definition object classes; repeated-row timeseries/curves/patterns require find-then-add instead. Exceptions from allocation propagate.
| [in,out] | reg | Mutable case-insensitive registry; new names retain their spelling. |
| [in] | name | Copied authored ID; collisions differing only by ASCII case are duplicates. |
| [in,out] | errors | Caller-owned sink receiving formatted ERR_DUP_NAME for a collision. |
| double openswmm::input::conduit_manning_n | ( | const SimulationContext & | ctx, |
| int | j ) |
Resolve effective conduit Manning roughness for the current routing/section model.
The Manning's n a conduit actually routes with, before any Courant lengthening adjustment — legacy conduit_validate's roughness.
IRREGULAR prefers positive transect channel n and applies sqrt(positive length_factor). DYNWAVE/FV FORCE_MAIN uses equivalent n from friction model/geometry, falling back to authored conduit roughness when not positive. Does not overwrite authored roughness or validate all geometric inputs.
| [in] | ctx | Borrowed resolved link/subtype/transect geometry with coherent force-main options. |
| [in] | j | Existing model link index; unchecked base-array access. |
Starts from the [CONDUITS] value and applies, in legacy's order: an IRREGULAR conduit takes its transect's main-channel n (link.c:1024); a force main under dynamic-wave routing takes its equivalent Manning n (link.c:1093-1096); an IRREGULAR conduit is then scaled by the square root of its transect's meander length factor (link.c:1101-1105). The stored roughness is never overwritten — it is the authored value the writers persist.
| double openswmm::input::conduit_true_length | ( | const SimulationContext & | ctx, |
| int | j ) |
Read the physical conduit length with irregular-channel meander correction.
The length a conduit actually routes with — legacy conduit_getLength (link.c:1198-1216).
| [in] | ctx | Borrowed resolved link/subtype/transect columns. |
| [in] | j | Link index; invalid/nonconduit/missing subtype returns zero. |
For every section but IRREGULAR this is the authored [CONDUITS] length. For an IRREGULAR one the authored number is the MAIN CHANNEL's length (what a FEMA study reports) while the routing length is the whole flood plain's, length / Transect.lengthFactor. The slope, the Courant lengthening ratio, the conduit's stored volume, the dq6 friction divisor, the evaporation / seepage loss rate and the variable-step scale all use it; the .inp writer, the report's length column and modLength's parse-time default keep the authored value.
| void openswmm::input::convert_internal_to_authored | ( | SimulationContext & | ctx | ) |
Undo conduit orientation, sediment offsets and elevation-offset normalization.
Restore authored link data for writing: un-reverse adverse-slope conduits (node1/node2, offset1/offset2, q0 sign, inlet/outlet losses) and, in ELEVATION offset mode, re-add each node's invert to the depth-normalised offsets and weir/outlet crests.
Intended for a serialization copy after convert_internal_to_display: most geometric authoring fields are then display lengths while xsect_y_bot remains internal feet. Restores direction, subtracts sediment depth times project length factor, and adds node invert to nonpump depth offsets/crest fields for ELEVATION convention. Mutates in place without an idempotency flag; repeated calls can corrupt authoring values. Does not write files or update running solver caches.
| [in,out] | ctx | Coherent model context modified incrementally; caller serializes parsing/initialization and supplies aligned name/data columns. |
Exact inverse of the reversal and ELEV_OFFSET passes inside resolve_cross_references. Operate on a copy — the live engine state must keep its canonical (depth, positive-slope) form. Vertices are untouched (the reversal never reorders them).
| void openswmm::input::convert_internal_to_display | ( | SimulationContext & | ctx | ) |
Convert the input fields the reader scaled to internal units back to display units (matching ctx.options.flow_units).
Exact inverse of the file-local convert_inputs_to_internal that resolve_cross_references applies at parse time: it multiplies the same node/link/subcatchment length-, area-, flow-, and rainfall-dimensioned fields by the forward UCF instead of its reciprocal. The .inp writer needs display units, but the engine stores everything internally in feet/cfs, so a save must undo the parse-time conversion or each save→reopen cycle compounds the factor (the m→ft "exploding model" bug). US-unit models are a no-op (factor 1.0).
MUST stay field-for-field in sync with convert_inputs_to_internal in PostParseResolver.cpp — editing one without the other reintroduces the asymmetry.
| ctx | Simulation context (mutated in place). |
| std::string openswmm::format_error | ( | int | code, |
| std::string_view | name = "" ) |
Format an error message with object name substitution.
Produces output like: " ERROR 173: Time Series RAIN1 has its data out of sequence."
| code | Error code. |
| name | Object name to substitute for s. |
| std::string openswmm::format_warning | ( | int | code, |
| std::string_view | name = "" ) |
Format a warning message with object name substitution.
| code | Warning code. |
| name | Object name to substitute for s. |
| void openswmm::input::handle_adjustments | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign monthly climate multipliers/offsets or subcatchment pattern references.
Parse [ADJUSTMENTS] — fills climate adjustment arrays.
Keyword-prefix forms TEMP/EVAP/RAIN/CONDUCT need twelve values; conductivity<=0 defaults one. Temperature/evap offsets stay authored project units, rainfall/conductivity are factors. N-PERV/DSTORE/INFIL require currently known subcatchment and time-pattern names; unresolved/short/unknown rows silently skip. Grows assignment vectors but does not clear previous entries, apply adjustments, convert units or set runtime pattern flags.
| [in,out] | ctx | Authored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing. |
| [in] | lines | Borrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units. |
| void openswmm::input::handle_aquifers | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append named legacy aquifer parameter sets and optional evaporation pattern.
Parse [AQUIFERS] into AquiferStore + aquifer_names.
Requires >=13 tokens; duplicates append ERR_DUP_NAME and skip. Stores porosity/moisture fractions, conductivity/rate and elevation parameters in authored project units, optional pattern by name. Numeric conversion is permissive; no layer physical-consistency, finite-value or pattern validation, zone-state creation or unit conversion.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_buildup | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign pollutant buildup functions or defer nonpollutant species rows.
Parse [BUILDUP] — buildup functions per (landuse x pollutant).
Requires existing land uses; resizes pollutant parameter matrices only when dimensions differ, discarding them in that case. Known pollutant rows overwrite supplied parameters, using legacy keyword prefixes and unknown=>NONE; EXT parameter3 looks up a timeseries immediately. Nonpollutant names append deferred MSX rows with retained series name. Coefficients retain function-specific authored mass/area/curb/time units; no full range, reference or species validation.
| [in,out] | ctx | Context receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below. |
| void openswmm::input::handle_conduits | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse conduit length/roughness, offsets and optional initial/limited flow.
Short rows skip; duplicate link IDs append ERR_DUP_NAME and preserve the earlier row. Accepted rows register a link, allocate its subtype, retain comments and record both endpoint names for later resolution. Numeric conversion is permissive and full hydraulic/topology validation occurs later. Requires NAME N1 N2 LENGTH ROUGHNESS OFFSET1 OFFSET2. Offset * is preserved as missing under elevation convention. Does not calculate slope, full flow, geometry or apply filled-circular sediment offsets.
| [in,out] | ctx | Context with coherent authored link/base/subtype stores; caller serializes input-phase mutation. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution. |
| void openswmm::input::handle_controls | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append raw nonempty control-rule blocks split at RULE rows.
Flushes a prior block when a case-insensitive RULE token starts a new one, joining retained rows with actual newlines. Text before the first RULE also forms a block; no grammar validation, name indexing, control compilation or runtime execution here. Allocation failure can leave prior appended blocks.
| [in,out] | ctx | Context whose control_rules.rule_text receives owned blocks; existing blocks retained. |
| [in] | lines | Borrowed raw section rows; tokenizer determines empty rows/first keyword, retained text is copied as authored. |
| void openswmm::input::handle_coordinates | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign node map coordinates and mark explicit coordinate presence.
Parse [COORDINATES] — fills spatial.node_x / node_y.
Known node IDs overwrite X/Y (last duplicate wins) and set node_has_xy=1; short/unknown rows skip silently. Grows coordinate/mask arrays as needed, preserving other nodes. Permissive numeric parsing can write fallback values; no finite/range validation or node creation.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed NODE X Y rows in authored map units, without CRS transformation. |
| void openswmm::input::handle_coverages | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign land-use percentages for each named subcatchment.
Parse [COVERAGES] — land use coverage fractions per subcatchment.
No-op unless both name registries are nonempty; undersized coverage/sweep arrays are replaced with zeros and coverage stride updated. Each row accepts multiple LANDUSE PERCENT pairs, last duplicate wins. Missing items/names/bad complete numeric tokens append errors and stop the remaining pairs after any earlier assignments. Values remain percentages, without [0,100] or sum-to100 validation; caller counts/products must fit signed arithmetic.
| [in,out] | ctx | Context receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below. |
| void openswmm::input::handle_curves | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append curve coordinate pairs to kind-scoped named tables.
Parse [CURVES] into TableData (kind-scoped names).
Creates/reuses non-TIMESERIES tables independently of a same-named series. New first-row type token uses exact folded lookup; unknown type appends ERR_KEYWORD but still creates a table using current_type (initially RATING, potentially retained from a previous curve). Recognized optional type tokens are consumed on continuation rows without retyping existing table. Raw x/y values remain curve-specific project units; ignores incomplete final pair and performs no ordering/range validation.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_dividers | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse divider methods, deferred references and type-specific hydraulic fields.
Parse [DIVIDERS] — sets divider-specific fields.
Short rows skip; duplicate IDs append ERR_DUP_NAME through add_unique and retain the earlier object. New rows and partial field writes are not rolled back on later refusal/allocation. Retains diversion-link name and optional TABULAR curve for post-parse resolution. CUTOFF/TABULAR use one method parameter, WEIR uses qMin/dhMax/coefficient, OVERFLOW none; optional depth/initial/surcharge/ponded fields follow that method-dependent tail. Unknown method keeps defaults; numeric parsing is permissive, without full range/topology validation.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
| void openswmm::input::handle_dwf | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append dry-weather inflow definitions with optional pattern names.
Parse [DWF] into DwfData.
Requires NODE CONSTITUENT AVERAGE; short rows skip. Retains node name for later resolution and up to four positional pattern names. Stores authored flow/concentration average with permissive numeric parsing; does not resolve constituent, validate patterns or apply loads.
| [in,out] | ctx | Authored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations. |
| [in] | lines | Borrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape. |
| void openswmm::input::handle_evaporation | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Update evaporation source/options, monthly values and recovery flags.
Parse [EVAPORATION] into SimulationOptions evap fields.
Recognizes CONSTANT/MONTHLY/TIMESERIES/TEMPERATURE/FILE/RECOVERY/DRY_ONLY; missing required tokens and unknown keys skip. Constant/monthly rates stay project evaporation units (in/day or mm/day), FILE may store twelve pan factors, names defer. Does not load climate/table files, resolve patterns, validate full numeric ranges or compute PET.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_events | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append accepted routing-event date/time windows.
Parse [EVENTS] — fills ctx.events.
Four tokens parse start/end as OADate dates plus day fractions; only start<end appends. Short/reversed/equal intervals skip silently. Permissive date/time helpers may yield sentinels; no sorting, overlap merge, simulation-range validation or event-clock reset here.
| [in,out] | ctx | Authored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing. |
| [in] | lines | Borrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units. |
| void openswmm::input::handle_files | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse the [FILES] section into ctx.files.
| ctx | Simulation context to populate. |
| lines | Non-comment, non-empty lines from the section. |
| void openswmm::input::handle_groundwater | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign subcatchment groundwater exchange coefficients and optional overrides.
Parse [GROUNDWATER] — link subcatchments to aquifers and nodes.
Nonempty rows require >=11 tokens, otherwise ERR_ITEMS. Unknown subcatchment defers row; required/optional numeric tokens use complete parsing with ERR_NUMBER, while absent/leading-* optional values are MISSING. Retains unresolved aquifer/node references for post-parse. Writes raw surface/threshold/elevation/initial-zone coefficients without final physical/topology/unit validation; no solver step.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_gwf | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Validate and retain custom LATERAL/DEEP groundwater flow expressions.
Parse [GWF] — custom groundwater flow expressions (stored as raw text).
Unknown subcatchment defers the row; known name is canonicalized for ext_options key. LAT-prefix selects LATERAL, exact DEEP selects DEEP; unknown type reports ERR_KEYWORD. Preserves expression commas from comment-stripped raw text and rejects gwf_validate errors with ERR_MATH_EXPR. Repeated keys replace text; no compiled solver installation or expression execution.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_hydrographs | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append unit-hydrograph gage bindings and month/response parameters.
Parse [HYDROGRAPHS] into UnitHydData.
Two tokens bind group to rain gage; response rows require >=6 tokens and malformed item counts append ERR_ITEMS. Months accept ALL (-1), case-insensitive three-letter month prefixes or complete integers 1..12; invalid month appends ERR_KEYWORD. SHORT/MEDIUM/LONG are exact folded tokens; invalid response silently skips. Stores R, peak time hours, K ratio and optional initial-abstraction values in project rain units without numeric/range checks. No model-index resolution or duplicate replacement here.
| [in,out] | ctx | Authored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations. |
| [in] | lines | Borrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape. |
| void openswmm::input::handle_infiltration | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign and check authored subcatchment infiltration parameters.
Parse [INFILTRATION] — Horton/Green-Ampt/CN params per subcatch.
Updates known rows with >=4 tokens. Default method follows OPTIONS; recognized final method token overrides it. Writes available raw project-unit parameter slots before validation: Horton requires nonnegative values/f0>=fmin, Green-Ampt suction>=0/Ksat>0/IMD in[0,1], curve number drying time>0. Failure appends ERR_INFILTRATION but leaves written values. Does not allocate solver state, normalize units or verify every finite input.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
| void openswmm::input::handle_inflows | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append raw external inflow rows for later reference/constituent resolution.
Parse [INFLOWS] into ExtInflowData.
Requires NODE CONSTITUENT SERIES; short rows skip. Retains authored node name even when currently unresolved. Optional type defaults FLOW, mass/series multipliers one and baseline zero, pattern empty; permissive numeric conversion uses those defaults. Raw baseline/series units follow constituent/type until loader conversion; no node creation, table binding, sign validation or runtime source injection.
| [in,out] | ctx | Authored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations. |
| [in] | lines | Borrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape. |
| void openswmm::input::handle_initial_quality | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append per-node/link initial-quality rows or record a CSV sidecar reference.
Parse [INITIAL_QUALITY] — per-node/per-link initial concentrations.
FILE stores its path token (last wins) for later loading without IO. Inline scope must be NODE/LINK with >=4 tokens and complete from_chars_double value; malformed rows append errors. Element/constituent resolution defers and raw value remains concentration units, age hours or temperature degC. Does not reject negative/nonfinite values solely via a separate policy check, apply seeds, clear prior rows or set error_code.
| [in,out] | ctx | Context receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below. |
| void openswmm::input::handle_inlet_junctions | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Create inlet-junction nodes and deferred design/capture usage references.
Parse [INLET_JUNCTIONS] — virtual junctions that carry a street inlet.
Requires NAME ELEV RIM DESIGN CAPTURE and <=11 tokens; validates shared usage tail before registration. Duplicate node IDs refuse. Creates JUNCTION with virtual/inlet flags, nonnegative rim (zero derives later), retained comment and usage with both references deferred by name. Does not require design/capture to exist yet or validate approach conduits/mesh compatibility.
| [in,out] | ctx | Authored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing. |
| [in] | lines | Borrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units. |
Name Elev MaxDepth Inlet CaptureNode (#Inlets Clog Qmax aLocal wLocal Placement): the node gets is_virtual = is_inlet = 1 and a node-hosted InletUsageStore row whose design / capture-node names are resolved by PostParseResolver. More than 11 tokens is a parse error (ERR_IJ_EXTRA_TOKENS). Implemented in InfraHandler.cpp beside the [INLET_USAGE] tail parser it shares.
| void openswmm::input::handle_inlet_usage | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append conduit-host inlet placements after parsing optional capture parameters.
Parse [INLET_USAGE] — fills ctx.inlet_usages.
Known link and design are required immediately; unknown ones append ERR_NAME. Capture node may be unresolved, retaining its name for post-parse. Uses shared tail range checks, then appends usage with node_host=-1 and street_index=-1. Does not validate STREET/drop compatibility, duplicate hosts, topology or execute capture; post-parse resolves those.
| [in,out] | ctx | Authored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing. |
| [in] | lines | Borrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units. |
| void openswmm::input::handle_inlets | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append inlet designs or merge one GRATE/CURB pair into a combination.
Parse [INLETS] — fills ctx.inlets.
Validates recognized type, required positive dimensions, grate/throat keywords and GENERIC open fraction(0,1]/optional nonnegative splash. Unknown types/items/numbers append errors. Only a GRATE+CURB pair sharing an ASCII-insensitive name can merge; other duplicates refuse, and no COMBO keyword is parsed. CUSTOM retains curve ID for resolution. Keeps first nonempty object comment; no solver-unit conversion or complete finite/curve applicability validation.
| [in,out] | ctx | Authored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing. |
| [in] | lines | Borrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units. |
| void openswmm::input::handle_junctions | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse ordinary junction definitions and retained object comments.
Parse [JUNCTIONS] into NodeData + node_names.
Short rows skip; duplicate IDs append ERR_DUP_NAME through add_unique and retain the earlier object. New rows and partial field writes are not rolled back on later refusal/allocation. Registers name/grows node before checking optional depth/surcharge/ponded-area values for negativity; rejected values therefore leave a default registered row. Invert may be negative. Stores JUNCTION type, elevations/depths and ponded area without a complete finite/numeric check; post-parse supplies topology/solver initialization.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
| void openswmm::input::handle_landuses | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append named land uses with optional sweep parameters/comments.
Parse [LANDUSES] into LanduseData + landuse_names.
Duplicate names report ERR_DUP_NAME and skip; existing other rows persist. Defaults zero interval/removal/days-since-sweep, stores supplied values permissively in authored days/fraction conventions. Does not allocate buildup/washoff/coverage matrices, validate sweep ranges or execute sweeping.
| [in,out] | ctx | Context receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below. |
| void openswmm::input::handle_lid_controls | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Merge conventional or NODE LID type/layer/removal authoring.
Parse [LID_CONTROLS] into LidControlStore + lid_names.
Reuses control names; two tokens set the type. Conventional layers fill available raw parameter slots permissively; unknown layer tokens become the type. NODE layers require recognized kind, exact arity and complete finite strtod values, otherwise errors. REMOVALS clamp percent/100 to[0,1], appending known pollutant pairs or deferred constituent names. Does not build runtime units, convert geometry/rates or enforce all material/range/layer-order rules.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_lid_usage | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append conventional LID deployment rows for known subcatchment/control names.
Parse [LID_USAGE] into LidUsageStore.
Requires >=8 tokens and known references; unknown names skip silently. NODE controls report an error requiring LID_NODES. Negative replicate count reports ERR_NUMBER, zero skips; positive count appends raw project area/width and authored saturation/routing percentages. Report * maps empty, optional drain target stays by name. Independent appends can fail without rollback; runtime groups, water balance and final validation are separate.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_loadings | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign initial pollutant surface buildup and defer MSX loading rows.
Parse [LOADINGS] — initial pollutant buildup on subcatchments.
Nonpollutant names append raw MSX loading rows first, even without pollutant definitions; species/subcatchment validation defers. Known pollutant/subcatchment pairs overwrite init_loading in authored mass per unit area, not runoff concentration. Can resize/zero quality matrices if pollutant shape differs. Short/unknown rows otherwise skip and numeric parsing is permissive; no runtime buildup seeding or unit conversion.
| [in,out] | ctx | Context receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below. |
| void openswmm::input::handle_losses | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign conduit loss/seepage parameters and a shared link flap flag.
Requires link and entry-loss token; unknown links defer the row. For a conduit writes available inlet/outlet/average loss and seepage (authored rain-rate units); all link classes may receive flap flag. No range/finite validation, sign normalization, unit conversion or resetting of omitted parameters.
| [in,out] | ctx | Context with coherent authored link/base/subtype stores; caller serializes input-phase mutation. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution. |
| void openswmm::input::handle_map | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Update map extents and map-unit metadata from recognized rows.
Parse [MAP] — fills spatial.map_x1/y1/x2/y2 and map_units.
DIMENSIONS with four values overwrites extents; UNITS stores an uppercase token. Unknown/short rows are ignored, prior fields retained. Uses permissive to_double conversion, no coordinate ordering/range checks, no CRS assignment or geometry rescaling.
| [in,out] | ctx | Model context receiving map geometry/tags; name registries must already identify referenced objects. |
| [in] | lines | Borrowed section data rows, consumed synchronously; coordinates remain authored map units without transformation. |
| void openswmm::input::handle_mesh_snow_cells | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse explicit mesh-snow cell rows through the shared dispatch.
Calls meshSnowRows section2; accepted authored assignments remain to be resolved against a mesh. Appends helper errors; no model-wide rollback.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_mesh_snow_defaults | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse mesh-snow default/tag rows through the shared dispatch.
Calls meshSnowRows section1; keeps authored rows for later precedence/mesh resolution and appends helper errors. No runtime state mutation.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_mesh_snow_options | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse mesh-snow option rows through the shared dispatch.
Calls meshSnowRows section0; helper errors append to ctx.errors and accepted keys modify configuration incrementally. No mesh allocation or runtime step.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_options | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse the [OPTIONS] section into ctx.options.
Built-in handler registered in SWMMEngine::register_builtin_handlers(). Unknown keys are stored in ctx.options.ext_options (R05). The CRS key also populates ctx.spatial.crs (R06).
| ctx | Simulation context to populate. |
| lines | Non-blank, comment-stripped lines from the [OPTIONS] section. |
| void openswmm::input::handle_orifices | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse orifice orientation, offset, discharge coefficient and gate timing.
Short rows skip; duplicate link IDs append ERR_DUP_NAME and preserve the earlier row. Accepted rows register a link, allocate its subtype, retain comments and record both endpoint names for later resolution. Numeric conversion is permissive and full hydraulic/topology validation occurs later. SIDE maps to1, every other supplied orientation token to BOTTOM0. Offset follows DEPTH/ELEVATION sentinel policy; gate uses tokenizer boolean parsing. Open/close rate is stored as its raw authored scalar; no timing conversion or solver state update here.
| [in,out] | ctx | Context with coherent authored link/base/subtype stores; caller serializes input-phase mutation. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution. |
| void openswmm::input::handle_outfalls | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse outfall boundary type, stage/reference and optional gate/route target.
Parse [OUTFALLS] — sets outfall-specific fields for nodes of type OUTFALL.
Short rows skip; duplicate IDs append ERR_DUP_NAME through add_unique and retain the earlier object. New rows and partial field writes are not rolled back on later refusal/allocation. Creates OUTFALL subtype; unknown boundary token keeps default FREE. FIXED stores project-length stage; TIDAL/TIMESERIES retain the boundary table name with unresolved -1. FREE/NORMAL may include a * stage placeholder before gate. Route-to subcatchment is looked up immediately and may stay -1; no target creation or full boundary validation.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
| void openswmm::input::handle_outlets | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse functional/tabular outlet ratings and optional flap gate.
Short rows skip; duplicate link IDs append ERR_DUP_NAME and preserve the earlier row. Accepted rows register a link, allocate its subtype, retain comments and record both endpoint names for later resolution. Numeric conversion is permissive and full hydraulic/topology validation occurs later. Crest uses offset sentinel policy and negative DEPTH crests clamp to zero. Rating type detects uppercase TABULAR/DEPTH substrings case-sensitively; other strings imply functional head. Tabular stores a curve name; functional stores coefficient/exponent. Gate position follows rating arity; no rating-curve validation or hydraulic computation.
| [in,out] | ctx | Context with coherent authored link/base/subtype stores; caller serializes input-phase mutation. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution. |
| void openswmm::input::handle_patterns | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append multiplier factors to named temporal patterns.
Parse [PATTERNS] into PatternData with continuation-line support.
New rows may explicitly select MONTHLY/DAILY/HOURLY/WEEKEND; omitted type defaults MONTHLY. Repeating a name appends factors, even if a different type token is supplied (stored type remains unchanged). Numeric conversion defaults to one on failure; no expected factor-length, finite/range or duplicate-row validation. Short rows skip.
| [in,out] | ctx | Authored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations. |
| [in] | lines | Borrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape. |
| void openswmm::input::handle_plugins | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append external plugin library paths and initialization arguments.
Parse [PLUGINS] into ctx.plugin_specs.
Nonempty tokenized rows append one owned PluginSpec; first token is path, remainder copied arguments. Does not clear earlier registrations, resolve paths, load libraries, validate duplicate specs or call initialization.
| [in,out] | ctx | Model context receiving authored section state and any documented diagnostics; not automatically reset before parsing. |
| [in] | lines | Borrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation. |
| void openswmm::input::handle_pollutants | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Register pollutant names and populate definition columns in two passes.
Parse [POLLUTANTS] into PollutantData + pollutant_names.
Name pass permits forward co-pollutant references and records duplicates. Then resize_pollutants resets every existing definition to defaults before parsing all rows; duplicate rows still repopulate the original index in the second pass. Unknown unit text defaults mg/L; decay converts 1/day to 1/second. Stores concentration, snow flag, co-pollutant/fraction and comments without complete finite/range validation; no network concentration matrices are sized.
| [in,out] | ctx | Context receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below. |
| void openswmm::input::handle_polygons | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Rebuild each subcatchment's ordered polygon coordinate lists.
Parse [POLYGONS] — fills spatial.subcatch_polygon_x/y.
Grows outer arrays then clears every current polygon before appending known SUBCATCH X Y rows. Short/unknown rows skip silently; numeric conversion is permissive. Does not enforce ring closure, orientation, point count or calculate area/centroid. Separate X/Y appends can fail without rollback.
| [in,out] | ctx | Model context receiving map geometry/tags; name registries must already identify referenced objects. |
| [in] | lines | Borrowed section data rows, consumed synchronously; coordinates remain authored map units without transformation. |
| void openswmm::input::handle_process_components | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append process-component registrations and parsed key/value arguments.
First token is component ID, CONFIG (case-insensitive) sets the config path with last occurrence winning; other keys preserve spelling/order. Malformed arguments append ctx.errors but the remaining row still registers. Does not clear prior specs, set error_code, resolve paths or load/apply components. Allocation can interrupt incremental appends.
| [in,out] | ctx | Model context receiving authored section state and any documented diagnostics; not automatically reset before parsing. |
| [in] | lines | Borrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation. |
| void openswmm::input::handle_pumps | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse pump curves, initial status and start/shutoff depths.
Short rows skip; duplicate link IDs append ERR_DUP_NAME and preserve the earlier row. Accepted rows register a link, allocate its subtype, retain comments and record both endpoint names for later resolution. Numeric conversion is permissive and full hydraulic/topology validation occurs later. Curve * leaves unresolved -1 for an ideal pump; other names are retained and looked up as curves. Optional status is ON only for that exact folded token, otherwise OFF; writes setting and target. Does not validate curve type or startup versus shutoff ordering.
| [in,out] | ctx | Context with coherent authored link/base/subtype stores; caller serializes input-phase mutation. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution. |
| void openswmm::input::handle_raingages | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse rain-gage recording format, source references and file filters.
Parse [RAINGAGES] into GageData + gage_names.
Short rows skip; duplicate IDs append ERR_DUP_NAME through add_unique and retain the earlier object. New rows and partial field writes are not rolled back on later refusal/allocation. Stores intensity/volume/cumulative format (unknown defaults intensity), interval in rounded integer seconds from decimal hours or H:MM[:SS], snow correction and positive optional scale. Caller input interval must be finite/int-representable. TIMESERIES names defer; FILE accepts path:column or standard station/IN|MM/start-date grammar. Start-date errors append ERR_DATETIME. Paths are authored only: no file IO, path resolution, rain conversion or complete source/interval validation here.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
| void openswmm::input::handle_rdii | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append node-to-unit-hydrograph RDII assignments.
Parse [RDII] into RDIIAssignData.
Requires NODE UH_GROUP SEWER_AREA; short rows skip. Stores raw project land-area units and node name/index, allowing unresolved nodes until post-parse. Does not check group existence, nonnegative/finite area, duplicate assignments or compute inflow.
| [in,out] | ctx | Authored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations. |
| [in] | lines | Borrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape. |
| void openswmm::input::handle_rdii_decay | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append exponential RDII abstraction/recovery parameters and optional degree-day snow.
Parse [RDII_DECAY] into RDIIDecayData (exponential IA model).
Rows under eight tokens, unknown response, negative depletion/base/thermal rates or malformed/negative SNOW melt factor skip silently. k_dep uses reciprocal project rain-depth units, k_0/k_T 1/hour, temperatures degC, sensitivity 1/degC, snow_ddf project depth/degC/day. Numeric parsing is permissive; no full finite-value checks or group existence validation. A non-SNOW extra token does not activate the optional clause; runtime evaluation occurs later.
| [in,out] | ctx | Authored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations. |
| [in] | lines | Borrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape. |
| void openswmm::input::handle_report | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Update recognized report flags and per-category object selectors.
Parses object ALL/NONE/lists and INPUT/CONTINUITY/FLOWSTATS/CONTROLS/AVERAGES/LINK_STEPS/DISABLED booleans. Explicit lists append names across repeated rows; ALL/NONE do not clear them. Does not resolve names, compile output schema, write files or validate report availability.
| [in,out] | ctx | Context options modified incrementally; prior flags and name selections retained unless overwritten. |
| [in] | lines | Borrowed REPORT data lines; rows under two tokens and unknown keys skip silently. |
| void openswmm::input::handle_snowpacks | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Merge snowpack surface/removal rows or delegate UEB authoring.
Parse [SNOWPACKS] into SnowpackStore + snowpack_names.
Reuses existing pack name or appends one, ensuring conventional parameter columns even for UEB. Seven surface values and six removal values remain authored units, optional removal target name retained. UEB helper refusal appends contextual error; unknown/short surface records otherwise leave a registered default pack. No runtime state initialization, unit conversion or full snowpack validation.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_storage | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse storage geometry, raw shape parameters and optional exfiltration.
Parse [STORAGE] — adds storage nodes and their geometry.
Short rows skip; duplicate IDs append ERR_DUP_NAME through add_unique and retain the earlier object. New rows and partial field writes are not rolled back on later refusal/allocation. Registers STORAGE with elevation/max/initial depth, then TABULAR curve name, FUNCTIONAL coefficients or geometric p1/p2/p3 with derived quadratic coefficients when valid. Unknown shape defaults FUNCTIONAL; invalid geometric derivation leaves default coefficients. Tail supplies surcharge, evaporation fraction, then bare Ksat or suction/Ksat/IMD. Keeps raw project-unit dimensions/comments; no final geometry/table/finite validation or exfiltration state initialization.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
| void openswmm::input::handle_streets | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append street cross-section definitions with optional back/gutter parameters.
Parse [STREETS] — fills ctx.streets.
Requires ID crown-width curb-height cross-slope road-n; short rows skip. ASCII-insensitive duplicates append ERR_DUP_NAME and skip. Defaults zero gutter/back geometry and two sides; slopes remain authored percentages. Numeric parsing is permissive without full range checks; independent column appends may fail without rollback.
| [in,out] | ctx | Authored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing. |
| [in] | lines | Borrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units. |
| void openswmm::input::handle_subareas | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign surface roughness/depression storage and inter-subarea routing.
Parse [SUBAREAS] — Manning's n + depression storage for each subcatch.
Updates only known subcatchments; short/unknown rows skip silently. Stores authored PctZero and its fraction, project rain-depth depression storage and Manning n. OUTLET/IMPERV/PERV accept keyword-prefix spellings; unknown routing text falls back OUTLET. If routing token exists, absent routed percentage defaults100%; existing rows otherwise persist. No finite/range validation.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
| void openswmm::input::handle_subcatchments | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse subcatchment geometry and authored outlet/gage/snow references.
Parse [SUBCATCHMENTS] into SubcatchData + subcatch_names.
Short rows skip; duplicate IDs append ERR_DUP_NAME through add_unique and retain the earlier object. New rows and partial field writes are not rolled back on later refusal/allocation. Retains names for deferred resolution; immediate outlet lookup prefers node over subcatchment. Converts impervious percentage to a fraction with upper cap100, slope percentage to fraction; no lower cap. Optional curb/snowpack and positive rain/snow scale factors are retained (* means no snowpack). Does not validate drainage topology, nonnegative geometry, gage existence or compute runoff state.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
| void openswmm::input::handle_symbols | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Update rain-gage symbol coordinates from known-name rows.
Parse [SYMBOLS] — fills spatial.gage_x/y.
Grows missing coordinate arrays with zero defaults; recognized rows overwrite the selected gage (last duplicate wins). Other existing coordinates are preserved. Short/unknown rows skip silently; no finite/range or CRS check.
| [in,out] | ctx | Model context receiving map geometry/tags; name registries must already identify referenced objects. |
| [in] | lines | Borrowed section data rows, consumed synchronously; coordinates remain authored map units without transformation. |
| void openswmm::input::handle_tags | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign per-object tags for known NODE, LINK and SUBCATCH rows.
Parse [TAGS] — writes per-index tags onto ctx.nodes.tags / ctx.links.tags / ctx.subcatches.tags (resolves name → idx via the matching NameIndex; unresolved lines are skipped).
Category is uppercased, object ID resolved through its ASCII-insensitive registry. Grows tag vectors as needed and overwrites each selected entry, preserving other tags. Unknown types/names and short rows skip silently; no user-flag schema interaction or clearing of absent assignments.
| [in,out] | ctx | Model context receiving map geometry/tags; name registries must already identify referenced objects. |
| [in] | lines | Borrowed TYPE NAME TAG rows; tokenizer removes quotes, only token three supplies the tag. |
| void openswmm::input::handle_temperature | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Update climate/snow forcing source and environmental authoring options.
Parse [TEMPERATURE] into SimulationOptions temperature/wind/snow fields.
Parses temperature series/file (optional OADate filter and C10/C/F units), monthly/file wind, humidity/dewpoint constant/monthly/series, legacy SNOWMELT/ADC and delegated snow SITE/model/step/met/radiation keys. Snow helper/date refusals append errors; most other numeric reads are permissive. Snow elevation/temperature and meteorology retain project units, DTLong minutes. Does not load files, resolve names, apply climate adjustments or advance weather state.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_timeseries | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append inline time-series samples or retain external-file references.
Parse [TIMESERIES] into TableData (kind-scoped names).
Creates/reuses TIMESERIES tables by case-insensitive name independently of curves. Per-series anchors survive interleaving and earlier sections: explicit slash-date rows use OADate, time-only decimal hours/clock values wrap forward when <=prior time-of-day. Pre-date samples stay relative and n_relative marks later start-date offsetting. FILE path:column is retained without loading or marking streaming state. Values parse permissively; no monotonicity/finite/shape validation or rollback of separate x/y appends.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_title | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Replace title notes with an exact copy of supplied section lines.
Parse [TITLE] into ctx.title_notes.
Owned title_notes are cleared and reserved before copying; blank/comment text is preserved, without tokenization or a three-line cap. Allocation can leave a partially replaced title.
| [in,out] | ctx | Model context receiving authored section state and any documented diagnostics; not automatically reset before parsing. |
| [in] | lines | Borrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation. |
Format:
Each non-blank, non-comment line is stored verbatim in ctx.title_notes as a separate entry.
| void openswmm::input::handle_transects | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Append transects from stateful NC, X1 and GR authoring records.
NC tracks active roughness: positive values replace, zero inherits and negatives append ERR_NUMBER. X1 appends a row even after a duplicate-name diagnostic, using active roughness, raw station/elevation modifiers and zero encroachment/comments; zero length/width factors default one. GR appends elevation/station pairs to the most recent stored transect, ignoring incomplete final pair. No declared station-count, ordering, bank or cross-section validation here; allocations can interrupt column alignment.
| [in,out] | ctx | Context with coherent authored link/base/subtype stores; caller serializes input-phase mutation. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution. |
| void openswmm::input::handle_treatment | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Store authored treatment expressions by node/pollutant key.
Parse [TREATMENT] — treatment expressions per (node x pollutant).
No-op without nodes or pollutants. Dimension changes resize/reset treatment authored storage; known-key rows reconstruct tokens from the third onward with single spaces and overwrite their slot. Unknown/short rows skip. Does not compile expressions, set has_treatment, resolve dependency cycles or execute removal.
| [in,out] | ctx | Context receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below. |
| void openswmm::input::handle_ueb_options | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Apply authored UEB option rows to snow configuration.
Skips token-empty rows, delegates setUebOption with its file-row policy flag false and appends contextual helper diagnostics. Preserves prior configuration except assigned keys; does not instantiate/step UEB or set context error_code.
| [in,out] | ctx | Context receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores. |
| [in] | lines | Borrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions. |
| void openswmm::input::handle_user_flag_values | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse and assign per-object flag values using the currently registered schema.
Parse [USER_FLAG_VALUES] into ctx.user_flags (per-object values).
Rows under four tokens skip silently. Object/flag categories are uppercased, object name spelling retained. Undefined schema defaults STRING and sets warning_code=103 if clear. Numeric conversion status/trailing text are ignored and zero-initialized values may survive refusal. No object-existence check, deferred schema retyping or clearing of prior assignments.
| [in,out] | ctx | Model context receiving authored section state and any documented diagnostics; not automatically reset before parsing. |
| [in] | lines | Borrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation. |
| void openswmm::input::handle_user_flags | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse flag-schema names, types and optional descriptions.
Parse [USER_FLAGS] into ctx.user_flags.
Uppercases schema names/type tokens with Tokenizer rules; duplicate names replace existing definitions. Fewer than two tokens skip silently. Unknown types become STRING and set warning_code=102 only if no warning exists. Description uses token three only. Existing schema/value state is retained; no lifecycle guard or object-value conversion.
| [in,out] | ctx | Model context receiving authored section state and any documented diagnostics; not automatically reset before parsing. |
| [in] | lines | Borrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation. |
Format:
| void openswmm::input::handle_vertices | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Rebuild each link's ordered intermediate-vertex lists.
Parse [VERTICES] — fills spatial.link_vertices_x/y.
Grows outer arrays to the link registry then clears all current per-link vertices, including links absent from lines. Appends recognized LINK X Y rows in input order; short/unknown-object rows skip silently. Numeric parsing is permissive; X/Y pushes can fail independently, with no rollback. Does not insert link endpoints or alter network topology.
| [in,out] | ctx | Model context receiving map geometry/tags; name registries must already identify referenced objects. |
| [in] | lines | Borrowed section data rows, consumed synchronously; coordinates remain authored map units without transformation. |
| void openswmm::input::handle_virtual_junctions | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse virtual-junction authoring flags and optional drawing rim depth.
Parse [VIRTUAL_JUNCTIONS] — junction-typed nodes with is_virtual = 1.
Short rows skip; duplicate IDs append ERR_DUP_NAME through add_unique and retain the earlier object. New rows and partial field writes are not rolled back on later refusal/allocation. Accepts NAME INVERT [RIM_DEPTH]; >3 tokens appends ERR_VJ_EXTRA_TOKENS before registration. Creates JUNCTION type with is_virtual=1. Rim depth is max(0,to_double), used for rendering; hydraulic properties derive from attached conduits later. No topology/coupling validation here.
| [in,out] | ctx | Model context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits. |
| [in] | lines | Borrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion. |
One token per line (the node name); geometry is derived from the two attached conduits in PostParseResolver. Extra tokens are a parse error (ERR_VJ_EXTRA_TOKENS). Refactored engine only.
| void openswmm::input::handle_washoff | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign pollutant washoff functions or defer nonpollutant species rows.
Parse [WASHOFF] — washoff functions per (landuse x pollutant).
Requires existing land uses and known land-use ID; short/unknown-land-use rows skip. Resizes dimension-changed pollutant matrices; known pollutants overwrite supplied coefficients/efficiencies, others append MSX authoring rows by name. Types match legacy prefixes (unknown=>NONE); coefficients/exponents and sweep/BMP percentages are stored permissively without finite/range conversion or runtime load computation.
| [in,out] | ctx | Context receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below. |
| void openswmm::input::handle_weirs | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Parse weir type, crest/coefficient, surcharge and roadway authoring.
Short rows skip; duplicate link IDs append ERR_DUP_NAME and preserve the earlier row. Accepted rows register a link, allocate its subtype, retain comments and record both endpoint names for later resolution. Numeric conversion is permissive and full hydraulic/topology validation occurs later. Unknown type defaults TRANSVERSE; supports SIDEFLOW/V-NOTCH/TRAPEZOIDAL/ROADWAY. Retains optional coefficient curve name for later binding. * preserves defaults for secondary coefficient/surcharge; roadway fields apply only to ROADWAY. No unit conversion or complete type/range validation.
| [in,out] | ctx | Context with coherent authored link/base/subtype stores; caller serializes input-phase mutation. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution. |
| void openswmm::input::handle_xsections | ( | SimulationContext & | ctx, |
| const std::vector< std::string > & | lines ) |
Assign raw link cross-sections and defer unresolved referenced names.
Unknown links defer the complete row for replay; <3 tokens append ERR_ITEMS, unknown shape ERR_KEYWORD. Shape is written before further item/positive Geom1 checks, so later refusal can leave partial changes. IRREGULAR/STREET retain transect/street name, CUSTOM retains shape-curve name and depth. Raw Geom1..4 persist for round trips; optional positive barrel/culvert tokens cast from double and require finite int-representable input. Derived geometry and references resolve later.
| [in,out] | ctx | Context with coherent authored link/base/subtype stores; caller serializes input-phase mutation. |
| [in] | lines | Borrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution. |
| void openswmm::input::load_external_rain_files | ( | SimulationContext & | ctx | ) |
Reload all external rain files using a fresh shared parse cache.
(Re)load every FILE-source rain gage's data from disk.
Delegates load_external_rain_files_impl, replacing applicable gage series/statistics and appending diagnostics. Each unique multi-column path parses once within this call; a new call creates a new cache. Does not clear existing error/warning vectors, reset engine weather cursors or reload separate FILE timeseries.
| [in,out] | ctx | Coherent model context modified incrementally; caller serializes parsing/initialization and supplies aligned name/data columns. |
Runs as part of resolve_cross_references() during open(). Exposed separately so an editing host can pick up a changed file path, station, or units without reopening the model — nothing else re-runs it, so swmm_file_path_set on a rain gage would otherwise have no effect until the next open and callers would silently keep reading the previous file's data.
Rebuilds ctx.gages.rain_series and the rainfall-file summary statistics, independent of the [OPTIONS] simulation dates.
| bool openswmm::input::looks_like_multicolumn_series_file | ( | const std::string & | abs_path | ) |
Open a file and sniff its first nonblank/noncomment row.
Reads until the first content row then closes the local stream. This open is separate from parse/cache attempts and is not counted by multicolumn_parse_count_total(). Not a full format validator.
| [in] | abs_path | Borrowed filename opened through UTF-8/native-path conversion. |
|
noexcept |
Read the relaxed atomic process-wide parse-entry count.
No reset or synchronization with completed parsing; use snapshots only as test diagnostics.
| bool openswmm::input::needs_authored_conversion | ( | const SimulationContext & | ctx | ) |
Detect hydraulic input normalizations requiring inverse serialization conversion.
True when the context holds parse-time normalisations that the .inp writer must undo: LINK_OFFSETS=ELEVATION (offsets stored as depths) or any conduit reversed for adverse slope (direction == -1).
Does not perform conversion or inspect all unit factors; callers separately decide display-unit conversion.
| [in] | ctx | Borrowed coherent base link/type/direction/shape arrays and offset convention. |
|
inline |
Parse month/day/year or month-day-year input into SWMM decimal days.
Reads numeric prefixes without requiring end-of-token after year. The two failure sentinels are historical behavior, not an optional/error result.
| [in] | sv | Borrowed numeric date; each separator may independently be slash or hyphen. |
|
inline |
Combine the permissive date and decimal-hour/clock parsers.
| [in] | date_sv | Borrowed date accepted by parse_date(), including its historical failure behavior. |
| [in] | time_sv | Borrowed decimal hours or clock token accepted by parse_time_day_fraction(). |
|
inlinenoexcept |
Parse a complete token while preserving the output on refusal.
Does not independently reject NaN/infinity. Whitespace/backend edge cases follow from_chars_double(); use a separate finite/range check when required.
| [in] | sv | Borrowed token; empty is explicitly accepted as zero. A single leading plus is stripped before backend conversion. |
| [out] | out | Written only on success; preserved on partial/failed conversion. |
| bool openswmm::input::parse_multicolumn_series_file | ( | const std::string & | abs_path, |
| ParsedSeriesFile & | out, | ||
| std::vector< std::string > & | errors, | ||
| SeriesFileStatus * | status = nullptr ) |
Parse CSV/TSV/TSF columns into owned sorted raw-value arrays.
Increments process parse counter even on failed open. Raw numeric cells use C-locale strtod prefixes without complete-token/range checks; absent/unparseable cells become NaN, present unparseable cells increment diagnostics. Invalid datetime syntax skips a whole row. Sorts dates/columns ascending without deduplicating equal timestamps; ties need not preserve source order. Stream EOF/read failure are not separately distinguished. Allocation/path exceptions propagate.
| [in] | abs_path | Borrowed filename expected resolved; opened through UTF-8/native-path helper. |
| [out] | out | Caller-owned parsed file RESET at entry; may contain a partial header/data prefix after refusal or exception. |
| [in,out] | errors | Caller-owned sink receiving appended file-level open/header/column diagnostics; not cleared. |
| [out] | status | Optional destination set to OK, OPEN_FAILED or FORMAT_FAILED on normal return. |
|
inline |
Pair raw section data rows with preceding object-comment text.
Single-semicolon lines append text after the semicolon using a literal backslash-n separator. Double-semicolon headers clear pending comments; trailing unattached comments are discarded. Whitespace-only strings are data unless pretrimmed. Data rows are copied verbatim: this helper does not strip inline comments or quotes.
| [in] | raw_lines | Borrowed section rows. Empty strings are skipped; semicolon handling requires the semicolon in column zero, so callers trim structural rows first. |
| bool openswmm::input::parse_series_datetime | ( | const std::string & | cell, |
| double & | out ) |
Parse supported date/clock syntax into SWMM decimal days.
Uses permissive sscanf prefixes, tolerates trailing text and missing clock components. encodeDate supplies its invalid-date sentinel and encodeTime accepts extended nonnegative hours/minutes. US AM/PM changes only hours 1..12; 00/13..23 remain as supplied. No timezone conversion or unit scaling.
| [in] | cell | Borrowed NUL-terminated text; supports ISO numeric date or US slash date, optional clock and US AM/PM suffix. |
| [out] | out | Written on recognized date syntax; preserved if fewer than three date fields parse. |
|
inline |
Parse decimal hours or permissive clock fields into elapsed days.
Clock path tolerates missing minute/second fields and trailing text; no [0,1) clamp. Parsed clock components must satisfy encodeTime() integer representability requirements.
| [in] | sv | Borrowed token: complete decimal number is hours/24; otherwise unsigned HH[:MM[:SS]] fields are parsed. |
|
inline |
Parse a duration as decimal seconds or permissive hour/minute/second fields.
Does not enforce clock-field bounds or complete consumption in the colon path. With no colon, a partial numeric-hours prefix is multiplied by 3600. Callers needing strict validation must validate separately.
| [in] | sv | Borrowed input: complete numeric token means seconds; otherwise reads unsigned hours/minutes and optional floating seconds. |
| void openswmm::input::recompute_conduit_flow_properties | ( | SimulationContext & | ctx, |
| int | j ) |
Recompute a single conduit's derived dynamic-wave flow properties.
Recomputes the routing coefficients the dynamic-wave solver consumes — rough_factor, beta, q_full, q_max, volume (and the force-main roughness factor) — from the conduit's current roughness, slope, and full-section geometry. This is the per-conduit body shared by resolve_cross_references (parse time) and the runtime geometry setters, so an edit to a conduit's roughness after open() propagates into the simulation instead of leaving stale parse-time coefficients in place.
Non-conduit links, and conduits with non-positive roughness or full area, are left untouched.
| ctx | Simulation context (mutated in place). |
| j | Link index. |
| void openswmm::input::resolve_cross_references | ( | SimulationContext & | ctx | ) |
Resolve all cross-references in ctx after all sections are parsed.
This is a best-effort pass: references that still can't be resolved after the full file is read are left as -1 and a warning is stored in ctx.warning_code.
| ctx | Simulation context (mutated in place). |
| void openswmm::input::resolve_external_file_slots | ( | SimulationContext & | ctx, |
| const std::string & | anchor_dir ) |
Slice IO-3: Resolve every external-file slot's .original token against an anchor directory and populate .absolute.
Walks ctx.files (rainfall/runoff/rdii/inflows/outflows/hotstart), ctx.gages.file_path[], ctx.options.temp_file, and every timeseries Table::file_path. For each non-empty slot, assigns slot.absolute = io::resolveRelative(slot.original, anchor_dir). Empty slots get an empty .absolute.
Called as part of resolve_cross_references after all handlers have run. Exposed here so unit tests can exercise the resolution pass without building a complete simulation context.
The original token is left untouched — InpWriter continues to consume it verbatim until Slice IO-4 wires the rebase-on-write step.
| ctx | Simulation context whose external-file slots are resolved in place. |
| anchor_dir | Directory the .original tokens were authored against; typically io::parentDir(ctx.inp_file_path). Empty means "no anchor" — relative tokens are left lexically normalised against an empty base. |
| int openswmm::input::restore_authored_orientation | ( | SimulationContext & | ctx | ) |
Undo adverse-slope conduit reversal in a context used for authoring.
Undo the parse-time adverse-slope reversal on every conduit with direction == -1 (node1/node2, offset1/offset2, q0 sign, inlet/outlet losses, slope sign) and reset direction to +1.
Swaps end nodes/offsets and inlet/outlet loss coefficients, negates initial flow/slope, sets direction=1. Leaves vertex order and runtime flow arrays unchanged. No solver/cache reinitialization or lifecycle guard; use a writer copy or a separate edit context, not an actively routed network.
| [in,out] | ctx | Coherent model context modified incrementally; caller serializes parsing/initialization and supplies aligned name/data columns. |
| bool openswmm::input::split_series_file_token | ( | std::string_view | token, |
| std::string & | path_out, | ||
| std::string & | column_out ) |
Split the last eligible column-suffix colon from an external-file token.
No trimming/unquoting, file lookup or encoding conversion. A true result with empty column selects first-data-column conventions at consumers.
| [in] | token | Borrowed bytes; must not alias either output string because output assignment can invalidate the view. |
| [out] | path_out | Receives the whole token if no separator, otherwise the prefix; must be distinct from column_out. |
| [out] | column_out | Cleared first; receives suffix if a separator exists, including an empty suffix for a trailing colon. |
|
inlinenoexcept |
Parse a numeric prefix, retaining a supplied default when conversion fails.
Not a whole-token validator; leading whitespace/plus and overflow semantics depend on from_chars_double() backend.
| [in] | sv | Borrowed character range; trailing nonnumeric bytes are accepted. |
| [in] | def | Initial result returned if the backend leaves its destination unchanged. |
|
inlinenoexcept |
Parse a signed integer prefix using decimal from_chars.
Does not trim whitespace or accept a leading plus; not a complete-token validator.
| [in] | sv | Borrowed token; trailing bytes are ignored after a valid integer prefix. |
| [in] | def | Fallback returned for invalid/out-of-range conversion. |