OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_quality.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
32
33#ifndef OPENSWMM_QUALITY_H
34#define OPENSWMM_QUALITY_H
35
36#include "openswmm_engine.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/* =========================================================================
43 * Landuse API
44 * ========================================================================= */
45
53
61SWMM_ENGINE_API int swmm_landuse_index(SWMM_Engine engine, const char* id);
62
71SWMM_ENGINE_API const char* swmm_landuse_id(SWMM_Engine engine, int idx);
72
85SWMM_ENGINE_API int swmm_landuse_add(SWMM_Engine engine, const char* id);
86
104SWMM_ENGINE_API int swmm_landuse_rename(SWMM_Engine engine, int idx, const char* new_id);
105
118SWMM_ENGINE_API int swmm_landuse_set_sweep_interval(SWMM_Engine engine, int idx, double days);
119
129SWMM_ENGINE_API int swmm_landuse_get_sweep_interval(SWMM_Engine engine, int idx, double* days);
130
143SWMM_ENGINE_API int swmm_landuse_set_sweep_removal(SWMM_Engine engine, int idx, double frac);
144
154SWMM_ENGINE_API int swmm_landuse_get_sweep_removal(SWMM_Engine engine, int idx, double* frac);
155
156/* =========================================================================
157 * Buildup API — indexed by (landuse_idx, pollutant_idx)
158 * ========================================================================= */
159
179SWMM_ENGINE_API int swmm_buildup_set(SWMM_Engine engine, int lu_idx, int pollut_idx, int func_type,
180 double c1, double c2, double c3, int normalizer);
181
206SWMM_ENGINE_API int swmm_buildup_get(SWMM_Engine engine, int lu_idx, int pollut_idx, int* func_type,
207 double* c1, double* c2, double* c3, int* normalizer);
208
209/* =========================================================================
210 * Washoff API — indexed by (landuse_idx, pollutant_idx)
211 * ========================================================================= */
212
233SWMM_ENGINE_API int swmm_washoff_set(SWMM_Engine engine, int lu_idx, int pollut_idx, int func_type,
234 double coeff, double expon, double sweep_effic,
235 double bmp_effic);
236
259SWMM_ENGINE_API int swmm_washoff_get(SWMM_Engine engine, int lu_idx, int pollut_idx, int* func_type,
260 double* coeff, double* expon, double* sweep_effic,
261 double* bmp_effic);
262
263/* =========================================================================
264 * Treatment API — indexed by (node_idx, pollutant_idx)
265 * ========================================================================= */
266
282SWMM_ENGINE_API int swmm_treatment_set(SWMM_Engine engine, int node_idx, int pollut_idx,
283 const char* expression);
284
300SWMM_ENGINE_API int swmm_treatment_get(SWMM_Engine engine, int node_idx, int pollut_idx, char* buf,
301 int buflen);
302
316SWMM_ENGINE_API int swmm_treatment_clear(SWMM_Engine engine, int node_idx, int pollut_idx);
317
349 char* errbuf, int buflen, int* col_out);
350
351#ifdef __cplusplus
352} /* extern "C" */
353#endif
354
355#endif /* OPENSWMM_QUALITY_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:62
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:55
OpenSWMM Engine — primary transparent C API (master header).
SWMM_ENGINE_API int swmm_landuse_get_sweep_removal(SWMM_Engine engine, int idx, double *frac)
Read the land-use sweep-removal fraction.
Definition openswmm_quality_impl.cpp:186
SWMM_ENGINE_API int swmm_landuse_count(SWMM_Engine engine)
Count land-use definitions in the current model.
Definition openswmm_quality_impl.cpp:42
SWMM_ENGINE_API int swmm_landuse_set_sweep_removal(SWMM_Engine engine, int idx, double frac)
Assign the land-use sweep-removal fraction.
Definition openswmm_quality_impl.cpp:178
SWMM_ENGINE_API int swmm_washoff_get(SWMM_Engine engine, int lu_idx, int pollut_idx, int *func_type, double *coeff, double *expon, double *sweep_effic, double *bmp_effic)
Get washoff function parameters for a (landuse, pollutant) pair.
Definition openswmm_quality_impl.cpp:344
SWMM_ENGINE_API int swmm_landuse_add(SWMM_Engine engine, const char *id)
Append a land use while preserving existing model parameter columns.
Definition openswmm_quality_impl.cpp:67
SWMM_ENGINE_API int swmm_buildup_get(SWMM_Engine engine, int lu_idx, int pollut_idx, int *func_type, double *c1, double *c2, double *c3, int *normalizer)
Get buildup function parameters for a (landuse, pollutant) pair.
Definition openswmm_quality_impl.cpp:243
SWMM_ENGINE_API int swmm_landuse_index(SWMM_Engine engine, const char *id)
Resolve a land-use identifier to its row index.
Definition openswmm_quality_impl.cpp:48
SWMM_ENGINE_API int swmm_treatment_clear(SWMM_Engine engine, int node_idx, int pollut_idx)
Clear a treatment expression for a (node, pollutant) pair.
Definition openswmm_quality_impl.cpp:459
SWMM_ENGINE_API int swmm_landuse_get_sweep_interval(SWMM_Engine engine, int idx, double *days)
Read the configured interval between street sweeps.
Definition openswmm_quality_impl.cpp:169
SWMM_ENGINE_API int swmm_buildup_set(SWMM_Engine engine, int lu_idx, int pollut_idx, int func_type, double c1, double c2, double c3, int normalizer)
Set buildup function parameters for a (landuse, pollutant) pair.
Definition openswmm_quality_impl.cpp:199
SWMM_ENGINE_API int swmm_landuse_rename(SWMM_Engine engine, int idx, const char *new_id)
Rename a land use in place.
Definition openswmm_quality_impl.cpp:145
SWMM_ENGINE_API int swmm_landuse_set_sweep_interval(SWMM_Engine engine, int idx, double days)
Assign the configured interval between street sweeps.
Definition openswmm_quality_impl.cpp:161
SWMM_ENGINE_API int swmm_washoff_set(SWMM_Engine engine, int lu_idx, int pollut_idx, int func_type, double coeff, double expon, double sweep_effic, double bmp_effic)
Set washoff function parameters for a (landuse, pollutant) pair.
Definition openswmm_quality_impl.cpp:303
SWMM_ENGINE_API int swmm_treatment_validate_expression(SWMM_Engine engine, const char *expr, char *errbuf, int buflen, int *col_out)
Validate a treatment expression WITHOUT modifying engine state.
Definition openswmm_quality_impl.cpp:477
SWMM_ENGINE_API const char * swmm_landuse_id(SWMM_Engine engine, int idx)
Borrow a land-use identifier from the model name index.
Definition openswmm_quality_impl.cpp:54
SWMM_ENGINE_API int swmm_treatment_set(SWMM_Engine engine, int node_idx, int pollut_idx, const char *expression)
Set a treatment expression for a (node, pollutant) pair.
Definition openswmm_quality_impl.cpp:405
SWMM_ENGINE_API int swmm_treatment_get(SWMM_Engine engine, int node_idx, int pollut_idx, char *buf, int buflen)
Get a treatment expression for a (node, pollutant) pair.
Definition openswmm_quality_impl.cpp:436