OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_statistics.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
31
32#ifndef OPENSWMM_STATISTICS_H
33#define OPENSWMM_STATISTICS_H
34
35#include "openswmm_engine.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/* =========================================================================
42 * Node Statistics
43 * ========================================================================= */
44
60SWMM_ENGINE_API int swmm_stat_node_max_depth(SWMM_Engine engine, int idx, double* val);
61
77SWMM_ENGINE_API int swmm_stat_node_max_overflow(SWMM_Engine engine, int idx, double* val);
78
94SWMM_ENGINE_API int swmm_stat_node_vol_flooded(SWMM_Engine engine, int idx, double* val);
95
111SWMM_ENGINE_API int swmm_stat_node_time_flooded(SWMM_Engine engine, int idx, double* val);
112
113/* =========================================================================
114 * Link Statistics
115 * ========================================================================= */
116
132SWMM_ENGINE_API int swmm_stat_link_max_flow(SWMM_Engine engine, int idx, double* val);
133
149SWMM_ENGINE_API int swmm_stat_link_max_velocity(SWMM_Engine engine, int idx, double* val);
150
166SWMM_ENGINE_API int swmm_stat_link_max_filling(SWMM_Engine engine, int idx, double* val);
167
183SWMM_ENGINE_API int swmm_stat_link_vol_flow(SWMM_Engine engine, int idx, double* val);
184
200SWMM_ENGINE_API int swmm_stat_link_surcharge_time(SWMM_Engine engine, int idx, double* val);
201
202/* =========================================================================
203 * Subcatchment Statistics
204 * ========================================================================= */
205
221SWMM_ENGINE_API int swmm_stat_subcatch_precip(SWMM_Engine engine, int idx, double* val);
222
238SWMM_ENGINE_API int swmm_stat_subcatch_runoff_vol(SWMM_Engine engine, int idx, double* val);
239
255SWMM_ENGINE_API int swmm_stat_subcatch_max_runoff(SWMM_Engine engine, int idx, double* val);
256
257/* =========================================================================
258 * Bulk Statistics
259 * ========================================================================= */
260
277SWMM_ENGINE_API int swmm_stat_node_max_depth_bulk(SWMM_Engine engine, double* buf, int count);
278
295SWMM_ENGINE_API int swmm_stat_link_max_flow_bulk(SWMM_Engine engine, double* buf, int count);
296
313SWMM_ENGINE_API int swmm_stat_subcatch_runoff_vol_bulk(SWMM_Engine engine, double* buf, int count);
314
315/* -------------------------------------------------------------------------
316 * Phase 3 statistics bulk getters — added in OpenSWMM 6.0.0 to power the
317 * MCP server's flooding / capacity summary tools without a per-node
318 * Python loop. Each is a simple SoA memcpy from the corresponding
319 * scalar accessor's column.
320 * ------------------------------------------------------------------------- */
321
338SWMM_ENGINE_API int swmm_stat_node_max_overflow_bulk(SWMM_Engine engine, double* buf, int count);
339
356SWMM_ENGINE_API int swmm_stat_node_vol_flooded_bulk(SWMM_Engine engine, double* buf, int count);
357
374SWMM_ENGINE_API int swmm_stat_node_time_flooded_bulk(SWMM_Engine engine, double* buf, int count);
375
392SWMM_ENGINE_API int swmm_stat_subcatch_max_runoff_bulk(SWMM_Engine engine, double* buf, int count);
393
394/* -------------------------------------------------------------------------
395 * Phase 4e link-stat bulks — complete the per-link statistics surface so
396 * the MCP server's capacity_summary tool can collapse to a single-pass
397 * shape (same as flooding_summary). Each is a simple SoA memcpy from
398 * the matching scalar accessor's column.
399 * ------------------------------------------------------------------------- */
400
417SWMM_ENGINE_API int swmm_stat_link_max_velocity_bulk(SWMM_Engine engine, double* buf, int count);
418
435SWMM_ENGINE_API int swmm_stat_link_max_filling_bulk(SWMM_Engine engine, double* buf, int count);
436
453SWMM_ENGINE_API int swmm_stat_link_vol_flow_bulk(SWMM_Engine engine, double* buf, int count);
454
471SWMM_ENGINE_API int swmm_stat_link_surcharge_time_bulk(SWMM_Engine engine, double* buf, int count);
472
473#ifdef __cplusplus
474} /* extern "C" */
475#endif
476
477#endif /* OPENSWMM_STATISTICS_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_stat_link_vol_flow(SWMM_Engine engine, int idx, double *val)
Read cumulative conveyed water volume for one link.
Definition openswmm_statistics_impl.cpp:105
SWMM_ENGINE_API int swmm_stat_link_max_velocity(SWMM_Engine engine, int idx, double *val)
Read maximum recorded absolute flow velocity for one link.
Definition openswmm_statistics_impl.cpp:87
SWMM_ENGINE_API int swmm_stat_link_surcharge_time_bulk(SWMM_Engine engine, double *buf, int count)
Copy cumulative surcharged duration for a prefix of the link table.
Definition openswmm_statistics_impl.cpp:278
SWMM_ENGINE_API int swmm_stat_node_time_flooded_bulk(SWMM_Engine engine, double *buf, int count)
Copy cumulative flooding duration for a prefix of the node table.
Definition openswmm_statistics_impl.cpp:219
SWMM_ENGINE_API int swmm_stat_node_max_overflow_bulk(SWMM_Engine engine, double *buf, int count)
Copy maximum recorded overflow discharge for a prefix of the node table.
Definition openswmm_statistics_impl.cpp:199
SWMM_ENGINE_API int swmm_stat_node_vol_flooded_bulk(SWMM_Engine engine, double *buf, int count)
Copy cumulative flooded water volume for a prefix of the node table.
Definition openswmm_statistics_impl.cpp:209
SWMM_ENGINE_API int swmm_stat_subcatch_precip(SWMM_Engine engine, int idx, double *val)
Read cumulative precipitation volume for one subcatchment.
Definition openswmm_statistics_impl.cpp:127
SWMM_ENGINE_API int swmm_stat_link_surcharge_time(SWMM_Engine engine, int idx, double *val)
Read cumulative surcharged duration for one link.
Definition openswmm_statistics_impl.cpp:114
SWMM_ENGINE_API int swmm_stat_link_max_velocity_bulk(SWMM_Engine engine, double *buf, int count)
Copy maximum recorded absolute flow velocity for a prefix of the link table.
Definition openswmm_statistics_impl.cpp:248
SWMM_ENGINE_API int swmm_stat_node_max_depth_bulk(SWMM_Engine engine, double *buf, int count)
Copy maximum recorded water depth for a prefix of the node table.
Definition openswmm_statistics_impl.cpp:158
SWMM_ENGINE_API int swmm_stat_subcatch_max_runoff_bulk(SWMM_Engine engine, double *buf, int count)
Copy maximum recorded runoff discharge for a prefix of the subcatchment table.
Definition openswmm_statistics_impl.cpp:229
SWMM_ENGINE_API int swmm_stat_subcatch_runoff_vol_bulk(SWMM_Engine engine, double *buf, int count)
Copy cumulative runoff volume for a prefix of the subcatchment table.
Definition openswmm_statistics_impl.cpp:178
SWMM_ENGINE_API int swmm_stat_link_max_flow(SWMM_Engine engine, int idx, double *val)
Read maximum recorded absolute flow for one link.
Definition openswmm_statistics_impl.cpp:78
SWMM_ENGINE_API int swmm_stat_link_max_filling_bulk(SWMM_Engine engine, double *buf, int count)
Copy maximum recorded depth/full-depth ratio for a prefix of the link table.
Definition openswmm_statistics_impl.cpp:258
SWMM_ENGINE_API int swmm_stat_link_max_flow_bulk(SWMM_Engine engine, double *buf, int count)
Copy maximum recorded absolute flow for a prefix of the link table.
Definition openswmm_statistics_impl.cpp:168
SWMM_ENGINE_API int swmm_stat_node_max_overflow(SWMM_Engine engine, int idx, double *val)
Read maximum recorded overflow discharge for one node.
Definition openswmm_statistics_impl.cpp:47
SWMM_ENGINE_API int swmm_stat_node_vol_flooded(SWMM_Engine engine, int idx, double *val)
Read cumulative flooded water volume for one node.
Definition openswmm_statistics_impl.cpp:56
SWMM_ENGINE_API int swmm_stat_subcatch_max_runoff(SWMM_Engine engine, int idx, double *val)
Read maximum recorded runoff discharge for one subcatchment.
Definition openswmm_statistics_impl.cpp:145
SWMM_ENGINE_API int swmm_stat_link_max_filling(SWMM_Engine engine, int idx, double *val)
Read maximum recorded depth/full-depth ratio for one link.
Definition openswmm_statistics_impl.cpp:96
SWMM_ENGINE_API int swmm_stat_node_time_flooded(SWMM_Engine engine, int idx, double *val)
Read cumulative flooding duration for one node.
Definition openswmm_statistics_impl.cpp:65
SWMM_ENGINE_API int swmm_stat_node_max_depth(SWMM_Engine engine, int idx, double *val)
Read maximum recorded water depth for one node.
Definition openswmm_statistics_impl.cpp:38
SWMM_ENGINE_API int swmm_stat_link_vol_flow_bulk(SWMM_Engine engine, double *buf, int count)
Copy cumulative conveyed water volume for a prefix of the link table.
Definition openswmm_statistics_impl.cpp:268
SWMM_ENGINE_API int swmm_stat_subcatch_runoff_vol(SWMM_Engine engine, int idx, double *val)
Read cumulative runoff volume for one subcatchment.
Definition openswmm_statistics_impl.cpp:136