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  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  WarnCode
 

Functions

void handle_subcatchments (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [SUBCATCHMENTS] into SubcatchData + subcatch_names.
 
void handle_subareas (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [SUBAREAS] — Manning's n + depression storage for each subcatch.
 
void handle_infiltration (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [INFILTRATION] — Horton/Green-Ampt/CN params per subcatch.
 
void handle_raingages (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [RAINGAGES] into GageData + gage_names.
 
void handle_controls (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_report (SimulationContext &ctx, const std::vector< std::string > &lines)
 
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)
 Parse [EVAPORATION] into SimulationOptions evap fields.
 
void handle_temperature (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [TEMPERATURE] into SimulationOptions temperature/wind/snow fields.
 
void handle_snowpacks (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [SNOWPACKS] into SnowpackStore + snowpack_names.
 
void handle_aquifers (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [AQUIFERS] into AquiferStore + aquifer_names.
 
void handle_groundwater (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [GROUNDWATER] — link subcatchments to aquifers and nodes.
 
void handle_gwf (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [GWF] — custom groundwater flow expressions (stored as raw text).
 
void handle_lid_controls (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [LID_CONTROLS] into LidControlStore + lid_names.
 
void handle_lid_usage (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [LID_USAGE] into LidUsageStore.
 
void handle_patterns (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [PATTERNS] into PatternData with continuation-line support.
 
void handle_inflows (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [INFLOWS] into ExtInflowData.
 
void handle_dwf (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [DWF] into DwfData.
 
void handle_rdii (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [RDII] into RDIIAssignData.
 
void handle_hydrographs (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [HYDROGRAPHS] into UnitHydData.
 
void handle_rdii_decay (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [RDII_DECAY] into RDIIDecayData (exponential IA model).
 
void handle_streets (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [STREETS] — fills ctx.streets.
 
void handle_inlets (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [INLETS] — fills ctx.inlets.
 
void handle_inlet_usage (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [INLET_USAGE] — fills ctx.inlet_usages.
 
void handle_inlet_junctions (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [INLET_JUNCTIONS] — virtual junctions that carry a street inlet.
 
void handle_adjustments (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [ADJUSTMENTS] — fills climate adjustment arrays.
 
void handle_events (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [EVENTS] — fills ctx.events.
 
void handle_conduits (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_pumps (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_orifices (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_weirs (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_outlets (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_xsections (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_losses (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_transects (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_junctions (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [JUNCTIONS] into NodeData + node_names.
 
void handle_virtual_junctions (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [VIRTUAL_JUNCTIONS] — junction-typed nodes with is_virtual = 1.
 
void handle_outfalls (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [OUTFALLS] — sets outfall-specific fields for nodes of type OUTFALL.
 
void handle_dividers (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [DIVIDERS] — sets divider-specific fields.
 
void handle_storage (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [STORAGE] — adds storage nodes and their geometry.
 
void handle_coordinates (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [COORDINATES] — fills spatial.node_x / node_y.
 
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)
 Parse [PLUGINS] into ctx.plugin_specs.
 
void handle_process_components (SimulationContext &ctx, const std::vector< std::string > &lines)
 
void handle_pollutants (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [POLLUTANTS] into PollutantData + pollutant_names.
 
void handle_landuses (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [LANDUSES] into LanduseData + landuse_names.
 
void handle_coverages (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [COVERAGES] — land use coverage fractions per subcatchment.
 
void handle_buildup (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [BUILDUP] — buildup functions per (landuse x pollutant).
 
void handle_washoff (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [WASHOFF] — washoff functions per (landuse x pollutant).
 
void handle_treatment (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [TREATMENT] — treatment expressions per (node x pollutant).
 
void handle_loadings (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [LOADINGS] — initial pollutant buildup on subcatchments.
 
void handle_initial_quality (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [INITIAL_QUALITY] — per-node/per-link initial concentrations.
 
void handle_map (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [MAP] — fills spatial.map_x1/y1/x2/y2 and map_units.
 
void handle_vertices (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [VERTICES] — fills spatial.link_vertices_x/y.
 
void handle_polygons (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [POLYGONS] — fills spatial.subcatch_polygon_x/y.
 
void handle_symbols (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [SYMBOLS] — fills spatial.gage_x/y.
 
void handle_tags (SimulationContext &ctx, const std::vector< std::string > &lines)
 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).
 
void handle_timeseries (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [TIMESERIES] into TableData (kind-scoped names).
 
void handle_curves (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [CURVES] into TableData (kind-scoped names).
 
void handle_title (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [TITLE] into ctx.title_notes.
 
void handle_user_flags (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [USER_FLAGS] into ctx.user_flags.
 
void handle_user_flag_values (SimulationContext &ctx, const std::vector< std::string > &lines)
 Parse [USER_FLAG_VALUES] into ctx.user_flags (per-object values).
 
double to_double (std::string_view sv, double def=0.0) noexcept
 Parse a double from a string_view, returning a default on failure.
 
int to_int (std::string_view sv, int def=0) noexcept
 Parse an int from a string_view, returning a default on failure.
 
double parse_date (std::string_view sv)
 Parse a date string in MM/DD/YYYY format to a DateTime (decimal days).
 
double parse_time_seconds (std::string_view sv)
 Parse a time string to seconds.
 
double parse_time_day_fraction (std::string_view sv)
 Parse a time string HH:MM:SS to a fractional day (DateTime).
 
double parse_datetime (std::string_view date_sv, std::string_view time_sv)
 Parse a combined date + time pair to a DateTime.
 
int add_unique (NameIndex &reg, const std::string &name, std::vector< std::string > &errors)
 Register a new object definition, rejecting duplicates like legacy.
 
bool parse_series_datetime (const std::string &cell, double &out)
 Parse a full datetime cell.
 
bool looks_like_multicolumn_series_file (const std::string &abs_path)
 Cheap content sniff: does this file look multi-column?
 
bool split_series_file_token (std::string_view token, std::string &path_out, std::string &column_out)
 Split a path[:column] FILE token into its path and column parts.
 
bool parse_multicolumn_series_file (const std::string &abs_path, ParsedSeriesFile &out, std::vector< std::string > &errors, SeriesFileStatus *status=nullptr)
 Parse a multi-column series file (format auto-detected).
 
long multicolumn_parse_count_total () noexcept
 Process-wide count of multi-column file parses (test hook).
 
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)
 (Re)load every FILE-source rain gage's data from disk.
 
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)
 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).
 
int restore_authored_orientation (SimulationContext &ctx)
 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.
 
void convert_internal_to_authored (SimulationContext &ctx)
 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.
 
void resolve_cross_references (SimulationContext &ctx)
 Resolve all cross-references in ctx after all sections are parsed.
 
std::vector< ParsedLineparse_section (const std::vector< std::string > &raw_lines)
 Split raw section lines into (data, comment) pairs.
 
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(
const std::vector<std::string>&
)>
Central, reentrant simulation context.
Definition SimulationContext.hpp:353

Handler function type for input file sections.

Called once per section with all non-comment, non-empty lines in that section. 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

◆ 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 new object definition, rejecting duplicates like legacy.

Legacy input.c addObject() emits ERR_DUP_NAME (207) when an object class that defines one object per line sees a second definition of the same name — and its hash table is case-insensitive, so names differing only in case collide too. Multi-line object classes (timeseries, curves, patterns, snowpacks, LID controls, inlets, unit hydrographs) legitimately repeat their name across lines and must keep using find-then-add instead of this helper.

Parameters
regName registry for the object class.
nameName from the definition line (stored spelling).
errorsctx.errors sink for the ERR_DUP_NAME message.
Returns
New index, or -1 if the name was already registered (the error has been pushed; caller should skip the line).
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)

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.

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 )

Parse [ADJUSTMENTS] — fills climate adjustment arrays.

Here is the call graph for this function:

◆ handle_aquifers()

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

Parse [AQUIFERS] into AquiferStore + aquifer_names.

Here is the call graph for this function:

◆ handle_buildup()

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

Parse [BUILDUP] — buildup functions per (landuse x pollutant).

Here is the call graph for this function:

◆ handle_conduits()

void openswmm::input::handle_conduits ( SimulationContext & ctx,
const std::vector< std::string > & lines )
Here is the call graph for this function:

◆ handle_controls()

void openswmm::input::handle_controls ( SimulationContext & ctx,
const std::vector< std::string > & lines )
Here is the call graph for this function:

◆ handle_coordinates()

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

Parse [COORDINATES] — fills spatial.node_x / node_y.

Here is the call graph for this function:

◆ handle_coverages()

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

Parse [COVERAGES] — land use coverage fractions per subcatchment.

Here is the call graph for this function:

◆ handle_curves()

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

Parse [CURVES] into TableData (kind-scoped names).

Here is the call graph for this function:

◆ handle_dividers()

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

Parse [DIVIDERS] — sets divider-specific fields.

Here is the call graph for this function:

◆ handle_dwf()

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

Parse [DWF] into DwfData.

Here is the call graph for this function:

◆ handle_evaporation()

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

Parse [EVAPORATION] into SimulationOptions evap fields.

Here is the call graph for this function:

◆ handle_events()

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

Parse [EVENTS] — fills ctx.events.

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 )

Parse [GROUNDWATER] — link subcatchments to aquifers and nodes.

Here is the call graph for this function:

◆ handle_gwf()

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

Parse [GWF] — custom groundwater flow expressions (stored as raw text).

Here is the call graph for this function:

◆ handle_hydrographs()

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

Parse [HYDROGRAPHS] into UnitHydData.

Here is the call graph for this function:

◆ handle_infiltration()

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

Parse [INFILTRATION] — Horton/Green-Ampt/CN params per subcatch.

Here is the call graph for this function:

◆ handle_inflows()

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

Parse [INFLOWS] into ExtInflowData.

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 )

Parse [INITIAL_QUALITY] — per-node/per-link initial concentrations.

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 )

Parse [INLET_JUNCTIONS] — virtual junctions that carry a street inlet.

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 )

Parse [INLET_USAGE] — fills ctx.inlet_usages.

Here is the call graph for this function:

◆ handle_inlets()

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

Parse [INLETS] — fills ctx.inlets.

Here is the call graph for this function:

◆ handle_junctions()

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

Parse [JUNCTIONS] into NodeData + node_names.

Here is the call graph for this function:

◆ handle_landuses()

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

Parse [LANDUSES] into LanduseData + landuse_names.

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 )

Parse [LID_CONTROLS] into LidControlStore + lid_names.

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 )

Parse [LID_USAGE] into LidUsageStore.

Here is the call graph for this function:

◆ handle_loadings()

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

Parse [LOADINGS] — initial pollutant buildup on subcatchments.

Here is the call graph for this function:

◆ handle_losses()

void openswmm::input::handle_losses ( SimulationContext & ctx,
const std::vector< std::string > & lines )
Here is the call graph for this function:

◆ handle_map()

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

Parse [MAP] — fills spatial.map_x1/y1/x2/y2 and map_units.

Here is the call graph for this function:

◆ 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 )
Here is the call graph for this function:

◆ handle_outfalls()

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

Parse [OUTFALLS] — sets outfall-specific fields for nodes of type OUTFALL.

Here is the call graph for this function:

◆ handle_outlets()

void openswmm::input::handle_outlets ( SimulationContext & ctx,
const std::vector< std::string > & lines )
Here is the call graph for this function:

◆ handle_patterns()

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

Parse [PATTERNS] into PatternData with continuation-line support.

Here is the call graph for this function:

◆ handle_plugins()

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

Parse [PLUGINS] into ctx.plugin_specs.

Here is the call graph for this function:

◆ handle_pollutants()

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

Parse [POLLUTANTS] into PollutantData + pollutant_names.

Here is the call graph for this function:

◆ handle_polygons()

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

Parse [POLYGONS] — fills spatial.subcatch_polygon_x/y.

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 )
Here is the call graph for this function:

◆ handle_pumps()

void openswmm::input::handle_pumps ( SimulationContext & ctx,
const std::vector< std::string > & lines )
Here is the call graph for this function:

◆ handle_raingages()

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

Parse [RAINGAGES] into GageData + gage_names.

Here is the call graph for this function:

◆ handle_rdii()

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

Parse [RDII] into RDIIAssignData.

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 )

Parse [RDII_DECAY] into RDIIDecayData (exponential IA model).

Here is the call graph for this function:

◆ handle_report()

void openswmm::input::handle_report ( SimulationContext & ctx,
const std::vector< std::string > & lines )
Here is the call graph for this function:

◆ handle_snowpacks()

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

Parse [SNOWPACKS] into SnowpackStore + snowpack_names.

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] — adds storage nodes and their geometry.

Here is the call graph for this function:

◆ handle_streets()

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

Parse [STREETS] — fills ctx.streets.

Here is the call graph for this function:

◆ handle_subareas()

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

Parse [SUBAREAS] — Manning's n + depression storage for each subcatch.

Here is the call graph for this function:

◆ handle_subcatchments()

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

Parse [SUBCATCHMENTS] into SubcatchData + subcatch_names.

Here is the call graph for this function:

◆ handle_symbols()

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

Parse [SYMBOLS] — fills spatial.gage_x/y.

Here is the call graph for this function:

◆ handle_tags()

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

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

Here is the call graph for this function:

◆ handle_temperature()

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

Parse [TEMPERATURE] into SimulationOptions temperature/wind/snow fields.

Here is the call graph for this function:

◆ handle_timeseries()

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

Parse [TIMESERIES] into TableData (kind-scoped names).

Here is the call graph for this function:

◆ handle_title()

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

Parse [TITLE] into ctx.title_notes.

Format:

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

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 )
Here is the call graph for this function:

◆ handle_treatment()

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

Parse [TREATMENT] — treatment expressions per (node x pollutant).

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 [USER_FLAG_VALUES] into ctx.user_flags (per-object values).

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 [USER_FLAGS] into ctx.user_flags.

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:1222
@ 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 )

Parse [VERTICES] — fills spatial.link_vertices_x/y.

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_JUNCTIONS] — junction-typed nodes with is_virtual = 1.

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 )

Parse [WASHOFF] — washoff functions per (landuse x pollutant).

Here is the call graph for this function:

◆ handle_weirs()

void openswmm::input::handle_weirs ( SimulationContext & ctx,
const std::vector< std::string > & lines )
Here is the call graph for this function:

◆ handle_xsections()

void openswmm::input::handle_xsections ( SimulationContext & ctx,
const std::vector< std::string > & lines )
Here is the call graph for this function:

◆ load_external_rain_files()

void openswmm::input::load_external_rain_files ( SimulationContext & ctx)

(Re)load every FILE-source rain gage's data from disk.

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, windowed to the current [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)

Cheap content sniff: does this file look multi-column?

Reads only up to the first content line. True when it starts with IDs: (TSF), contains a comma (legacy .dat is whitespace delimited), or is tab-delimited with a non-datetime first cell (a TSV header row). Used by the timeseries loader to route a FILE reference without a :column suffix.

Here is the call graph for this function:

◆ multicolumn_parse_count_total()

long openswmm::input::multicolumn_parse_count_total ( )
noexcept

Process-wide count of multi-column file parses (test hook).

Lets a black-box engine test assert the single-read guarantee across swmm_engine_open (capture before, compare after). Not part of the public C API.

◆ needs_authored_conversion()

bool openswmm::input::needs_authored_conversion ( const SimulationContext & ctx)

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

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 a date string in MM/DD/YYYY format to a DateTime (decimal days).

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

Parse a combined date + time pair to a DateTime.

Parameters
date_svDate string in MM/DD/YYYY format.
time_svTime string in HH:MM:SS format.
Returns
DateTime value (decimal days).
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 a multi-column series file (format auto-detected).

Parameters
abs_pathResolved path to open.
outReceives the parsed file on success.
errorsReceives one human-readable string per file-level problem (cannot open, no header, no data columns).
statusOptional; receives why parsing failed (or OK).
Returns
true on success (a well-formed file with zero data rows still succeeds — consumers decide whether emptiness is an error).
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

Split raw section lines into (data, comment) pairs.

Rules applied in order:

  • Lines starting with ";;" are column-header or dashes markers — discarded, and any accumulated pending comment is reset.
  • Lines starting with ";" (but not ";;") are object-comment lines. The leading semicolon is stripped and the text is appended to the pending comment, separated from any prior line by the literal "\\n" token.
  • All other non-empty lines are data lines. They receive the pending comment (which is then cleared) and are appended to the result.
  • A trailing comment block with no subsequent data line is silently discarded (there is no object to attach it to).
Parameters
raw_linesLines as accumulated by InputReader (may contain ";;" and ";" lines verbatim, plus stripped data lines).
Returns
Vector of ParsedLine, one entry per data line.
Here is the caller graph for this function:

◆ parse_series_datetime()

bool openswmm::input::parse_series_datetime ( const std::string & cell,
double & out )

Parse a full datetime cell.

Accepts ISO-8601 YYYY-MM-DD[ T]HH:MM[:SS], 24-hour US MM/DD/YYYY[ HH:MM[:SS]], and 12-hour US with a trailing AM/PM token (MM/DD/YYYY hh:mm[:ss] AM — the TSF form). Relocated from PostParseResolver.cpp (csv_parse_datetime) per the 2026-08-17 plan; the n<5 hour-dropping asymmetry of the US branch is fixed to mirror the ISO branch.

Parameters
cellText of the cell (already trimmed).
outReceives the encoded SWMM OADate on success.
Returns
true when the cell parsed as a datetime.
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 a time string HH:MM:SS to a fractional day (DateTime).

For use with datetime::encodeTime. Returns fractional day [0, 1).

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 time string to seconds.

Accepts:

  • HH:MM:SS → hours*3600 + min*60 + sec
  • HH:MM → hours*3600 + min*60
  • N → N (plain seconds, floating point)
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 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.

Returns
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 a path[:column] FILE token into its path and column parts.

ONE rule, shared by every consumer of the convention — the rain gage reader (handlers/CatchmentHandler.cpp) and the timeseries loader (PostParseResolver.cpp). They used to differ (first colon vs. last colon), which derived two different cache keys for the same file and silently defeated the single-read guarantee whenever a path contained a colon.

The rule: take the LAST colon in the token, then reject it as a column separator when either

  • it is the Windows drive-letter colon (index 1, preceded by a letter), or
  • the text after it contains a path separator ('/' or '\'), i.e. the colon belongs to a directory name (legal on POSIX/macOS, e.g. /data/Rich:2024/rain.csv).
Parameters
tokenThe verbatim FILE token.
path_outReceives the path (the whole token when there is no column).
column_outReceives the column name (empty when there is none, and also when the token ends in a bare :).
Returns
true when a column separator was found. An empty column_out with a true return is the "path:" form, which selects the first data column but still identifies the file as multi-column.
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 double from a string_view, returning a default on failure.

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 an int from a string_view, returning a default on failure.

Here is the caller graph for this function: