OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::input Namespace Reference

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 &reg, 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.
 

Typedef Documentation

◆ SectionHandler

Initial value:
std::function<void(SimulationContext&, const std::vector<std::string>&
)>
Central, reentrant simulation context.
Definition SimulationContext.hpp:390

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.

Parameters
ctxSimulation context to populate.
linesAll non-blank, non-comment lines in the section (after comment stripping but before tokenization).

Enumeration Type Documentation

◆ NwsCondition

enum class openswmm::input::NwsCondition
strong

legacy setCondition (rain.c).

Enumerator
NONE 
ACCUMULATED 
DELETED 
MISSING 

◆ NwsFormat

enum class openswmm::input::NwsFormat
strong
Enumerator
NONE 
TAPE 
SPACE_DELIMITED 
COMMA_DELIMITED 
ONLINE_60 
ONLINE_15 

◆ SeriesFileStatus

Why a parse failed (or that it did not).

Enumerator
OK 

parsed (possibly zero data rows)

OPEN_FAILED 

file could not be opened

FORMAT_FAILED 

no header / no data columns

◆ WarnCode

enum openswmm::WarnCode : int

Function Documentation

◆ add_unique()

int openswmm::input::add_unique ( NameIndex & reg,
const std::string & name,
std::vector< std::string > & errors )
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.

Parameters
[in,out]regMutable case-insensitive registry; new names retain their spelling.
[in]nameCopied authored ID; collisions differing only by ASCII case are duplicates.
[in,out]errorsCaller-owned sink receiving formatted ERR_DUP_NAME for a collision.
Returns
New object index, or -1 after recording duplicate-name error.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ conduit_manning_n()

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.

Parameters
[in]ctxBorrowed resolved link/subtype/transect geometry with coherent force-main options.
[in]jExisting model link index; unchecked base-array access.
Returns
Zero for nonconduit/missing subtype, otherwise effective n.

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.

Returns
The effective n, or 0 for a non-conduit / missing conduit row.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ conduit_true_length()

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).

Parameters
[in]ctxBorrowed resolved link/subtype/transect columns.
[in]jLink index; invalid/nonconduit/missing subtype returns zero.
Returns
Stored conduit length divided by positive transect length_factor for IRREGULAR, otherwise stored length; internal feet after resolution.

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.

Returns
The routing length (ft), or 0 for a non-conduit / missing row.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_internal_to_authored()

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.

Parameters
[in,out]ctxCoherent 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).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_internal_to_display()

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.

Parameters
ctxSimulation context (mutated in place).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ format_error()

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."

Parameters
codeError code.
nameObject name to substitute for s.
Returns
Formatted error message string.
Here is the caller graph for this function:

◆ format_warning()

std::string openswmm::format_warning ( int code,
std::string_view name = "" )

Format a warning message with object name substitution.

Parameters
codeWarning code.
nameObject name to substitute for s.
Returns
Formatted warning message string.
Here is the caller graph for this function:

◆ handle_adjustments()

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.

Parameters
[in,out]ctxAuthored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing.
[in]linesBorrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units.
Here is the call graph for this function:

◆ handle_aquifers()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_buildup()

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.

Parameters
[in,out]ctxContext receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts.
[in]linesBorrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below.
Here is the call graph for this function:

◆ handle_conduits()

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.

Parameters
[in,out]ctxContext with coherent authored link/base/subtype stores; caller serializes input-phase mutation.
[in]linesBorrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution.
Here is the call graph for this function:

◆ handle_controls()

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.

Parameters
[in,out]ctxContext whose control_rules.rule_text receives owned blocks; existing blocks retained.
[in]linesBorrowed raw section rows; tokenizer determines empty rows/first keyword, retained text is copied as authored.
Here is the call graph for this function:

◆ handle_coordinates()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed NODE X Y rows in authored map units, without CRS transformation.
Here is the call graph for this function:

◆ handle_coverages()

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.

Parameters
[in,out]ctxContext receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts.
[in]linesBorrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below.
Here is the call graph for this function:

◆ handle_curves()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_dividers()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion.
Here is the call graph for this function:

◆ handle_dwf()

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.

Parameters
[in,out]ctxAuthored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations.
[in]linesBorrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape.
Here is the call graph for this function:

◆ handle_evaporation()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_events()

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.

Parameters
[in,out]ctxAuthored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing.
[in]linesBorrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units.
Here is the call graph for this function:

◆ handle_files()

void openswmm::input::handle_files ( SimulationContext & ctx,
const std::vector< std::string > & lines )

Parse the [FILES] section into ctx.files.

Parameters
ctxSimulation context to populate.
linesNon-comment, non-empty lines from the section.
Here is the call graph for this function:

◆ handle_groundwater()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_gwf()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_hydrographs()

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.

Parameters
[in,out]ctxAuthored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations.
[in]linesBorrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape.
Here is the call graph for this function:

◆ handle_infiltration()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion.
Here is the call graph for this function:

◆ handle_inflows()

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.

Parameters
[in,out]ctxAuthored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations.
[in]linesBorrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape.
Here is the call graph for this function:

◆ handle_initial_quality()

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.

Parameters
[in,out]ctxContext receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts.
[in]linesBorrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below.
Here is the call graph for this function:

◆ handle_inlet_junctions()

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.

Parameters
[in,out]ctxAuthored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing.
[in]linesBorrowed 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.

Here is the call graph for this function:

◆ handle_inlet_usage()

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.

Parameters
[in,out]ctxAuthored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing.
[in]linesBorrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units.
Here is the call graph for this function:

◆ handle_inlets()

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.

Parameters
[in,out]ctxAuthored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing.
[in]linesBorrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units.
Here is the call graph for this function:

◆ handle_junctions()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion.
Here is the call graph for this function:

◆ handle_landuses()

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.

Parameters
[in,out]ctxContext receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts.
[in]linesBorrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below.
Here is the call graph for this function:

◆ handle_lid_controls()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_lid_usage()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_loadings()

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.

Parameters
[in,out]ctxContext receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts.
[in]linesBorrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below.
Here is the call graph for this function:

◆ handle_losses()

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.

Parameters
[in,out]ctxContext with coherent authored link/base/subtype stores; caller serializes input-phase mutation.
[in]linesBorrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution.
Here is the call graph for this function:

◆ handle_map()

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.

Parameters
[in,out]ctxModel context receiving map geometry/tags; name registries must already identify referenced objects.
[in]linesBorrowed section data rows, consumed synchronously; coordinates remain authored map units without transformation.
Here is the call graph for this function:

◆ handle_mesh_snow_cells()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.

◆ handle_mesh_snow_defaults()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.

◆ handle_mesh_snow_options()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.

◆ handle_options()

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).

Parameters
ctxSimulation context to populate.
linesNon-blank, comment-stripped lines from the [OPTIONS] section.
Here is the call graph for this function:

◆ handle_orifices()

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.

Parameters
[in,out]ctxContext with coherent authored link/base/subtype stores; caller serializes input-phase mutation.
[in]linesBorrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution.
Here is the call graph for this function:

◆ handle_outfalls()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion.
Here is the call graph for this function:

◆ handle_outlets()

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.

Parameters
[in,out]ctxContext with coherent authored link/base/subtype stores; caller serializes input-phase mutation.
[in]linesBorrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution.
Here is the call graph for this function:

◆ handle_patterns()

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.

Parameters
[in,out]ctxAuthored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations.
[in]linesBorrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape.
Here is the call graph for this function:

◆ handle_plugins()

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.

Parameters
[in,out]ctxModel context receiving authored section state and any documented diagnostics; not automatically reset before parsing.
[in]linesBorrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation.
Here is the call graph for this function:

◆ handle_pollutants()

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.

Parameters
[in,out]ctxContext receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts.
[in]linesBorrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below.
Here is the call graph for this function:

◆ handle_polygons()

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.

Parameters
[in,out]ctxModel context receiving map geometry/tags; name registries must already identify referenced objects.
[in]linesBorrowed section data rows, consumed synchronously; coordinates remain authored map units without transformation.
Here is the call graph for this function:

◆ handle_process_components()

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.

Parameters
[in,out]ctxModel context receiving authored section state and any documented diagnostics; not automatically reset before parsing.
[in]linesBorrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation.
Here is the call graph for this function:

◆ handle_pumps()

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.

Parameters
[in,out]ctxContext with coherent authored link/base/subtype stores; caller serializes input-phase mutation.
[in]linesBorrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution.
Here is the call graph for this function:

◆ handle_raingages()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion.
Here is the call graph for this function:

◆ handle_rdii()

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.

Parameters
[in,out]ctxAuthored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations.
[in]linesBorrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape.
Here is the call graph for this function:

◆ handle_rdii_decay()

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.

Parameters
[in,out]ctxAuthored model stores/diagnostics modified incrementally; existing rows retained and caller serializes mutations.
[in]linesBorrowed section data lines tokenized synchronously; stored names/values are copied, no borrowed line views escape.
Here is the call graph for this function:

◆ handle_report()

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.

Parameters
[in,out]ctxContext options modified incrementally; prior flags and name selections retained unless overwritten.
[in]linesBorrowed REPORT data lines; rows under two tokens and unknown keys skip silently.
Here is the call graph for this function:

◆ handle_snowpacks()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_storage()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion.
Here is the call graph for this function:

◆ handle_streets()

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.

Parameters
[in,out]ctxAuthored context stores/errors updated incrementally; caller maintains coherent columns and serializes parsing.
[in]linesBorrowed section rows, tokenized synchronously; stored strings copied and physical values retained in authored project units.
Here is the call graph for this function:

◆ handle_subareas()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion.
Here is the call graph for this function:

◆ handle_subcatchments()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed section rows, copied/tokenized synchronously; lengths/areas/flows remain project display units until post-parse conversion.
Here is the call graph for this function:

◆ handle_symbols()

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.

Parameters
[in,out]ctxModel context receiving map geometry/tags; name registries must already identify referenced objects.
[in]linesBorrowed section data rows, consumed synchronously; coordinates remain authored map units without transformation.
Here is the call graph for this function:

◆ handle_tags()

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.

Parameters
[in,out]ctxModel context receiving map geometry/tags; name registries must already identify referenced objects.
[in]linesBorrowed TYPE NAME TAG rows; tokenizer removes quotes, only token three supplies the tag.
Here is the call graph for this function:

◆ handle_temperature()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_timeseries()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_title()

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.

Parameters
[in,out]ctxModel context receiving authored section state and any documented diagnostics; not automatically reset before parsing.
[in]linesBorrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation.

Format:

[TITLE]
;;Project Title/Notes
First line of project title or notes
Second line...
EXTERN char Title[MAXTITLE][MAXMSG+1]
Definition globals.h:70
Definition objects.h:1060

Each non-blank, non-comment line is stored verbatim in ctx.title_notes as a separate entry.

◆ handle_transects()

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.

Parameters
[in,out]ctxContext with coherent authored link/base/subtype stores; caller serializes input-phase mutation.
[in]linesBorrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution.
Here is the call graph for this function:

◆ handle_treatment()

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.

Parameters
[in,out]ctxContext receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts.
[in]linesBorrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below.
Here is the call graph for this function:

◆ handle_ueb_options()

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.

Parameters
[in,out]ctxContext receiving authored hydrology configuration/deferred references/errors; caller serializes parsing with coherent current stores.
[in]linesBorrowed section data rows, tokenized/copied synchronously; units remain project authoring units except the stated conversions.
Here is the call graph for this function:

◆ handle_user_flag_values()

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.

Parameters
[in,out]ctxModel context receiving authored section state and any documented diagnostics; not automatically reset before parsing.
[in]linesBorrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation.
Here is the call graph for this function:

◆ handle_user_flags()

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.

Parameters
[in,out]ctxModel context receiving authored section state and any documented diagnostics; not automatically reset before parsing.
[in]linesBorrowed section data lines without the section heading, tokenized/copied synchronously; may be empty. Caller serializes context mutation.

Format:

[USER_FLAGS]
;;Name Type Default Description
ENABLE_DEBUG_OUT BOOLEAN NO "Write extra debug output"
MAX_ITERATIONS INTEGER 10 "Override Newton iterations"
STABILITY_FACTOR REAL 1.0 "Global stability multiplier"
LABEL_PREFIX STRING "SIM" "Prefix for output labels"
@ NO
No option.
Definition enums.h:1173
@ INTEGER
Signed integer.
Definition UserFlags.hpp:83
@ STRING
Arbitrary string.
Definition UserFlags.hpp:85
@ REAL
Double-precision floating-point.
Definition UserFlags.hpp:84
@ BOOLEAN
YES/NO/TRUE/FALSE/1/0.
Definition UserFlags.hpp:82
Here is the call graph for this function:

◆ handle_vertices()

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.

Parameters
[in,out]ctxModel context receiving map geometry/tags; name registries must already identify referenced objects.
[in]linesBorrowed section data rows, consumed synchronously; coordinates remain authored map units without transformation.
Here is the call graph for this function:

◆ handle_virtual_junctions()

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.

Parameters
[in,out]ctxModel context receiving authored definitions and errors; caller supplies a coherent BUILDING/input phase and serializes edits.
[in]linesBorrowed 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.

Here is the call graph for this function:

◆ handle_washoff()

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.

Parameters
[in,out]ctxContext receiving authored quality stores and errors; caller serializes input-phase mutations and provides coherent name/dimension counts.
[in]linesBorrowed section rows, tokenized/copied synchronously. Numeric quantities retain their documented authored units except explicit conversions below.
Here is the call graph for this function:

◆ handle_weirs()

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.

Parameters
[in,out]ctxContext with coherent authored link/base/subtype stores; caller serializes input-phase mutation.
[in]linesBorrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution.
Here is the call graph for this function:

◆ handle_xsections()

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.

Parameters
[in,out]ctxContext with coherent authored link/base/subtype stores; caller serializes input-phase mutation.
[in]linesBorrowed section rows, tokenized/copied synchronously; geometry/flow values remain project display units pending resolution.
Here is the call graph for this function:

◆ load_external_rain_files()

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.

Parameters
[in,out]ctxCoherent 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.

Here is the caller graph for this function:

◆ looks_like_multicolumn_series_file()

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.

Parameters
[in]abs_pathBorrowed filename opened through UTF-8/native-path conversion.
Returns
True for an IDs: prefix, any comma, or tabs with a nondatetime first cell; false for open failure, empty input or no matching signature.
Here is the call graph for this function:

◆ multicolumn_parse_count_total()

long openswmm::input::multicolumn_parse_count_total ( )
noexcept

Read the relaxed atomic process-wide parse-entry count.

No reset or synchronization with completed parsing; use snapshots only as test diagnostics.

Returns
Cumulative calls entering parse_multicolumn_series_file(), including failed opens and attempts that later throw.

◆ needs_authored_conversion()

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.

Parameters
[in]ctxBorrowed coherent base link/type/direction/shape arrays and offset convention.
Returns
True for ELEVATION offsets, any negative direction flag or positive sediment depth on FILLED_CIRCULAR conduit.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_date()

double openswmm::input::parse_date ( std::string_view sv)
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.

Parameters
[in]svBorrowed numeric date; each separator may independently be slash or hyphen.
Returns
Encoded date relative to 1899-12-30; 0 for syntactic parse failure, or -datetime::DateDelta for an invalid Gregorian date.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_datetime()

double openswmm::input::parse_datetime ( std::string_view date_sv,
std::string_view time_sv )
inline

Combine the permissive date and decimal-hour/clock parsers.

Parameters
[in]date_svBorrowed date accepted by parse_date(), including its historical failure behavior.
[in]time_svBorrowed decimal hours or clock token accepted by parse_time_day_fraction().
Returns
Sum of both parser results in SWMM decimal days; no independent combined validity check.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_double_strict()

bool openswmm::input::parse_double_strict ( std::string_view sv,
double & out )
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.

Parameters
[in]svBorrowed token; empty is explicitly accepted as zero. A single leading plus is stripped before backend conversion.
[out]outWritten only on success; preserved on partial/failed conversion.
Returns
True after complete conversion or the empty-token zero case; false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_multicolumn_series_file()

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.

Parameters
[in]abs_pathBorrowed filename expected resolved; opened through UTF-8/native-path helper.
[out]outCaller-owned parsed file RESET at entry; may contain a partial header/data prefix after refusal or exception.
[in,out]errorsCaller-owned sink receiving appended file-level open/header/column diagnostics; not cleared.
[out]statusOptional destination set to OK, OPEN_FAILED or FORMAT_FAILED on normal return.
Returns
True for a valid header with at least one data column, even with no successfully parsed data rows; false for file-level refusal.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_section()

std::vector< ParsedLine > openswmm::input::parse_section ( const std::vector< std::string > & raw_lines)
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.

Parameters
[in]raw_linesBorrowed section rows. Empty strings are skipped; semicolon handling requires the semicolon in column zero, so callers trim structural rows first.
Returns
Independent ParsedLine strings, one per nonempty data row.
Here is the caller graph for this function:

◆ parse_series_datetime()

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.

Parameters
[in]cellBorrowed NUL-terminated text; supports ISO numeric date or US slash date, optional clock and US AM/PM suffix.
[out]outWritten on recognized date syntax; preserved if fewer than three date fields parse.
Returns
True when date field syntax parses, false otherwise; this is not independent Gregorian/clock validity validation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_time_day_fraction()

double openswmm::input::parse_time_day_fraction ( std::string_view sv)
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.

Parameters
[in]svBorrowed token: complete decimal number is hours/24; otherwise unsigned HH[:MM[:SS]] fields are parsed.
Returns
Elapsed-day value, possibly >=1 or negative for decimal-hour inputs; zero when no leading integer hour parses.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_time_seconds()

double openswmm::input::parse_time_seconds ( std::string_view sv)
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.

Parameters
[in]svBorrowed input: complete numeric token means seconds; otherwise reads unsigned hours/minutes and optional floating seconds.
Returns
Seconds; zero when no leading hours parse. A failed minute parse after a colon returns the numeric hour value without multiplying it by 3600.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ recompute_conduit_flow_properties()

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.

Parameters
ctxSimulation context (mutated in place).
jLink index.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolve_cross_references()

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.

Parameters
ctxSimulation context (mutated in place).
Here is the caller graph for this function:

◆ resolve_external_file_slots()

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.

Parameters
ctxSimulation context whose external-file slots are resolved in place.
anchor_dirDirectory 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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ restore_authored_orientation()

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.

Parameters
[in,out]ctxCoherent model context modified incrementally; caller serializes parsing/initialization and supplies aligned name/data columns.
Returns
Number of negative-direction conduits restored.
Number of conduits restored.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_series_file_token()

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.

Parameters
[in]tokenBorrowed bytes; must not alias either output string because output assignment can invalidate the view.
[out]path_outReceives the whole token if no separator, otherwise the prefix; must be distinct from column_out.
[out]column_outCleared first; receives suffix if a separator exists, including an empty suffix for a trailing colon.
Returns
True for an eligible colon, false if absent, a sole alphabetic drive colon at index one, or a suffix containing slash/backslash.
Here is the caller graph for this function:

◆ to_double()

double openswmm::input::to_double ( std::string_view sv,
double def = 0.0 )
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.

Parameters
[in]svBorrowed character range; trailing nonnumeric bytes are accepted.
[in]defInitial result returned if the backend leaves its destination unchanged.
Returns
Parsed numeric prefix or default; conversion status and final pointer are intentionally ignored.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_int()

int openswmm::input::to_int ( std::string_view sv,
int def = 0 )
inlinenoexcept

Parse a signed integer prefix using decimal from_chars.

Does not trim whitespace or accept a leading plus; not a complete-token validator.

Parameters
[in]svBorrowed token; trailing bytes are ignored after a valid integer prefix.
[in]defFallback returned for invalid/out-of-range conversion.
Returns
Parsed integer prefix, or def if from_chars reports an error.
Here is the caller graph for this function: