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
46SWMM_ENGINE_API int swmm_stat_node_max_depth(SWMM_Engine engine, int idx, double* val);
47
49SWMM_ENGINE_API int swmm_stat_node_max_overflow(SWMM_Engine engine, int idx, double* val);
50
52SWMM_ENGINE_API int swmm_stat_node_vol_flooded(SWMM_Engine engine, int idx, double* val);
53
55SWMM_ENGINE_API int swmm_stat_node_time_flooded(SWMM_Engine engine, int idx, double* val);
56
57/* =========================================================================
58 * Link Statistics
59 * ========================================================================= */
60
62SWMM_ENGINE_API int swmm_stat_link_max_flow(SWMM_Engine engine, int idx, double* val);
63
65SWMM_ENGINE_API int swmm_stat_link_max_velocity(SWMM_Engine engine, int idx, double* val);
66
68SWMM_ENGINE_API int swmm_stat_link_max_filling(SWMM_Engine engine, int idx, double* val);
69
71SWMM_ENGINE_API int swmm_stat_link_vol_flow(SWMM_Engine engine, int idx, double* val);
72
74SWMM_ENGINE_API int swmm_stat_link_surcharge_time(SWMM_Engine engine, int idx, double* val);
75
76/* =========================================================================
77 * Subcatchment Statistics
78 * ========================================================================= */
79
81SWMM_ENGINE_API int swmm_stat_subcatch_precip(SWMM_Engine engine, int idx, double* val);
82
84SWMM_ENGINE_API int swmm_stat_subcatch_runoff_vol(SWMM_Engine engine, int idx, double* val);
85
87SWMM_ENGINE_API int swmm_stat_subcatch_max_runoff(SWMM_Engine engine, int idx, double* val);
88
89/* =========================================================================
90 * Bulk Statistics
91 * ========================================================================= */
92
94SWMM_ENGINE_API int swmm_stat_node_max_depth_bulk(SWMM_Engine engine, double* buf, int count);
95
97SWMM_ENGINE_API int swmm_stat_link_max_flow_bulk(SWMM_Engine engine, double* buf, int count);
98
100SWMM_ENGINE_API int swmm_stat_subcatch_runoff_vol_bulk(SWMM_Engine engine, double* buf, int count);
101
102/* -------------------------------------------------------------------------
103 * Phase 3 statistics bulk getters — added in OpenSWMM 6.0.0 to power the
104 * MCP server's flooding / capacity summary tools without a per-node
105 * Python loop. Each is a simple SoA memcpy from the corresponding
106 * scalar accessor's column.
107 * ------------------------------------------------------------------------- */
108
115SWMM_ENGINE_API int swmm_stat_node_max_overflow_bulk(SWMM_Engine engine, double* buf, int count);
116
122SWMM_ENGINE_API int swmm_stat_node_vol_flooded_bulk(SWMM_Engine engine, double* buf, int count);
123
129SWMM_ENGINE_API int swmm_stat_node_time_flooded_bulk(SWMM_Engine engine, double* buf, int count);
130
136SWMM_ENGINE_API int swmm_stat_subcatch_max_runoff_bulk(SWMM_Engine engine, double* buf, int count);
137
138/* -------------------------------------------------------------------------
139 * Phase 4e link-stat bulks — complete the per-link statistics surface so
140 * the MCP server's capacity_summary tool can collapse to a single-pass
141 * shape (same as flooding_summary). Each is a simple SoA memcpy from
142 * the matching scalar accessor's column.
143 * ------------------------------------------------------------------------- */
144
151SWMM_ENGINE_API int swmm_stat_link_max_velocity_bulk(SWMM_Engine engine, double* buf, int count);
152
159SWMM_ENGINE_API int swmm_stat_link_max_filling_bulk(SWMM_Engine engine, double* buf, int count);
160
167SWMM_ENGINE_API int swmm_stat_link_vol_flow_bulk(SWMM_Engine engine, double* buf, int count);
168
175SWMM_ENGINE_API int swmm_stat_link_surcharge_time_bulk(SWMM_Engine engine, double* buf, int count);
176
177#ifdef __cplusplus
178} /* extern "C" */
179#endif
180
181#endif /* OPENSWMM_STATISTICS_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_stat_link_vol_flow(SWMM_Engine engine, int idx, double *val)
Total volume conveyed through a link (project volume units).
Definition openswmm_statistics_impl.cpp:98
SWMM_ENGINE_API int swmm_stat_link_max_velocity(SWMM_Engine engine, int idx, double *val)
Maximum velocity in a link (project length/time units).
Definition openswmm_statistics_impl.cpp:82
SWMM_ENGINE_API int swmm_stat_link_surcharge_time_bulk(SWMM_Engine engine, double *buf, int count)
Get cumulative surcharge time per link into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:264
SWMM_ENGINE_API int swmm_stat_node_time_flooded_bulk(SWMM_Engine engine, double *buf, int count)
Get cumulative time-flooded for all nodes into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:206
SWMM_ENGINE_API int swmm_stat_node_max_overflow_bulk(SWMM_Engine engine, double *buf, int count)
Get maximum overflow rate for all nodes into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:186
SWMM_ENGINE_API int swmm_stat_node_vol_flooded_bulk(SWMM_Engine engine, double *buf, int count)
Get total flooded volume for all nodes into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:196
SWMM_ENGINE_API int swmm_stat_subcatch_precip(SWMM_Engine engine, int idx, double *val)
Total precipitation volume at a subcatchment (project volume units).
Definition openswmm_statistics_impl.cpp:118
SWMM_ENGINE_API int swmm_stat_link_surcharge_time(SWMM_Engine engine, int idx, double *val)
Total surcharge time for a link (hours).
Definition openswmm_statistics_impl.cpp:106
SWMM_ENGINE_API int swmm_stat_link_max_velocity_bulk(SWMM_Engine engine, double *buf, int count)
Get peak velocity for all links into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:234
SWMM_ENGINE_API int swmm_stat_node_max_depth_bulk(SWMM_Engine engine, double *buf, int count)
Get maximum depth for all nodes into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:146
SWMM_ENGINE_API int swmm_stat_subcatch_max_runoff_bulk(SWMM_Engine engine, double *buf, int count)
Get peak runoff rate for all subcatchments into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:216
SWMM_ENGINE_API int swmm_stat_subcatch_runoff_vol_bulk(SWMM_Engine engine, double *buf, int count)
Get total runoff volume for all subcatchments into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:166
SWMM_ENGINE_API int swmm_stat_link_max_flow(SWMM_Engine engine, int idx, double *val)
Maximum flow in a link (project flow units).
Definition openswmm_statistics_impl.cpp:74
SWMM_ENGINE_API int swmm_stat_link_max_filling_bulk(SWMM_Engine engine, double *buf, int count)
Get peak depth-to-full-depth ratio for all links into a buffer.
Definition openswmm_statistics_impl.cpp:244
SWMM_ENGINE_API int swmm_stat_link_max_flow_bulk(SWMM_Engine engine, double *buf, int count)
Get maximum flow for all links into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:156
SWMM_ENGINE_API int swmm_stat_node_max_overflow(SWMM_Engine engine, int idx, double *val)
Maximum overflow rate at a node (project flow units).
Definition openswmm_statistics_impl.cpp:46
SWMM_ENGINE_API int swmm_stat_node_vol_flooded(SWMM_Engine engine, int idx, double *val)
Total volume flooded at a node (project volume units).
Definition openswmm_statistics_impl.cpp:54
SWMM_ENGINE_API int swmm_stat_subcatch_max_runoff(SWMM_Engine engine, int idx, double *val)
Maximum runoff rate from a subcatchment (project flow units).
Definition openswmm_statistics_impl.cpp:134
SWMM_ENGINE_API int swmm_stat_link_max_filling(SWMM_Engine engine, int idx, double *val)
Maximum depth/full-depth ratio in a link.
Definition openswmm_statistics_impl.cpp:90
SWMM_ENGINE_API int swmm_stat_node_time_flooded(SWMM_Engine engine, int idx, double *val)
Total time flooded at a node (hours).
Definition openswmm_statistics_impl.cpp:62
SWMM_ENGINE_API int swmm_stat_node_max_depth(SWMM_Engine engine, int idx, double *val)
Maximum depth at a node (project length units).
Definition openswmm_statistics_impl.cpp:38
SWMM_ENGINE_API int swmm_stat_link_vol_flow_bulk(SWMM_Engine engine, double *buf, int count)
Get cumulative flow volume per link into a caller-supplied buffer.
Definition openswmm_statistics_impl.cpp:254
SWMM_ENGINE_API int swmm_stat_subcatch_runoff_vol(SWMM_Engine engine, int idx, double *val)
Total runoff volume from a subcatchment (project volume units).
Definition openswmm_statistics_impl.cpp:126