OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_edit.h File Reference

OpenSWMM Engine — Model editing C API (deletion and type conversion). More...

#include "openswmm_engine.h"
Include dependency graph for openswmm_edit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SWMM_ImpactEntry
 One object that references the deletion target. More...
 
struct  SWMM_ImpactReport
 Aggregate impact report for a deletion operation. More...
 
struct  SWMM_ConversionResult
 Result of a node or link type conversion. More...
 

Typedefs

typedef enum SWMM_RefType SWMM_RefType
 Category of an object that holds a cross-reference to a deleted object.
 
typedef struct SWMM_ImpactEntry SWMM_ImpactEntry
 One object that references the deletion target.
 
typedef struct SWMM_ImpactReport SWMM_ImpactReport
 Aggregate impact report for a deletion operation.
 
typedef struct SWMM_ConversionResult SWMM_ConversionResult
 Result of a node or link type conversion.
 

Enumerations

enum  SWMM_RefType {
  SWMM_REF_NODE = 0 ,
  SWMM_REF_LINK = 1 ,
  SWMM_REF_SUBCATCH = 2 ,
  SWMM_REF_GAGE = 3 ,
  SWMM_REF_TABLE = 4 ,
  SWMM_REF_TRANSECT = 5 ,
  SWMM_REF_INLET_USAGE = 6 ,
  SWMM_REF_EXT_INFLOW = 7 ,
  SWMM_REF_DWF_INFLOW = 8 ,
  SWMM_REF_RDII_ASSIGN = 9 ,
  SWMM_REF_TREATMENT = 10 ,
  SWMM_REF_LID_USAGE = 11 ,
  SWMM_REF_SNOWPACK = 12 ,
  SWMM_REF_HYDROGRAPH = 13 ,
  SWMM_REF_POLLUTANT = 14 ,
  SWMM_REF_PATTERN = 15 ,
  SWMM_REF_AQUIFER = 16 ,
  SWMM_REF_LID_CONTROL = 17 ,
  SWMM_REF_STREET = 18 ,
  SWMM_REF_INLET_DESIGN = 19 ,
  SWMM_REF_LANDUSE = 20 ,
  SWMM_REF_CONTROL_RULE = 21
}
 Category of an object that holds a cross-reference to a deleted object. More...
 

Functions

SWMM_ENGINE_API void swmm_impact_report_free (SWMM_ImpactReport *report)
 Release heap memory owned by an impact report.
 
SWMM_ENGINE_API int swmm_node_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_link_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_subcatch_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_gage_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_table_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_transect_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_pollutant_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_pattern_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_aquifer_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_snowpack_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_lid_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_street_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_inlet_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_landuse_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out)
 Analyse which objects reference a given node, without deleting it.
 
SWMM_ENGINE_API int swmm_hydrograph_analyze_impact (SWMM_Engine engine, const char *uh_name, SWMM_ImpactReport *report_out)
 Analyse which objects reference a unit-hydrograph group, without deleting it.
 
SWMM_ENGINE_API int swmm_node_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a node and cascade-delete or nullify all referencing objects.
 
SWMM_ENGINE_API int swmm_link_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a link and cascade-delete or nullify all referencing objects.
 
SWMM_ENGINE_API int swmm_subcatch_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a subcatchment and nullify all referencing objects.
 
SWMM_ENGINE_API int swmm_gage_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a rain gage and nullify subcatchment gage references.
 
SWMM_ENGINE_API int swmm_node_delete_many (SWMM_Engine engine, const int *indices, int n, SWMM_ImpactReport *cascade_out)
 Delete many nodes in one call — equivalent to sequential swmm_node_delete calls in DESCENDING index order, with ONE name-index rebuild for the whole batch.
 
SWMM_ENGINE_API int swmm_link_delete_many (SWMM_Engine engine, const int *indices, int n, SWMM_ImpactReport *cascade_out)
 Delete many nodes in one call — equivalent to sequential swmm_node_delete calls in DESCENDING index order, with ONE name-index rebuild for the whole batch.
 
SWMM_ENGINE_API int swmm_subcatch_delete_many (SWMM_Engine engine, const int *indices, int n, SWMM_ImpactReport *cascade_out)
 Delete many nodes in one call — equivalent to sequential swmm_node_delete calls in DESCENDING index order, with ONE name-index rebuild for the whole batch.
 
SWMM_ENGINE_API int swmm_gage_delete_many (SWMM_Engine engine, const int *indices, int n, SWMM_ImpactReport *cascade_out)
 Delete many nodes in one call — equivalent to sequential swmm_node_delete calls in DESCENDING index order, with ONE name-index rebuild for the whole batch.
 
SWMM_ENGINE_API int swmm_table_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a time series or curve and nullify all referencing objects.
 
SWMM_ENGINE_API int swmm_transect_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a transect and nullify link xsect_curve references.
 
SWMM_ENGINE_API int swmm_pollutant_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a pollutant and re-pack every per-pollutant matrix.
 
SWMM_ENGINE_API int swmm_pattern_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a time pattern and clear all name-based references.
 
SWMM_ENGINE_API int swmm_aquifer_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete an aquifer; referencing subcatchments lose their groundwater (gw_aquifer set to -1) and surviving indices are renumbered.
 
SWMM_ENGINE_API int swmm_snowpack_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a snowpack; referencing subcatchments' snowpack index and raw-name mirror are cleared, surviving indices renumbered.
 
SWMM_ENGINE_API int swmm_lid_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a LID control; LID-usage rows referencing it are cascade-deleted and surviving lid_index values renumbered.
 
SWMM_ENGINE_API int swmm_street_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a street; inlet-usage rows referencing it are cascade-deleted (consistent with link deletion) and street_index values renumbered.
 
SWMM_ENGINE_API int swmm_inlet_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete an inlet design; inlet-usage rows referencing it are cascade-deleted and design_index values renumbered.
 
SWMM_ENGINE_API int swmm_landuse_delete (SWMM_Engine engine, int idx, SWMM_ImpactReport *cascade_out)
 Delete a land use; buildup/washoff rows and subcatchment coverage columns for it are re-packed.
 
SWMM_ENGINE_API int swmm_hydrograph_delete (SWMM_Engine engine, const char *uh_name, SWMM_ImpactReport *cascade_out)
 Delete a unit-hydrograph group by name.
 
SWMM_ENGINE_API void swmm_conversion_result_free (SWMM_ConversionResult *result)
 Release heap memory owned by a conversion result.
 
SWMM_ENGINE_API int swmm_node_convert (SWMM_Engine engine, int idx, int new_type, SWMM_ConversionResult *result_out)
 Convert a node to a different type in-place.
 
SWMM_ENGINE_API int swmm_link_convert (SWMM_Engine engine, int idx, int new_type, SWMM_ConversionResult *result_out)
 Convert a link to a different type in-place.
 
SWMM_ENGINE_API int swmm_conduit_split (SWMM_Engine engine, int link_idx, double t, const char *new_node_name, const char *new_link_name, int make_virtual, int *new_node_idx, int *new_link_idx)
 Split a conduit at normalized position t, inserting a new node.
 
SWMM_ENGINE_API int swmm_virtual_junction_fuse (SWMM_Engine engine, int node_idx, int *surviving_link_idx)
 Re-fuse the two conduits of a virtual junction into one, deleting the node (inverse of a virtual split).
 
SWMM_ENGINE_API int swmm_conduit_split_inlet (SWMM_Engine engine, int link_idx, double t, const char *new_node_name, const char *new_link_name, const char *inlet_id, const char *capture_node, int *new_node_idx, int *new_link_idx)
 Split a STREET conduit at t and make the inserted node an inlet junction with the given design and capture node (2026-09-05).
 
SWMM_ENGINE_API int swmm_inlet_junction_fuse (SWMM_Engine engine, int node_idx, int *surviving_link_idx)
 Inverse of swmm_conduit_split_inlet: removes the inlet junction's usage row, then re-fuses the conduit pair exactly as swmm_virtual_junction_fuse does.
 

Detailed Description

OpenSWMM Engine — Model editing C API (deletion and type conversion).

Provides two capabilities for interactive model editing:

1. Object deletion — remove any node, link, subcatchment, rain gage, table/curve, or transect from the model while the engine is in BUILDING or OPENED state. A pre-deletion impact-analysis function is provided so callers can inspect what would be affected before committing.

2. Type conversion — convert a node between JUNCTION/OUTFALL/STORAGE/ DIVIDER, or a link between CONDUIT/PUMP/ORIFICE/WEIR/OUTLET, in-place. Common properties are preserved; type-specific properties are cleared and sensible defaults are applied.

Safety guards

All mutating operations (delete, convert) require the engine to be in SWMM_STATE_BUILDING or SWMM_STATE_OPENED. The impact-analysis functions are read-only and work in any state where data is present (not CREATED, CLOSED, or ERROR).

See also
openswmm_engine.h
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n Apache-2.0

Typedef Documentation

◆ SWMM_ConversionResult

typedef struct SWMM_ConversionResult SWMM_ConversionResult

Result of a node or link type conversion.

Lists type-specific fields that were cleared and any topology warnings generated. Caller must pass to swmm_conversion_result_free when done.

◆ SWMM_ImpactEntry

typedef struct SWMM_ImpactEntry SWMM_ImpactEntry

One object that references the deletion target.

field is a static string literal naming the specific cross- reference field (e.g. "node1", "outlet_node", "pump_curve"). The caller must NOT free it.

◆ SWMM_ImpactReport

typedef struct SWMM_ImpactReport SWMM_ImpactReport

Aggregate impact report for a deletion operation.

entries is heap-allocated by the engine. The caller must pass this struct to swmm_impact_report_free when done.

◆ SWMM_RefType

typedef enum SWMM_RefType SWMM_RefType

Category of an object that holds a cross-reference to a deleted object.

Enumeration Type Documentation

◆ SWMM_RefType

Category of an object that holds a cross-reference to a deleted object.

Enumerator
SWMM_REF_NODE 

A node holds a reference.

SWMM_REF_LINK 

A link holds a reference.

SWMM_REF_SUBCATCH 

A subcatchment holds a reference.

SWMM_REF_GAGE 

A rain gage holds a reference.

SWMM_REF_TABLE 

A time series or curve holds a reference.

SWMM_REF_TRANSECT 

A transect holds a reference.

SWMM_REF_INLET_USAGE 

An inlet usage entry holds a reference.

SWMM_REF_EXT_INFLOW 

An external-inflow row holds a reference.

SWMM_REF_DWF_INFLOW 

A dry-weather-flow row holds a reference.

SWMM_REF_RDII_ASSIGN 

An RDII assignment row holds a reference.

SWMM_REF_TREATMENT 

A treatment expression holds a reference.

SWMM_REF_LID_USAGE 

A LID usage row holds a reference.

SWMM_REF_SNOWPACK 

A snowpack holds a reference.

SWMM_REF_HYDROGRAPH 

A unit-hydrograph group holds a reference.

SWMM_REF_POLLUTANT 

A pollutant holds a reference.

SWMM_REF_PATTERN 

A time pattern holds a reference.

SWMM_REF_AQUIFER 

An aquifer holds a reference.

SWMM_REF_LID_CONTROL 

A LID control holds a reference.

SWMM_REF_STREET 

A street holds a reference.

SWMM_REF_INLET_DESIGN 

An inlet design holds a reference.

SWMM_REF_LANDUSE 

A land use holds a reference.

SWMM_REF_CONTROL_RULE 

A control rule references the object by name.

Function Documentation

◆ swmm_aquifer_analyze_impact()

SWMM_ENGINE_API int swmm_aquifer_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_aquifer_delete()

SWMM_ENGINE_API int swmm_aquifer_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete an aquifer; referencing subcatchments lose their groundwater (gw_aquifer set to -1) and surviving indices are renumbered.

Here is the call graph for this function:

◆ swmm_conduit_split()

SWMM_ENGINE_API int swmm_conduit_split ( SWMM_Engine engine,
int link_idx,
double t,
const char * new_node_name,
const char * new_link_name,
int make_virtual,
int * new_node_idx,
int * new_link_idx )

Split a conduit at normalized position t, inserting a new node.

The split point lies at fraction t of the conduit's vertex-aware polyline length (0 < t < 1). The original conduit keeps its name and upstream end and is shortened to t·L; a new conduit named new_link_name carries the remaining length, copying cross-section, roughness and barrels, and taking over the downstream offset. The break-point invert is interpolated along the conduit gradient and interior vertices are partitioned. With make_virtual != 0 the new node becomes a virtual junction (validation runs; on a rule failure the split still stands as a regular junction and the rule code is returned).

Parameters
engineEngine handle.
link_idxZero-based conduit index.
tNormalized split position along the polyline (0..1 exclusive).
new_node_nameUnique name for the inserted node.
new_link_nameUnique name for the new downstream conduit.
make_virtual1 to flag the new node as a virtual junction.
[out]new_node_idxReceives the new node index (may be NULL).
[out]new_link_idxReceives the new conduit index (may be NULL).
Returns
SWMM_OK on success; SWMM_ERR_LIFECYCLE, SWMM_ERR_BADHANDLE, SWMM_ERR_BADINDEX, SWMM_ERR_BADPARAM (bad t / duplicate or empty name / non-conduit); or an ERR_VJ_* rule code (609/611/613/617) when make_virtual validation fails after a successful split.
Here is the call graph for this function:

◆ swmm_conduit_split_inlet()

SWMM_ENGINE_API int swmm_conduit_split_inlet ( SWMM_Engine engine,
int link_idx,
double t,
const char * new_node_name,
const char * new_link_name,
const char * inlet_id,
const char * capture_node,
int * new_node_idx,
int * new_link_idx )

Split a STREET conduit at t and make the inserted node an inlet junction with the given design and capture node (2026-09-05).

Equivalent to swmm_conduit_split(make_virtual=1) followed by swmm_node_set_inlet(1) and swmm_inlet_usage_set(host=node), but atomic: on any failure after the split the split is undone (fused back) and the error returned. The usage row is created with num_inlets=1, 0 % clogged, no flow limit, no local depression, AUTOMATIC placement; adjust with swmm_inlet_usage_set.

Parameters
inlet_idExisting inlet design name.
capture_nodeExisting node name (not virtual, not the new node).
Returns
SWMM_OK; generic codes; ERR_VJ_ / ERR_IJ_ rule codes; 625 for an unknown design; 627 for a bad capture node.
Here is the call graph for this function:

◆ swmm_conversion_result_free()

SWMM_ENGINE_API void swmm_conversion_result_free ( SWMM_ConversionResult * result)

Release heap memory owned by a conversion result.

Does not free the struct itself. Safe to call on a zero-initialised struct.

◆ swmm_gage_analyze_impact()

SWMM_ENGINE_API int swmm_gage_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_gage_delete()

SWMM_ENGINE_API int swmm_gage_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a rain gage and nullify subcatchment gage references.

Here is the call graph for this function:

◆ swmm_gage_delete_many()

SWMM_ENGINE_API int swmm_gage_delete_many ( SWMM_Engine engine,
const int * indices,
int n,
SWMM_ImpactReport * cascade_out )

Delete many nodes in one call — equivalent to sequential swmm_node_delete calls in DESCENDING index order, with ONE name-index rebuild for the whole batch.

The per-object path rebuilds the entire name→index hash after EVERY delete, which dominates bulk deletions on large models (K deletes = K full rehashes over every remaining name). The batch runs the identical per-object cascade logic — semantics, cascade behaviour and final state match the sequential descending equivalent exactly — but rehashes once.

indices are pre-batch indices; duplicates are tolerated (deduplicated internally). Every index is validated BEFORE any mutation: an out-of-range entry fails the whole call with SWMM_ERR_BADINDEX and no changes. Cascade entries in cascade_out carry the indices the sequential-descending equivalent would report.

Parameters
engineEngine handle.
indicesArray of n zero-based node indices (pre-batch).
nNumber of entries in indices; 0 is a no-op.
cascade_outIf non-NULL, receives the aggregate cascade report. Caller must free with swmm_impact_report_free.
Returns
SWMM_OK, SWMM_ERR_LIFECYCLE if not BUILDING/OPENED, SWMM_ERR_BADHANDLE, SWMM_ERR_BADPARAM if indices is NULL with n > 0, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_hydrograph_analyze_impact()

SWMM_ENGINE_API int swmm_hydrograph_analyze_impact ( SWMM_Engine engine,
const char * uh_name,
SWMM_ImpactReport * report_out )

Analyse which objects reference a unit-hydrograph group, without deleting it.

Groups are keyed by name (they have no stable index — a group is the set of [HYDROGRAPHS] parameter lines sharing one name).

Parameters
engineEngine handle.
uh_nameUnit-hydrograph group name.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADPARAM if the name is NULL/empty or names no existing group.
Here is the call graph for this function:

◆ swmm_hydrograph_delete()

SWMM_ENGINE_API int swmm_hydrograph_delete ( SWMM_Engine engine,
const char * uh_name,
SWMM_ImpactReport * cascade_out )

Delete a unit-hydrograph group by name.

Cascade-deletes RDII assignments using the group, then removes the group's parameter lines, gage assignment, and RDII-decay rows. swmm_hydrograph_remove_group is the report-less equivalent.

Returns
SWMM_OK, SWMM_ERR_LIFECYCLE, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADPARAM if the name is NULL/empty or unknown.
Here is the call graph for this function:

◆ swmm_impact_report_free()

SWMM_ENGINE_API void swmm_impact_report_free ( SWMM_ImpactReport * report)

Release heap memory owned by an impact report.

Does not free the struct itself (typically stack-allocated by the caller). Safe to call on a zero-initialised struct.

◆ swmm_inlet_analyze_impact()

SWMM_ENGINE_API int swmm_inlet_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_inlet_delete()

SWMM_ENGINE_API int swmm_inlet_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete an inlet design; inlet-usage rows referencing it are cascade-deleted and design_index values renumbered.

Here is the call graph for this function:

◆ swmm_inlet_junction_fuse()

SWMM_ENGINE_API int swmm_inlet_junction_fuse ( SWMM_Engine engine,
int node_idx,
int * surviving_link_idx )

Inverse of swmm_conduit_split_inlet: removes the inlet junction's usage row, then re-fuses the conduit pair exactly as swmm_virtual_junction_fuse does.

Here is the call graph for this function:

◆ swmm_landuse_analyze_impact()

SWMM_ENGINE_API int swmm_landuse_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_landuse_delete()

SWMM_ENGINE_API int swmm_landuse_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a land use; buildup/washoff rows and subcatchment coverage columns for it are re-packed.

Here is the call graph for this function:

◆ swmm_lid_analyze_impact()

SWMM_ENGINE_API int swmm_lid_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_lid_delete()

SWMM_ENGINE_API int swmm_lid_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a LID control; LID-usage rows referencing it are cascade-deleted and surviving lid_index values renumbered.

Here is the call graph for this function:

◆ swmm_link_analyze_impact()

SWMM_ENGINE_API int swmm_link_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_link_convert()

SWMM_ENGINE_API int swmm_link_convert ( SWMM_Engine engine,
int idx,
int new_type,
SWMM_ConversionResult * result_out )

Convert a link to a different type in-place.

Common properties (node1, node2, offset1, offset2, q0, q_limit, setting, comments) are preserved. Type-specific fields are cleared and new-type defaults applied.

Parameters
engineEngine handle.
idxZero-based link index.
new_typeTarget SWMM_LinkType value.
result_outIf non-NULL, receives the conversion result.
Returns
SWMM_OK on success, SWMM_ERR_BADPARAM if new_type equals current type, SWMM_ERR_LIFECYCLE, SWMM_ERR_BADHANDLE, SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_link_delete()

SWMM_ENGINE_API int swmm_link_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a link and cascade-delete or nullify all referencing objects.

Divider node divider_link fields that reference this link are nullified. Inlet usage entries whose link_index equals idx are deleted.

Here is the call graph for this function:

◆ swmm_link_delete_many()

SWMM_ENGINE_API int swmm_link_delete_many ( SWMM_Engine engine,
const int * indices,
int n,
SWMM_ImpactReport * cascade_out )

Delete many nodes in one call — equivalent to sequential swmm_node_delete calls in DESCENDING index order, with ONE name-index rebuild for the whole batch.

The per-object path rebuilds the entire name→index hash after EVERY delete, which dominates bulk deletions on large models (K deletes = K full rehashes over every remaining name). The batch runs the identical per-object cascade logic — semantics, cascade behaviour and final state match the sequential descending equivalent exactly — but rehashes once.

indices are pre-batch indices; duplicates are tolerated (deduplicated internally). Every index is validated BEFORE any mutation: an out-of-range entry fails the whole call with SWMM_ERR_BADINDEX and no changes. Cascade entries in cascade_out carry the indices the sequential-descending equivalent would report.

Parameters
engineEngine handle.
indicesArray of n zero-based node indices (pre-batch).
nNumber of entries in indices; 0 is a no-op.
cascade_outIf non-NULL, receives the aggregate cascade report. Caller must free with swmm_impact_report_free.
Returns
SWMM_OK, SWMM_ERR_LIFECYCLE if not BUILDING/OPENED, SWMM_ERR_BADHANDLE, SWMM_ERR_BADPARAM if indices is NULL with n > 0, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_node_analyze_impact()

SWMM_ENGINE_API int swmm_node_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_node_convert()

SWMM_ENGINE_API int swmm_node_convert ( SWMM_Engine engine,
int idx,
int new_type,
SWMM_ConversionResult * result_out )

Convert a node to a different type in-place.

Common properties (invert_elev, full_depth, init_depth, sur_depth, ponded_area, coordinates) are preserved. Type-specific fields for the old type are cleared and type-specific defaults for the new type are applied. Topology warnings are generated but conversion still proceeds.

Parameters
engineEngine handle.
idxZero-based node index.
new_typeTarget SWMM_NodeType value.
result_outIf non-NULL, receives the conversion result. Caller must free with swmm_conversion_result_free.
Returns
SWMM_OK on success, SWMM_ERR_LIFECYCLE if not BUILDING/OPENED, SWMM_ERR_BADPARAM if new_type is invalid or equals current type, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_node_delete()

SWMM_ENGINE_API int swmm_node_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a node and cascade-delete or nullify all referencing objects.

Links that reference the node as node1 or node2 are deleted. Subcatchment outlet_node and inlet_usage node_index references are nullified (set to -1). All remaining integer cross-references whose value is greater than idx are decremented by 1.

Parameters
engineEngine handle.
idxZero-based node index.
cascade_outIf non-NULL, receives the cascade report describing what was deleted or nullified. Caller must free with swmm_impact_report_free.
Returns
SWMM_OK on success, SWMM_ERR_LIFECYCLE if not BUILDING/OPENED, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_node_delete_many()

SWMM_ENGINE_API int swmm_node_delete_many ( SWMM_Engine engine,
const int * indices,
int n,
SWMM_ImpactReport * cascade_out )

Delete many nodes in one call — equivalent to sequential swmm_node_delete calls in DESCENDING index order, with ONE name-index rebuild for the whole batch.

The per-object path rebuilds the entire name→index hash after EVERY delete, which dominates bulk deletions on large models (K deletes = K full rehashes over every remaining name). The batch runs the identical per-object cascade logic — semantics, cascade behaviour and final state match the sequential descending equivalent exactly — but rehashes once.

indices are pre-batch indices; duplicates are tolerated (deduplicated internally). Every index is validated BEFORE any mutation: an out-of-range entry fails the whole call with SWMM_ERR_BADINDEX and no changes. Cascade entries in cascade_out carry the indices the sequential-descending equivalent would report.

Parameters
engineEngine handle.
indicesArray of n zero-based node indices (pre-batch).
nNumber of entries in indices; 0 is a no-op.
cascade_outIf non-NULL, receives the aggregate cascade report. Caller must free with swmm_impact_report_free.
Returns
SWMM_OK, SWMM_ERR_LIFECYCLE if not BUILDING/OPENED, SWMM_ERR_BADHANDLE, SWMM_ERR_BADPARAM if indices is NULL with n > 0, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_pattern_analyze_impact()

SWMM_ENGINE_API int swmm_pattern_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_pattern_delete()

SWMM_ENGINE_API int swmm_pattern_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a time pattern and clear all name-based references.

Clears matching DWF pat1..4, ext-inflow baseline patterns, aquifer ET patterns, and the global evaporation-recovery pattern. Unlike swmm_pattern_remove this reports what was cleared and rejects out-of-range indices.

Here is the call graph for this function:

◆ swmm_pollutant_analyze_impact()

SWMM_ENGINE_API int swmm_pollutant_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_pollutant_delete()

SWMM_ENGINE_API int swmm_pollutant_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a pollutant and re-pack every per-pollutant matrix.

Cascades: ext-inflow/DWF rows whose constituent names the pollutant. Re-packs: buildup/washoff (per-pollutant columns), treatment expressions, per-object concentration state (including [LOADINGS] initial buildup). Nullifies: co-pollutant references, LID removal pairs. Remaining co_pollut indices are renumbered.

Here is the call graph for this function:

◆ swmm_snowpack_analyze_impact()

SWMM_ENGINE_API int swmm_snowpack_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_snowpack_delete()

SWMM_ENGINE_API int swmm_snowpack_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a snowpack; referencing subcatchments' snowpack index and raw-name mirror are cleared, surviving indices renumbered.

Here is the call graph for this function:

◆ swmm_street_analyze_impact()

SWMM_ENGINE_API int swmm_street_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_street_delete()

SWMM_ENGINE_API int swmm_street_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a street; inlet-usage rows referencing it are cascade-deleted (consistent with link deletion) and street_index values renumbered.

Here is the call graph for this function:

◆ swmm_subcatch_analyze_impact()

SWMM_ENGINE_API int swmm_subcatch_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_subcatch_delete()

SWMM_ENGINE_API int swmm_subcatch_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a subcatchment and nullify all referencing objects.

Other subcatchments' outlet_subcatch fields and outfall nodes' outfall_route_to fields that reference this subcatchment are nullified.

Here is the call graph for this function:

◆ swmm_subcatch_delete_many()

SWMM_ENGINE_API int swmm_subcatch_delete_many ( SWMM_Engine engine,
const int * indices,
int n,
SWMM_ImpactReport * cascade_out )

Delete many nodes in one call — equivalent to sequential swmm_node_delete calls in DESCENDING index order, with ONE name-index rebuild for the whole batch.

The per-object path rebuilds the entire name→index hash after EVERY delete, which dominates bulk deletions on large models (K deletes = K full rehashes over every remaining name). The batch runs the identical per-object cascade logic — semantics, cascade behaviour and final state match the sequential descending equivalent exactly — but rehashes once.

indices are pre-batch indices; duplicates are tolerated (deduplicated internally). Every index is validated BEFORE any mutation: an out-of-range entry fails the whole call with SWMM_ERR_BADINDEX and no changes. Cascade entries in cascade_out carry the indices the sequential-descending equivalent would report.

Parameters
engineEngine handle.
indicesArray of n zero-based node indices (pre-batch).
nNumber of entries in indices; 0 is a no-op.
cascade_outIf non-NULL, receives the aggregate cascade report. Caller must free with swmm_impact_report_free.
Returns
SWMM_OK, SWMM_ERR_LIFECYCLE if not BUILDING/OPENED, SWMM_ERR_BADHANDLE, SWMM_ERR_BADPARAM if indices is NULL with n > 0, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_table_analyze_impact()

SWMM_ENGINE_API int swmm_table_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_table_delete()

SWMM_ENGINE_API int swmm_table_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a time series or curve and nullify all referencing objects.

Affected references: gage ts_index, node storage_curve / outfall_param (TIDAL/TIMESERIES) / divider_curve, link pump_curve / xsect_curve.

Here is the call graph for this function:

◆ swmm_transect_analyze_impact()

SWMM_ENGINE_API int swmm_transect_analyze_impact ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * report_out )

Analyse which objects reference a given node, without deleting it.

Parameters
engineEngine handle.
idxZero-based node index.
report_outReceives the impact report (may be NULL if not needed).
Returns
SWMM_OK, SWMM_ERR_BADHANDLE, or SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_transect_delete()

SWMM_ENGINE_API int swmm_transect_delete ( SWMM_Engine engine,
int idx,
SWMM_ImpactReport * cascade_out )

Delete a transect and nullify link xsect_curve references.

Links with IRREGULAR cross-section shape whose xsect_curve equals idx have their xsect_curve set to -1 and shape reset to CIRCULAR.

Here is the call graph for this function:

◆ swmm_virtual_junction_fuse()

SWMM_ENGINE_API int swmm_virtual_junction_fuse ( SWMM_Engine engine,
int node_idx,
int * surviving_link_idx )

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 (one conduit flowing in, one flowing out).

Parameters
engineEngine handle.
node_idxZero-based node index of the virtual junction.
[out]surviving_link_idxReceives the surviving conduit's index AFTER deletions renumber (may be NULL).
Returns
SWMM_OK on success; SWMM_ERR_LIFECYCLE, SWMM_ERR_BADHANDLE, SWMM_ERR_BADINDEX, SWMM_ERR_BADPARAM (not a virtual junction); or 609 (ERR_VJ_LINK_COUNT) when the node is not a two-conduit through pair.
Here is the call graph for this function: