OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm_callbacks.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
42
43#ifndef OPENSWMM_ENGINE_CALLBACKS_H
44#define OPENSWMM_ENGINE_CALLBACKS_H
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
51typedef void* SWMM_Engine;
52
53/* =========================================================================
54 * Progress callback
55 * ========================================================================= */
56
81typedef void (*SWMM_ProgressCallback)(
82 SWMM_Engine engine,
83 double elapsed_frac,
84 double sim_time,
85 void* user_data
86);
87
88/* =========================================================================
89 * Warning / error callback
90 * ========================================================================= */
91
106typedef void (*SWMM_WarningCallback)(
107 SWMM_Engine engine,
108 int code,
109 const char* message,
110 void* user_data
111);
112
113/* =========================================================================
114 * Timestep begin/end callbacks
115 * ========================================================================= */
116
129 SWMM_Engine engine,
130 double sim_time,
131 double dt,
132 void* user_data
133);
134
146typedef void (*SWMM_StepEndCallback)(
147 SWMM_Engine engine,
148 double sim_time,
149 double dt,
150 void* user_data
151);
152
153/* =========================================================================
154 * Plugin event callbacks (fired by the plugin system)
155 * ========================================================================= */
156
167 SWMM_Engine engine,
168 const char* plugin_id,
169 int old_state,
170 int new_state,
171 void* user_data
172);
173
174/* =========================================================================
175 * Hot start callbacks
176 * ========================================================================= */
177
189 SWMM_Engine engine,
190 const char* object_type,
191 const char* object_id,
192 void* user_data
193);
194
195#ifdef __cplusplus
196} /* extern "C" */
197#endif
198
199#endif /* OPENSWMM_ENGINE_CALLBACKS_H */
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:51
void(* SWMM_PluginStateCallback)(SWMM_Engine engine, const char *plugin_id, int old_state, int new_state, void *user_data)
Called when a plugin changes state.
Definition openswmm_callbacks.h:166
void(* SWMM_HotStartMissingCallback)(SWMM_Engine engine, const char *object_type, const char *object_id, void *user_data)
Called for each object that was missing when applying a hot start.
Definition openswmm_callbacks.h:188
void(* SWMM_StepBeginCallback)(SWMM_Engine engine, double sim_time, double dt, void *user_data)
Called at the beginning of each simulation timestep, before physics.
Definition openswmm_callbacks.h:128
void(* SWMM_WarningCallback)(SWMM_Engine engine, int code, const char *message, void *user_data)
Called when the engine emits a warning or non-fatal error.
Definition openswmm_callbacks.h:106
void(* SWMM_StepEndCallback)(SWMM_Engine engine, double sim_time, double dt, void *user_data)
Called at the end of each simulation timestep, after physics.
Definition openswmm_callbacks.h:146
void(* SWMM_ProgressCallback)(SWMM_Engine engine, double elapsed_frac, double sim_time, void *user_data)
Called after each simulation timestep to report progress.
Definition openswmm_callbacks.h:81