![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
C API implementation — object deletion and type conversion. More...
#include "openswmm_api_common.hpp"#include "TypeHelpers.hpp"#include "../edit/ObjectDeleter.hpp"#include "../edit/TypeConverter.hpp"#include "../edit/VirtualJunctionOps.hpp"#include "../../../include/openswmm/engine/openswmm_edit.h"#include <cstring>#include <cstdlib>#include <vector>Macros | |
| #define | SWMM_DELETE_MANY_BODY(COUNT_EXPR, MANY_FN) |
Functions | |
| SWMM_ENGINE_API void | swmm_impact_report_free (SWMM_ImpactReport *report) |
| Release report entries and reset their pointer/count. | |
| SWMM_ENGINE_API void | swmm_conversion_result_free (SWMM_ConversionResult *result) |
| Release all allocated conversion field/warning strings and arrays. | |
| SWMM_ENGINE_API int | swmm_node_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a node without changing model data. | |
| SWMM_ENGINE_API int | swmm_link_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a link without changing model data. | |
| SWMM_ENGINE_API int | swmm_subcatch_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a subcatchment without changing model data. | |
| SWMM_ENGINE_API int | swmm_gage_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a rain gage without changing model data. | |
| SWMM_ENGINE_API int | swmm_table_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a time-series/curve table without changing model data. | |
| SWMM_ENGINE_API int | swmm_transect_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a transect without changing model data. | |
| SWMM_ENGINE_API int | swmm_pollutant_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a pollutant without changing model data. | |
| SWMM_ENGINE_API int | swmm_pattern_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a time pattern without changing model data. | |
| SWMM_ENGINE_API int | swmm_aquifer_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to an aquifer without changing model data. | |
| SWMM_ENGINE_API int | swmm_snowpack_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a snowpack without changing model data. | |
| SWMM_ENGINE_API int | swmm_lid_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a LID control without changing model data. | |
| SWMM_ENGINE_API int | swmm_street_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a street without changing model data. | |
| SWMM_ENGINE_API int | swmm_inlet_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to an inlet design without changing model data. | |
| SWMM_ENGINE_API int | swmm_landuse_analyze_impact (SWMM_Engine engine, int idx, SWMM_ImpactReport *report_out) |
| Inspect incoming references to a land use without changing model data. | |
| SWMM_ENGINE_API int | swmm_hydrograph_analyze_impact (SWMM_Engine engine, const char *uh_name, SWMM_ImpactReport *report_out) |
| Inspect references to an existing hydrograph group by exact-case name. | |
| 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 a batch of node rows using pre-batch indices. | |
| SWMM_ENGINE_API int | swmm_link_delete_many (SWMM_Engine engine, const int *indices, int n, SWMM_ImpactReport *cascade_out) |
| Delete a batch of link rows using pre-batch indices. | |
| SWMM_ENGINE_API int | swmm_subcatch_delete_many (SWMM_Engine engine, const int *indices, int n, SWMM_ImpactReport *cascade_out) |
| Delete a batch of subcatchment rows using pre-batch indices. | |
| SWMM_ENGINE_API int | swmm_gage_delete_many (SWMM_Engine engine, const int *indices, int n, SWMM_ImpactReport *cascade_out) |
| Delete a batch of rain gage rows using pre-batch indices. | |
| 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 an existing hydrograph group by exact-case name. | |
| 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 an eligible conduit and create a configured inlet junction. | |
| SWMM_ENGINE_API int | swmm_inlet_junction_fuse (SWMM_Engine engine, int node_idx, int *surviving_link_idx) |
| Remove an inlet junction usage and fuse its through-conduit pair. | |
C API implementation — object deletion and type conversion.
| #define SWMM_DELETE_MANY_BODY | ( | COUNT_EXPR, | |
| MANY_FN ) |
| SWMM_ENGINE_API int swmm_aquifer_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to an aquifer without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing aquifer index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing aquifer index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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).
| [in] | engine | Engine handle. |
| [in] | link_idx | Zero-based conduit index. |
| [in] | t | Normalized split position along the polyline (0..1 exclusive). |
| [in] | new_node_name | Unique name for the inserted node. |
| [in] | new_link_name | Unique name for the new downstream conduit. |
| [in] | make_virtual | 1 to flag the new node as a virtual junction. |
| [out] | new_node_idx | Receives the new node index (may be NULL). |
| [out] | new_link_idx | Receives the new conduit index (may be NULL). |
| 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 an eligible conduit and create a configured inlet junction.
Requires BUILDING/OPENED. Creates one inlet, zero clogging, no capture limit/depression and AUTOMATIC placement. The edit helper attempts fusion to undo a later rule refusal. Undo can fail if virtual promotion left a regular node; a failed call can therefore leave a split while output indices remain unchanged. Adjust usage parameters with swmm_inlet_usage_set().
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | link_idx | Zero-based existing conduit index with a cross-section compatible with the design. |
| [in] | t | Finite normalized location strictly between 0 and 1 along the vertex-aware polyline. |
| [in] | new_node_name | Non-null, nonempty unique copied name for the inserted node. |
| [in] | new_link_name | Non-null, nonempty unique copied name for the downstream conduit. |
| [in] | inlet_id | Non-null existing inlet-design name, looked up case-insensitively. |
| [in] | capture_node | Non-null existing capture-node name; cannot select a virtual junction or the inserted node. |
| [out] | new_node_idx | Optional inserted node index, written only on success. |
| [out] | new_link_idx | Optional downstream conduit index, written only on success. |
| SWMM_ENGINE_API void swmm_conversion_result_free | ( | SWMM_ConversionResult * | result | ) |
Release all allocated conversion field/warning strings and arrays.
May be called after engine destruction. Use this function rather than freeing engine-allocated contents individually.
| [in,out] | result | Previously returned result or zero-initialized struct; NULL is a no-op. Resets arrays/counts but leaves new_type unchanged; does not free the struct. |
| SWMM_ENGINE_API int swmm_gage_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a rain gage without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing rain gage index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing rain gage index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_gage_delete_many | ( | SWMM_Engine | engine, |
| const int * | indices, | ||
| int | n, | ||
| SWMM_ImpactReport * | cascade_out ) |
Delete a batch of rain gage rows using pre-batch indices.
Requires BUILDING/OPENED. Validates every index before any mutation, then applies the same cascade logic as descending single-row deletions and rebuilds name indices once. Cascade report indices follow that descending sequence, rather than all sharing the original or final index space. All cached model indices should be re-resolved after success.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | indices | Borrowed array of n zero-based indices; required only when n>0. Duplicates are deduplicated. |
| [in] | n | Array length; n<=0 succeeds as a no-op after handle/lifecycle validation. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_hydrograph_analyze_impact | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect references to an existing hydrograph group by exact-case name.
Requires readable data (all states except CREATED/CLOSED/ERROR); with NULL output only validates existence.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | uh_name | Borrowed nonempty name matching a parameter row or gage assignment exactly; decay-only names do not establish a group. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_hydrograph_delete | ( | SWMM_Engine | engine, |
| const char * | uh_name, | ||
| SWMM_ImpactReport * | cascade_out ) |
Delete an existing hydrograph group by exact-case name.
Requires BUILDING/OPENED. Removes exact-case parameter, gage, decay and RDII assignment rows; the report lists affected RDII references. No running solver cache is refreshed.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | uh_name | Borrowed nonempty name matching a parameter row or gage assignment exactly; decay-only names do not establish a group. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API void swmm_impact_report_free | ( | SWMM_ImpactReport * | report | ) |
Release report entries and reset their pointer/count.
May be called after engine destruction. Field-name literals are static and must not be freed individually.
| [in,out] | report | Previously returned report or a zero-initialized struct; NULL is a no-op. The struct itself remains caller-owned. |
| SWMM_ENGINE_API int swmm_inlet_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to an inlet design without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing inlet design index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing inlet design index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_inlet_junction_fuse | ( | SWMM_Engine | engine, |
| int | node_idx, | ||
| int * | surviving_link_idx ) |
Remove an inlet junction usage and fuse its through-conduit pair.
Requires BUILDING/OPENED. Removes the inlet usage and downstream conduit/node; the upstream name survives, lengths sum and the old junction coordinate becomes an interior vertex. Re-resolve cached indices afterward.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | node_idx | Zero-based existing inlet-junction node index. |
| [out] | surviving_link_idx | Optional output for the final renumbered surviving upstream conduit index; written only on success. |
| SWMM_ENGINE_API int swmm_landuse_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a land use without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing land use index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing land use index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_lid_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a LID control without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing LID control index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing LID control index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_link_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a link without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing link index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Engine handle. |
| [in] | idx | Zero-based link index. |
| [in] | new_type | Target SWMM_LinkType value. |
| [out] | result_out | If non-NULL, receives the conversion result. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing link index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_link_delete_many | ( | SWMM_Engine | engine, |
| const int * | indices, | ||
| int | n, | ||
| SWMM_ImpactReport * | cascade_out ) |
Delete a batch of link rows using pre-batch indices.
Requires BUILDING/OPENED. Validates every index before any mutation, then applies the same cascade logic as descending single-row deletions and rebuilds name indices once. Cascade report indices follow that descending sequence, rather than all sharing the original or final index space. All cached model indices should be re-resolved after success.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | indices | Borrowed array of n zero-based indices; required only when n>0. Duplicates are deduplicated. |
| [in] | n | Array length; n<=0 succeeds as a no-op after handle/lifecycle validation. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_node_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a node without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing node index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Engine handle. |
| [in] | idx | Zero-based node index. |
| [in] | new_type | Target SWMM_NodeType value. |
| [out] | result_out | If non-NULL, receives the conversion result. Caller must free with swmm_conversion_result_free. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing node index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_node_delete_many | ( | SWMM_Engine | engine, |
| const int * | indices, | ||
| int | n, | ||
| SWMM_ImpactReport * | cascade_out ) |
Delete a batch of node rows using pre-batch indices.
Requires BUILDING/OPENED. Validates every index before any mutation, then applies the same cascade logic as descending single-row deletions and rebuilds name indices once. Cascade report indices follow that descending sequence, rather than all sharing the original or final index space. All cached model indices should be re-resolved after success.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | indices | Borrowed array of n zero-based indices; required only when n>0. Duplicates are deduplicated. |
| [in] | n | Array length; n<=0 succeeds as a no-op after handle/lifecycle validation. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_pattern_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a time pattern without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing time pattern index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing time pattern index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_pollutant_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a pollutant without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing pollutant index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing pollutant index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_snowpack_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a snowpack without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing snowpack index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing snowpack index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_street_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a street without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing street index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing street index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_subcatch_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a subcatchment without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing subcatchment index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing subcatchment index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_subcatch_delete_many | ( | SWMM_Engine | engine, |
| const int * | indices, | ||
| int | n, | ||
| SWMM_ImpactReport * | cascade_out ) |
Delete a batch of subcatchment rows using pre-batch indices.
Requires BUILDING/OPENED. Validates every index before any mutation, then applies the same cascade logic as descending single-row deletions and rebuilds name indices once. Cascade report indices follow that descending sequence, rather than all sharing the original or final index space. All cached model indices should be re-resolved after success.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | indices | Borrowed array of n zero-based indices; required only when n>0. Duplicates are deduplicated. |
| [in] | n | Array length; n<=0 succeeds as a no-op after handle/lifecycle validation. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_table_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a time-series/curve table without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing time-series/curve table index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing time-series/curve table index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| SWMM_ENGINE_API int swmm_transect_analyze_impact | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_ImpactReport * | report_out ) |
Inspect incoming references to a transect without changing model data.
Allowed whenever model data is readable: every state except CREATED, CLOSED and ERROR. With report_out=NULL performs handle/state/index validation only. Report indices describe the current model; later edits can invalidate them.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing transect index. |
| [out] | report_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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.
| [in] | engine | Non-null live engine; caller serializes access. |
| [in] | idx | Zero-based existing transect index. |
| [out] | cascade_out | Optional caller-owned result struct. Receives a newly allocated report; free any previous contents first and release new contents with swmm_impact_report_free(). Preserved on validation failure. |
| 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).
| [in] | engine | Engine handle. |
| [in] | node_idx | Zero-based node index of the virtual junction. |
| [out] | surviving_link_idx | Receives the surviving conduit's index AFTER deletions renumber (may be NULL). |