![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Classes | |
| struct | CascadeEntry |
| Describes one object that was impacted (deleted or nullified) during a cascade deletion. More... | |
| struct | CascadeResult |
| Aggregate cascade result for one deletion operation. More... | |
| struct | ConversionResult |
| struct | SplitResult |
| Result of vj_split_conduit. More... | |
Functions | |
| std::vector< int > | find_control_rule_refs (const SimulationContext &ctx, const std::string &object_name) |
| Find stored rule-text tokens naming an object after an object keyword. | |
| CascadeResult | analyze_node_impact (const SimulationContext &ctx, int node_idx) |
| Inspect references to a node. | |
| CascadeResult | analyze_link_impact (const SimulationContext &ctx, int link_idx) |
| Inspect references to a link. | |
| CascadeResult | analyze_subcatch_impact (const SimulationContext &ctx, int sc_idx) |
| Inspect references to a subcatchment. | |
| CascadeResult | analyze_gage_impact (const SimulationContext &ctx, int gage_idx) |
| Inspect references to a rain gage. | |
| CascadeResult | analyze_table_impact (const SimulationContext &ctx, int table_idx) |
| Inspect references to a time-series/curve table. | |
| CascadeResult | analyze_transect_impact (const SimulationContext &ctx, int transect_idx) |
| Inspect references to a transect. | |
| CascadeResult | delete_link (SimulationContext &ctx, int link_idx) |
| Delete a link. | |
| CascadeResult | delete_node (SimulationContext &ctx, int node_idx) |
| Delete a node. | |
| CascadeResult | delete_subcatch (SimulationContext &ctx, int sc_idx) |
| Delete a subcatchment. | |
| CascadeResult | delete_gage (SimulationContext &ctx, int gage_idx) |
| Delete a rain gage. | |
| CascadeResult | delete_nodes_many (SimulationContext &ctx, std::vector< int > indices) |
| Delete node rows in deduplicated descending pre-batch order. | |
| CascadeResult | delete_links_many (SimulationContext &ctx, std::vector< int > indices) |
| Delete link rows in deduplicated descending pre-batch order. | |
| CascadeResult | delete_subcatches_many (SimulationContext &ctx, std::vector< int > indices) |
| Delete subcatchment rows in deduplicated descending pre-batch order. | |
| CascadeResult | delete_gages_many (SimulationContext &ctx, std::vector< int > indices) |
| Delete rain gage rows in deduplicated descending pre-batch order. | |
| CascadeResult | delete_table (SimulationContext &ctx, int table_idx) |
| Delete a time-series/curve table. | |
| CascadeResult | delete_transect (SimulationContext &ctx, int transect_idx) |
| Delete a transect. | |
| CascadeResult | analyze_pollutant_impact (const SimulationContext &ctx, int pollut_idx) |
| Inspect references to a pollutant. | |
| CascadeResult | delete_pollutant (SimulationContext &ctx, int pollut_idx) |
| Delete a pollutant. | |
| CascadeResult | analyze_pattern_impact (const SimulationContext &ctx, int pattern_idx) |
| Inspect references to a time pattern. | |
| CascadeResult | delete_pattern (SimulationContext &ctx, int pattern_idx) |
| Delete a time pattern. | |
| CascadeResult | analyze_aquifer_impact (const SimulationContext &ctx, int aquifer_idx) |
| Inspect references to a aquifer. | |
| CascadeResult | delete_aquifer (SimulationContext &ctx, int aquifer_idx) |
| Delete a aquifer. | |
| CascadeResult | analyze_snowpack_impact (const SimulationContext &ctx, int snowpack_idx) |
| Inspect references to a snowpack. | |
| CascadeResult | delete_snowpack (SimulationContext &ctx, int snowpack_idx) |
| Delete a snowpack. | |
| CascadeResult | analyze_lid_impact (const SimulationContext &ctx, int lid_idx) |
| Inspect references to a LID control. | |
| CascadeResult | delete_lid (SimulationContext &ctx, int lid_idx) |
| Delete a LID control. | |
| CascadeResult | analyze_street_impact (const SimulationContext &ctx, int street_idx) |
| Inspect references to a street. | |
| CascadeResult | delete_street (SimulationContext &ctx, int street_idx) |
| Delete a street. | |
| CascadeResult | analyze_inlet_impact (const SimulationContext &ctx, int inlet_idx) |
| Inspect references to a inlet design. | |
| CascadeResult | delete_inlet (SimulationContext &ctx, int inlet_idx) |
| Delete a inlet design. | |
| CascadeResult | analyze_landuse_impact (const SimulationContext &ctx, int landuse_idx) |
| Inspect references to a land use. | |
| CascadeResult | delete_landuse (SimulationContext &ctx, int landuse_idx) |
| Delete a land use. | |
| CascadeResult | analyze_hydrograph_impact (const SimulationContext &ctx, const std::string &uh_name) |
| Inspect RDII references to an exact-case hydrograph group. | |
| CascadeResult | delete_hydrograph (SimulationContext &ctx, const std::string &uh_name) |
| Delete all authoring rows belonging to an exact-case hydrograph group. | |
| ConversionResult | convert_node (SimulationContext &ctx, int idx, NodeType new_type) |
| Replace one node subtype row and report cleared fields/warnings. | |
| ConversionResult | convert_link (SimulationContext &ctx, int idx, LinkType new_type) |
| Replace one link subtype row and report cleared fields/warnings. | |
| int | vj_rule_violation (const SimulationContext &ctx, int node_idx) |
| Check the virtual-junction usage rules for a node. | |
| void | vj_apply_derived_geometry (SimulationContext &ctx, int node_idx) |
| Apply the derived-geometry contract to a validated virtual junction: full depth = pipe crown (xsect y_full), zero surcharge depth, zero ponded area. The invert and the rendering-only rim depth are user/split-supplied data and are left alone. | |
| void | vj_clear_virtual (SimulationContext &ctx, int node_idx) |
| Clear a node's virtual flag, promoting its rendering rim depth (if any) back to the real full depth. | |
| int | vj_set_virtual (SimulationContext &ctx, int node_idx, bool make_virtual) |
| Set or clear a node's virtual flag. | |
| SplitResult | vj_split_conduit (SimulationContext &ctx, int link_idx, double t, const std::string &new_node_name, const std::string &new_link_name, bool make_virtual) |
Split a conduit at normalized position t along its vertex-aware polyline, inserting a new node (virtual junction when make_virtual) and a new downstream conduit. | |
| int | vj_fuse (SimulationContext &ctx, int node_idx, int *surviving_link_out) |
| Re-fuse the two conduits of a virtual junction into one, deleting the node (inverse of a virtual split). | |
| int | ij_host_conduit (const SimulationContext &ctx, int host_kind, int host_idx) |
| The conduit whose cross-section governs an inlet usage row. | |
| bool | ij_usage_shape_ok (const SimulationContext &ctx, int design_idx, int link_idx) |
| Legacy inlet_validate shape rule (inlet.c:498-505): CUSTOM designs fit any shape, DROP_* need RECT_OPEN/TRAPEZOIDAL, everything else needs STREET_XSECT. | |
| int | ij_rule_violation (const SimulationContext &ctx, int node_idx, bool for_drop_inlet) |
Check the inlet-junction usage rules for a node: every virtual-junction rule, then rule 623 — both attached conduits carry the cross-section the design needs (STREET_XSECT, or RECT_OPEN/TRAPEZOIDAL when for_drop_inlet). | |
| int | ij_set_inlet (SimulationContext &ctx, int node_idx, bool make_inlet) |
| Promote a node to an inlet junction or demote it. | |
| SplitResult | ij_split_conduit (SimulationContext &ctx, int link_idx, double t, const std::string &new_node_name, const std::string &new_link_name, int design_idx, int capture_node_idx) |
| Split a conduit and make the inserted node an inlet junction with the given design and capture node. | |
| int | ij_fuse (SimulationContext &ctx, int node_idx, int *surviving_link_out) |
| Inverse of ij_split_conduit (re-fusion): re-fuse an inlet junction's conduit pair. The node deletion inside vj_fuse cascades the node-hosted usage row away with the node; a failed fuse changes nothing. | |
| CascadeResult openswmm::edit::analyze_aquifer_impact | ( | const SimulationContext & | ctx, |
| int | aquifer_idx ) |
Inspect references to a aquifer.
Scans current incoming references without mutating ctx. Covers subcatchment groundwater assignments. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | aquifer_idx | Existing zero-based aquifer index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_gage_impact | ( | const SimulationContext & | ctx, |
| int | gage_idx ) |
Inspect references to a rain gage.
Scans current incoming references without mutating ctx. Covers subcatchment gage references and spatial rows. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | gage_idx | Existing zero-based rain gage index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_hydrograph_impact | ( | const SimulationContext & | ctx, |
| const std::string & | uh_name ) |
Inspect RDII references to an exact-case hydrograph group.
Exact-case matching applies to all scanned/deleted references. Does not mutate the context.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | uh_name | Borrowed exact-case group name. This low-level helper accepts absent names and returns an empty report. |
| CascadeResult openswmm::edit::analyze_inlet_impact | ( | const SimulationContext & | ctx, |
| int | inlet_idx ) |
Inspect references to a inlet design.
Scans current incoming references without mutating ctx. Covers inlet usages referencing the design. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | inlet_idx | Existing zero-based inlet design index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_landuse_impact | ( | const SimulationContext & | ctx, |
| int | landuse_idx ) |
Inspect references to a land use.
Scans current incoming references without mutating ctx. Covers buildup/washoff rows and subcatchment coverage columns. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | landuse_idx | Existing zero-based land use index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_lid_impact | ( | const SimulationContext & | ctx, |
| int | lid_idx ) |
Inspect references to a LID control.
Scans current incoming references without mutating ctx. Covers subcatchment usages and storage-node LID assignments/outlet anchors. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | lid_idx | Existing zero-based LID control index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_link_impact | ( | const SimulationContext & | ctx, |
| int | link_idx ) |
Inspect references to a link.
Scans current incoming references without mutating ctx. Covers divider/inlet usage references, subtype/reaction rows and spatial geometry. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | link_idx | Existing zero-based link index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_node_impact | ( | const SimulationContext & | ctx, |
| int | node_idx ) |
Inspect references to a node.
Scans current incoming references without mutating ctx. Covers attached links, inflow/DWF/RDII rows, subtype/reaction references and spatial rows. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | node_idx | Existing zero-based node index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_pattern_impact | ( | const SimulationContext & | ctx, |
| int | pattern_idx ) |
Inspect references to a time pattern.
Scans current incoming references without mutating ctx. Covers exact-case DWF/external-inflow/aquifer/global evaporation pattern-name references. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | pattern_idx | Existing zero-based time pattern index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_pollutant_impact | ( | const SimulationContext & | ctx, |
| int | pollut_idx ) |
Inspect references to a pollutant.
Scans current incoming references without mutating ctx. Covers buildup/washoff/treatment/quality columns, inflow/DWF rows and LID/co-pollutant references. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | pollut_idx | Existing zero-based pollutant index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_snowpack_impact | ( | const SimulationContext & | ctx, |
| int | snowpack_idx ) |
Inspect references to a snowpack.
Scans current incoming references without mutating ctx. Covers subcatchment snowpack indices and deferred names. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | snowpack_idx | Existing zero-based snowpack index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_street_impact | ( | const SimulationContext & | ctx, |
| int | street_idx ) |
Inspect references to a street.
Scans current incoming references without mutating ctx. Covers street inlet usages and conduit section references. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | street_idx | Existing zero-based street index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_subcatch_impact | ( | const SimulationContext & | ctx, |
| int | sc_idx ) |
Inspect references to a subcatchment.
Scans current incoming references without mutating ctx. Covers downstream subcatchment/outfall references, LID usages, coverage/quality rows and spatial geometry. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | sc_idx | Existing zero-based subcatchment index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_table_impact | ( | const SimulationContext & | ctx, |
| int | table_idx ) |
Inspect references to a time-series/curve table.
Scans current incoming references without mutating ctx. Covers gage/outfall/storage/divider/pump/cross-section references. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | table_idx | Existing zero-based time-series/curve table index, validated by the caller. |
| CascadeResult openswmm::edit::analyze_transect_impact | ( | const SimulationContext & | ctx, |
| int | transect_idx ) |
Inspect references to a transect.
Scans current incoming references without mutating ctx. Covers irregular conduit references and shape resets. Returned report predicts supported reference changes rather than certifying model validity.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | transect_idx | Existing zero-based transect index, validated by the caller. |
| ConversionResult openswmm::edit::convert_link | ( | SimulationContext & | ctx, |
| int | idx, | ||
| LinkType | new_type ) |
Replace one link subtype row and report cleared fields/warnings.
Preserves common base properties and creates default subtype properties. Clears old conduit section/pump token fields and seeds target-type defaults. Caller must validate before running; no cache rebuild or transactional rollback.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | idx | Existing zero-based link index; validated by caller. |
| [in] | new_type | Supported internal LinkType different from the existing type; caller validates it. |
| ConversionResult openswmm::edit::convert_node | ( | SimulationContext & | ctx, |
| int | idx, | ||
| NodeType | new_type ) |
Replace one node subtype row and report cleared fields/warnings.
Preserves common base properties and creates default subtype properties. Clears virtual/inlet flags and storage LID anchors when applicable. Caller must validate before running; no cache rebuild or transactional rollback.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | idx | Existing zero-based node index; validated by caller. |
| [in] | new_type | Supported internal NodeType different from the existing type; caller validates it. |
| CascadeResult openswmm::edit::delete_aquifer | ( | SimulationContext & | ctx, |
| int | aquifer_idx ) |
Delete a aquifer.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers subcatchment groundwater assignments. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | aquifer_idx | Existing zero-based aquifer index, validated by the caller. |
| CascadeResult openswmm::edit::delete_gage | ( | SimulationContext & | ctx, |
| int | gage_idx ) |
Delete a rain gage.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers subcatchment gage references and spatial rows. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | gage_idx | Existing zero-based rain gage index, validated by the caller. |
| CascadeResult openswmm::edit::delete_gages_many | ( | SimulationContext & | ctx, |
| std::vector< int > | indices ) |
Delete rain gage rows in deduplicated descending pre-batch order.
Runs the same individual cascade functions while deferring affected name-index rebuilds to scope exit. Caller validates every input before entry if atomic refusal is required; deletion/allocation exceptions do not roll back earlier deletions. Map lookup must not run concurrently while the batch leaves maps stale.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | indices | Owned index-vector copy/move; every value must name an existing pre-batch rain gage. Empty is a no-op; duplicates are deduplicated. |
| CascadeResult openswmm::edit::delete_hydrograph | ( | SimulationContext & | ctx, |
| const std::string & | uh_name ) |
Delete all authoring rows belonging to an exact-case hydrograph group.
Exact-case matching applies to all scanned/deleted references. Deletes RDII assignments, parameter rows, gage assignments and exponential-decay rows. No running RDII cache refresh or rollback.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | uh_name | Borrowed exact-case group name. This low-level helper accepts absent names and returns an empty report. |
| CascadeResult openswmm::edit::delete_inlet | ( | SimulationContext & | ctx, |
| int | inlet_idx ) |
Delete a inlet design.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers inlet usages referencing the design. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | inlet_idx | Existing zero-based inlet design index, validated by the caller. |
| CascadeResult openswmm::edit::delete_landuse | ( | SimulationContext & | ctx, |
| int | landuse_idx ) |
Delete a land use.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers buildup/washoff rows and subcatchment coverage columns. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | landuse_idx | Existing zero-based land use index, validated by the caller. |
| CascadeResult openswmm::edit::delete_lid | ( | SimulationContext & | ctx, |
| int | lid_idx ) |
Delete a LID control.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers subcatchment usages and storage-node LID assignments/outlet anchors. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | lid_idx | Existing zero-based LID control index, validated by the caller. |
| CascadeResult openswmm::edit::delete_link | ( | SimulationContext & | ctx, |
| int | link_idx ) |
Delete a link.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers divider/inlet usage references, subtype/reaction rows and spatial geometry. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | link_idx | Existing zero-based link index, validated by the caller. |
| CascadeResult openswmm::edit::delete_links_many | ( | SimulationContext & | ctx, |
| std::vector< int > | indices ) |
Delete link rows in deduplicated descending pre-batch order.
Runs the same individual cascade functions while deferring affected name-index rebuilds to scope exit. Caller validates every input before entry if atomic refusal is required; deletion/allocation exceptions do not roll back earlier deletions. Map lookup must not run concurrently while the batch leaves maps stale.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | indices | Owned index-vector copy/move; every value must name an existing pre-batch link. Empty is a no-op; duplicates are deduplicated. |
| CascadeResult openswmm::edit::delete_node | ( | SimulationContext & | ctx, |
| int | node_idx ) |
Delete a node.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers attached links, inflow/DWF/RDII rows, subtype/reaction references and spatial rows. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | node_idx | Existing zero-based node index, validated by the caller. |
| CascadeResult openswmm::edit::delete_nodes_many | ( | SimulationContext & | ctx, |
| std::vector< int > | indices ) |
Delete node rows in deduplicated descending pre-batch order.
Runs the same individual cascade functions while deferring affected name-index rebuilds to scope exit. Caller validates every input before entry if atomic refusal is required; deletion/allocation exceptions do not roll back earlier deletions. Map lookup must not run concurrently while the batch leaves maps stale.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | indices | Owned index-vector copy/move; every value must name an existing pre-batch node. Empty is a no-op; duplicates are deduplicated. |
| CascadeResult openswmm::edit::delete_pattern | ( | SimulationContext & | ctx, |
| int | pattern_idx ) |
Delete a time pattern.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers exact-case DWF/external-inflow/aquifer/global evaporation pattern-name references. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | pattern_idx | Existing zero-based time pattern index, validated by the caller. |
| CascadeResult openswmm::edit::delete_pollutant | ( | SimulationContext & | ctx, |
| int | pollut_idx ) |
Delete a pollutant.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers buildup/washoff/treatment/quality columns, inflow/DWF rows and LID/co-pollutant references. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | pollut_idx | Existing zero-based pollutant index, validated by the caller. |
| CascadeResult openswmm::edit::delete_snowpack | ( | SimulationContext & | ctx, |
| int | snowpack_idx ) |
Delete a snowpack.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers subcatchment snowpack indices and deferred names. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | snowpack_idx | Existing zero-based snowpack index, validated by the caller. |
| CascadeResult openswmm::edit::delete_street | ( | SimulationContext & | ctx, |
| int | street_idx ) |
Delete a street.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers street inlet usages and conduit section references. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | street_idx | Existing zero-based street index, validated by the caller. |
| CascadeResult openswmm::edit::delete_subcatch | ( | SimulationContext & | ctx, |
| int | sc_idx ) |
Delete a subcatchment.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers downstream subcatchment/outfall references, LID usages, coverage/quality rows and spatial geometry. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | sc_idx | Existing zero-based subcatchment index, validated by the caller. |
| CascadeResult openswmm::edit::delete_subcatches_many | ( | SimulationContext & | ctx, |
| std::vector< int > | indices ) |
Delete subcatchment rows in deduplicated descending pre-batch order.
Runs the same individual cascade functions while deferring affected name-index rebuilds to scope exit. Caller validates every input before entry if atomic refusal is required; deletion/allocation exceptions do not roll back earlier deletions. Map lookup must not run concurrently while the batch leaves maps stale.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | indices | Owned index-vector copy/move; every value must name an existing pre-batch subcatchment. Empty is a no-op; duplicates are deduplicated. |
| CascadeResult openswmm::edit::delete_table | ( | SimulationContext & | ctx, |
| int | table_idx ) |
Delete a time-series/curve table.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers gage/outfall/storage/divider/pump/cross-section references. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | table_idx | Existing zero-based time-series/curve table index, validated by the caller. |
| CascadeResult openswmm::edit::delete_transect | ( | SimulationContext & | ctx, |
| int | transect_idx ) |
Delete a transect.
Erases the object, cascades/nullifies supported references and shifts later object indices. Covers irregular conduit references and shape resets. Re-resolve cached indices after success; exceptions can leave partial mutation because no transactional rollback is implemented.
| [in,out] | ctx | Caller-owned editable BUILDING/OPENED context with aligned stores. Caller enforces lifecycle/index validity; no guards or solver-cache rebuild are provided here. |
| [in] | transect_idx | Existing zero-based transect index, validated by the caller. |
| std::vector< int > openswmm::edit::find_control_rule_refs | ( | const SimulationContext & | ctx, |
| const std::string & | object_name ) |
Find stored rule-text tokens naming an object after an object keyword.
Scans whitespace-separated token pairs for NODE/LINK/CONDUIT/PUMP/ORIFICE/WEIR/OUTLET/GAGE then name; this is not a full control-expression parser and does not unquote tokens or modify rule text.
| [in] | ctx | Borrowed context with aligned object/reference stores; no concurrent edits during this read. |
| [in] | object_name | Borrowed nonempty object name; empty returns no hits. Matching uses ASCII-insensitive comparison. |
| int openswmm::edit::ij_fuse | ( | SimulationContext & | ctx, |
| int | node_idx, | ||
| int * | surviving_link_out ) |
Inverse of ij_split_conduit (re-fusion): re-fuse an inlet junction's conduit pair. The node deletion inside vj_fuse cascades the node-hosted usage row away with the node; a failed fuse changes nothing.
| [in,out] | ctx | Caller-owned aligned BUILDING/OPENED context; lifecycle is a caller precondition, not checked here. Mutations can invalidate cached indices/views. |
| [in] | node_idx | Zero-based node index; behavior for invalid indices is specified by the return/no-op contract. |
| [out] | surviving_link_out | Optional caller-owned survivor-index destination, written only on success in the final renumbered link table. |
| int openswmm::edit::ij_host_conduit | ( | const SimulationContext & | ctx, |
| int | host_kind, | ||
| int | host_idx ) |
The conduit whose cross-section governs an inlet usage row.
| [in] | ctx | Borrowed aligned context; caller prevents concurrent mutation. |
| [in] | host_kind | Zero selects a link host; any nonzero value selects a node host. |
| [in] | host_idx | Host link/node index. Invalid index returns -1. |
| int openswmm::edit::ij_rule_violation | ( | const SimulationContext & | ctx, |
| int | node_idx, | ||
| bool | for_drop_inlet ) |
Check the inlet-junction usage rules for a node: every virtual-junction rule, then rule 623 — both attached conduits carry the cross-section the design needs (STREET_XSECT, or RECT_OPEN/TRAPEZOIDAL when for_drop_inlet).
| [in] | ctx | Borrowed aligned context; caller prevents concurrent mutation. |
| [in] | node_idx | Zero-based node index; behavior for invalid indices is specified by the return/no-op contract. |
| [in] | for_drop_inlet | True requires RECT_OPEN/TRAPEZOIDAL attached sections; false requires STREET_XSECT. |
| int openswmm::edit::ij_set_inlet | ( | SimulationContext & | ctx, |
| int | node_idx, | ||
| bool | make_inlet ) |
Promote a node to an inlet junction or demote it.
Promotion runs ij_rule_violation first (nothing is changed on a violation), makes the node virtual when it is not already, and sets is_inlet. The drop-inlet variant of rule 623 is selected from the node's existing usage row when it has one. Demotion clears is_inlet and erases the node's usage row, leaving a plain virtual junction (use vj_set_virtual to go further).
| [in,out] | ctx | Caller-owned aligned BUILDING/OPENED context; lifecycle is a caller precondition, not checked here. Mutations can invalidate cached indices/views. |
| [in] | node_idx | Zero-based node index; behavior for invalid indices is specified by the return/no-op contract. |
| [in] | make_inlet | True promotes a JUNCTION after rule checks; false clears its inlet flag/usage while retaining virtual state. |
| SplitResult openswmm::edit::ij_split_conduit | ( | SimulationContext & | ctx, |
| int | link_idx, | ||
| double | t, | ||
| const std::string & | new_node_name, | ||
| const std::string & | new_link_name, | ||
| int | design_idx, | ||
| int | capture_node_idx ) |
Split a conduit and make the inserted node an inlet junction with the given design and capture node.
vj_split_conduit (make_virtual) followed by the usage row and ij_set_inlet. On failure after the split, undo via vj_fuse is attempted; see the explicit best-effort undo limitation below. Failure is reported through SplitResult::err (625 for a bad design, 627 for a bad capture node, else a rule code).
| [in,out] | ctx | Caller-owned aligned BUILDING/OPENED context; lifecycle is a caller precondition, not checked here. Mutations can invalidate cached indices/views. |
| [in] | link_idx | Zero-based conduit index; split refuses invalid/nonconduit rows. Endpoint/spatial/subtype arrays must be aligned and endpoint references valid. |
| [in] | t | Finite fraction strictly between zero and one. |
| [in] | new_node_name | Copied nonempty unique node ID; ASCII-insensitive collisions are refused. |
| [in] | new_link_name | Copied nonempty unique downstream conduit ID; ASCII-insensitive collisions are refused. |
| [in] | design_idx | Existing inlet-design index; invalid returns ERR_IJ_DESIGN before splitting. |
| [in] | capture_node_idx | Existing nonvirtual receiving node; invalid returns ERR_IJ_CAPTURE_NODE before splitting. |
| bool openswmm::edit::ij_usage_shape_ok | ( | const SimulationContext & | ctx, |
| int | design_idx, | ||
| int | link_idx ) |
Legacy inlet_validate shape rule (inlet.c:498-505): CUSTOM designs fit any shape, DROP_* need RECT_OPEN/TRAPEZOIDAL, everything else needs STREET_XSECT.
| [in] | ctx | Borrowed aligned context; caller prevents concurrent mutation. |
| [in] | design_idx | Existing design index; invalid returns false. |
| [in] | link_idx | Existing link index; invalid returns false. |
| void openswmm::edit::vj_apply_derived_geometry | ( | SimulationContext & | ctx, |
| int | node_idx ) |
Apply the derived-geometry contract to a validated virtual junction: full depth = pipe crown (xsect y_full), zero surcharge depth, zero ponded area. The invert and the rendering-only rim depth are user/split-supplied data and are left alone.
| [in,out] | ctx | Caller-owned aligned BUILDING/OPENED context; lifecycle is a caller precondition, not checked here. Mutations can invalidate cached indices/views. |
| [in] | node_idx | Caller-validated node index already satisfying the virtual-junction rules. |
| void openswmm::edit::vj_clear_virtual | ( | SimulationContext & | ctx, |
| int | node_idx ) |
Clear a node's virtual flag, promoting its rendering rim depth (if any) back to the real full depth.
The single exit from virtual: shared by swmm_node_set_virtual(0) and the node type converter, so J(4 ft) → VJ → J returns 4 ft instead of keeping the pipe crown. A no-op on a non-virtual node. An inlet junction is a virtual junction too, so this also clears is_inlet and drops the node's inlet-usage row — nothing may hold a node-hosted usage once the node is a plain junction again.
| [in,out] | ctx | Caller-owned aligned BUILDING/OPENED context; lifecycle is a caller precondition, not checked here. Mutations can invalidate cached indices/views. |
| [in] | node_idx | Zero-based node index; behavior for invalid indices is specified by the return/no-op contract. |
| int openswmm::edit::vj_fuse | ( | SimulationContext & | ctx, |
| int | node_idx, | ||
| int * | surviving_link_out ) |
Re-fuse the two conduits of a virtual junction into one, deleting the node (inverse of a virtual split).
The upstream conduit's name survives; lengths sum; the node coordinate becomes an interior vertex of the merged conduit so map alignment is preserved; the downstream conduit's identifiers are retired. Requires a through orientation.
| [in,out] | ctx | Caller-owned aligned BUILDING/OPENED context; lifecycle is a caller precondition, not checked here. Mutations can invalidate cached indices/views. |
| [in] | node_idx | Zero-based node index; behavior for invalid indices is specified by the return/no-op contract. |
| [out] | surviving_link_out | Optional caller-owned survivor-index destination, written only on success in the final renumbered link table. |
| int openswmm::edit::vj_rule_violation | ( | const SimulationContext & | ctx, |
| int | node_idx ) |
Check the virtual-junction usage rules for a node.
Rules (plan §6): exactly two attached links, both conduits (ERR_VJ_LINK_COUNT); identical cross-section — shape, geom1..4, curve/transect, barrels; roughness may differ (ERR_VJ_XSECT_MISMATCH); zero offsets at the node (ERR_VJ_OFFSET); the node is not a 2D surface-coupling point (ERR_VJ_LATERAL_INFLOW). Point lateral sources — [INFLOWS], [DWF], RDII, subcatchment outlets, LID drains, the runtime API — are permitted. The routing-model rule is model-level and checked by PostParseResolver, not here.
| [in] | ctx | Borrowed aligned context; caller prevents concurrent mutation. |
| [in] | node_idx | Zero-based node index; behavior for invalid indices is specified by the return/no-op contract. |
| int openswmm::edit::vj_set_virtual | ( | SimulationContext & | ctx, |
| int | node_idx, | ||
| bool | make_virtual ) |
Set or clear a node's virtual flag.
Setting runs the full rule check first and applies the derived geometry on success; the node must be JUNCTION-typed. A max depth taller than the pipe crown is carried over as the node's rendering rim depth so the drawn ground surface survives the conversion. Clearing (vj_clear_virtual) always succeeds for a virtual node.
| [in,out] | ctx | Caller-owned aligned BUILDING/OPENED context; lifecycle is a caller precondition, not checked here. Mutations can invalidate cached indices/views. |
| [in] | node_idx | Zero-based node index; behavior for invalid indices is specified by the return/no-op contract. |
| [in] | make_virtual | True validates/promotes a JUNCTION; false clears virtual/inlet state for any valid node. |
| SplitResult openswmm::edit::vj_split_conduit | ( | SimulationContext & | ctx, |
| int | link_idx, | ||
| double | t, | ||
| const std::string & | new_node_name, | ||
| const std::string & | new_link_name, | ||
| bool | make_virtual ) |
Split a conduit at normalized position t along its vertex-aware polyline, inserting a new node (virtual junction when make_virtual) and a new downstream conduit.
The original conduit keeps its name and upstream end and is shortened to t·L; the new conduit carries the remaining (1−t)·L, copies the cross-section, roughness, barrels and related properties, and takes over the downstream offset. The break-point invert is interpolated along the conduit gradient, interior vertices are partitioned between the two conduits, and the new node's coordinate is the polyline point at t.
| [in,out] | ctx | Caller-owned aligned BUILDING/OPENED context; lifecycle is a caller precondition, not checked here. Mutations can invalidate cached indices/views. |
| [in] | link_idx | Zero-based conduit index; split refuses invalid/nonconduit rows. Endpoint/spatial/subtype arrays must be aligned and endpoint references valid. |
| [in] | t | Finite polyline fraction strictly between zero and one. |
| [in] | new_node_name | Copied nonempty unique node ID; ASCII-insensitive collisions are refused. |
| [in] | new_link_name | Copied nonempty unique downstream conduit ID; ASCII-insensitive collisions are refused. |
| [in] | make_virtual | True attempts virtual promotion after the geometric split; false leaves a regular junction. |