OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
openswmm_tables.h
Go to the documentation of this file.
1
16#ifndef OPENSWMM_TABLES_H
17#define OPENSWMM_TABLES_H
18
19#include "openswmm_engine.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/* =========================================================================
26 * Identity
27 * ========================================================================= */
28
35
42SWMM_ENGINE_API int swmm_table_index(SWMM_Engine engine, const char* id);
43
50SWMM_ENGINE_API const char* swmm_table_id(SWMM_Engine engine, int idx);
51
73SWMM_ENGINE_API int swmm_table_get_type(SWMM_Engine engine, int idx, int* type);
74
75/* =========================================================================
76 * Creation (BUILDING state only)
77 * ========================================================================= */
78
85SWMM_ENGINE_API int swmm_timeseries_add(SWMM_Engine engine, const char* id);
86
98SWMM_ENGINE_API int swmm_curve_add(SWMM_Engine engine, const char* id, int type);
99
100/* =========================================================================
101 * Data points
102 * ========================================================================= */
103
116SWMM_ENGINE_API int swmm_table_add_point(SWMM_Engine engine, int idx, double x, double y);
117
125SWMM_ENGINE_API int swmm_table_get_point_count(SWMM_Engine engine, int idx, int* count);
126
136SWMM_ENGINE_API int swmm_table_get_point(SWMM_Engine engine, int idx, int pt_idx, double* x, double* y);
137
144SWMM_ENGINE_API int swmm_table_clear(SWMM_Engine engine, int idx);
145
146/* =========================================================================
147 * Lookup (cursor-optimized)
148 * ========================================================================= */
149
162SWMM_ENGINE_API int swmm_table_lookup(SWMM_Engine engine, int idx, double x, double* y);
163
164/* =========================================================================
165 * Patterns
166 * ========================================================================= */
167
178SWMM_ENGINE_API int swmm_pattern_add(SWMM_Engine engine, const char* id, int type);
179
188SWMM_ENGINE_API int swmm_pattern_set_factors(SWMM_Engine engine, int idx, const double* factors, int count);
189
196
203SWMM_ENGINE_API int swmm_pattern_index(SWMM_Engine engine, const char* id);
204
211SWMM_ENGINE_API const char* swmm_pattern_id(SWMM_Engine engine, int idx);
212
225SWMM_ENGINE_API int swmm_pattern_get_type(SWMM_Engine engine, int idx, int* type);
226
234SWMM_ENGINE_API int swmm_pattern_get_factor_count(SWMM_Engine engine, int idx, int* count);
235
244SWMM_ENGINE_API int swmm_pattern_get_factor(SWMM_Engine engine, int idx, int i, double* v);
245
266
278SWMM_ENGINE_API int swmm_pattern_rename(SWMM_Engine engine, int idx, const char* newId);
279
280#ifdef __cplusplus
281} /* extern "C" */
282#endif
283
284#endif /* OPENSWMM_TABLES_H */
double * y
Definition odesolve.c:28
#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 int swmm_table_add_point(SWMM_Engine engine, int idx, double x, double y)
Append a data point (x, y) to a table.
Definition openswmm_tables_impl.cpp:112
SWMM_ENGINE_API int swmm_pattern_add(SWMM_Engine engine, const char *id, int type)
Add a new time pattern to the model.
Definition openswmm_tables_impl.cpp:170
SWMM_ENGINE_API int swmm_pattern_get_factor(SWMM_Engine engine, int idx, int i, double *v)
Get one multiplier factor from a pattern.
Definition openswmm_tables_impl.cpp:230
SWMM_ENGINE_API int swmm_table_get_point(SWMM_Engine engine, int idx, int pt_idx, double *x, double *y)
Get a specific data point from a table.
Definition openswmm_tables_impl.cpp:130
SWMM_ENGINE_API int swmm_table_lookup(SWMM_Engine engine, int idx, double x, double *y)
Interpolate a Y value from a table for a given X.
Definition openswmm_tables_impl.cpp:157
SWMM_ENGINE_API const char * swmm_pattern_id(SWMM_Engine engine, int idx)
Get the string identifier of a pattern by index.
Definition openswmm_tables_impl.cpp:205
SWMM_ENGINE_API int swmm_pattern_index(SWMM_Engine engine, const char *id)
Look up a pattern's zero-based index by its string identifier.
Definition openswmm_tables_impl.cpp:196
SWMM_ENGINE_API int swmm_table_get_point_count(SWMM_Engine engine, int idx, int *count)
Get the number of data points in a table.
Definition openswmm_tables_impl.cpp:122
SWMM_ENGINE_API int swmm_table_get_type(SWMM_Engine engine, int idx, int *type)
Get a table's type code.
Definition openswmm_tables_impl.cpp:57
SWMM_ENGINE_API int swmm_timeseries_add(SWMM_Engine engine, const char *id)
Add a new time series to the model.
Definition openswmm_tables_impl.cpp:70
SWMM_ENGINE_API int swmm_pattern_remove(SWMM_Engine engine, int idx)
Remove a time pattern by index, clearing any reference sites.
Definition openswmm_tables_impl.cpp:241
SWMM_ENGINE_API int swmm_table_clear(SWMM_Engine engine, int idx)
Remove all data points from a table.
Definition openswmm_tables_impl.cpp:142
SWMM_ENGINE_API int swmm_table_count(SWMM_Engine engine)
Get the total number of tables (time series + curves) in the model.
Definition openswmm_tables_impl.cpp:40
SWMM_ENGINE_API int swmm_pattern_count(SWMM_Engine engine)
Get the total number of time patterns in the model.
Definition openswmm_tables_impl.cpp:191
SWMM_ENGINE_API const char * swmm_table_id(SWMM_Engine engine, int idx)
Get the string identifier of a table by index.
Definition openswmm_tables_impl.cpp:50
SWMM_ENGINE_API int swmm_pattern_get_type(SWMM_Engine engine, int idx, int *type)
Get a pattern's type code.
Definition openswmm_tables_impl.cpp:212
SWMM_ENGINE_API int swmm_curve_add(SWMM_Engine engine, const char *id, int type)
Add a new curve to the model.
Definition openswmm_tables_impl.cpp:89
SWMM_ENGINE_API int swmm_table_index(SWMM_Engine engine, const char *id)
Look up a table's zero-based index by its string identifier.
Definition openswmm_tables_impl.cpp:45
SWMM_ENGINE_API int swmm_pattern_set_factors(SWMM_Engine engine, int idx, const double *factors, int count)
Set the multiplier factors for a time pattern.
Definition openswmm_tables_impl.cpp:182
SWMM_ENGINE_API int swmm_pattern_rename(SWMM_Engine engine, int idx, const char *newId)
Rename a time pattern; updates every stored reference to the previous name across inflows,...
Definition openswmm_tables_impl.cpp:262
SWMM_ENGINE_API int swmm_pattern_get_factor_count(SWMM_Engine engine, int idx, int *count)
Get the number of multiplier factors stored for a pattern.
Definition openswmm_tables_impl.cpp:221