27#ifdef OPENSWMM_ENGINE_STATIC
28# define SWMM_ENGINE_API
31# ifdef openswmm_engine_EXPORTS
32# define SWMM_ENGINE_API __declspec(dllexport)
34# define SWMM_ENGINE_API __declspec(dllimport)
37# define SWMM_ENGINE_API __attribute__((visibility("default")))
86 double* x,
double*
y,
double* z);
92 double* x,
double*
y,
double* z);
119 int* v0,
int* v1,
int* v2);
131 double* cx,
double* cy,
164 char* buf,
int buflen);
171 char* buf,
int buflen);
177 int* n0,
int* n1,
int* n2);
240 const char* node_name);
444 double* max_velocities);
462 double* init_storage,
463 double* final_storage,
465 double* coupling_1d_to_2d_in,
466 double* coupling_2d_to_1d_out,
470 double* boundary_out,
484 double value,
int mode,
490 double value,
int mode,
505 double value,
int mode,
511 double value,
int mode,
518 double value,
int mode,
566#define SWMM_2D_BC_WALL 0
567#define SWMM_2D_BC_NORMAL_FLOW 1
568#define SWMM_2D_BC_SPECIFIED_STAGE 2
569#define SWMM_2D_BC_SPECIFIED_FLOW 3
570#define SWMM_2D_BC_RATING_CURVE 4
582 int tri_idx,
int edge,
588 int tri_idx,
int edge,
594 int tri_idx,
int edge,
600 int tri_idx,
int edge,
606 int tri_idx,
int edge,
612 int tri_idx,
int edge,
631 int tri_idx,
int edge,
636 int tri_idx,
int edge,
659 int tri_idx,
int edge,
SWMM_ENGINE_API int swmm_2d_get_total_exchange_flow(SWMM_Engine engine, double *flow)
Get total exchange flow rate (sum of all coupling flows, m³/s). Positive = net flow from 2D into 1D n...
Definition Api2D.cpp:604
SWMM_ENGINE_API int swmm_2d_get_edge_bc_head(SWMM_Engine engine, int tri_idx, int edge, double *head)
Get specified stage boundary head for an edge.
Definition Api2D.cpp:931
SWMM_ENGINE_API int swmm_2d_vertex_get_coupled_node(SWMM_Engine engine, int vertex_idx, int *node_idx)
Get vertex coupling: which SWMM node is coupled to this vertex.
Definition Api2D.cpp:271
SWMM_ENGINE_API int swmm_2d_set_vertex_coupling_cd(SWMM_Engine engine, int vertex_idx, double cd)
Set the coupling discharge coefficient of a vertex ([2D_VERTEX_NODE_MAP] CD column)....
Definition Api2D.cpp:325
SWMM_ENGINE_API int swmm_2d_triangle_get_area(SWMM_Engine engine, int idx, double *area)
Get triangle area.
Definition Api2D.cpp:135
SWMM_ENGINE_API int swmm_2d_get_rel_tolerance(SWMM_Engine engine, double *rtol)
Get CVODE relative tolerance.
Definition Api2D.cpp:828
SWMM_ENGINE_API int swmm_2d_get_continuity_error(SWMM_Engine engine, double *err)
Get the global 2D surface continuity error (fraction).
Definition Api2D.cpp:664
SWMM_ENGINE_API int swmm_2d_get_edge_bc_flow(SWMM_Engine engine, int tri_idx, int edge, double *flow)
Get prescribed flow per metre of edge (m³/s/m) for a SPECIFIED_FLOW edge. V-E4.
Definition Api2D.cpp:1012
SWMM_ENGINE_API int swmm_2d_triangle_get_neighbours(SWMM_Engine engine, int idx, int *n0, int *n1, int *n2)
Get triangle neighbour indices (-1 = boundary edge).
Definition Api2D.cpp:227
SWMM_ENGINE_API int swmm_2d_get_edge_bc_type(SWMM_Engine engine, int tri_idx, int edge, int *bc_type)
Get boundary condition type for an edge.
Definition Api2D.cpp:901
SWMM_ENGINE_API int swmm_2d_reset_edge_conveyance(SWMM_Engine engine)
Reset every edge's conveyance factor to 1.0 (unrestricted).
Definition Api2D.cpp:518
SWMM_ENGINE_API int swmm_2d_get_cvode_steps(SWMM_Engine engine, long *steps)
Get number of CVODE internal steps taken in the last advance.
Definition Api2D.cpp:613
SWMM_ENGINE_API int swmm_2d_edge_get_geometry_bulk(SWMM_Engine engine, double *length, double *nx, double *ny)
Bulk get edge geometry — time-invariant edge length and outward unit normal components,...
Definition Api2D.cpp:543
SWMM_ENGINE_API int swmm_2d_get_total_volume(SWMM_Engine engine, double *volume)
Get total 2D surface volume (sum of depth * area).
Definition Api2D.cpp:595
SWMM_ENGINE_API int swmm_2d_boundary_edge_count(SWMM_Engine engine, int *count)
Get the number of boundary edges (edges with no neighbour).
Definition Api2D.cpp:885
SWMM_ENGINE_API int swmm_2d_set_edge_bc_type(SWMM_Engine engine, int tri_idx, int edge, int bc_type)
Set boundary condition type for an edge.
Definition Api2D.cpp:912
SWMM_ENGINE_API int swmm_2d_vertex_get_xyz_bulk(SWMM_Engine engine, double *x, double *y, double *z)
Bulk get vertex coordinates.
Definition Api2D.cpp:98
SWMM_ENGINE_API int swmm_2d_set_vertex_tag(SWMM_Engine engine, int idx, const char *tag)
Set the descriptive tag of a vertex (the [2D_VERTICES] TAG column). Distinct from the 1D<->2D couplin...
Definition Api2D.cpp:167
SWMM_ENGINE_API int swmm_2d_set_vertex_z(SWMM_Engine engine, int idx, double z)
Set vertex Z (ground elevation).
Definition Api2D.cpp:112
SWMM_ENGINE_API int swmm_2d_set_rel_tolerance(SWMM_Engine engine, double rtol)
Set CVODE relative tolerance.
Definition Api2D.cpp:837
SWMM_ENGINE_API int swmm_2d_get_stat_max_continuity_err(SWMM_Engine engine, double *max_errs)
Get per-triangle max |continuity residual| statistics (cumulative, m3/s).
Definition Api2D.cpp:653
SWMM_ENGINE_API int swmm_2d_vertex_get_heads_bulk(SWMM_Engine engine, double *heads)
Bulk get reconstructed heads at all vertices.
Definition Api2D.cpp:571
SWMM_ENGINE_API int swmm_2d_get_triangle_tag(SWMM_Engine engine, int idx, char *buf, int buflen)
Get the descriptive tag of a triangle (the [2D_TRIANGLES] TAG column). Copies up to buflen-1 bytes in...
Definition Api2D.cpp:203
SWMM_ENGINE_API int swmm_2d_get_coupling_flux(SWMM_Engine engine, int idx, double *flux)
Get coupling exchange flux at a triangle (m/s, + = into 2D).
Definition Api2D.cpp:382
SWMM_ENGINE_API int swmm_2d_get_stat_max_depths(SWMM_Engine engine, double *max_depths)
Get per-triangle max depth statistics (cumulative).
Definition Api2D.cpp:631
SWMM_ENGINE_API int swmm_2d_set_triangle_tag(SWMM_Engine engine, int idx, const char *tag)
Set the descriptive tag of a triangle (the [2D_TRIANGLES] TAG column, e.g. a region / subcatchment id...
Definition Api2D.cpp:178
SWMM_ENGINE_API int swmm_2d_set_edge_bc_slope(SWMM_Engine engine, int tri_idx, int edge, double slope)
Set normal flow boundary slope for an edge.
Definition Api2D.cpp:964
SWMM_ENGINE_API int swmm_2d_force_rainfall(SWMM_Engine engine, int idx, double value, int mode, int persist)
Force rainfall on a specific triangle.
Definition Api2D.cpp:707
SWMM_ENGINE_API int swmm_2d_get_max_depth(SWMM_Engine engine, double *max_depth)
Get the maximum depth across all triangles.
Definition Api2D.cpp:585
SWMM_ENGINE_API int swmm_2d_get_depth(SWMM_Engine engine, int idx, double *depth)
Get water depth at a triangle.
Definition Api2D.cpp:362
SWMM_ENGINE_API int swmm_2d_get_head(SWMM_Engine engine, int idx, double *head)
Get total head at a triangle (z + depth).
Definition Api2D.cpp:372
SWMM_ENGINE_API int swmm_2d_get_edge_flux_bulk(SWMM_Engine engine, double *flux)
Bulk get normal edge flux at every edge of every triangle.
Definition Api2D.cpp:527
SWMM_ENGINE_API int swmm_2d_get_edge_bc_cum_flux(SWMM_Engine engine, int tri_idx, int edge, double *cum_flux)
Get cumulative boundary flux at an edge (m³, + = outflow).
Definition Api2D.cpp:976
SWMM_ENGINE_API int swmm_2d_triangle_coupling_count(SWMM_Engine engine, int *count)
Get the number of triangle-to-node coupling points.
Definition Api2D.cpp:257
SWMM_ENGINE_API int swmm_2d_triangle_get_centroid(SWMM_Engine engine, int idx, double *cx, double *cy, double *cz)
Get triangle centroid coordinates.
Definition Api2D.cpp:145
SWMM_ENGINE_API int swmm_2d_get_net_source(SWMM_Engine engine, int idx, double *net_source)
Get net source/sink rate at a triangle (m/s).
Definition Api2D.cpp:402
SWMM_ENGINE_API int swmm_2d_vertex_get_head(SWMM_Engine engine, int idx, double *head)
Get reconstructed head at a vertex.
Definition Api2D.cpp:561
SWMM_ENGINE_API int swmm_2d_force_evap(SWMM_Engine engine, int idx, double value, int mode, int persist)
Force evaporation on a specific triangle.
Definition Api2D.cpp:739
SWMM_ENGINE_API int swmm_2d_get_depths_bulk(SWMM_Engine engine, double *depths)
Bulk get depths for all triangles.
Definition Api2D.cpp:412
SWMM_ENGINE_API int swmm_2d_set_edge_bc_head(SWMM_Engine engine, int tri_idx, int edge, double head)
Set specified stage boundary head for an edge.
Definition Api2D.cpp:942
SWMM_ENGINE_API int swmm_2d_set_abs_tolerance(SWMM_Engine engine, double atol)
Set CVODE absolute tolerance.
Definition Api2D.cpp:855
SWMM_ENGINE_API int swmm_2d_triangle_count(SWMM_Engine engine, int *count)
Get the number of mesh triangles.
Definition Api2D.cpp:78
SWMM_ENGINE_API int swmm_2d_get_rainfall(SWMM_Engine engine, int idx, double *rainfall)
Get rainfall intensity at a triangle (m/s).
Definition Api2D.cpp:392
SWMM_ENGINE_API int swmm_2d_get_coupling_fluxes_bulk(SWMM_Engine engine, double *fluxes)
Bulk get coupling fluxes for all triangles.
Definition Api2D.cpp:432
SWMM_ENGINE_API int swmm_2d_prepare_for_edit(SWMM_Engine engine)
Make the parsed 2D mesh editable without a full initialize().
Definition Api2D.cpp:59
SWMM_ENGINE_API int swmm_2d_set_triangle_mannings(SWMM_Engine engine, int idx, double n)
Set triangle Manning's roughness coefficient.
Definition Api2D.cpp:157
SWMM_ENGINE_API int swmm_2d_get_stat_max_velocities(SWMM_Engine engine, double *max_velocities)
Get per-triangle max velocity-magnitude statistics (cumulative, m/s).
Definition Api2D.cpp:642
SWMM_ENGINE_API int swmm_2d_set_vertex_coupled_node(SWMM_Engine engine, int vertex_idx, const char *node_name)
Set (or clear) the SWMM node a vertex is coupled to, by name.
Definition Api2D.cpp:293
SWMM_ENGINE_API int swmm_2d_get_dry_depth(SWMM_Engine engine, double *dry_depth)
Get the dry depth threshold (m).
Definition Api2D.cpp:810
SWMM_ENGINE_API int swmm_2d_get_edge_conveyance_bulk(SWMM_Engine engine, double *conveyance)
Bulk get conveyance factor at every edge of every triangle.
Definition Api2D.cpp:506
SWMM_ENGINE_API int swmm_2d_set_edge_bc_tseries_name(SWMM_Engine engine, int tri_idx, int edge, const char *name)
Set the timeseries NAME to drive a SPECIFIED_STAGE edge.
Definition Api2D.cpp:993
SWMM_ENGINE_API int swmm_2d_get_cvode_last_step(SWMM_Engine engine, double *h_last)
Get CVODE last internal step size.
Definition Api2D.cpp:622
SWMM_ENGINE_API int swmm_2d_force_clear_all(SWMM_Engine engine)
Clear all 2D forcings.
Definition Api2D.cpp:786
SWMM_ENGINE_API int swmm_2d_get_mass_balance(SWMM_Engine engine, double *init_storage, double *final_storage, double *rainfall_in, double *coupling_1d_to_2d_in, double *coupling_2d_to_1d_out, double *outfall_in, double *outfall_out, double *boundary_in, double *boundary_out, double *evap_out)
Get the global 2D mass-balance terms (all m3). Any pointer may be NULL.
Definition Api2D.cpp:676
SWMM_ENGINE_API int swmm_2d_vertex_count(SWMM_Engine engine, int *count)
Get the number of mesh vertices.
Definition Api2D.cpp:70
SWMM_ENGINE_API int swmm_2d_triangle_get_coupled_node(SWMM_Engine engine, int tri_idx, int *node_idx)
Get triangle coupling: which SWMM node is coupled to this triangle.
Definition Api2D.cpp:282
SWMM_ENGINE_API int swmm_2d_force_rainfall_uniform(SWMM_Engine engine, double value, int mode, int persist)
Force rainfall on all triangles (uniform).
Definition Api2D.cpp:722
SWMM_ENGINE_API int swmm_2d_vertex_get_xyz(SWMM_Engine engine, int idx, double *x, double *y, double *z)
Get vertex coordinates.
Definition Api2D.cpp:86
SWMM_ENGINE_API int swmm_2d_force_evap_uniform(SWMM_Engine engine, double value, int mode, int persist)
Force evaporation on all triangles (uniform).
Definition Api2D.cpp:754
SWMM_ENGINE_API int swmm_2d_get_edge_bc_slope(SWMM_Engine engine, int tri_idx, int edge, double *slope)
Get normal flow boundary slope for an edge.
Definition Api2D.cpp:953
SWMM_ENGINE_API int swmm_2d_get_abs_tolerance(SWMM_Engine engine, double *atol)
Get CVODE absolute tolerance.
Definition Api2D.cpp:846
SWMM_ENGINE_API int swmm_2d_triangle_get_vertices(SWMM_Engine engine, int idx, int *v0, int *v1, int *v2)
Get triangle connectivity (3 vertex indices).
Definition Api2D.cpp:123
SWMM_ENGINE_API int swmm_2d_get_heads_bulk(SWMM_Engine engine, double *heads)
Bulk get heads for all triangles.
Definition Api2D.cpp:422
SWMM_ENGINE_API int swmm_2d_set_dry_depth(SWMM_Engine engine, double dry_depth)
Set the dry depth threshold (m).
Definition Api2D.cpp:819
SWMM_ENGINE_API int swmm_2d_set_edge_conveyance(SWMM_Engine engine, int tri, int edge, double conveyance)
Set the per-edge conveyance factor for one edge.
Definition Api2D.cpp:486
SWMM_ENGINE_API int swmm_2d_get_vertex_coupling_cd(SWMM_Engine engine, int vertex_idx, double *cd)
Get the coupling discharge coefficient of a vertex ([2D_VERTEX_NODE_MAP] CD column; default 0....
Definition Api2D.cpp:314
SWMM_ENGINE_API int swmm_2d_vertex_coupling_count(SWMM_Engine engine, int *count)
Get the number of vertex-to-node coupling points.
Definition Api2D.cpp:243
SWMM_ENGINE_API int swmm_2d_triangle_get_mannings(SWMM_Engine engine, int idx, double *n)
Get triangle Manning's roughness.
Definition Api2D.cpp:217
SWMM_ENGINE_API int swmm_2d_get_edge_conveyance(SWMM_Engine engine, int tri, int edge, double *conveyance)
Get the per-edge conveyance factor for one edge.
Definition Api2D.cpp:473
SWMM_ENGINE_API int swmm_2d_force_coupling_flux(SWMM_Engine engine, int idx, double value, int mode, int persist)
Force coupling flux on a specific triangle (override computed exchange).
Definition Api2D.cpp:771
SWMM_ENGINE_API int swmm_2d_get_vertex_tag(SWMM_Engine engine, int idx, char *buf, int buflen)
Get the descriptive tag of a vertex (the [2D_VERTICES] TAG column). Copies up to buflen-1 bytes into ...
Definition Api2D.cpp:189
SWMM_ENGINE_API int swmm_2d_get_vertex_coupling_area(SWMM_Engine engine, int vertex_idx, double *area)
Get the coupling exchange area of a vertex ([2D_VERTEX_NODE_MAP] AREA column, m²; default 1....
Definition Api2D.cpp:336
SWMM_ENGINE_API int swmm_2d_is_active(SWMM_Engine engine, int *active)
Check whether the 2D module is active for this simulation.
Definition Api2D.cpp:52
SWMM_ENGINE_API int swmm_2d_set_vertex_coupling_area(SWMM_Engine engine, int vertex_idx, double area)
Set the coupling exchange area of a vertex ([2D_VERTEX_NODE_MAP] AREA column, m²)....
Definition Api2D.cpp:347
double * y
Definition odesolve.c:28
SWMM_ENGINE_API int swmm_2d_set_edge_bc_flow_tseries_name(SWMM_Engine engine, int tri_idx, int edge, const char *name)
Set the timeseries NAME to drive a SPECIFIED_FLOW edge. V-E4 — same resolution contract as swmm_2d_se...
Definition Api2D.cpp:1034
#define SWMM_ENGINE_API
Definition openswmm_2d.h:37
SWMM_ENGINE_API int swmm_2d_set_edge_bc_flow(SWMM_Engine engine, int tri_idx, int edge, double flow)
Set prescribed flow per metre of edge (m³/s/m). V-E4.
Definition Api2D.cpp:1023
SWMM_ENGINE_API int swmm_2d_set_edge_bc_rating_curve_name(SWMM_Engine engine, int tri_idx, int edge, const char *name)
Set the curve NAME to drive a RATING_CURVE edge.
Definition Api2D.cpp:1053
Callback function typedefs for the OpenSWMM Engine C API.
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:35