![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
U4 — implementation of openswmm_gw_transport.h. More...
#include <openswmm/engine/openswmm_engine.h>#include <openswmm/engine/openswmm_gw_transport.h>#include "../../core/SWMMEngine.hpp"#include "../gw/GwTransportSections.hpp"#include <algorithm>#include <cctype>#include <cstdio>#include <cstring>#include <string>#include <vector>Macros | |
| #define | GW_GET(engine) |
| #define | GW_EDITABLE(eng) |
Functions | |
| SWMM_ENGINE_API int | swmm_gw_transport_option_get (SWMM_Engine engine, const char *key, char *buf, int buflen) |
Read one option into buf. SWMM_ERR_BADPARAM on an unknown key. | |
| SWMM_ENGINE_API int | swmm_gw_transport_option_set (SWMM_Engine engine, const char *key, const char *value) |
| Set one option (BUILDING/OPENED). | |
| SWMM_ENGINE_API int | swmm_gw_transport_authored (SWMM_Engine engine) |
1 when any [GW_*] row was authored, else 0. | |
| SWMM_ENGINE_API int | swmm_gw_params_count (SWMM_Engine engine) |
| SWMM_ENGINE_API int | swmm_gw_params_get (SWMM_Engine engine, int idx, SWMM_GwParams *row, char *tag_buf, int tag_len) |
Read row idx; tag_buf receives the TAG (empty otherwise). | |
| SWMM_ENGINE_API int | swmm_gw_params_set (SWMM_Engine engine, const SWMM_GwParams *row, const char *tag) |
Append or replace the row for (scope, tag/. | |
| SWMM_ENGINE_API int | swmm_gw_params_remove (SWMM_Engine engine, int idx) |
| SWMM_ENGINE_API int | swmm_gw_sorption_count (SWMM_Engine engine) |
| SWMM_ENGINE_API int | swmm_gw_sorption_get (SWMM_Engine engine, int idx, int *scope, char *tag_buf, int tag_len, int *cell, char *species_buf, int species_len, double *kd, double *decay) |
| SWMM_ENGINE_API int | swmm_gw_sorption_set (SWMM_Engine engine, int scope, const char *tag, int cell, const char *species, double kd, double decay) |
| SWMM_ENGINE_API int | swmm_gw_sorption_remove (SWMM_Engine engine, int idx) |
| SWMM_ENGINE_API int | swmm_gw_init_quality_count (SWMM_Engine engine) |
| SWMM_ENGINE_API int | swmm_gw_init_quality_get (SWMM_Engine engine, int idx, int *scope, char *tag_buf, int tag_len, int *cell, int *zone, int *layer, char *species_buf, int species_len, double *value) |
| SWMM_ENGINE_API int | swmm_gw_init_quality_set (SWMM_Engine engine, int scope, const char *tag, int cell, int zone, int layer, const char *species, double value) |
| SWMM_ENGINE_API int | swmm_gw_init_quality_remove (SWMM_Engine engine, int idx) |
| SWMM_ENGINE_API int | swmm_gw_init_quality_file_get (SWMM_Engine engine, char *buf, int buflen) |
The FILE <csv> sidecar reference ("" when none). | |
| SWMM_ENGINE_API int | swmm_gw_init_quality_file_set (SWMM_Engine engine, const char *path) |
| SWMM_ENGINE_API int | swmm_gw_boundary_quality_count (SWMM_Engine engine) |
| SWMM_ENGINE_API int | swmm_gw_boundary_quality_get (SWMM_Engine engine, int idx, int *cell, int *edge, char *species_buf, int species_len, char *kind_buf, int kind_len, double *value, char *ts_buf, int ts_len) |
| SWMM_ENGINE_API int | swmm_gw_boundary_quality_set (SWMM_Engine engine, int cell, int edge, const char *species, const char *kind, double value, const char *ts_name) |
| SWMM_ENGINE_API int | swmm_gw_boundary_quality_remove (SWMM_Engine engine, int idx) |
| SWMM_ENGINE_API int | swmm_gw_source_count (SWMM_Engine engine) |
| SWMM_ENGINE_API int | swmm_gw_source_get (SWMM_Engine engine, int idx, char *name_buf, int name_len, int *scope, char *tag_buf, int tag_len, int *cell, double *flow, char *flow_ts_buf, int flow_ts_len) |
| SWMM_ENGINE_API int | swmm_gw_source_set (SWMM_Engine engine, const char *name, int scope, const char *tag, int cell, double flow, const char *flow_ts) |
Append or replace the source named name. | |
| SWMM_ENGINE_API int | swmm_gw_source_remove (SWMM_Engine engine, int idx) |
| SWMM_ENGINE_API int | swmm_gw_source_species_count (SWMM_Engine engine, int src_idx) |
Species terms carried by source src_idx. | |
| SWMM_ENGINE_API int | swmm_gw_source_species_get (SWMM_Engine engine, int src_idx, int term_idx, char *species_buf, int species_len, char *kind_buf, int kind_len, double *value, char *ts_buf, int ts_len) |
| SWMM_ENGINE_API int | swmm_gw_source_species_set (SWMM_Engine engine, int src_idx, const char *species, const char *kind, double value, const char *ts_name) |
| SWMM_ENGINE_API int | swmm_gw_source_species_remove (SWMM_Engine engine, int src_idx, int term_idx) |
U4 — implementation of openswmm_gw_transport.h.
Every setter parses through the SAME line parsers the .inp sections use, so the API and the file can never drift: an option the file refuses the API refuses, with the same message shape. The rows live on SurfaceRouter2D (via ctx.twod_io.gw), so a save re-emits exactly what the API wrote.
| #define GW_EDITABLE | ( | eng | ) |
| #define GW_GET | ( | engine | ) |
| SWMM_ENGINE_API int swmm_gw_boundary_quality_count | ( | SWMM_Engine | engine | ) |
| SWMM_ENGINE_API int swmm_gw_boundary_quality_get | ( | SWMM_Engine | engine, |
| int | idx, | ||
| int * | cell, | ||
| int * | edge, | ||
| char * | species_buf, | ||
| int | species_len, | ||
| char * | kind_buf, | ||
| int | kind_len, | ||
| double * | value, | ||
| char * | ts_buf, | ||
| int | ts_len ) |
| SWMM_ENGINE_API int swmm_gw_boundary_quality_remove | ( | SWMM_Engine | engine, |
| int | idx ) |
| SWMM_ENGINE_API int swmm_gw_boundary_quality_set | ( | SWMM_Engine | engine, |
| int | cell, | ||
| int | edge, | ||
| const char * | species, | ||
| const char * | kind, | ||
| double | value, | ||
| const char * | ts_name ) |
| edge | LOCAL edge 0..nv-1 of cell (3 for a triangle, 4 for a quad). |
| SWMM_ENGINE_API int swmm_gw_init_quality_count | ( | SWMM_Engine | engine | ) |
| SWMM_ENGINE_API int swmm_gw_init_quality_file_get | ( | SWMM_Engine | engine, |
| char * | buf, | ||
| int | buflen ) |
The FILE <csv> sidecar reference ("" when none).
| SWMM_ENGINE_API int swmm_gw_init_quality_file_set | ( | SWMM_Engine | engine, |
| const char * | path ) |
| SWMM_ENGINE_API int swmm_gw_init_quality_get | ( | SWMM_Engine | engine, |
| int | idx, | ||
| int * | scope, | ||
| char * | tag_buf, | ||
| int | tag_len, | ||
| int * | cell, | ||
| int * | zone, | ||
| int * | layer, | ||
| char * | species_buf, | ||
| int | species_len, | ||
| double * | value ) |
| layer | 1-based, meaningful only when zone is SWMM_GW_ZONE_LAYER. |
| SWMM_ENGINE_API int swmm_gw_init_quality_remove | ( | SWMM_Engine | engine, |
| int | idx ) |
| SWMM_ENGINE_API int swmm_gw_init_quality_set | ( | SWMM_Engine | engine, |
| int | scope, | ||
| const char * | tag, | ||
| int | cell, | ||
| int | zone, | ||
| int | layer, | ||
| const char * | species, | ||
| double | value ) |
| SWMM_ENGINE_API int swmm_gw_params_count | ( | SWMM_Engine | engine | ) |
| SWMM_ENGINE_API int swmm_gw_params_get | ( | SWMM_Engine | engine, |
| int | idx, | ||
| SWMM_GwParams * | row, | ||
| char * | tag_buf, | ||
| int | tag_len ) |
Read row idx; tag_buf receives the TAG (empty otherwise).
| SWMM_ENGINE_API int swmm_gw_params_remove | ( | SWMM_Engine | engine, |
| int | idx ) |
| SWMM_ENGINE_API int swmm_gw_params_set | ( | SWMM_Engine | engine, |
| const SWMM_GwParams * | row, | ||
| const char * | tag ) |
Append or replace the row for (scope, tag/. cell)
| SWMM_ENGINE_API int swmm_gw_sorption_count | ( | SWMM_Engine | engine | ) |
| SWMM_ENGINE_API int swmm_gw_sorption_get | ( | SWMM_Engine | engine, |
| int | idx, | ||
| int * | scope, | ||
| char * | tag_buf, | ||
| int | tag_len, | ||
| int * | cell, | ||
| char * | species_buf, | ||
| int | species_len, | ||
| double * | kd, | ||
| double * | decay ) |
| decay | 1/day; negative means "use the [POLLUTANTS] kdecay". |
| SWMM_ENGINE_API int swmm_gw_sorption_remove | ( | SWMM_Engine | engine, |
| int | idx ) |
| SWMM_ENGINE_API int swmm_gw_sorption_set | ( | SWMM_Engine | engine, |
| int | scope, | ||
| const char * | tag, | ||
| int | cell, | ||
| const char * | species, | ||
| double | kd, | ||
| double | decay ) |
| SWMM_ENGINE_API int swmm_gw_source_count | ( | SWMM_Engine | engine | ) |
| SWMM_ENGINE_API int swmm_gw_source_get | ( | SWMM_Engine | engine, |
| int | idx, | ||
| char * | name_buf, | ||
| int | name_len, | ||
| int * | scope, | ||
| char * | tag_buf, | ||
| int | tag_len, | ||
| int * | cell, | ||
| double * | flow, | ||
| char * | flow_ts_buf, | ||
| int | flow_ts_len ) |
| SWMM_ENGINE_API int swmm_gw_source_remove | ( | SWMM_Engine | engine, |
| int | idx ) |
| SWMM_ENGINE_API int swmm_gw_source_set | ( | SWMM_Engine | engine, |
| const char * | name, | ||
| int | scope, | ||
| const char * | tag, | ||
| int | cell, | ||
| double | flow, | ||
| const char * | flow_ts ) |
Append or replace the source named name.
| SWMM_ENGINE_API int swmm_gw_source_species_count | ( | SWMM_Engine | engine, |
| int | src_idx ) |
Species terms carried by source src_idx.
| SWMM_ENGINE_API int swmm_gw_source_species_get | ( | SWMM_Engine | engine, |
| int | src_idx, | ||
| int | term_idx, | ||
| char * | species_buf, | ||
| int | species_len, | ||
| char * | kind_buf, | ||
| int | kind_len, | ||
| double * | value, | ||
| char * | ts_buf, | ||
| int | ts_len ) |
| SWMM_ENGINE_API int swmm_gw_source_species_remove | ( | SWMM_Engine | engine, |
| int | src_idx, | ||
| int | term_idx ) |
| SWMM_ENGINE_API int swmm_gw_source_species_set | ( | SWMM_Engine | engine, |
| int | src_idx, | ||
| const char * | species, | ||
| const char * | kind, | ||
| double | value, | ||
| const char * | ts_name ) |
| kind | "CONC" or "MASS". Upserts on the species name. |
| SWMM_ENGINE_API int swmm_gw_transport_authored | ( | SWMM_Engine | engine | ) |
1 when any [GW_*] row was authored, else 0.
| SWMM_ENGINE_API int swmm_gw_transport_option_get | ( | SWMM_Engine | engine, |
| const char * | key, | ||
| char * | buf, | ||
| int | buflen ) |
Read one option into buf. SWMM_ERR_BADPARAM on an unknown key.
| SWMM_ENGINE_API int swmm_gw_transport_option_set | ( | SWMM_Engine | engine, |
| const char * | key, | ||
| const char * | value ) |
Set one option (BUILDING/OPENED).