![]() |
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 control rules whose text references an object by name. | |
| CascadeResult | analyze_node_impact (const SimulationContext &ctx, int node_idx) |
| CascadeResult | analyze_link_impact (const SimulationContext &ctx, int link_idx) |
| CascadeResult | analyze_subcatch_impact (const SimulationContext &ctx, int sc_idx) |
| CascadeResult | analyze_gage_impact (const SimulationContext &ctx, int gage_idx) |
| CascadeResult | analyze_table_impact (const SimulationContext &ctx, int table_idx) |
| CascadeResult | analyze_transect_impact (const SimulationContext &ctx, int transect_idx) |
| CascadeResult | delete_link (SimulationContext &ctx, int link_idx) |
| CascadeResult | delete_node (SimulationContext &ctx, int node_idx) |
| CascadeResult | delete_subcatch (SimulationContext &ctx, int sc_idx) |
| CascadeResult | delete_gage (SimulationContext &ctx, int gage_idx) |
| CascadeResult | delete_nodes_many (SimulationContext &ctx, std::vector< int > indices) |
| Batch deletion — equivalent to sequential per-object deletes in DESCENDING index order, with ONE name-index rebuild per batch. | |
| CascadeResult | delete_links_many (SimulationContext &ctx, std::vector< int > indices) |
| Batch deletion — equivalent to sequential per-object deletes in DESCENDING index order, with ONE name-index rebuild per batch. | |
| CascadeResult | delete_subcatches_many (SimulationContext &ctx, std::vector< int > indices) |
| Batch deletion — equivalent to sequential per-object deletes in DESCENDING index order, with ONE name-index rebuild per batch. | |
| CascadeResult | delete_gages_many (SimulationContext &ctx, std::vector< int > indices) |
| Batch deletion — equivalent to sequential per-object deletes in DESCENDING index order, with ONE name-index rebuild per batch. | |
| CascadeResult | delete_table (SimulationContext &ctx, int table_idx) |
| CascadeResult | delete_transect (SimulationContext &ctx, int transect_idx) |
| CascadeResult | analyze_pollutant_impact (const SimulationContext &ctx, int pollut_idx) |
| CascadeResult | delete_pollutant (SimulationContext &ctx, int pollut_idx) |
| CascadeResult | analyze_pattern_impact (const SimulationContext &ctx, int pattern_idx) |
| CascadeResult | delete_pattern (SimulationContext &ctx, int pattern_idx) |
| CascadeResult | analyze_aquifer_impact (const SimulationContext &ctx, int aquifer_idx) |
| CascadeResult | delete_aquifer (SimulationContext &ctx, int aquifer_idx) |
| CascadeResult | analyze_snowpack_impact (const SimulationContext &ctx, int snowpack_idx) |
| CascadeResult | delete_snowpack (SimulationContext &ctx, int snowpack_idx) |
| CascadeResult | analyze_lid_impact (const SimulationContext &ctx, int lid_idx) |
| CascadeResult | delete_lid (SimulationContext &ctx, int lid_idx) |
| CascadeResult | analyze_street_impact (const SimulationContext &ctx, int street_idx) |
| CascadeResult | delete_street (SimulationContext &ctx, int street_idx) |
| CascadeResult | analyze_inlet_impact (const SimulationContext &ctx, int inlet_idx) |
| CascadeResult | delete_inlet (SimulationContext &ctx, int inlet_idx) |
| CascadeResult | analyze_landuse_impact (const SimulationContext &ctx, int landuse_idx) |
| CascadeResult | delete_landuse (SimulationContext &ctx, int landuse_idx) |
| CascadeResult | analyze_hydrograph_impact (const SimulationContext &ctx, const std::string &uh_name) |
| Unit-hydrograph groups are keyed by name (no stable index exists). | |
| CascadeResult | delete_hydrograph (SimulationContext &ctx, const std::string &uh_name) |
| ConversionResult | convert_node (SimulationContext &ctx, int idx, NodeType new_type) |
Convert a node in-place to new_type. | |
| ConversionResult | convert_link (SimulationContext &ctx, int idx, LinkType new_type) |
Convert a link in-place to new_type. | |
| 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-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 ) |
| CascadeResult openswmm::edit::analyze_gage_impact | ( | const SimulationContext & | ctx, |
| int | gage_idx ) |
| CascadeResult openswmm::edit::analyze_hydrograph_impact | ( | const SimulationContext & | ctx, |
| const std::string & | uh_name ) |
Unit-hydrograph groups are keyed by name (no stable index exists).
| CascadeResult openswmm::edit::analyze_inlet_impact | ( | const SimulationContext & | ctx, |
| int | inlet_idx ) |
| CascadeResult openswmm::edit::analyze_landuse_impact | ( | const SimulationContext & | ctx, |
| int | landuse_idx ) |
| CascadeResult openswmm::edit::analyze_lid_impact | ( | const SimulationContext & | ctx, |
| int | lid_idx ) |
| CascadeResult openswmm::edit::analyze_link_impact | ( | const SimulationContext & | ctx, |
| int | link_idx ) |
| CascadeResult openswmm::edit::analyze_node_impact | ( | const SimulationContext & | ctx, |
| int | node_idx ) |
| CascadeResult openswmm::edit::analyze_pattern_impact | ( | const SimulationContext & | ctx, |
| int | pattern_idx ) |
| CascadeResult openswmm::edit::analyze_pollutant_impact | ( | const SimulationContext & | ctx, |
| int | pollut_idx ) |
| CascadeResult openswmm::edit::analyze_snowpack_impact | ( | const SimulationContext & | ctx, |
| int | snowpack_idx ) |
| CascadeResult openswmm::edit::analyze_street_impact | ( | const SimulationContext & | ctx, |
| int | street_idx ) |
| CascadeResult openswmm::edit::analyze_subcatch_impact | ( | const SimulationContext & | ctx, |
| int | sc_idx ) |
| CascadeResult openswmm::edit::analyze_table_impact | ( | const SimulationContext & | ctx, |
| int | table_idx ) |
| CascadeResult openswmm::edit::analyze_transect_impact | ( | const SimulationContext & | ctx, |
| int | transect_idx ) |
| ConversionResult openswmm::edit::convert_link | ( | SimulationContext & | ctx, |
| int | idx, | ||
| LinkType | new_type ) |
Convert a link in-place to new_type.
| ConversionResult openswmm::edit::convert_node | ( | SimulationContext & | ctx, |
| int | idx, | ||
| NodeType | new_type ) |
Convert a node in-place to new_type.
| CascadeResult openswmm::edit::delete_aquifer | ( | SimulationContext & | ctx, |
| int | aquifer_idx ) |
| CascadeResult openswmm::edit::delete_gage | ( | SimulationContext & | ctx, |
| int | gage_idx ) |
| CascadeResult openswmm::edit::delete_gages_many | ( | SimulationContext & | ctx, |
| std::vector< int > | indices ) |
Batch deletion — equivalent to sequential per-object deletes in DESCENDING index order, with ONE name-index rebuild per batch.
The K-object cost of the per-object path is dominated by NameIndex::remove_at rebuilding the whole name→index map per delete (K full rehashes over every remaining name). These run the SAME per-object delete code — semantics are identical by construction, cascade behaviour included — inside a begin/end_bulk_remove() scope on the affected name indexes, so the map rebuilds once. indices are deduplicated and sorted descending internally (descending also keeps each entry's reported index equal to its pre-batch index for the objects named in indices; cascade entries report indices as the sequential-descending equivalent would). Out-of-range indices are the CALLER's job to reject (the C wrapper validates before any mutation, keeping the call all-or-nothing).
| CascadeResult openswmm::edit::delete_hydrograph | ( | SimulationContext & | ctx, |
| const std::string & | uh_name ) |
| CascadeResult openswmm::edit::delete_inlet | ( | SimulationContext & | ctx, |
| int | inlet_idx ) |
| CascadeResult openswmm::edit::delete_landuse | ( | SimulationContext & | ctx, |
| int | landuse_idx ) |
| CascadeResult openswmm::edit::delete_lid | ( | SimulationContext & | ctx, |
| int | lid_idx ) |
| CascadeResult openswmm::edit::delete_link | ( | SimulationContext & | ctx, |
| int | link_idx ) |
| CascadeResult openswmm::edit::delete_links_many | ( | SimulationContext & | ctx, |
| std::vector< int > | indices ) |
Batch deletion — equivalent to sequential per-object deletes in DESCENDING index order, with ONE name-index rebuild per batch.
The K-object cost of the per-object path is dominated by NameIndex::remove_at rebuilding the whole name→index map per delete (K full rehashes over every remaining name). These run the SAME per-object delete code — semantics are identical by construction, cascade behaviour included — inside a begin/end_bulk_remove() scope on the affected name indexes, so the map rebuilds once. indices are deduplicated and sorted descending internally (descending also keeps each entry's reported index equal to its pre-batch index for the objects named in indices; cascade entries report indices as the sequential-descending equivalent would). Out-of-range indices are the CALLER's job to reject (the C wrapper validates before any mutation, keeping the call all-or-nothing).
| CascadeResult openswmm::edit::delete_node | ( | SimulationContext & | ctx, |
| int | node_idx ) |
| CascadeResult openswmm::edit::delete_nodes_many | ( | SimulationContext & | ctx, |
| std::vector< int > | indices ) |
Batch deletion — equivalent to sequential per-object deletes in DESCENDING index order, with ONE name-index rebuild per batch.
The K-object cost of the per-object path is dominated by NameIndex::remove_at rebuilding the whole name→index map per delete (K full rehashes over every remaining name). These run the SAME per-object delete code — semantics are identical by construction, cascade behaviour included — inside a begin/end_bulk_remove() scope on the affected name indexes, so the map rebuilds once. indices are deduplicated and sorted descending internally (descending also keeps each entry's reported index equal to its pre-batch index for the objects named in indices; cascade entries report indices as the sequential-descending equivalent would). Out-of-range indices are the CALLER's job to reject (the C wrapper validates before any mutation, keeping the call all-or-nothing).
| CascadeResult openswmm::edit::delete_pattern | ( | SimulationContext & | ctx, |
| int | pattern_idx ) |
| CascadeResult openswmm::edit::delete_pollutant | ( | SimulationContext & | ctx, |
| int | pollut_idx ) |
| CascadeResult openswmm::edit::delete_snowpack | ( | SimulationContext & | ctx, |
| int | snowpack_idx ) |
| CascadeResult openswmm::edit::delete_street | ( | SimulationContext & | ctx, |
| int | street_idx ) |
| CascadeResult openswmm::edit::delete_subcatch | ( | SimulationContext & | ctx, |
| int | sc_idx ) |
| CascadeResult openswmm::edit::delete_subcatches_many | ( | SimulationContext & | ctx, |
| std::vector< int > | indices ) |
Batch deletion — equivalent to sequential per-object deletes in DESCENDING index order, with ONE name-index rebuild per batch.
The K-object cost of the per-object path is dominated by NameIndex::remove_at rebuilding the whole name→index map per delete (K full rehashes over every remaining name). These run the SAME per-object delete code — semantics are identical by construction, cascade behaviour included — inside a begin/end_bulk_remove() scope on the affected name indexes, so the map rebuilds once. indices are deduplicated and sorted descending internally (descending also keeps each entry's reported index equal to its pre-batch index for the objects named in indices; cascade entries report indices as the sequential-descending equivalent would). Out-of-range indices are the CALLER's job to reject (the C wrapper validates before any mutation, keeping the call all-or-nothing).
| CascadeResult openswmm::edit::delete_table | ( | SimulationContext & | ctx, |
| int | table_idx ) |
| CascadeResult openswmm::edit::delete_transect | ( | SimulationContext & | ctx, |
| int | transect_idx ) |
| std::vector< int > openswmm::edit::find_control_rule_refs | ( | const SimulationContext & | ctx, |
| const std::string & | object_name ) |
Find control rules whose text references an object by name.
Scans each rule's premise/action clauses for an object-type keyword (NODE, LINK, CONDUIT, PUMP, ORIFICE, WEIR, OUTLET) followed by object_name (case-insensitive, matching legacy rule parsing). Read-only; rule text is never modified by any delete — the caller decides what to do with affected rules.
| int openswmm::edit::ij_fuse | ( | SimulationContext & | ctx, |
| int | node_idx, | ||
| int * | surviving_link_out ) |
Inverse of ij_split_conduit: 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.
| 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.
| host_kind | 0 = link host (the conduit itself), 1 = node host (the conduit approaching the inlet junction — node2 == host — else the first attached conduit). |
| 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).
| 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).
| 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. Atomic: any failure after the split is undone with vj_fuse and reported through SplitResult::err (625 for a bad design, 627 for a bad capture node, else a rule code).
| 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.
| 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.
| 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.
| 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.
| surviving_link_out | Optional: receives the surviving conduit's index AFTER deletions renumber the arrays. |
| 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.
| 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.
| 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.