|
| SWMM_ENGINE_API SWMM_Engine | swmm_engine_create (void) |
| | Create a new engine instance (SWMM_STATE_CREATED).
|
| |
| SWMM_ENGINE_API int | swmm_engine_open (SWMM_Engine engine, const char *inp, const char *rpt, const char *out) |
| | Open and parse a SWMM input file; load plugins → SWMM_STATE_OPENED.
|
| |
| SWMM_ENGINE_API int | swmm_engine_initialize (SWMM_Engine engine) |
| | Initialize the simulation → SWMM_STATE_INITIALIZED.
|
| |
| SWMM_ENGINE_API int | swmm_engine_start (SWMM_Engine engine, int save_results) |
| | Start the simulation → SWMM_STATE_STARTED.
|
| |
| SWMM_ENGINE_API int | swmm_engine_step (SWMM_Engine engine, double *elapsed_time) |
| | Advance one explicit timestep. elapsed_time==0 when done.
|
| |
| SWMM_ENGINE_API int | swmm_engine_end (SWMM_Engine engine) |
| | End the simulation → SWMM_STATE_ENDED.
|
| |
| SWMM_ENGINE_API int | swmm_engine_report (SWMM_Engine engine) |
| | Write summary report (SWMM_STATE_ENDED).
|
| |
| SWMM_ENGINE_API int | swmm_engine_close (SWMM_Engine engine) |
| | Close all files → SWMM_STATE_CLOSED.
|
| |
| SWMM_ENGINE_API void | swmm_engine_destroy (SWMM_Engine engine) |
| | Destroy the engine handle (any state, NULL safe).
|
| |
| SWMM_ENGINE_API int | swmm_engine_get_state (SWMM_Engine engine, int *state) |
| | Query the current engine lifecycle state.
|
| |
| SWMM_ENGINE_API int | swmm_set_progress_callback (SWMM_Engine engine, SWMM_ProgressCallback callback, void *user_data) |
| |
| SWMM_ENGINE_API int | swmm_set_warning_callback (SWMM_Engine engine, SWMM_WarningCallback callback, void *user_data) |
| |
| SWMM_ENGINE_API int | swmm_set_step_begin_callback (SWMM_Engine engine, SWMM_StepBeginCallback callback, void *user_data) |
| |
| SWMM_ENGINE_API int | swmm_set_step_end_callback (SWMM_Engine engine, SWMM_StepEndCallback callback, void *user_data) |
| |
| SWMM_ENGINE_API int | swmm_get_last_error (SWMM_Engine engine) |
| |
| SWMM_ENGINE_API const char * | swmm_get_last_error_msg (SWMM_Engine engine) |
| |
| SWMM_ENGINE_API const char * | swmm_error_message (int code) |
| |
| SWMM_ENGINE_API int | swmm_get_start_time (SWMM_Engine engine, double *start) |
| |
| SWMM_ENGINE_API int | swmm_get_end_time (SWMM_Engine engine, double *end) |
| |
| SWMM_ENGINE_API int | swmm_get_current_time (SWMM_Engine engine, double *current) |
| |
| SWMM_ENGINE_API int | swmm_get_routing_step (SWMM_Engine engine, double *dt) |
| |
OpenSWMM Engine — primary transparent C API (master header).
This is the main public header for the openswmm.engine library (version 6.0.0-alpha.1). It defines:
- Error / warning / state enums
- Engine lifecycle functions (create, open, init, start, step, end, close, destroy)
- Callback registration
- Simulation timing
- Error reporting
- The SWMM_ENGINE_API export macro
Domain-specific APIs are in separate headers:
- openswmm_model.h — model building, validation, serialisation, options, user flags
- openswmm_nodes.h — node creation, properties, state, forcing, bulk
- openswmm_links.h — link creation, properties, cross-sections, state, bulk
- openswmm_subcatchments.h — subcatchment creation, properties, state, bulk
- openswmm_gages.h — rain gage creation, properties, rainfall
- openswmm_massbalance.h — continuity errors and flux totals
- openswmm_hotstart.h — hot start file management
- openswmm_callbacks.h — callback typedefs
Including this header pulls in ALL of the above (master include). To use a single domain, include just that domain header.
Lifecycle
CREATED → OPENED → INITIALIZED → STARTED → [RUNNING] → ENDED → CLOSED
Programmatic model building (no .inp):
[BUILDING] → INITIALIZED → STARTED → [RUNNING] → ENDED → CLOSED
Typical usage:
double elapsed = 0.0;
}
void * SWMM_Engine
Opaque handle to an OpenSWMM Engine instance.
Definition openswmm_callbacks.h:35
OpenSWMM Engine — primary transparent C API (master header).
@ SWMM_OK
Definition openswmm_engine.h:100
SWMM_ENGINE_API int swmm_engine_end(SWMM_Engine engine)
End the simulation → SWMM_STATE_ENDED.
Definition openswmm_engine_impl.cpp:50
SWMM_ENGINE_API int swmm_engine_close(SWMM_Engine engine)
Close all files → SWMM_STATE_CLOSED.
Definition openswmm_engine_impl.cpp:60
SWMM_ENGINE_API void swmm_engine_destroy(SWMM_Engine engine)
Destroy the engine handle (any state, NULL safe).
Definition openswmm_engine_impl.cpp:65
SWMM_ENGINE_API int swmm_engine_open(SWMM_Engine engine, const char *inp, const char *rpt, const char *out)
Open and parse a SWMM input file; load plugins → SWMM_STATE_OPENED.
Definition openswmm_engine_impl.cpp:29
SWMM_ENGINE_API SWMM_Engine swmm_engine_create(void)
Create a new engine instance (SWMM_STATE_CREATED).
Definition openswmm_engine_impl.cpp:21
SWMM_ENGINE_API int swmm_engine_start(SWMM_Engine engine, int save_results)
Start the simulation → SWMM_STATE_STARTED.
Definition openswmm_engine_impl.cpp:40
SWMM_ENGINE_API int swmm_engine_report(SWMM_Engine engine)
Write summary report (SWMM_STATE_ENDED).
Definition openswmm_engine_impl.cpp:55
SWMM_ENGINE_API int swmm_engine_initialize(SWMM_Engine engine)
Initialize the simulation → SWMM_STATE_INITIALIZED.
Definition openswmm_engine_impl.cpp:35
SWMM_ENGINE_API int swmm_engine_step(SWMM_Engine engine, double *elapsed_time)
Advance one explicit timestep. elapsed_time==0 when done.
Definition openswmm_engine_impl.cpp:45
- Note
- This API maintains a C89-compatible ABI at the boundary.