![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
C FFI wrapper for the OutputReader class. More...
Macros | |
| #define | CHECK_READER(h) do { if (!(h)) return -1; } while(0) |
Functions | |
| SWMM_ENGINE_API SWMM_Output | swmm_output_open (const char *path) |
| Open a binary output file for reading. | |
| SWMM_ENGINE_API void | swmm_output_close (SWMM_Output handle) |
| Close the output file and free all resources. | |
| SWMM_ENGINE_API int | swmm_output_get_version (SWMM_Output handle) |
| Get the SWMM version stored in the output file. | |
| SWMM_ENGINE_API int | swmm_output_get_flow_units (SWMM_Output handle) |
| Get the flow units code. | |
| SWMM_ENGINE_API int | swmm_output_get_subcatch_count (SWMM_Output handle) |
| Get the number of subcatchments in the output file. | |
| SWMM_ENGINE_API int | swmm_output_get_node_count (SWMM_Output handle) |
| Get the number of nodes in the output file. | |
| SWMM_ENGINE_API int | swmm_output_get_link_count (SWMM_Output handle) |
| Get the number of links in the output file. | |
| SWMM_ENGINE_API int | swmm_output_get_pollut_count (SWMM_Output handle) |
| Get the number of pollutants in the output file. | |
| SWMM_ENGINE_API int | swmm_output_get_period_count (SWMM_Output handle) |
| Get the number of reporting periods (timesteps) in the output file. | |
| SWMM_ENGINE_API int | swmm_output_get_start_date (SWMM_Output handle, double *start_date) |
| Get the simulation start date as a Julian date (double). | |
| SWMM_ENGINE_API int | swmm_output_get_report_step (SWMM_Output handle) |
| Get the report step in seconds. | |
| SWMM_ENGINE_API const char * | swmm_output_get_subcatch_id (SWMM_Output handle, int index) |
| Get the string ID of a subcatchment by index. | |
| SWMM_ENGINE_API const char * | swmm_output_get_node_id (SWMM_Output handle, int index) |
| Get the string ID of a node by index. | |
| SWMM_ENGINE_API const char * | swmm_output_get_link_id (SWMM_Output handle, int index) |
| Get the string ID of a link by index. | |
| SWMM_ENGINE_API int | swmm_output_get_subcatch_result (SWMM_Output handle, int period, int var, float *values) |
| Get one subcatchment variable for all subcatchments at a given period. | |
| SWMM_ENGINE_API int | swmm_output_get_node_result (SWMM_Output handle, int period, int var, float *values) |
| Get one node variable for all nodes at a given period. | |
| SWMM_ENGINE_API int | swmm_output_get_link_result (SWMM_Output handle, int period, int var, float *values) |
| Get one link variable for all links at a given period. | |
| SWMM_ENGINE_API int | swmm_output_get_system_result (SWMM_Output handle, int period, int var, float *value) |
| Get system-wide results at a given period. | |
| SWMM_ENGINE_API int | swmm_output_get_subcatch_series (SWMM_Output handle, int subcatch_idx, int var, int start_period, int end_period, float *values) |
| Get a subcatchment variable time series across a range of periods. | |
| SWMM_ENGINE_API int | swmm_output_get_node_series (SWMM_Output handle, int node_idx, int var, int start_period, int end_period, float *values) |
| Get a node variable time series across a range of periods. | |
| SWMM_ENGINE_API int | swmm_output_get_link_series (SWMM_Output handle, int link_idx, int var, int start_period, int end_period, float *values) |
| Get a link variable time series across a range of periods. | |
| SWMM_ENGINE_API int | swmm_output_get_system_series (SWMM_Output handle, int var, int start_period, int end_period, float *values) |
| Get a system variable time series across a range of periods. | |
| SWMM_ENGINE_API int | swmm_output_get_subcatch_attribute (SWMM_Output handle, int subcatch_idx, int period, float *values, int *count) |
| Get all result variables for a single subcatchment at one period. | |
| SWMM_ENGINE_API int | swmm_output_get_node_attribute (SWMM_Output handle, int node_idx, int period, float *values, int *count) |
| Get all result variables for a single node at one period. | |
| SWMM_ENGINE_API int | swmm_output_get_link_attribute (SWMM_Output handle, int link_idx, int period, float *values, int *count) |
| Get all result variables for a single link at one period. | |
| SWMM_ENGINE_API int | swmm_output_get_period_time (SWMM_Output handle, int period, double *time) |
| Get the simulation time (Julian date) for a given period. | |
| SWMM_ENGINE_API int | swmm_output_get_error_code (SWMM_Output handle) |
| Get the error code stored in the output file footer. | |
C FFI wrapper for the OutputReader class.
Maps the C API declared in openswmm_output.h to the C++ OutputReader implementation. Each function casts the opaque SWMM_Output handle to an OutputReader pointer.
| #define CHECK_READER | ( | h | ) | do { if (!(h)) return -1; } while(0) |
| SWMM_ENGINE_API void swmm_output_close | ( | SWMM_Output | handle | ) |
Close the output file and free all resources.
| handle | Output reader handle (NULL safe). |
| SWMM_ENGINE_API int swmm_output_get_error_code | ( | SWMM_Output | handle | ) |
Get the error code stored in the output file footer.
| handle | Output reader handle. |
| SWMM_ENGINE_API int swmm_output_get_flow_units | ( | SWMM_Output | handle | ) |
Get the flow units code.
| handle | Output reader handle. |
| SWMM_ENGINE_API int swmm_output_get_link_attribute | ( | SWMM_Output | handle, |
| int | link_idx, | ||
| int | period, | ||
| float * | values, | ||
| int * | count | ||
| ) |
Get all result variables for a single link at one period.
| handle | Output reader handle. |
| link_idx | Zero-based link index. |
| period | Zero-based period index. |
| values | Caller-allocated array of n_link_vars floats. |
| count | Pointer to receive the number of variables written. |
| SWMM_ENGINE_API int swmm_output_get_link_count | ( | SWMM_Output | handle | ) |
Get the number of links in the output file.
| handle | Output reader handle. |
| SWMM_ENGINE_API const char * swmm_output_get_link_id | ( | SWMM_Output | handle, |
| int | index | ||
| ) |
Get the string ID of a link by index.
| handle | Output reader handle. |
| index | Zero-based link index. |
| SWMM_ENGINE_API int swmm_output_get_link_result | ( | SWMM_Output | handle, |
| int | period, | ||
| int | var, | ||
| float * | values | ||
| ) |
Get one link variable for all links at a given period.
| handle | Output reader handle. |
| period | Zero-based period index. |
| var | Link variable (see SWMM_OutLinkVar). |
| values | Caller-allocated array of at least link_count floats. |
| SWMM_ENGINE_API int swmm_output_get_link_series | ( | SWMM_Output | handle, |
| int | link_idx, | ||
| int | var, | ||
| int | start_period, | ||
| int | end_period, | ||
| float * | values | ||
| ) |
Get a link variable time series across a range of periods.
| handle | Output reader handle. |
| link_idx | Zero-based link index. |
| var | Link variable. |
| start_period | First period (inclusive, zero-based). |
| end_period | Last period (inclusive, zero-based). |
| values | Caller-allocated array of (end_period - start_period + 1) floats. |
| SWMM_ENGINE_API int swmm_output_get_node_attribute | ( | SWMM_Output | handle, |
| int | node_idx, | ||
| int | period, | ||
| float * | values, | ||
| int * | count | ||
| ) |
Get all result variables for a single node at one period.
| handle | Output reader handle. |
| node_idx | Zero-based node index. |
| period | Zero-based period index. |
| values | Caller-allocated array of n_node_vars floats. |
| count | Pointer to receive the number of variables written. |
| SWMM_ENGINE_API int swmm_output_get_node_count | ( | SWMM_Output | handle | ) |
Get the number of nodes in the output file.
| handle | Output reader handle. |
| SWMM_ENGINE_API const char * swmm_output_get_node_id | ( | SWMM_Output | handle, |
| int | index | ||
| ) |
Get the string ID of a node by index.
| handle | Output reader handle. |
| index | Zero-based node index. |
| SWMM_ENGINE_API int swmm_output_get_node_result | ( | SWMM_Output | handle, |
| int | period, | ||
| int | var, | ||
| float * | values | ||
| ) |
Get one node variable for all nodes at a given period.
| handle | Output reader handle. |
| period | Zero-based period index. |
| var | Node variable (see SWMM_OutNodeVar). |
| values | Caller-allocated array of at least node_count floats. |
| SWMM_ENGINE_API int swmm_output_get_node_series | ( | SWMM_Output | handle, |
| int | node_idx, | ||
| int | var, | ||
| int | start_period, | ||
| int | end_period, | ||
| float * | values | ||
| ) |
Get a node variable time series across a range of periods.
| handle | Output reader handle. |
| node_idx | Zero-based node index. |
| var | Node variable. |
| start_period | First period (inclusive, zero-based). |
| end_period | Last period (inclusive, zero-based). |
| values | Caller-allocated array of (end_period - start_period + 1) floats. |
| SWMM_ENGINE_API int swmm_output_get_period_count | ( | SWMM_Output | handle | ) |
Get the number of reporting periods (timesteps) in the output file.
| handle | Output reader handle. |
| SWMM_ENGINE_API int swmm_output_get_period_time | ( | SWMM_Output | handle, |
| int | period, | ||
| double * | time | ||
| ) |
Get the simulation time (Julian date) for a given period.
| handle | Output reader handle. |
| period | Zero-based period index. |
| time | Pointer to receive the simulation time as a double (Julian date). |
| SWMM_ENGINE_API int swmm_output_get_pollut_count | ( | SWMM_Output | handle | ) |
Get the number of pollutants in the output file.
| handle | Output reader handle. |
| SWMM_ENGINE_API int swmm_output_get_report_step | ( | SWMM_Output | handle | ) |
Get the report step in seconds.
| handle | Output reader handle. |
| SWMM_ENGINE_API int swmm_output_get_start_date | ( | SWMM_Output | handle, |
| double * | start_date | ||
| ) |
Get the simulation start date as a Julian date (double).
| handle | Output reader handle. |
| start_date | Pointer to receive the start date value. |
| SWMM_ENGINE_API int swmm_output_get_subcatch_attribute | ( | SWMM_Output | handle, |
| int | subcatch_idx, | ||
| int | period, | ||
| float * | values, | ||
| int * | count | ||
| ) |
Get all result variables for a single subcatchment at one period.
| handle | Output reader handle. |
| subcatch_idx | Zero-based subcatchment index. |
| period | Zero-based period index. |
| values | Caller-allocated array of n_subcatch_vars floats. |
| count | Pointer to receive the number of variables written. |
| SWMM_ENGINE_API int swmm_output_get_subcatch_count | ( | SWMM_Output | handle | ) |
Get the number of subcatchments in the output file.
| handle | Output reader handle. |
| SWMM_ENGINE_API const char * swmm_output_get_subcatch_id | ( | SWMM_Output | handle, |
| int | index | ||
| ) |
Get the string ID of a subcatchment by index.
| handle | Output reader handle. |
| index | Zero-based subcatchment index. |
| SWMM_ENGINE_API int swmm_output_get_subcatch_result | ( | SWMM_Output | handle, |
| int | period, | ||
| int | var, | ||
| float * | values | ||
| ) |
Get one subcatchment variable for all subcatchments at a given period.
| handle | Output reader handle. |
| period | Zero-based period index. |
| var | Subcatchment variable (see SWMM_OutSubcatchVar). |
| values | Caller-allocated array of at least subcatch_count floats. |
| SWMM_ENGINE_API int swmm_output_get_subcatch_series | ( | SWMM_Output | handle, |
| int | subcatch_idx, | ||
| int | var, | ||
| int | start_period, | ||
| int | end_period, | ||
| float * | values | ||
| ) |
Get a subcatchment variable time series across a range of periods.
| handle | Output reader handle. |
| subcatch_idx | Zero-based subcatchment index. |
| var | Subcatchment variable. |
| start_period | First period (inclusive, zero-based). |
| end_period | Last period (inclusive, zero-based). |
| values | Caller-allocated array of (end_period - start_period + 1) floats. |
| SWMM_ENGINE_API int swmm_output_get_system_result | ( | SWMM_Output | handle, |
| int | period, | ||
| int | var, | ||
| float * | value | ||
| ) |
Get system-wide results at a given period.
| handle | Output reader handle. |
| period | Zero-based period index. |
| var | System variable (see SWMM_OutSystemVar). |
| value | Pointer to receive the single float value. |
| SWMM_ENGINE_API int swmm_output_get_system_series | ( | SWMM_Output | handle, |
| int | var, | ||
| int | start_period, | ||
| int | end_period, | ||
| float * | values | ||
| ) |
Get a system variable time series across a range of periods.
| handle | Output reader handle. |
| var | System variable. |
| start_period | First period (inclusive, zero-based). |
| end_period | Last period (inclusive, zero-based). |
| values | Caller-allocated array of (end_period - start_period + 1) floats. |
| SWMM_ENGINE_API int swmm_output_get_version | ( | SWMM_Output | handle | ) |
Get the SWMM version stored in the output file.
| handle | Output reader handle. |
| SWMM_ENGINE_API SWMM_Output swmm_output_open | ( | const char * | path | ) |
Open a binary output file for reading.
| path | Path to a .out file produced by DefaultOutputPlugin. |