OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
openswmm_xsect.h
Go to the documentation of this file.
1
43
44#ifndef OPENSWMM_XSECT_H
45#define OPENSWMM_XSECT_H
46
47#include "openswmm_engine.h"
48#include "openswmm_links.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
55typedef void* SWMM_XSect;
56
69
70/* =========================================================================
71 * Construction / destruction
72 * ========================================================================= */
73
105SWMM_ENGINE_API int swmm_xsect_create(int shape, double geom1, double geom2,
106 double geom3, double geom4,
107 int unit_system, SWMM_XSect* out);
108
137 const double* stations, const double* elevations, int n_pts,
138 double x_left_bank, double x_right_bank,
139 double n_left, double n_channel, double n_right, double length_factor,
140 int unit_system, SWMM_XSect* out);
141
160 double y_full, const double* curve_depths, const double* curve_widths,
161 int n_pts, int unit_system, SWMM_XSect* out);
162
188 double width, double curb_height, double slope, double roughness,
189 double gutter_depression, double gutter_width, int sides,
190 double back_width, double back_slope, double back_roughness,
191 int unit_system, SWMM_XSect* out);
192
215SWMM_ENGINE_API int swmm_link_create_xsect(SWMM_Engine engine, int link_idx,
216 SWMM_XSect* out);
217
226
227/* =========================================================================
228 * Identity
229 * ========================================================================= */
230
238SWMM_ENGINE_API int swmm_xsect_get_shape(SWMM_XSect xsect, int* shape);
239
255SWMM_ENGINE_API int swmm_xsect_get_units(SWMM_XSect xsect, int* unit_system,
256 int* flow_units);
257
269SWMM_ENGINE_API const char* swmm_xsect_shape_name(int shape);
270
271/* =========================================================================
272 * Queries — scalar
273 * ========================================================================= */
274
286 double* area);
287
298 double* width);
299
310 double* hydrad);
311
322 double* depth);
323
334 double* hydrad);
335
346 double* sf);
347
359 double* area);
360
370SWMM_ENGINE_API int swmm_xsect_dsda(SWMM_XSect xsect, double area, double* dsda);
371
382 double* ycrit);
383
400 double* a_full, double* r_full,
401 double* w_max, double* s_full,
402 double* a_max);
403
411SWMM_ENGINE_API int swmm_xsect_is_open(SWMM_XSect xsect, int* is_open);
412
413/* =========================================================================
414 * Queries — array
415 * ========================================================================= */
416/*
417 * Each scalar query above has an `_array` counterpart evaluating `n` inputs in
418 * one call. `in` and `out` must each hold `n` elements and may alias. `n` == 0
419 * is a no-op returning SWMM_OK. A single out-of-domain input fails the whole
420 * call with SWMM_ERR_BADPARAM, leaving `out` unspecified.
421 */
422
425 const double* depth, int n,
426 double* area);
429 const double* depth, int n,
430 double* width);
433 const double* depth, int n,
434 double* hydrad);
437 const double* area, int n,
438 double* depth);
441 const double* area, int n,
442 double* hydrad);
445 const double* area,
446 int n, double* sf);
449 const double* sf, int n,
450 double* area);
452SWMM_ENGINE_API int swmm_xsect_dsda_array(SWMM_XSect xsect, const double* area,
453 int n, double* dsda);
456 const double* flow, int n,
457 double* ycrit);
458
459#ifdef __cplusplus
460}
461#endif
462
463#endif /* OPENSWMM_XSECT_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:37
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:35
OpenSWMM Engine — primary transparent C API (master header).
SWMM_ENGINE_API const char * swmm_xsect_shape_name(int shape)
Get the name of a cross-section shape code.
Definition openswmm_xsect_impl.cpp:453
SWMM_ENGINE_API int swmm_xsect_depth_of_area(SWMM_XSect xsect, double area, double *depth)
Depth of flow for a given area — the inverse of swmm_xsect_area_of_depth().
Definition openswmm_xsect_impl.cpp:480
SWMM_ENGINE_API int swmm_xsect_hydrad_of_area_array(SWMM_XSect xsect, const double *area, int n, double *hydrad)
Array form of swmm_xsect_hydrad_of_area().
Definition openswmm_xsect_impl.cpp:572
SWMM_ENGINE_API int swmm_xsect_hydrad_of_area(SWMM_XSect xsect, double area, double *hydrad)
Hydraulic radius for a given area.
Definition openswmm_xsect_impl.cpp:486
SWMM_ENGINE_API int swmm_xsect_critical_depth(SWMM_XSect xsect, double flow, double *ycrit)
Critical depth for a given flow.
Definition openswmm_xsect_impl.cpp:511
SWMM_ENGINE_API int swmm_xsect_create(int shape, double geom1, double geom2, double geom3, double geom4, int unit_system, SWMM_XSect *out)
Create a cross-section from a shape code and its geometry parameters.
Definition openswmm_xsect_impl.cpp:191
SWMM_ENGINE_API int swmm_link_create_xsect(SWMM_Engine engine, int link_idx, SWMM_XSect *out)
Create a cross-section from a link of an open model.
Definition openswmm_xsect_impl.cpp:371
SWMM_ENGINE_API int swmm_xsect_area_of_sectfactor_array(SWMM_XSect xsect, const double *sf, int n, double *area)
Array form of swmm_xsect_area_of_sectfactor().
Definition openswmm_xsect_impl.cpp:586
SWMM_ENGINE_API int swmm_xsect_create_irregular(const double *stations, const double *elevations, int n_pts, double x_left_bank, double x_right_bank, double n_left, double n_channel, double n_right, double length_factor, int unit_system, SWMM_XSect *out)
Create an irregular (natural channel) cross-section from a transect.
Definition openswmm_xsect_impl.cpp:237
SWMM_ENGINE_API int swmm_xsect_dsda(SWMM_XSect xsect, double area, double *dsda)
Derivative of the section factor with respect to area, dS/dA.
Definition openswmm_xsect_impl.cpp:504
SWMM_ENGINE_API int swmm_xsect_area_of_depth_array(SWMM_XSect xsect, const double *depth, int n, double *area)
Array form of swmm_xsect_area_of_depth().
Definition openswmm_xsect_impl.cpp:544
void * SWMM_XSect
Opaque handle to a standalone cross-section. Free with swmm_xsect_free().
Definition openswmm_xsect.h:55
SWMM_UnitSystem
Unit system for a standalone cross-section.
Definition openswmm_xsect.h:65
@ SWMM_UNITS_US
Definition openswmm_xsect.h:66
@ SWMM_UNITS_SI
Definition openswmm_xsect.h:67
SWMM_ENGINE_API int swmm_xsect_free(SWMM_XSect xsect)
Release a cross-section handle.
Definition openswmm_xsect_impl.cpp:428
SWMM_ENGINE_API int swmm_xsect_sectfactor_of_area(SWMM_XSect xsect, double area, double *sf)
Section factor (A·R^(2/3)) for a given area.
Definition openswmm_xsect_impl.cpp:492
SWMM_ENGINE_API int swmm_xsect_create_street(double width, double curb_height, double slope, double roughness, double gutter_depression, double gutter_width, int sides, double back_width, double back_slope, double back_roughness, int unit_system, SWMM_XSect *out)
Create a street cross-section.
Definition openswmm_xsect_impl.cpp:324
SWMM_ENGINE_API int swmm_xsect_critical_depth_array(SWMM_XSect xsect, const double *flow, int n, double *ycrit)
Array form of swmm_xsect_critical_depth().
Definition openswmm_xsect_impl.cpp:600
SWMM_ENGINE_API int swmm_xsect_create_custom(double y_full, const double *curve_depths, const double *curve_widths, int n_pts, int unit_system, SWMM_XSect *out)
Create a custom cross-section from a normalized shape curve.
Definition openswmm_xsect_impl.cpp:286
SWMM_ENGINE_API int swmm_xsect_area_of_depth(SWMM_XSect xsect, double depth, double *area)
Flow area at a given depth.
Definition openswmm_xsect_impl.cpp:462
SWMM_ENGINE_API int swmm_xsect_hydrad_of_depth(SWMM_XSect xsect, double depth, double *hydrad)
Hydraulic radius (area / wetted perimeter) at a given depth.
Definition openswmm_xsect_impl.cpp:474
SWMM_ENGINE_API int swmm_xsect_width_of_depth(SWMM_XSect xsect, double depth, double *width)
Top width of the water surface at a given depth.
Definition openswmm_xsect_impl.cpp:468
SWMM_ENGINE_API int swmm_xsect_area_of_sectfactor(SWMM_XSect xsect, double sf, double *area)
Flow area for a given section factor — the inverse of swmm_xsect_sectfactor_of_area(),...
Definition openswmm_xsect_impl.cpp:498
SWMM_ENGINE_API int swmm_xsect_depth_of_area_array(SWMM_XSect xsect, const double *area, int n, double *depth)
Array form of swmm_xsect_depth_of_area().
Definition openswmm_xsect_impl.cpp:565
SWMM_ENGINE_API int swmm_xsect_dsda_array(SWMM_XSect xsect, const double *area, int n, double *dsda)
Array form of swmm_xsect_dsda().
Definition openswmm_xsect_impl.cpp:593
SWMM_ENGINE_API int swmm_xsect_hydrad_of_depth_array(SWMM_XSect xsect, const double *depth, int n, double *hydrad)
Array form of swmm_xsect_hydrad_of_depth().
Definition openswmm_xsect_impl.cpp:558
SWMM_ENGINE_API int swmm_xsect_full_properties(SWMM_XSect xsect, double *y_full, double *a_full, double *r_full, double *w_max, double *s_full, double *a_max)
Full-depth (bank-full) properties of the cross-section.
Definition openswmm_xsect_impl.cpp:517
SWMM_ENGINE_API int swmm_xsect_get_units(SWMM_XSect xsect, int *unit_system, int *flow_units)
Get the unit system and flow units a handle reports its results in.
Definition openswmm_xsect_impl.cpp:444
SWMM_ENGINE_API int swmm_xsect_get_shape(SWMM_XSect xsect, int *shape)
Get the shape code of a cross-section.
Definition openswmm_xsect_impl.cpp:437
SWMM_ENGINE_API int swmm_xsect_width_of_depth_array(SWMM_XSect xsect, const double *depth, int n, double *width)
Array form of swmm_xsect_width_of_depth().
Definition openswmm_xsect_impl.cpp:551
SWMM_ENGINE_API int swmm_xsect_sectfactor_of_area_array(SWMM_XSect xsect, const double *area, int n, double *sf)
Array form of swmm_xsect_sectfactor_of_area().
Definition openswmm_xsect_impl.cpp:579
SWMM_ENGINE_API int swmm_xsect_is_open(SWMM_XSect xsect, int *is_open)
Whether the cross-section is open to the atmosphere at its top.
Definition openswmm_xsect_impl.cpp:533