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

C API implementation — subcatchment identity, creation, properties, state, bulk. More...

#include "openswmm_api_common.hpp"
#include "StringCase.hpp"
#include "../hydrology/Groundwater.hpp"
#include "../math/MathExpr.hpp"
#include "../../../include/openswmm/engine/openswmm_subcatchments.h"
#include <algorithm>
#include <array>
#include <cstring>
#include <string>
#include <vector>
Include dependency graph for openswmm_subcatchments_impl.cpp:

Functions

SWMM_ENGINE_API int swmm_subcatch_count (SWMM_Engine engine)
 Get the total number of subcatchments in the model.
 
SWMM_ENGINE_API int swmm_subcatch_index (SWMM_Engine engine, const char *id)
 Look up a subcatchment's zero-based index by its string identifier.
 
SWMM_ENGINE_API const char * swmm_subcatch_id (SWMM_Engine engine, int idx)
 Get the string identifier of a subcatchment by index.
 
SWMM_ENGINE_API int swmm_subcatch_add (SWMM_Engine engine, const char *id)
 Add a new subcatchment to the model.
 
SWMM_ENGINE_API int swmm_subcatch_set_outlet (SWMM_Engine engine, int idx, int node_idx)
 Set the outlet node that receives runoff from this subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_set_area (SWMM_Engine engine, int idx, double area)
 Set the subcatchment area.
 
SWMM_ENGINE_API int swmm_subcatch_set_width (SWMM_Engine engine, int idx, double width)
 Set the characteristic overland flow width.
 
SWMM_ENGINE_API int swmm_subcatch_set_slope (SWMM_Engine engine, int idx, double slope)
 Set the average surface slope.
 
SWMM_ENGINE_API int swmm_subcatch_set_imperv_pct (SWMM_Engine engine, int idx, double pct)
 Set the percentage of impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_set_zero_imperv_pct (SWMM_Engine engine, int idx, double pct)
 Set the percentage of the impervious area having no depression storage.
 
SWMM_ENGINE_API int swmm_subcatch_set_n_imperv (SWMM_Engine engine, int idx, double n)
 Set Manning's n for the impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_set_n_perv (SWMM_Engine engine, int idx, double n)
 Set Manning's n for the pervious area.
 
SWMM_ENGINE_API int swmm_subcatch_set_ds_imperv (SWMM_Engine engine, int idx, double ds)
 Set the depression storage depth for the impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_set_ds_perv (SWMM_Engine engine, int idx, double ds)
 Set the depression storage depth for the pervious area.
 
SWMM_ENGINE_API int swmm_subcatch_set_gage (SWMM_Engine engine, int idx, int gage_idx)
 Assign a rain gage to a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_set_infil_horton (SWMM_Engine engine, int idx, double f0, double fmin, double decay, double dry_time)
 Select ordinary Horton infiltration and store its input parameters.
 
SWMM_ENGINE_API int swmm_subcatch_set_infil_green_ampt (SWMM_Engine engine, int idx, double suction, double conductivity, double initial_deficit)
 Select ordinary Green-Ampt infiltration and store input parameters.
 
SWMM_ENGINE_API int swmm_subcatch_set_infil_curve_number (SWMM_Engine engine, int idx, double cn, double drying_time)
 Set Curve Number infiltration parameters.
 
SWMM_ENGINE_API int swmm_subcatch_set_infil_model (SWMM_Engine engine, int idx, int model)
 Set ONLY the infiltration model code for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_area (SWMM_Engine engine, int idx, double *area)
 Get the subcatchment area.
 
SWMM_ENGINE_API int swmm_subcatch_get_imperv_pct (SWMM_Engine engine, int idx, double *pct)
 Get the percentage of impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_get_zero_imperv_pct (SWMM_Engine engine, int idx, double *pct)
 Get the percentage of the impervious area having no depression storage.
 
SWMM_ENGINE_API int swmm_subcatch_get_outlet (SWMM_Engine engine, int idx, int *node_idx)
 Get the outlet node index for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_width (SWMM_Engine engine, int idx, double *w)
 Get the characteristic overland flow width.
 
SWMM_ENGINE_API int swmm_subcatch_get_slope (SWMM_Engine engine, int idx, double *s)
 Get the average surface slope.
 
SWMM_ENGINE_API int swmm_subcatch_get_n_imperv (SWMM_Engine engine, int idx, double *n)
 Get Manning's n for the impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_get_n_perv (SWMM_Engine engine, int idx, double *n)
 Get Manning's n for the pervious area.
 
SWMM_ENGINE_API int swmm_subcatch_get_ds_imperv (SWMM_Engine engine, int idx, double *ds)
 Get the depression storage depth for the impervious area.
 
SWMM_ENGINE_API int swmm_subcatch_get_ds_perv (SWMM_Engine engine, int idx, double *ds)
 Get the depression storage depth for the pervious area.
 
SWMM_ENGINE_API int swmm_subcatch_get_gage (SWMM_Engine engine, int idx, int *gage_idx)
 Get the rain gage index assigned to a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_set_outlet_subcatch (SWMM_Engine engine, int idx, int sc_idx)
 Set a subcatchment's outlet to another subcatchment (cascading).
 
SWMM_ENGINE_API int swmm_subcatch_get_outlet_subcatch (SWMM_Engine engine, int idx, int *sc_idx)
 Get the downstream subcatchment index (for cascading outlets).
 
SWMM_ENGINE_API int swmm_subcatch_get_infil_model (SWMM_Engine engine, int idx, int *model)
 Get the infiltration model type for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_infil_horton (SWMM_Engine engine, int idx, double *f0, double *fmin, double *decay, double *dry_time)
 Get Horton infiltration parameters for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_infil_green_ampt (SWMM_Engine engine, int idx, double *suction, double *conductivity, double *deficit)
 Get Green–Ampt infiltration parameters for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_infil_curve_number (SWMM_Engine engine, int idx, double *cn, double *drying_time)
 Get the Curve Number infiltration parameters for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_stat_precip (SWMM_Engine engine, int idx, double *vol)
 Get the total precipitation volume at a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_stat_runoff_vol (SWMM_Engine engine, int idx, double *vol)
 Get the total runoff volume from a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_stat_max_runoff (SWMM_Engine engine, int idx, double *rate)
 Get the maximum runoff rate from a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_set_coverage (SWMM_Engine engine, int sc_idx, int lu_idx, double fraction)
 Set the land use coverage percent for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_coverage (SWMM_Engine engine, int sc_idx, int lu_idx, double *fraction)
 Get the land use coverage percent for a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_coverages (SWMM_Engine engine, int sc_idx, double *out, int n)
 Get all land use coverage percents for a subcatchment in one call.
 
SWMM_ENGINE_API int swmm_subcatch_set_initial_loading (SWMM_Engine engine, int sc_idx, int pollut_idx, double buildup)
 Set the initial pollutant buildup on a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_initial_loading (SWMM_Engine engine, int sc_idx, int pollut_idx, double *buildup)
 Get the initial pollutant buildup on a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_runoff (SWMM_Engine engine, int idx, double *runoff)
 Get the current runoff rate from a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_groundwater (SWMM_Engine engine, int idx, double *gw_flow)
 Get the current groundwater flow from a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_rainfall (SWMM_Engine engine, int idx, double *rainfall)
 Get the current rainfall intensity at a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_snow_depth (SWMM_Engine engine, int idx, double *depth)
 Get the current snow depth on a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_set_aquifer (SWMM_Engine engine, int idx, int aquifer_idx)
 Assign the aquifer used for groundwater.
 
SWMM_ENGINE_API int swmm_subcatch_get_aquifer (SWMM_Engine engine, int idx, int *aquifer_idx)
 Read the assigned aquifer used for groundwater.
 
SWMM_ENGINE_API int swmm_subcatch_set_gw_node (SWMM_Engine engine, int idx, int node_idx)
 Assign the node receiving groundwater.
 
SWMM_ENGINE_API int swmm_subcatch_get_gw_node (SWMM_Engine engine, int idx, int *node_idx)
 Read the assigned node receiving groundwater.
 
SWMM_ENGINE_API int swmm_subcatch_set_gw_params (SWMM_Engine engine, int idx, double surf_elev, double a1, double b1, double a2, double b2, double a3, double tw, double hstar)
 Assign the input groundwater flow-law parameters.
 
SWMM_ENGINE_API int swmm_subcatch_get_gw_params (SWMM_Engine engine, int idx, double *surf_elev, double *a1, double *b1, double *a2, double *b2, double *a3, double *tw, double *hstar)
 Read the input groundwater flow-law parameters.
 
SWMM_ENGINE_API int swmm_subcatch_get_gwf_expression (SWMM_Engine engine, int index, int type, char *buf, int buflen)
 Read a subcatchment's custom groundwater flow expression.
 
SWMM_ENGINE_API int swmm_subcatch_set_gwf_expression (SWMM_Engine engine, int index, int type, const char *expr)
 Set or clear a subcatchment's custom groundwater flow expression.
 
SWMM_ENGINE_API int swmm_gwf_validate_expression (SWMM_Engine engine, const char *expr, char *errbuf, int buflen, int *col_out)
 Validate a [GWF] expression WITHOUT modifying engine state.
 
SWMM_ENGINE_API int swmm_gwf_variable_count (SWMM_Engine engine)
 Number of variables a [GWF] expression may reference.
 
SWMM_ENGINE_API int swmm_gwf_variable_name (SWMM_Engine engine, int i, char *buf, int buflen)
 Name of the i-th [GWF] variable (upper-case, e.g. "HGW").
 
SWMM_ENGINE_API int swmm_gwf_variable_description (SWMM_Engine engine, int i, char *buf, int buflen)
 Short English description of the i-th [GWF] variable, with a units placeholder, e.g. "Water table height above aquifer bottom (ft or m)".
 
SWMM_ENGINE_API int swmm_gwf_function_count (SWMM_Engine engine)
 Number of built-in functions a [GWF] expression may call.
 
SWMM_ENGINE_API int swmm_gwf_function_name (SWMM_Engine engine, int i, char *buf, int buflen)
 Name of the i-th expression function (lower-case, stable order: abs, sgn, sqrt, log, exp, sin, cos, tan, asin, acos, atan, step, min, max, cot, sinh, cosh, tanh, coth, log10, acot).
 
SWMM_ENGINE_API int swmm_subcatch_set_gw_state (SWMM_Engine engine, int idx, double theta, double lower_depth)
 Set the groundwater state on a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_gw_state (SWMM_Engine engine, int idx, double *theta, double *lower_depth)
 Get the groundwater state on a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_set_snow_state (SWMM_Engine engine, int idx, int surface, double swe, double fw, double ati, double coldc)
 Set degree-day snow state on one snow subarea of a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_snow_state (SWMM_Engine engine, int idx, int surface, double *swe, double *fw, double *ati, double *coldc)
 Get degree-day snow state on one snow subarea of a subcatchment. UEB callers use swmm_subcatch_get_snow_process_state in openswmm_snow.h.
 
SWMM_ENGINE_API int swmm_subcatch_get_evap (SWMM_Engine engine, int idx, double *evap)
 Get the current evaporation rate at a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_get_infil (SWMM_Engine engine, int idx, double *infil)
 Get the current infiltration rate at a subcatchment.
 
SWMM_ENGINE_API int swmm_subcatch_set_rainfall (SWMM_Engine engine, int idx, double rainfall)
 Overwrite the current subcatchment rainfall state during RUNNING.
 
SWMM_ENGINE_API int swmm_subcatch_get_quality (SWMM_Engine engine, int subcatch_idx, int pollutant_idx, double *conc)
 Get the pollutant concentration in subcatchment runoff.
 
SWMM_ENGINE_API int swmm_subcatch_get_runoff_bulk (SWMM_Engine engine, double *buf, int count)
 Get runoff rates for all subcatchments in a single call.
 
SWMM_ENGINE_API int swmm_subcatch_get_quality_bulk (SWMM_Engine engine, int pollutant_idx, double *buf, int count)
 Get pollutant concentrations for all subcatchments for one pollutant.
 
SWMM_ENGINE_API int swmm_subcatch_get_rainfall_bulk (SWMM_Engine engine, double *buf, int count)
 Copy rainfall values for a prefix of subcatchments.
 
SWMM_ENGINE_API int swmm_subcatch_get_evap_bulk (SWMM_Engine engine, double *buf, int count)
 Copy evap values for a prefix of subcatchments.
 
SWMM_ENGINE_API int swmm_subcatch_get_infil_bulk (SWMM_Engine engine, double *buf, int count)
 Copy infil values for a prefix of subcatchments.
 
SWMM_ENGINE_API int swmm_subcatch_get_snow_depth_bulk (SWMM_Engine engine, double *buf, int count)
 Copy snow depth values for a prefix of subcatchments.
 
SWMM_ENGINE_API int swmm_subcatch_get_ids_bulk (SWMM_Engine engine, char *buf, int stride, int count)
 Get subcatchment IDs for all subcatchments in a single call (stride-packed UTF-8).
 
SWMM_ENGINE_API int swmm_subcatch_get_ponded_quality (SWMM_Engine engine, int subcatch_idx, int pollutant_idx, double *mass)
 Read a pollutant's ponded surface mass.
 
SWMM_ENGINE_API int swmm_subcatch_set_ponded_quality (SWMM_Engine engine, int subcatch_idx, int pollutant_idx, double mass)
 Replace a pollutant's ponded surface mass.
 
SWMM_ENGINE_API int swmm_subcatch_rename (SWMM_Engine engine, int idx, const char *newId)
 Rename a subcatchment in its name registry.
 
SWMM_ENGINE_API int swmm_subcatch_get_tag (SWMM_Engine engine, int idx, char *buf, int buflen)
 Copy a subcatchment tag.
 
SWMM_ENGINE_API int swmm_subcatch_set_tag (SWMM_Engine engine, int idx, const char *tag)
 Replace or clear a copied subcatchment tag.
 
SWMM_ENGINE_API int swmm_aquifer_count (SWMM_Engine engine)
 Get the total number of aquifer definitions in the model.
 
SWMM_ENGINE_API int swmm_aquifer_index (SWMM_Engine engine, const char *id)
 Look up an aquifer's zero-based index by its string identifier.
 
SWMM_ENGINE_API const char * swmm_aquifer_id (SWMM_Engine engine, int idx)
 Get the string identifier of an aquifer definition by index.
 
SWMM_ENGINE_API int swmm_aquifer_add (SWMM_Engine engine, const char *id)
 Add a new aquifer definition with default (zero) parameters.
 
SWMM_ENGINE_API int swmm_aquifer_rename (SWMM_Engine engine, int idx, const char *new_id)
 Rename an aquifer in place.
 
SWMM_ENGINE_API int swmm_aquifer_get_param (SWMM_Engine engine, int idx, int param, double *value)
 Get an aquifer parameter (input-file units).
 
SWMM_ENGINE_API int swmm_aquifer_set_param (SWMM_Engine engine, int idx, int param, double value)
 Set an aquifer parameter (input-file units).
 
SWMM_ENGINE_API int swmm_aquifer_get_evap_pattern (SWMM_Engine engine, int idx, char *buf, int buflen)
 Read the aquifer's upper-zone evaporation pattern name.
 
SWMM_ENGINE_API int swmm_aquifer_set_evap_pattern (SWMM_Engine engine, int idx, const char *name)
 Set or clear the aquifer's upper-zone evaporation pattern name.
 
SWMM_ENGINE_API int swmm_subcatch_set_snowpack (SWMM_Engine engine, int idx, const char *name)
 Assign an existing snowpack before initialization.
 
SWMM_ENGINE_API const char * swmm_subcatch_get_snowpack (SWMM_Engine engine, int idx)
 Borrow the assigned snowpack ID.
 
SWMM_ENGINE_API int swmm_snowpack_count (SWMM_Engine engine)
 Get the total number of snowpack definitions in the model.
 
SWMM_ENGINE_API int swmm_snowpack_index (SWMM_Engine engine, const char *id)
 Look up a snowpack's zero-based index by its string identifier.
 
SWMM_ENGINE_API const char * swmm_snowpack_id (SWMM_Engine engine, int idx)
 Get the string identifier of a snowpack definition by index.
 
SWMM_ENGINE_API int swmm_snowpack_add (SWMM_Engine engine, const char *id)
 Add a new snowpack definition with default (zero) parameters.
 
SWMM_ENGINE_API int swmm_snowpack_rename (SWMM_Engine engine, int idx, const char *new_id)
 Rename a snow pack in place.
 
SWMM_ENGINE_API int swmm_snowpack_set_plowable (SWMM_Engine engine, int idx, double cmin, double cmax, double tbase, double fwfrac, double sd0, double fw0, double last)
 Assign the plowable snow-melt surface parameters.
 
SWMM_ENGINE_API int swmm_snowpack_get_plowable (SWMM_Engine engine, int idx, double *cmin, double *cmax, double *tbase, double *fwfrac, double *sd0, double *fw0, double *last)
 Read the plowable snow-melt surface parameters.
 
SWMM_ENGINE_API int swmm_snowpack_set_impervious (SWMM_Engine engine, int idx, double cmin, double cmax, double tbase, double fwfrac, double sd0, double fw0, double last)
 Assign the impervious snow-melt surface parameters.
 
SWMM_ENGINE_API int swmm_snowpack_get_impervious (SWMM_Engine engine, int idx, double *cmin, double *cmax, double *tbase, double *fwfrac, double *sd0, double *fw0, double *last)
 Read the impervious snow-melt surface parameters.
 
SWMM_ENGINE_API int swmm_snowpack_set_pervious (SWMM_Engine engine, int idx, double cmin, double cmax, double tbase, double fwfrac, double sd0, double fw0, double last)
 Assign the pervious snow-melt surface parameters.
 
SWMM_ENGINE_API int swmm_snowpack_get_pervious (SWMM_Engine engine, int idx, double *cmin, double *cmax, double *tbase, double *fwfrac, double *sd0, double *fw0, double *last)
 Read the pervious snow-melt surface parameters.
 
SWMM_ENGINE_API int swmm_snowpack_set_removal (SWMM_Engine engine, int idx, double dsnow, double fout, double fimp, double fperv, double fimelt, double fsubcatch)
 Assign snow redistribution parameters.
 
SWMM_ENGINE_API int swmm_snowpack_get_removal (SWMM_Engine engine, int idx, double *dsnow, double *fout, double *fimp, double *fperv, double *fimelt, double *fsubcatch)
 Read snow redistribution parameters.
 
SWMM_ENGINE_API int swmm_snowpack_set_removal_subcatch (SWMM_Engine engine, int idx, const char *name)
 Set or clear the copied snow-removal destination name.
 
SWMM_ENGINE_API int swmm_snowpack_get_removal_subcatch (SWMM_Engine engine, int idx, char *buf, int buflen)
 Copy the snow-removal destination name.
 
SWMM_ENGINE_API int swmm_subcatch_set_rain_scale_factor (SWMM_Engine engine, int idx, double factor)
 Replace the rain precipitation multiplier.
 
SWMM_ENGINE_API int swmm_subcatch_get_rain_scale_factor (SWMM_Engine engine, int idx, double *factor)
 Read the rain precipitation multiplier.
 
SWMM_ENGINE_API int swmm_subcatch_set_snow_scale_factor (SWMM_Engine engine, int idx, double factor)
 Replace the snow precipitation multiplier.
 
SWMM_ENGINE_API int swmm_subcatch_get_snow_scale_factor (SWMM_Engine engine, int idx, double *factor)
 Read the snow precipitation multiplier.
 

Detailed Description

C API implementation — subcatchment identity, creation, properties, state, bulk.

See also
include/openswmm/engine/openswmm_subcatchments.h
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License
Apache-2.0

Function Documentation

◆ swmm_aquifer_add()

SWMM_ENGINE_API int swmm_aquifer_add ( SWMM_Engine engine,
const char * id )

Add a new aquifer definition with default (zero) parameters.

Parameters default to 0.0 / empty strings — use the property setters from Slice BP AquiferEditor to configure porosity, conductivity, etc. Lifecycle: BUILDING or OPENED.

Parameters
[in]engineEngine handle.
[in]idUnique null-terminated identifier.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. Copies ID and rejects case-insensitive duplicates; NULL is refused, but this wrapper has no explicit empty-ID check.

◆ swmm_aquifer_count()

SWMM_ENGINE_API int swmm_aquifer_count ( SWMM_Engine engine)

Get the total number of aquifer definitions in the model.

Parameters
[in]engineEngine handle.
Returns
Number of aquifer definitions, or -1 on error.
Note
Null engine returns -1.

◆ swmm_aquifer_get_evap_pattern()

SWMM_ENGINE_API int swmm_aquifer_get_evap_pattern ( SWMM_Engine engine,
int idx,
char * buf,
int buflen )

Read the aquifer's upper-zone evaporation pattern name.

The optional monthly time pattern ([PATTERNS] MONTHLY) that scales the upper-zone evaporation fraction — the trailing [ETupat] column of the [AQUIFERS] line. The 12 numeric parameters are reached via swmm_aquifer_get_param; this completes the round-trip for the one string-valued column. Writes a NUL-terminated string into buf (empty when no pattern is assigned), truncating if buflen is too small.

Parameters
[in]engineEngine handle.
[in]idxZero-based aquifer index.
[out]bufDestination buffer for the pattern name.
[in]buflenSize of buf in bytes (must be > 0).
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Output must be non-null with positive byte capacity; text is NUL-terminated and silently truncated to capacity minus one byte.
Here is the call graph for this function:

◆ swmm_aquifer_get_param()

SWMM_ENGINE_API int swmm_aquifer_get_param ( SWMM_Engine engine,
int idx,
int param,
double * value )

Get an aquifer parameter (input-file units).

Parameters
[in]engineEngine handle.
[in]idxZero-based aquifer index.
[in]paramA SWMM_AquiferParam code.
[out]valueReceives the parameter value.
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_aquifer_id()

SWMM_ENGINE_API const char * swmm_aquifer_id ( SWMM_Engine engine,
int idx )

Get the string identifier of an aquifer definition by index.

Parameters
[in]engineEngine handle.
[in]idxZero-based aquifer index.
Returns
Null-terminated string owned by the engine, or NULL on error.
Note
Returned text borrows engine storage; do not free. Copy before a registry/table edit or engine close/destruction. Null engine/invalid index returns NULL.

◆ swmm_aquifer_index()

SWMM_ENGINE_API int swmm_aquifer_index ( SWMM_Engine engine,
const char * id )

Look up an aquifer's zero-based index by its string identifier.

Parameters
[in]engineEngine handle.
[in]idNull-terminated aquifer identifier.
Returns
Zero-based index, or -1 if not found.
Note
Case-insensitive name lookup; null engine/name or no match returns -1.

◆ swmm_aquifer_rename()

SWMM_ENGINE_API int swmm_aquifer_rename ( SWMM_Engine engine,
int idx,
const char * new_id )

Rename an aquifer in place.

Updates both the name vector and the name registry so swmm_aquifer_id() and swmm_aquifer_index() stay in agreement. [GROUNDWATER] holds an aquifer INDEX, not a name, so subcatchment references follow automatically. Lifecycle: BUILDING or OPENED.

Parameters
[in]engineEngine handle.
[in]idxAquifer index.
[in]new_idNew unique name (non-empty). A pure case-respelling of this same aquifer is allowed.
Returns
SWMM_OK, or SWMM_ERR_BADPARAM on an empty or duplicate name.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_aquifer_set_evap_pattern()

SWMM_ENGINE_API int swmm_aquifer_set_evap_pattern ( SWMM_Engine engine,
int idx,
const char * name )

Set or clear the aquifer's upper-zone evaporation pattern name.

Inverse of swmm_aquifer_get_evap_pattern. The name is resolved to a [PATTERNS] entry at start(); a null or empty string clears the assignment. Pre-start-only (BUILDING / OPENED): the pattern index is bound when the simulation starts, so a mid-run change returns SWMM_ERR_LIFECYCLE.

Parameters
[in]engineEngine handle.
[in]idxZero-based aquifer index.
[in]namePattern name, or null/empty to clear.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_aquifer_set_param()

SWMM_ENGINE_API int swmm_aquifer_set_param ( SWMM_Engine engine,
int idx,
int param,
double value )

Set an aquifer parameter (input-file units).

Flux-coefficient parameters take effect on the next step when set mid-run (the groundwater solver's per-subcatchment copies are refreshed); structural / initial-condition parameters return SWMM_ERR_LIFECYCLE while the simulation is running.

Parameters
[in]engineEngine handle.
[in]idxZero-based aquifer index.
[in]paramA SWMM_AquiferParam code.
[in]valueNew parameter value.
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Structural/initial parameters require BUILDING/OPENED; flux parameters have no lifecycle restriction and refresh cached aquifer parameters outside those states. Numeric bounds use comparisons only; provide finite inputs.
Here is the call graph for this function:

◆ swmm_gwf_function_count()

SWMM_ENGINE_API int swmm_gwf_function_count ( SWMM_Engine engine)

Number of built-in functions a [GWF] expression may call.

Parameters
[in]engineEngine handle.
Returns
Function count, or -1 on error.
Note
Null engine returns -1.
Here is the call graph for this function:

◆ swmm_gwf_function_name()

SWMM_ENGINE_API int swmm_gwf_function_name ( SWMM_Engine engine,
int i,
char * buf,
int buflen )

Name of the i-th expression function (lower-case, stable order: abs, sgn, sqrt, log, exp, sin, cos, tan, asin, acos, atan, step, min, max, cot, sinh, cosh, tanh, coth, log10, acot).

Parameters
[in]engineEngine handle.
[in]iZero-based index, < swmm_gwf_function_count().
[out]bufDestination buffer (NUL-terminated, truncated if too small).
[in]buflenSize of buf in bytes (must be > 0).
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Output must be non-null with positive byte capacity; text is NUL-terminated and silently truncated to capacity minus one byte.
Here is the call graph for this function:

◆ swmm_gwf_validate_expression()

SWMM_ENGINE_API int swmm_gwf_validate_expression ( SWMM_Engine engine,
const char * expr,
char * errbuf,
int buflen,
int * col_out )

Validate a [GWF] expression WITHOUT modifying engine state.

Editor-support peer of swmm_treatment_validate_expression: grammar-only, never mutates the engine, so it is safe to invoke per keystroke. Stricter than the runtime parser: unknown characters, unknown identifiers (must be a GW variable or a function), unbalanced parentheses, misplaced operators and wrong function arity (min/max take 2 arguments, all others 1) are errors. An empty or whitespace-only expression is INVALID ("expression is empty") — callers treat empty as "clear" themselves.

Parameters
[in]engineEngine handle (grammar only; no model data is read).
[in]exprExpression text.
[out]errbufReceives the diagnostic on failure ("" on success). May be NULL.
[in]buflenSize of errbuf in bytes.
[out]col_outReceives the 0-based character offset of the error, or -1 when not attributable. May be NULL.
Returns
SWMM_OK when the expression is valid, SWMM_ERR_BADPARAM when invalid (diagnostic in errbuf/col_out) or on NULL expr.
Note
col_out may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE.
Here is the call graph for this function:

◆ swmm_gwf_variable_count()

SWMM_ENGINE_API int swmm_gwf_variable_count ( SWMM_Engine engine)

Number of variables a [GWF] expression may reference.

Parameters
[in]engineEngine handle.
Returns
Variable count, or -1 on error.
Note
Null engine returns -1.

◆ swmm_gwf_variable_description()

SWMM_ENGINE_API int swmm_gwf_variable_description ( SWMM_Engine engine,
int i,
char * buf,
int buflen )

Short English description of the i-th [GWF] variable, with a units placeholder, e.g. "Water table height above aquifer bottom (ft or m)".

Parameters
[in]engineEngine handle.
[in]iZero-based index, < swmm_gwf_variable_count().
[out]bufDestination buffer (NUL-terminated, truncated if too small).
[in]buflenSize of buf in bytes (must be > 0).
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Output must be non-null with positive byte capacity; text is NUL-terminated and silently truncated to capacity minus one byte.

◆ swmm_gwf_variable_name()

SWMM_ENGINE_API int swmm_gwf_variable_name ( SWMM_Engine engine,
int i,
char * buf,
int buflen )

Name of the i-th [GWF] variable (upper-case, e.g. "HGW").

Parameters
[in]engineEngine handle.
[in]iZero-based index, < swmm_gwf_variable_count().
[out]bufDestination buffer (NUL-terminated, truncated if too small).
[in]buflenSize of buf in bytes (must be > 0).
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Output must be non-null with positive byte capacity; text is NUL-terminated and silently truncated to capacity minus one byte.

◆ swmm_snowpack_add()

SWMM_ENGINE_API int swmm_snowpack_add ( SWMM_Engine engine,
const char * id )

Add a new snowpack definition with default (zero) parameters.

All three surface arrays (plowable / impervious / pervious) and the removal row are zero-initialised. Use the property setters from Slice BP SnowpackEditor to configure melt coefficients, ATI, negative-melt-ratio, and removal fractions. Lifecycle: BUILDING or OPENED.

Parameters
[in]engineEngine handle.
[in]idUnique null-terminated identifier.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. Copies ID and rejects case-insensitive duplicates; NULL is refused, but this wrapper has no explicit empty-ID check.
Here is the call graph for this function:

◆ swmm_snowpack_count()

SWMM_ENGINE_API int swmm_snowpack_count ( SWMM_Engine engine)

Get the total number of snowpack definitions in the model.

Parameters
[in]engineEngine handle.
Returns
Number of snowpack definitions, or -1 on error.
Note
Null engine returns -1.

◆ swmm_snowpack_get_impervious()

SWMM_ENGINE_API int swmm_snowpack_get_impervious ( SWMM_Engine engine,
int idx,
double * cmin,
double * cmax,
double * tbase,
double * fwfrac,
double * sd0,
double * fw0,
double * last )

Read the impervious snow-melt surface parameters.

No lifecycle check; reads stored input values.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[out]cminOptional output. Minimum melt factor, inches/hour/degree F or mm/hour/degree C.
[out]cmaxOptional output. Maximum melt factor in the same units.
[out]tbaseOptional output. Base melt temperature, degrees F for US or C for SI.
[out]fwfracOptional output. Free-water capacity fraction.
[out]sd0Optional output. Initial snow water-equivalent depth, inches/mm.
[out]fw0Optional output. Initial free-water depth, inches/mm.
[out]lastOptional output. Snow water-equivalent depth for complete cover, inches/mm.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_snowpack_get_pervious()

SWMM_ENGINE_API int swmm_snowpack_get_pervious ( SWMM_Engine engine,
int idx,
double * cmin,
double * cmax,
double * tbase,
double * fwfrac,
double * sd0,
double * fw0,
double * last )

Read the pervious snow-melt surface parameters.

No lifecycle check; reads stored input values.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[out]cminOptional output. Minimum melt factor, inches/hour/degree F or mm/hour/degree C.
[out]cmaxOptional output. Maximum melt factor in the same units.
[out]tbaseOptional output. Base melt temperature, degrees F for US or C for SI.
[out]fwfracOptional output. Free-water capacity fraction.
[out]sd0Optional output. Initial snow water-equivalent depth, inches/mm.
[out]fw0Optional output. Initial free-water depth, inches/mm.
[out]lastOptional output. Snow water-equivalent depth for complete cover, inches/mm.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_snowpack_get_plowable()

SWMM_ENGINE_API int swmm_snowpack_get_plowable ( SWMM_Engine engine,
int idx,
double * cmin,
double * cmax,
double * tbase,
double * fwfrac,
double * sd0,
double * fw0,
double * last )

Read the plowable snow-melt surface parameters.

No lifecycle check; reads stored input values.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[out]cminOptional output. Minimum melt factor, inches/hour/degree F or mm/hour/degree C.
[out]cmaxOptional output. Maximum melt factor in the same units.
[out]tbaseOptional output. Base melt temperature, degrees F for US or C for SI.
[out]fwfracOptional output. Free-water capacity fraction.
[out]sd0Optional output. Initial snow water-equivalent depth, inches/mm.
[out]fw0Optional output. Initial free-water depth, inches/mm.
[out]lastOptional output. Plowable fraction of impervious area.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_snowpack_get_removal()

SWMM_ENGINE_API int swmm_snowpack_get_removal ( SWMM_Engine engine,
int idx,
double * dsnow,
double * fout,
double * fimp,
double * fperv,
double * fimelt,
double * fsubcatch )

Read snow redistribution parameters.

No lifecycle check.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[out]dsnowOptional output. Snow depth at which removal begins, inches/mm.
[out]foutOptional output. Fraction exported out of the watershed.
[out]fimpOptional output. Fraction routed to impervious surface.
[out]fpervOptional output. Fraction routed to pervious surface.
[out]fimeltOptional output. Fraction converted to immediate melt.
[out]fsubcatchOptional output. Fraction transferred to the separately named destination subcatchment.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.
Here is the call graph for this function:

◆ swmm_snowpack_get_removal_subcatch()

SWMM_ENGINE_API int swmm_snowpack_get_removal_subcatch ( SWMM_Engine engine,
int idx,
char * buf,
int buflen )

Copy the snow-removal destination name.

No lifecycle check; empty when no destination is assigned.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[out]bufNon-null caller-owned buffer, NUL-terminated and silently truncated to buflen-1 bytes.
[in]buflenPositive capacity in bytes including NUL.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.
Here is the call graph for this function:

◆ swmm_snowpack_id()

SWMM_ENGINE_API const char * swmm_snowpack_id ( SWMM_Engine engine,
int idx )

Get the string identifier of a snowpack definition by index.

Parameters
[in]engineEngine handle.
[in]idxZero-based snowpack index.
Returns
Null-terminated string owned by the engine, or NULL on error.
Note
Returned text borrows engine storage; do not free. Copy before a registry/table edit or engine close/destruction. Null engine/invalid index returns NULL.

◆ swmm_snowpack_index()

SWMM_ENGINE_API int swmm_snowpack_index ( SWMM_Engine engine,
const char * id )

Look up a snowpack's zero-based index by its string identifier.

Parameters
[in]engineEngine handle.
[in]idNull-terminated snowpack identifier.
Returns
Zero-based index, or -1 if not found.
Note
Case-insensitive name lookup; null engine/name or no match returns -1.

◆ swmm_snowpack_rename()

SWMM_ENGINE_API int swmm_snowpack_rename ( SWMM_Engine engine,
int idx,
const char * new_id )

Rename a snow pack in place.

Updates both the name vector (read by swmm_snowpack_id() and the [SNOWPACKS] writer) and the name registry (read by swmm_snowpack_index() and the [SUBCATCHMENTS] snow-pack column), plus the deferred-resolution name held per subcatchment. Melt parameters and subcatchment assignments are index-based and follow automatically. Lifecycle: BUILDING or OPENED.

Parameters
[in]engineEngine handle.
[in]idxSnow pack index.
[in]new_idNew unique name (non-empty). A pure case-respelling of this same snow pack is allowed.
Returns
SWMM_OK, or SWMM_ERR_BADPARAM on an empty or duplicate name.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.
Here is the call graph for this function:

◆ swmm_snowpack_set_impervious()

SWMM_ENGINE_API int swmm_snowpack_set_impervious ( SWMM_Engine engine,
int idx,
double cmin,
double cmax,
double tbase,
double fwfrac,
double sd0,
double fw0,
double last )

Assign the impervious snow-melt surface parameters.

Requires BUILDING/OPENED. Values seed snow state at start; this setter stores them without finite/range checks.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[in]cminMinimum melt factor, inches/hour/degree F or mm/hour/degree C.
[in]cmaxMaximum melt factor in the same units.
[in]tbaseBase melt temperature, degrees F for US or C for SI.
[in]fwfracFree-water capacity fraction.
[in]sd0Initial snow water-equivalent depth, inches/mm.
[in]fw0Initial free-water depth, inches/mm.
[in]lastSnow water-equivalent depth for complete cover, inches/mm.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_snowpack_set_pervious()

SWMM_ENGINE_API int swmm_snowpack_set_pervious ( SWMM_Engine engine,
int idx,
double cmin,
double cmax,
double tbase,
double fwfrac,
double sd0,
double fw0,
double last )

Assign the pervious snow-melt surface parameters.

Requires BUILDING/OPENED. Values seed snow state at start; this setter stores them without finite/range checks.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[in]cminMinimum melt factor, inches/hour/degree F or mm/hour/degree C.
[in]cmaxMaximum melt factor in the same units.
[in]tbaseBase melt temperature, degrees F for US or C for SI.
[in]fwfracFree-water capacity fraction.
[in]sd0Initial snow water-equivalent depth, inches/mm.
[in]fw0Initial free-water depth, inches/mm.
[in]lastSnow water-equivalent depth for complete cover, inches/mm.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_snowpack_set_plowable()

SWMM_ENGINE_API int swmm_snowpack_set_plowable ( SWMM_Engine engine,
int idx,
double cmin,
double cmax,
double tbase,
double fwfrac,
double sd0,
double fw0,
double last )

Assign the plowable snow-melt surface parameters.

Requires BUILDING/OPENED. Values seed snow state at start; this setter stores them without finite/range checks.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[in]cminMinimum melt factor, inches/hour/degree F or mm/hour/degree C.
[in]cmaxMaximum melt factor in the same units.
[in]tbaseBase melt temperature, degrees F for US or C for SI.
[in]fwfracFree-water capacity fraction.
[in]sd0Initial snow water-equivalent depth, inches/mm.
[in]fw0Initial free-water depth, inches/mm.
[in]lastPlowable fraction of impervious area.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_snowpack_set_removal()

SWMM_ENGINE_API int swmm_snowpack_set_removal ( SWMM_Engine engine,
int idx,
double dsnow,
double fout,
double fimp,
double fperv,
double fimelt,
double fsubcatch )

Assign snow redistribution parameters.

Requires BUILDING/OPENED. Does not validate individual values, fraction sum or destination; stores authoring inputs verbatim.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[in]dsnowSnow depth at which removal begins, inches/mm.
[in]foutFraction exported out of the watershed.
[in]fimpFraction routed to impervious surface.
[in]fpervFraction routed to pervious surface.
[in]fimeltFraction converted to immediate melt.
[in]fsubcatchFraction transferred to the separately named destination subcatchment.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.
Here is the call graph for this function:

◆ swmm_snowpack_set_removal_subcatch()

SWMM_ENGINE_API int swmm_snowpack_set_removal_subcatch ( SWMM_Engine engine,
int idx,
const char * name )

Set or clear the copied snow-removal destination name.

Requires BUILDING/OPENED. Stores the name without resolving existence here.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing snowpack definition index.
[in]nameBorrowed NUL-terminated subcatchment name; NULL/empty clears it.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.
Here is the call graph for this function:

◆ swmm_subcatch_add()

SWMM_ENGINE_API int swmm_subcatch_add ( SWMM_Engine engine,
const char * id )

Add a new subcatchment to the model.

The engine must be in SWMM_STATE_BUILDING or SWMM_STATE_OPENED. Returns SWMM_ERR_LIFECYCLE for any other state. After creation, use the property setters to configure area, slope, imperviousness, etc.

Parameters
[in]engineEngine handle.
[in]idUnique null-terminated identifier for the new subcatchment.
Returns
SWMM_OK on success, SWMM_ERR_LIFECYCLE if not in an editable state, or another error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. Copies ID and rejects case-insensitive duplicates; NULL is refused, but this wrapper has no explicit empty-ID check.

◆ swmm_subcatch_count()

SWMM_ENGINE_API int swmm_subcatch_count ( SWMM_Engine engine)

Get the total number of subcatchments in the model.

Parameters
[in]engineEngine handle.
Returns
Number of subcatchments, or -1 on error.
Note
Null engine returns -1.

◆ swmm_subcatch_get_aquifer()

SWMM_ENGINE_API int swmm_subcatch_get_aquifer ( SWMM_Engine engine,
int idx,
int * aquifer_idx )

Read the assigned aquifer used for groundwater.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[out]aquifer_idxOptional stored target-index output; -1 denotes none.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_area()

SWMM_ENGINE_API int swmm_subcatch_get_area ( SWMM_Engine engine,
int idx,
double * area )

Get the subcatchment area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]areaReceives the area in project area units.
Returns
SWMM_OK on success, or an error code.
Note
area may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_coverage()

SWMM_ENGINE_API int swmm_subcatch_get_coverage ( SWMM_Engine engine,
int sc_idx,
int lu_idx,
double * fraction )

Get the land use coverage percent for a subcatchment.

Parameters
[in]engineEngine handle.
[in]sc_idxZero-based subcatchment index.
[in]lu_idxZero-based land use index.
[out]fractionReceives the coverage in percent (0–100).
Returns
SWMM_OK on success, or an error code.
Note
fraction may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_coverages()

SWMM_ENGINE_API int swmm_subcatch_get_coverages ( SWMM_Engine engine,
int sc_idx,
double * out,
int n )

Get all land use coverage percents for a subcatchment in one call.

Bulk peer of swmm_subcatch_get_coverage for grid editors: fills out[0..n-1] with the coverage percent for land uses 0..n-1. n must not exceed the engine's land use count.

Parameters
[in]engineEngine handle.
[in]sc_idxZero-based subcatchment index.
[out]outCaller-owned array receiving n percents (0–100).
[in]nNumber of land uses to fetch (array capacity).
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Requires non-null out even for n=0. n must be in [0,landuse count] or BADINDEX. Writes exactly n prefix percentages; unsized coverage returns zeros.

◆ swmm_subcatch_get_ds_imperv()

SWMM_ENGINE_API int swmm_subcatch_get_ds_imperv ( SWMM_Engine engine,
int idx,
double * ds )

Get the depression storage depth for the impervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]dsReceives the depression storage depth.
Returns
SWMM_OK on success, or an error code.
Note
ds may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_ds_perv()

SWMM_ENGINE_API int swmm_subcatch_get_ds_perv ( SWMM_Engine engine,
int idx,
double * ds )

Get the depression storage depth for the pervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]dsReceives the depression storage depth.
Returns
SWMM_OK on success, or an error code.
Note
ds may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_evap()

SWMM_ENGINE_API int swmm_subcatch_get_evap ( SWMM_Engine engine,
int idx,
double * evap )

Get the current evaporation rate at a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]evapReceives the evaporation rate.
Returns
SWMM_OK on success, or an error code.
Note
evap may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_evap_bulk()

SWMM_ENGINE_API int swmm_subcatch_get_evap_bulk ( SWMM_Engine engine,
double * buf,
int count )

Copy evap values for a prefix of subcatchments.

Writes min(count,subcatchment count) elements and preserves any remaining buffer tail. No lifecycle check; returns the current stored state.

Parameters
[in]engineNon-null live engine; caller serializes access.
[out]bufNon-null caller-owned array with room for min(count,subcatchment count) doubles. Evaporation loss rate in inches/day or mm/day.
[in]countPositive destination element capacity; a short buffer selects the corresponding model prefix.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_gage()

SWMM_ENGINE_API int swmm_subcatch_get_gage ( SWMM_Engine engine,
int idx,
int * gage_idx )

Get the rain gage index assigned to a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]gage_idxReceives the gage index.
Returns
SWMM_OK on success, or an error code.
Note
gage_idx may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_groundwater()

SWMM_ENGINE_API int swmm_subcatch_get_groundwater ( SWMM_Engine engine,
int idx,
double * gw_flow )

Get the current groundwater flow from a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]gw_flowReceives the groundwater flow in project flow units.
Returns
SWMM_OK on success, or an error code.
Note
gw_flow may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_gw_node()

SWMM_ENGINE_API int swmm_subcatch_get_gw_node ( SWMM_Engine engine,
int idx,
int * node_idx )

Read the assigned node receiving groundwater.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[out]node_idxOptional stored target-index output; -1 denotes none.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_gw_params()

SWMM_ENGINE_API int swmm_subcatch_get_gw_params ( SWMM_Engine engine,
int idx,
double * surf_elev,
double * a1,
double * b1,
double * a2,
double * b2,
double * a3,
double * tw,
double * hstar )

Read the input groundwater flow-law parameters.

Values retain input-file units. No lifecycle check; does not read runtime theta/lower_depth.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[out]surf_elevOptional output. Ground surface elevation, ft/m.
[out]a1Optional output. Groundwater outflow coefficient in the project input groundwater law.
[out]b1Optional output. Dimensionless groundwater outflow exponent.
[out]a2Optional output. Surface-water outflow coefficient in the project input groundwater law.
[out]b2Optional output. Dimensionless surface-water outflow exponent.
[out]a3Optional output. Surface/groundwater interaction coefficient in the project input law.
[out]twOptional output. Fixed receiving surface-water depth, ft/m; zero uses live node depth.
[out]hstarOptional output. Lateral-flow threshold water-table elevation, ft/m; -1e10 uses receiving-node invert. Other values, including -99, are literal elevations.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_gw_state()

SWMM_ENGINE_API int swmm_subcatch_get_gw_state ( SWMM_Engine engine,
int idx,
double * theta,
double * lower_depth )

Get the groundwater state on a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxSubcatchment index (must have groundwater).
[out]thetaReceives the upper zone moisture content.
[out]lower_depthReceives the saturated zone depth (user length units).
Returns
SWMM_OK or error code.
Note
theta may be NULL to suppress that output. lower_depth may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No lifecycle guard, but requires an initialized groundwater solver row with positive total depth or BADPARAM.

◆ swmm_subcatch_get_gwf_expression()

SWMM_ENGINE_API int swmm_subcatch_get_gwf_expression ( SWMM_Engine engine,
int index,
int type,
char * buf,
int buflen )

Read a subcatchment's custom groundwater flow expression.

Writes a NUL-terminated string into buf (empty when no expression is set), truncating if buflen is too small.

Parameters
[in]engineEngine handle.
[in]indexZero-based subcatchment index.
[in]typeA SWMM_GwfType code.
[out]bufDestination buffer for the expression text.
[in]buflenSize of buf in bytes (must be > 0).
Returns
SWMM_OK on success, SWMM_ERR_BADPARAM for a bad type, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Output must be non-null with positive byte capacity; text is NUL-terminated and silently truncated to capacity minus one byte.

◆ swmm_subcatch_get_ids_bulk()

SWMM_ENGINE_API int swmm_subcatch_get_ids_bulk ( SWMM_Engine engine,
char * buf,
int stride,
int count )

Get subcatchment IDs for all subcatchments in a single call (stride-packed UTF-8).

Format identical to swmm_node_get_ids_bulk.

Parameters
[in]engineEngine handle.
[out]bufCaller-allocated buffer of stride*count bytes.
[in]stridePer-ID slot size in bytes (must be > 1).
[in]countNumber of IDs to read.
Returns
SWMM_OK on success; SWMM_ERR_BADHANDLE if engine is invalid; SWMM_ERR_BADPARAM if buf is NULL, stride < 2, or count <= 0.
See also
swmm_subcatch_id, swmm_node_get_ids_bulk
Since
6.0.0
Note
A null engine returns SWMM_ERR_BADHANDLE.

◆ swmm_subcatch_get_imperv_pct()

SWMM_ENGINE_API int swmm_subcatch_get_imperv_pct ( SWMM_Engine engine,
int idx,
double * pct )

Get the percentage of impervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]pctReceives the imperviousness percentage (0–100).
Returns
SWMM_OK on success, or an error code.
Note
pct may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_infil()

SWMM_ENGINE_API int swmm_subcatch_get_infil ( SWMM_Engine engine,
int idx,
double * infil )

Get the current infiltration rate at a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]infilReceives the infiltration rate.
Returns
SWMM_OK on success, or an error code.
Note
infil may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_infil_bulk()

SWMM_ENGINE_API int swmm_subcatch_get_infil_bulk ( SWMM_Engine engine,
double * buf,
int count )

Copy infil values for a prefix of subcatchments.

Writes min(count,subcatchment count) elements and preserves any remaining buffer tail. No lifecycle check; returns the current stored state.

Parameters
[in]engineNon-null live engine; caller serializes access.
[out]bufNon-null caller-owned array with room for min(count,subcatchment count) doubles. Infiltration loss rate in inches/hour or mm/hour.
[in]countPositive destination element capacity; a short buffer selects the corresponding model prefix.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_infil_curve_number()

SWMM_ENGINE_API int swmm_subcatch_get_infil_curve_number ( SWMM_Engine engine,
int idx,
double * cn,
double * drying_time )

Get the Curve Number infiltration parameters for a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]cnReceives the SCS curve number. May be NULL.
[out]drying_timeReceives the drying time in days. May be NULL.
Returns
SWMM_OK on success, or an error code.
See also
swmm_subcatch_set_infil_curve_number
Note
cn may be NULL to suppress that output. drying_time may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Reads the overloaded input slots without checking the active infiltration model; select the getter matching swmm_subcatch_get_infil_model().

◆ swmm_subcatch_get_infil_green_ampt()

SWMM_ENGINE_API int swmm_subcatch_get_infil_green_ampt ( SWMM_Engine engine,
int idx,
double * suction,
double * conductivity,
double * deficit )

Get Green–Ampt infiltration parameters for a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]suctionReceives the soil capillary suction head.
[out]conductivityReceives the saturated hydraulic conductivity.
[out]deficitReceives the initial moisture deficit (fraction).
Returns
SWMM_OK on success, or an error code.
Note
suction may be NULL to suppress that output. conductivity may be NULL to suppress that output. deficit may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Reads the overloaded input slots without checking the active infiltration model; select the getter matching swmm_subcatch_get_infil_model().

◆ swmm_subcatch_get_infil_horton()

SWMM_ENGINE_API int swmm_subcatch_get_infil_horton ( SWMM_Engine engine,
int idx,
double * f0,
double * fmin,
double * decay,
double * dry_time )

Get Horton infiltration parameters for a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]f0Receives the maximum infiltration rate.
[out]fminReceives the minimum infiltration rate.
[out]decayReceives the decay constant (1/hr).
[out]dry_timeReceives the time to fully dry (hours).
Returns
SWMM_OK on success, or an error code.
Note
f0 may be NULL to suppress that output. fmin may be NULL to suppress that output. decay may be NULL to suppress that output. dry_time may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Reads the overloaded input slots without checking the active infiltration model; select the getter matching swmm_subcatch_get_infil_model().

◆ swmm_subcatch_get_infil_model()

SWMM_ENGINE_API int swmm_subcatch_get_infil_model ( SWMM_Engine engine,
int idx,
int * model )

Get the infiltration model type for a subcatchment.

Returns an integer code: 0=HORTON, 1=MOD_HORTON, 2=GREEN_AMPT, 3=MOD_GREEN_AMPT, 4=CURVE_NUMBER.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]modelReceives the infiltration model code.
Returns
SWMM_OK on success, or an error code.
Note
model may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_initial_loading()

SWMM_ENGINE_API int swmm_subcatch_get_initial_loading ( SWMM_Engine engine,
int sc_idx,
int pollut_idx,
double * buildup )

Get the initial pollutant buildup on a subcatchment.

Parameters
[in]engineEngine handle.
[in]sc_idxZero-based subcatchment index.
[in]pollut_idxZero-based pollutant index.
[out]buildupReceives the initial buildup (mass per unit area).
Returns
SWMM_OK on success, or an error code.
Note
buildup may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Constituent indices 0..np-1 select pollutants; np+m selects reaction species m. This is an initial authoring loading, not current runoff concentration; unset storage reads zero.

◆ swmm_subcatch_get_n_imperv()

SWMM_ENGINE_API int swmm_subcatch_get_n_imperv ( SWMM_Engine engine,
int idx,
double * n )

Get Manning's n for the impervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]nReceives Manning's n.
Returns
SWMM_OK on success, or an error code.
Note
n may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_n_perv()

SWMM_ENGINE_API int swmm_subcatch_get_n_perv ( SWMM_Engine engine,
int idx,
double * n )

Get Manning's n for the pervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]nReceives Manning's n.
Returns
SWMM_OK on success, or an error code.
Note
n may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_outlet()

SWMM_ENGINE_API int swmm_subcatch_get_outlet ( SWMM_Engine engine,
int idx,
int * node_idx )

Get the outlet node index for a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]node_idxReceives the outlet node index.
Returns
SWMM_OK on success, or an error code.
Note
node_idx may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_outlet_subcatch()

SWMM_ENGINE_API int swmm_subcatch_get_outlet_subcatch ( SWMM_Engine engine,
int idx,
int * sc_idx )

Get the downstream subcatchment index (for cascading outlets).

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]sc_idxReceives the downstream subcatchment index, or -1 if none.
Returns
SWMM_OK on success, or an error code.
Note
sc_idx may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_ponded_quality()

SWMM_ENGINE_API int swmm_subcatch_get_ponded_quality ( SWMM_Engine engine,
int subcatch_idx,
int pollutant_idx,
double * mass )

Read a pollutant's ponded surface mass.

Mass uses the surface-quality kernel's internal constituent mass convention (mg for mass-based pollutant transport). No lifecycle check. A missing slot returns zero.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]subcatch_idxZero-based existing subcatchment index.
[in]pollutant_idxZero-based pollutant index in the allocated concentration stride; reaction/reserved species are not selected by this API.
[out]massOptional output of stored mass, zero when no ponded slot exists.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_quality()

SWMM_ENGINE_API int swmm_subcatch_get_quality ( SWMM_Engine engine,
int subcatch_idx,
int pollutant_idx,
double * conc )

Get the pollutant concentration in subcatchment runoff.

Parameters
[in]engineEngine handle.
[in]subcatch_idxZero-based subcatchment index.
[in]pollutant_idxZero-based pollutant index.
[out]concReceives the concentration in pollutant units.
Returns
SWMM_OK on success, or an error code.
Note
conc may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Pollutant indices exclude reaction/reserved species. Concentration storage must already be sized (normal initialized model); this wrapper does not lazily allocate it.

◆ swmm_subcatch_get_quality_bulk()

SWMM_ENGINE_API int swmm_subcatch_get_quality_bulk ( SWMM_Engine engine,
int pollutant_idx,
double * buf,
int count )

Get pollutant concentrations for all subcatchments for one pollutant.

Parameters
[in]engineEngine handle.
[in]pollutant_idxZero-based pollutant index.
[out]bufCaller-allocated buffer of at least count doubles.
[in]countNumber of elements (should equal swmm_subcatch_count()).
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. A null buffer or nonpositive count returns SWMM_ERR_BADPARAM. Copies min(count,subcatchment count) records and leaves any buffer tail unchanged. Pollutant indices exclude reaction/reserved species. Concentration storage must already be sized (normal initialized model); this wrapper does not lazily allocate it.

◆ swmm_subcatch_get_rain_scale_factor()

SWMM_ENGINE_API int swmm_subcatch_get_rain_scale_factor ( SWMM_Engine engine,
int idx,
double * factor )

Read the rain precipitation multiplier.

No lifecycle guard. The runoff precipitation path applies it on subsequent rain evaluation, in addition to the gage factor.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[out]factorOptional dimensionless stored factor output.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.
Here is the call graph for this function:

◆ swmm_subcatch_get_rainfall()

SWMM_ENGINE_API int swmm_subcatch_get_rainfall ( SWMM_Engine engine,
int idx,
double * rainfall )

Get the current rainfall intensity at a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]rainfallReceives the rainfall in project rate units.
Returns
SWMM_OK on success, or an error code.
Note
rainfall may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_rainfall_bulk()

SWMM_ENGINE_API int swmm_subcatch_get_rainfall_bulk ( SWMM_Engine engine,
double * buf,
int count )

Copy rainfall values for a prefix of subcatchments.

Writes min(count,subcatchment count) elements and preserves any remaining buffer tail. No lifecycle check; returns the current stored state.

Parameters
[in]engineNon-null live engine; caller serializes access.
[out]bufNon-null caller-owned array with room for min(count,subcatchment count) doubles. Rainfall intensity in inches/hour or mm/hour.
[in]countPositive destination element capacity; a short buffer selects the corresponding model prefix.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_runoff()

SWMM_ENGINE_API int swmm_subcatch_get_runoff ( SWMM_Engine engine,
int idx,
double * runoff )

Get the current runoff rate from a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]runoffReceives the runoff rate in project flow units.
Returns
SWMM_OK on success, or an error code.
Note
runoff may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_runoff_bulk()

SWMM_ENGINE_API int swmm_subcatch_get_runoff_bulk ( SWMM_Engine engine,
double * buf,
int count )

Get runoff rates for all subcatchments in a single call.

Parameters
[in]engineEngine handle.
[out]bufCaller-allocated buffer of at least count doubles.
[in]countNumber of elements (should equal swmm_subcatch_count()).
Returns
SWMM_OK on success, or an error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A null buffer or nonpositive count returns SWMM_ERR_BADPARAM. Copies min(count,subcatchment count) records and leaves any buffer tail unchanged.

◆ swmm_subcatch_get_slope()

SWMM_ENGINE_API int swmm_subcatch_get_slope ( SWMM_Engine engine,
int idx,
double * s )

Get the average surface slope.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]sReceives the slope percentage.
Returns
SWMM_OK on success, or an error code.
Note
s may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_snow_depth()

SWMM_ENGINE_API int swmm_subcatch_get_snow_depth ( SWMM_Engine engine,
int idx,
double * depth )

Get the current snow depth on a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]depthReceives the snow depth in project length units.
Returns
SWMM_OK on success, or an error code.
Note
depth may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_snow_depth_bulk()

SWMM_ENGINE_API int swmm_subcatch_get_snow_depth_bulk ( SWMM_Engine engine,
double * buf,
int count )

Copy snow depth values for a prefix of subcatchments.

Writes min(count,subcatchment count) elements and preserves any remaining buffer tail. This implementation zero-fills the prefix; unlike the scalar snow-depth getter it does not sample integrated snow state.

Parameters
[in]engineNon-null live engine; caller serializes access.
[out]bufNon-null caller-owned array with room for min(count,subcatchment count) doubles. Placeholder zero, not a sampled SnowSolver depth.
[in]countPositive destination element capacity; a short buffer selects the corresponding model prefix.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_snow_scale_factor()

SWMM_ENGINE_API int swmm_subcatch_get_snow_scale_factor ( SWMM_Engine engine,
int idx,
double * factor )

Read the snow precipitation multiplier.

No lifecycle guard. The runoff precipitation path applies it on subsequent snow evaluation, in addition to the gage factor.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[out]factorOptional dimensionless stored factor output.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.
Here is the call graph for this function:

◆ swmm_subcatch_get_snow_state()

SWMM_ENGINE_API int swmm_subcatch_get_snow_state ( SWMM_Engine engine,
int idx,
int surface,
double * swe,
double * fw,
double * ati,
double * coldc )

Get degree-day snow state on one snow subarea of a subcatchment. UEB callers use swmm_subcatch_get_snow_process_state in openswmm_snow.h.

Parameters
[in]engineEngine handle.
[in]idxSubcatchment index (must have a snow pack).
[in]surfaceSnow subarea: 0 plowable, 1 impervious, 2 pervious.
[out]sweReceives SWE (user depth units); may be NULL.
[out]fwReceives free water (user depth units); may be NULL.
[out]atiReceives ATI (user temperature units); may be NULL.
[out]coldcReceives cold content (user depth units); may be NULL.
Returns
SWMM_OK or error code.
Note
swe may be NULL to suppress that output. fw may be NULL to suppress that output. ati may be NULL to suppress that output. coldc may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No lifecycle guard, but requires assigned degree-day snowpack and allocated solver state. UEB snowpacks or missing solver rows return BADPARAM; invalid surface returns BADINDEX.
Here is the call graph for this function:

◆ swmm_subcatch_get_snowpack()

SWMM_ENGINE_API const char * swmm_subcatch_get_snowpack ( SWMM_Engine engine,
int idx )

Borrow the assigned snowpack ID.

Do not free; copy before renaming/removing the snowpack or closing/destroying the engine.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
Returns
Engine-owned NUL-terminated name, an empty string for no assignment, or NULL for null engine/invalid subcatchment.
Here is the call graph for this function:

◆ swmm_subcatch_get_stat_max_runoff()

SWMM_ENGINE_API int swmm_subcatch_get_stat_max_runoff ( SWMM_Engine engine,
int idx,
double * rate )

Get the maximum runoff rate from a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]rateReceives the maximum runoff rate in project flow units.
Returns
SWMM_OK on success, or an error code.
Note
rate may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_stat_precip()

SWMM_ENGINE_API int swmm_subcatch_get_stat_precip ( SWMM_Engine engine,
int idx,
double * vol )

Get the total precipitation volume at a subcatchment.

Parameters
[in]engineEngine handle (ENDED or RUNNING state).
[in]idxZero-based subcatchment index.
[out]volReceives the precipitation volume in project volume units.
Returns
SWMM_OK on success, or an error code.
Note
vol may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_stat_runoff_vol()

SWMM_ENGINE_API int swmm_subcatch_get_stat_runoff_vol ( SWMM_Engine engine,
int idx,
double * vol )

Get the total runoff volume from a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]volReceives the runoff volume in project volume units.
Returns
SWMM_OK on success, or an error code.
Note
vol may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_tag()

SWMM_ENGINE_API int swmm_subcatch_get_tag ( SWMM_Engine engine,
int idx,
char * buf,
int buflen )

Copy a subcatchment tag.

Missing tags copy as empty text. No lifecycle check.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[out]bufNon-null caller-owned buffer, NUL-terminated and silently truncated to buflen-1 bytes.
[in]buflenPositive capacity in bytes including NUL.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_get_width()

SWMM_ENGINE_API int swmm_subcatch_get_width ( SWMM_Engine engine,
int idx,
double * w )

Get the characteristic overland flow width.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]wReceives the width in project length units.
Returns
SWMM_OK on success, or an error code.
Note
w may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_get_zero_imperv_pct()

SWMM_ENGINE_API int swmm_subcatch_get_zero_imperv_pct ( SWMM_Engine engine,
int idx,
double * pct )

Get the percentage of the impervious area having no depression storage.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[out]pctReceives the zero-depression-storage percentage (0–100).
Returns
SWMM_OK on success, or an error code.
See also
swmm_subcatch_set_zero_imperv_pct
Note
pct may be NULL to suppress that output. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_id()

SWMM_ENGINE_API const char * swmm_subcatch_id ( SWMM_Engine engine,
int idx )

Get the string identifier of a subcatchment by index.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
Returns
Null-terminated string owned by the engine, or NULL on error.
Note
Returned text borrows engine storage; do not free. Copy before a registry/table edit or engine close/destruction. Null engine/invalid index returns NULL.

◆ swmm_subcatch_index()

SWMM_ENGINE_API int swmm_subcatch_index ( SWMM_Engine engine,
const char * id )

Look up a subcatchment's zero-based index by its string identifier.

Parameters
[in]engineEngine handle.
[in]idNull-terminated subcatchment identifier.
Returns
Zero-based index, or -1 if not found.
Note
Case-insensitive name lookup; null engine/name or no match returns -1.

◆ swmm_subcatch_rename()

SWMM_ENGINE_API int swmm_subcatch_rename ( SWMM_Engine engine,
int idx,
const char * newId )

Rename a subcatchment in its name registry.

Requires BUILDING/OPENED. Uses the registry collision policy; returns BADPARAM on collision. This wrapper does not explicitly migrate name-keyed GWF expression options.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]newIdNon-null, nonempty copied unique ID; case-only respelling of this row is permitted.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_subcatch_set_aquifer()

SWMM_ENGINE_API int swmm_subcatch_set_aquifer ( SWMM_Engine engine,
int idx,
int aquifer_idx )

Assign the aquifer used for groundwater.

Requires BUILDING/OPENED. Stores the reference verbatim without changing current groundwater state.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]aquifer_idxExisting zero-based target index or -1 for none; the target range is NOT checked by this wrapper.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_subcatch_set_area()

SWMM_ENGINE_API int swmm_subcatch_set_area ( SWMM_Engine engine,
int idx,
double area )

Set the subcatchment area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]areaArea in project area units (acres or hectares).
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_coverage()

SWMM_ENGINE_API int swmm_subcatch_set_coverage ( SWMM_Engine engine,
int sc_idx,
int lu_idx,
double fraction )

Set the land use coverage percent for a subcatchment.

Assigns what percent of a subcatchment's area is covered by a particular land use category (for buildup/washoff modeling). Stored and reported verbatim in PERCENT (0–100), matching the [COVERAGES] .inp convention.

Parameters
[in]engineEngine handle.
[in]sc_idxZero-based subcatchment index.
[in]lu_idxZero-based land use index.
[in]fractionCoverage in percent (0–100).
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_ds_imperv()

SWMM_ENGINE_API int swmm_subcatch_set_ds_imperv ( SWMM_Engine engine,
int idx,
double ds )

Set the depression storage depth for the impervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]dsDepression storage in project length units.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_ds_perv()

SWMM_ENGINE_API int swmm_subcatch_set_ds_perv ( SWMM_Engine engine,
int idx,
double ds )

Set the depression storage depth for the pervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]dsDepression storage in project length units.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_gage()

SWMM_ENGINE_API int swmm_subcatch_set_gage ( SWMM_Engine engine,
int idx,
int gage_idx )

Assign a rain gage to a subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]gage_idxZero-based rain gage index.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Only the owning subcatchment index is checked; the supplied target reference is stored without target range, cycle or cross-field validation.

◆ swmm_subcatch_set_gw_node()

SWMM_ENGINE_API int swmm_subcatch_set_gw_node ( SWMM_Engine engine,
int idx,
int node_idx )

Assign the node receiving groundwater.

Requires BUILDING/OPENED. Stores the reference verbatim without changing current groundwater state.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]node_idxExisting zero-based target index or -1 for none; the target range is NOT checked by this wrapper.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_subcatch_set_gw_params()

SWMM_ENGINE_API int swmm_subcatch_set_gw_params ( SWMM_Engine engine,
int idx,
double surf_elev,
double a1,
double b1,
double a2,
double b2,
double a3,
double tw,
double hstar )

Assign the input groundwater flow-law parameters.

Values retain input-file units. Requires BUILDING/OPENED. Stores values without finite/range validation; does not inject runtime groundwater state.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]surf_elevGround surface elevation, ft/m.
[in]a1Groundwater outflow coefficient in the project input groundwater law.
[in]b1Dimensionless groundwater outflow exponent.
[in]a2Surface-water outflow coefficient in the project input groundwater law.
[in]b2Dimensionless surface-water outflow exponent.
[in]a3Surface/groundwater interaction coefficient in the project input law.
[in]twFixed receiving surface-water depth, ft/m; zero uses live node depth.
[in]hstarLateral-flow threshold water-table elevation, ft/m; -1e10 uses receiving-node invert. Other values, including -99, are literal elevations.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_subcatch_set_gw_state()

SWMM_ENGINE_API int swmm_subcatch_set_gw_state ( SWMM_Engine engine,
int idx,
double theta,
double lower_depth )

Set the groundwater state on a subcatchment.

State injection for data assimilation / external coupling. Pass a negative value to leave that component unchanged. Note that mass balance reports will reflect the storage discontinuity, mirroring hotstart loading.

Parameters
[in]engineEngine handle.
[in]idxSubcatchment index (must have groundwater).
[in]thetaUpper zone moisture content (0..porosity), or < 0 to keep.
[in]lower_depthSaturated zone depth above aquifer bottom in user length units (ft US, m SI), or < 0 to keep.
Returns
SWMM_OK or error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No lifecycle guard, but requires an initialized groundwater solver row with positive total depth or BADPARAM. Nonnegative theta is capped at porosity only (not raised to wilting point); nonnegative lower_depth is converted from ft/m and capped at aquifer total depth. Negative values leave each component unchanged.

◆ swmm_subcatch_set_gwf_expression()

SWMM_ENGINE_API int swmm_subcatch_set_gwf_expression ( SWMM_Engine engine,
int index,
int type,
const char * expr )

Set or clear a subcatchment's custom groundwater flow expression.

Inverse of swmm_subcatch_get_gwf_expression. A null or empty string clears the expression. The text is stored as given and is NOT validated here (so files with legacy quirks still load); use swmm_gwf_validate_expression first. An invalid expression fails start() with ERROR 233. Pre-start-only (BUILDING / OPENED): the expression is compiled when the simulation starts, so a mid-run change returns SWMM_ERR_LIFECYCLE.

Parameters
[in]engineEngine handle.
[in]indexZero-based subcatchment index.
[in]typeA SWMM_GwfType code.
[in]exprExpression text, or null/empty to clear.
Returns
SWMM_OK on success, SWMM_ERR_BADPARAM for a bad type, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Copies or clears source text without compiling it; call swmm_gwf_validate_expression() for an immediate syntax diagnostic.

◆ swmm_subcatch_set_imperv_pct()

SWMM_ENGINE_API int swmm_subcatch_set_imperv_pct ( SWMM_Engine engine,
int idx,
double pct )

Set the percentage of impervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]pctImperviousness as a percentage (0–100).
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_infil_curve_number()

SWMM_ENGINE_API int swmm_subcatch_set_infil_curve_number ( SWMM_Engine engine,
int idx,
double cn,
double drying_time )

Set Curve Number infiltration parameters.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]cnSCS curve number (clamped to 10–99 by the runoff solver).
[in]drying_timeDays for a fully saturated soil to dry, matching the third [INFILTRATION] column and legacy curvenum_setParams p[2]. Drives the regeneration constant; a value <= 0 disables regeneration.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_infil_green_ampt()

SWMM_ENGINE_API int swmm_subcatch_set_infil_green_ampt ( SWMM_Engine engine,
int idx,
double suction,
double conductivity,
double initial_deficit )

Select ordinary Green-Ampt infiltration and store input parameters.

Requires BUILDING/OPENED. Sets model=2 and slots 1..3 without finite/range checks; later parameter slots remain unchanged.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]suctionWetting-front suction head, inches/mm.
[in]conductivitySaturated hydraulic conductivity, inches/hour or mm/hour.
[in]initial_deficitInitial volumetric soil-moisture deficit fraction.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_subcatch_set_infil_horton()

SWMM_ENGINE_API int swmm_subcatch_set_infil_horton ( SWMM_Engine engine,
int idx,
double f0,
double fmin,
double decay,
double dry_time )

Select ordinary Horton infiltration and store its input parameters.

Requires BUILDING/OPENED. Sets model=0 and parameter slots 1..4 without finite/range checks; leaves the fifth slot unchanged. Selecting a modified model later requires swmm_subcatch_set_infil_model().

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]f0Initial maximum capacity, inches/hour or mm/hour.
[in]fminMinimum capacity, inches/hour or mm/hour.
[in]decayExponential capacity decay constant, per hour.
[in]dry_timeDrying/regeneration time, days.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.

◆ swmm_subcatch_set_infil_model()

SWMM_ENGINE_API int swmm_subcatch_set_infil_model ( SWMM_Engine engine,
int idx,
int model )

Set ONLY the infiltration model code for a subcatchment.

model: 0=HORTON, 1=MOD_HORTON, 2=GREEN_AMPT, 3=MOD_GREEN_AMPT, 4=CURVE_NUMBER. The per-model parameters are positionally overloaded, so after switching the model code callers should set the matching parameters via swmm_subcatch_set_infil_horton / _green_ampt / _curve_number.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]modelInfiltration model code (0..4).
Returns
SWMM_OK, or SWMM_ERR_BADPARAM if model is out of range.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX.

◆ swmm_subcatch_set_initial_loading()

SWMM_ENGINE_API int swmm_subcatch_set_initial_loading ( SWMM_Engine engine,
int sc_idx,
int pollut_idx,
double buildup )

Set the initial pollutant buildup on a subcatchment.

The [LOADINGS] value: initial buildup mass per unit area (normalizer units) present at the simulation start, overriding the DRY_DAYS-derived buildup for the pollutant.

Parameters
[in]engineEngine handle.
[in]sc_idxZero-based subcatchment index.
[in]pollut_idxZero-based pollutant index.
[in]buildupInitial buildup (mass per unit area).
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here. Constituent indices 0..np-1 select pollutants; np+m selects reaction species m. This is an initial authoring loading, not current runoff concentration; unset storage reads zero.

◆ swmm_subcatch_set_n_imperv()

SWMM_ENGINE_API int swmm_subcatch_set_n_imperv ( SWMM_Engine engine,
int idx,
double n )

Set Manning's n for the impervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]nManning's roughness coefficient.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_n_perv()

SWMM_ENGINE_API int swmm_subcatch_set_n_perv ( SWMM_Engine engine,
int idx,
double n )

Set Manning's n for the pervious area.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]nManning's roughness coefficient.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_outlet()

SWMM_ENGINE_API int swmm_subcatch_set_outlet ( SWMM_Engine engine,
int idx,
int node_idx )

Set the outlet node that receives runoff from this subcatchment.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]node_idxZero-based node index of the receiving node.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Only the owning subcatchment index is checked; the supplied target reference is stored without target range, cycle or cross-field validation.

◆ swmm_subcatch_set_outlet_subcatch()

SWMM_ENGINE_API int swmm_subcatch_set_outlet_subcatch ( SWMM_Engine engine,
int idx,
int sc_idx )

Set a subcatchment's outlet to another subcatchment (cascading).

When a subcatchment drains to another subcatchment instead of directly to a node, use this function. Mutually exclusive with swmm_subcatch_set_outlet().

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]sc_idxZero-based index of the receiving subcatchment.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. Only the owning subcatchment index is checked; the supplied target reference is stored without target range, cycle or cross-field validation.

◆ swmm_subcatch_set_ponded_quality()

SWMM_ENGINE_API int swmm_subcatch_set_ponded_quality ( SWMM_Engine engine,
int subcatch_idx,
int pollutant_idx,
double mass )

Replace a pollutant's ponded surface mass.

Mass uses the surface-quality kernel's internal constituent mass convention (mg for mass-based pollutant transport). No lifecycle check. A valid index with no allocated ponded slot succeeds without writing; injection is not booked as an external source in this wrapper.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]subcatch_idxZero-based existing subcatchment index.
[in]pollutant_idxZero-based pollutant index in the allocated concentration stride; reaction/reserved species are not selected by this API.
[in]massRaw stored ponded mass; no finite/range validation or unit conversion.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_set_rain_scale_factor()

SWMM_ENGINE_API int swmm_subcatch_set_rain_scale_factor ( SWMM_Engine engine,
int idx,
double factor )

Replace the rain precipitation multiplier.

No lifecycle guard. The runoff precipitation path applies it on subsequent rain evaluation, in addition to the gage factor.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]factorDimensionless multiplier; values <=0 are refused. Supply a finite positive value because no explicit finiteness check is made.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.
Here is the call graph for this function:

◆ swmm_subcatch_set_rainfall()

SWMM_ENGINE_API int swmm_subcatch_set_rainfall ( SWMM_Engine engine,
int idx,
double rainfall )

Overwrite the current subcatchment rainfall state during RUNNING.

Directly replaces the stored rainfall value; the next hydrology/forcing update can overwrite it. Does not register a persistent forcing provider.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]rainfallRainfall intensity, inches/hour or mm/hour; converted to internal ft/s without finite/range validation.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE unless RUNNING.

◆ swmm_subcatch_set_slope()

SWMM_ENGINE_API int swmm_subcatch_set_slope ( SWMM_Engine engine,
int idx,
double slope )

Set the average surface slope.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]slopeSlope as a percentage (e.g., 2.0 = 2%).
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_snow_scale_factor()

SWMM_ENGINE_API int swmm_subcatch_set_snow_scale_factor ( SWMM_Engine engine,
int idx,
double factor )

Replace the snow precipitation multiplier.

No lifecycle guard. The runoff precipitation path applies it on subsequent snow evaluation, in addition to the gage factor.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]factorDimensionless multiplier; values <=0 are refused. Supply a finite positive value because no explicit finiteness check is made.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.
Here is the call graph for this function:

◆ swmm_subcatch_set_snow_state()

SWMM_ENGINE_API int swmm_subcatch_set_snow_state ( SWMM_Engine engine,
int idx,
int surface,
double swe,
double fw,
double ati,
double coldc )

Set degree-day snow state on one snow subarea of a subcatchment.

State injection for data assimilation (e.g. observed SWE). Pass a negative value to leave that component unchanged.

Parameters
[in]engineEngine handle.
[in]idxSubcatchment index (must have a snow pack).
[in]surfaceSnow subarea: 0 plowable, 1 impervious, 2 pervious.
[in]sweSnow water equivalent in user depth units (in US, mm SI), or < 0 to keep.
[in]fwFree water in user depth units, or < 0 to keep.
[in]atiAntecedent temperature index (deg F US, deg C SI); pass <= -999 to keep (negative temperatures are valid).
[in]coldcCold content in user depth units of melt equivalent, or < 0 to keep.
Returns
SWMM_OK or error code.
Note
A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No lifecycle guard, but requires assigned degree-day snowpack and allocated solver state. UEB snowpacks or missing solver rows return BADPARAM; invalid surface returns BADINDEX. Negative swe/fw/coldc preserve each component; ati<=-999 preserves ATI. After any edit, free water is capped to pack SWE, even if its input was negative. No independent finite check.
Here is the call graph for this function:

◆ swmm_subcatch_set_snowpack()

SWMM_ENGINE_API int swmm_subcatch_set_snowpack ( SWMM_Engine engine,
int idx,
const char * name )

Assign an existing snowpack before initialization.

Requires BUILDING/OPENED. Unknown nonempty names return BADPARAM without changing the assignment; stores both resolved index and canonical name.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]nameBorrowed snowpack ID resolved case-insensitively; NULL/empty clears the assignment.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments. SWMM_ERR_LIFECYCLE outside BUILDING/OPENED.
Here is the call graph for this function:

◆ swmm_subcatch_set_tag()

SWMM_ENGINE_API int swmm_subcatch_set_tag ( SWMM_Engine engine,
int idx,
const char * tag )

Replace or clear a copied subcatchment tag.

No lifecycle check. Stored per object, so a registry rename preserves the tag.

Parameters
[in]engineNon-null live engine; caller serializes access.
[in]idxZero-based existing subcatchment index.
[in]tagBorrowed NUL-terminated tag; NULL/empty clears it.
Returns
SWMM_OK; SWMM_ERR_BADHANDLE for null engine, SWMM_ERR_BADINDEX for a failed index check, or SWMM_ERR_BADPARAM for invalid required arguments.

◆ swmm_subcatch_set_width()

SWMM_ENGINE_API int swmm_subcatch_set_width ( SWMM_Engine engine,
int idx,
double width )

Set the characteristic overland flow width.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]widthWidth in project length units.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.

◆ swmm_subcatch_set_zero_imperv_pct()

SWMM_ENGINE_API int swmm_subcatch_set_zero_imperv_pct ( SWMM_Engine engine,
int idx,
double pct )

Set the percentage of the impervious area having no depression storage.

The [SUBAREAS] PctZero column; legacy Subcatch[i].fracImperv2.

Parameters
[in]engineEngine handle.
[in]idxZero-based subcatchment index.
[in]pctZero-depression-storage impervious area as a percentage (0–100) of the impervious area.
Returns
SWMM_OK on success, or an error code.
Note
Requires BUILDING or OPENED; other states return SWMM_ERR_LIFECYCLE. A null engine returns SWMM_ERR_BADHANDLE. A failed subcatchment/pollutant index check returns SWMM_ERR_BADINDEX. No independent finite/range validation of the numeric inputs is performed here.