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
48
50SWMM_ENGINE_API int swmm_landuse_index(SWMM_Engine engine, const char* id);
51
53SWMM_ENGINE_API const char* swmm_landuse_id (SWMM_Engine engine, int idx);
54
56SWMM_ENGINE_API int swmm_landuse_add(SWMM_Engine engine, const char* id);
57
70SWMM_ENGINE_API int swmm_landuse_rename(SWMM_Engine engine, int idx, const char* new_id);
71
73SWMM_ENGINE_API int swmm_landuse_set_sweep_interval(SWMM_Engine engine, int idx, double days);
74
76SWMM_ENGINE_API int swmm_landuse_get_sweep_interval(SWMM_Engine engine, int idx, double* days);
77
79SWMM_ENGINE_API int swmm_landuse_set_sweep_removal(SWMM_Engine engine, int idx, double frac);
80
82SWMM_ENGINE_API int swmm_landuse_get_sweep_removal(SWMM_Engine engine, int idx, double* frac);
83
84/* =========================================================================
85 * Buildup API — indexed by (landuse_idx, pollutant_idx)
86 * ========================================================================= */
87
100SWMM_ENGINE_API int swmm_buildup_set(SWMM_Engine engine, int lu_idx, int pollut_idx,
101 int func_type, double c1, double c2, double c3,
102 int normalizer);
103
117SWMM_ENGINE_API int swmm_buildup_get(SWMM_Engine engine, int lu_idx, int pollut_idx,
118 int* func_type, double* c1, double* c2, double* c3,
119 int* normalizer);
120
121/* =========================================================================
122 * Washoff API — indexed by (landuse_idx, pollutant_idx)
123 * ========================================================================= */
124
137SWMM_ENGINE_API int swmm_washoff_set(SWMM_Engine engine, int lu_idx, int pollut_idx,
138 int func_type, double coeff, double expon,
139 double sweep_effic, double bmp_effic);
140
154SWMM_ENGINE_API int swmm_washoff_get(SWMM_Engine engine, int lu_idx, int pollut_idx,
155 int* func_type, double* coeff, double* expon,
156 double* sweep_effic, double* bmp_effic);
157
158/* =========================================================================
159 * Treatment API — indexed by (node_idx, pollutant_idx)
160 * ========================================================================= */
161
170SWMM_ENGINE_API int swmm_treatment_set(SWMM_Engine engine, int node_idx, int pollut_idx,
171 const char* expression);
172
182SWMM_ENGINE_API int swmm_treatment_get(SWMM_Engine engine, int node_idx, int pollut_idx,
183 char* buf, int buflen);
184
193SWMM_ENGINE_API int swmm_treatment_clear(SWMM_Engine engine, int node_idx, int pollut_idx);
194
220 char* errbuf, int buflen, int* col_out);
221
222#ifdef __cplusplus
223} /* extern "C" */
224#endif
225
226#endif /* OPENSWMM_QUALITY_H */
#define SWMM_ENGINE_API
Definition openswmm_2d.h:53
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:51
OpenSWMM Engine — primary transparent C API (master header).
SWMM_ENGINE_API int swmm_landuse_get_sweep_removal(SWMM_Engine engine, int idx, double *frac)
Get sweep removal fraction (0-1).
Definition openswmm_quality_impl.cpp:180
SWMM_ENGINE_API int swmm_landuse_count(SWMM_Engine engine)
Number of land uses defined.
Definition openswmm_quality_impl.cpp:41
SWMM_ENGINE_API int swmm_landuse_set_sweep_removal(SWMM_Engine engine, int idx, double frac)
Set sweep removal fraction (0-1).
Definition openswmm_quality_impl.cpp:172
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:273
SWMM_ENGINE_API int swmm_landuse_add(SWMM_Engine engine, const char *id)
Add a new land use (BUILDING state only).
Definition openswmm_quality_impl.cpp:62
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:220
SWMM_ENGINE_API int swmm_landuse_index(SWMM_Engine engine, const char *id)
Look up a land use by name. Returns -1 if not found.
Definition openswmm_quality_impl.cpp:46
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:353
SWMM_ENGINE_API int swmm_landuse_get_sweep_interval(SWMM_Engine engine, int idx, double *days)
Get sweep interval (days between street sweeps).
Definition openswmm_quality_impl.cpp:164
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:192
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:141
SWMM_ENGINE_API int swmm_landuse_set_sweep_interval(SWMM_Engine engine, int idx, double days)
Set sweep interval (days between street sweeps).
Definition openswmm_quality_impl.cpp:156
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:246
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:372
SWMM_ENGINE_API const char * swmm_landuse_id(SWMM_Engine engine, int idx)
Return the name of a land use by index. Returns NULL on error.
Definition openswmm_quality_impl.cpp:51
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:299
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:330