![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
OpenSWMM Engine — Output File Reader C API. More...
#include "openswmm_engine_export.h"Go to the source code of this file.
Typedefs | |
| typedef void * | SWMM_Output |
| Opaque handle to an opened output file reader. | |
| typedef enum SWMM_OutSubcatchVar | SWMM_OutSubcatchVar |
| Subcatchment result variable indices. | |
| typedef enum SWMM_OutNodeVar | SWMM_OutNodeVar |
| typedef enum SWMM_OutLinkVar | SWMM_OutLinkVar |
| Link result variable indices. | |
| typedef enum SWMM_OutSystemVar | SWMM_OutSystemVar |
| System-wide result variable indices. | |
Functions | |
| SWMM_ENGINE_API int | swmm_output_get_pollut_units (SWMM_Output handle, int index) |
| Read a species column stored concentration-unit code. | |
| SWMM_ENGINE_API int | swmm_output_has_subcatch_variable (SWMM_Output handle, int code) |
| Node result variable indices. | |
| SWMM_ENGINE_API SWMM_Output | swmm_output_open (const char *path) |
| Allocate a reader for a binary output with a valid closing footer. | |
| SWMM_ENGINE_API SWMM_Output | swmm_output_open_live (const char *path) |
| Allocate a reader for the complete records of an output still being written. | |
| SWMM_ENGINE_API int | swmm_output_refresh (SWMM_Output handle, int *periods) |
| Update whole-period count and adopt a final footer on a live reader. | |
| SWMM_ENGINE_API int | swmm_output_is_live (SWMM_Output handle) |
| Read whether the output reader is still using live record counting. | |
| SWMM_ENGINE_API void | swmm_output_close (SWMM_Output handle) |
| Close the file and delete its independent output-reader handle. | |
| SWMM_ENGINE_API int | swmm_output_get_version (SWMM_Output handle) |
| Read the output writer version. | |
| SWMM_ENGINE_API int | swmm_output_get_flow_units (SWMM_Output handle) |
| Read the output file flow-unit selector. | |
| SWMM_ENGINE_API int | swmm_output_get_subcatch_count (SWMM_Output handle) |
| Read the output subcatchment count. | |
| SWMM_ENGINE_API int | swmm_output_get_node_count (SWMM_Output handle) |
| Read the output node count. | |
| SWMM_ENGINE_API int | swmm_output_get_link_count (SWMM_Output handle) |
| Read the output link count. | |
| SWMM_ENGINE_API int | swmm_output_get_pollut_count (SWMM_Output handle) |
| Read the output species-column count. | |
| SWMM_ENGINE_API int | swmm_output_get_period_count (SWMM_Output handle) |
| Read the output currently known whole-report count. | |
| SWMM_ENGINE_API int | swmm_output_get_start_date (SWMM_Output handle, double *start_date) |
| Read the calendar baseline stored in output report metadata. | |
| SWMM_ENGINE_API int | swmm_output_get_report_step (SWMM_Output handle) |
| Read the output configured reporting interval. | |
| SWMM_ENGINE_API const char * | swmm_output_get_subcatch_id (SWMM_Output handle, int index) |
| Borrow a subcatchment identifier from the output header. | |
| SWMM_ENGINE_API const char * | swmm_output_get_node_id (SWMM_Output handle, int index) |
| Borrow a node identifier from the output header. | |
| SWMM_ENGINE_API const char * | swmm_output_get_link_id (SWMM_Output handle, int index) |
| Borrow a link identifier from the output header. | |
| SWMM_ENGINE_API const char * | swmm_output_get_pollut_id (SWMM_Output handle, int index) |
| Borrow a species identifier from the output header. | |
| SWMM_ENGINE_API int | swmm_output_get_subcatch_result (SWMM_Output handle, int period, int var, float *values) |
| Read one subcatchment variable for all subcatchment rows at one period. | |
| SWMM_ENGINE_API int | swmm_output_get_node_result (SWMM_Output handle, int period, int var, float *values) |
| Read one node variable for all node rows at one period. | |
| SWMM_ENGINE_API int | swmm_output_get_link_result (SWMM_Output handle, int period, int var, float *values) |
| Read one link variable for all link rows at one period. | |
| SWMM_ENGINE_API int | swmm_output_get_system_result (SWMM_Output handle, int period, int var, float *value) |
| Read one system variable for the system at one 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) |
| Read a closed range of subcatchment report samples. | |
| 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) |
| Read a closed range of node report samples. | |
| 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) |
| Read a closed range of link report samples. | |
| SWMM_ENGINE_API int | swmm_output_get_system_series (SWMM_Output handle, int var, int start_period, int end_period, float *values) |
| Read a closed range of system report samples. | |
| SWMM_ENGINE_API int | swmm_output_get_subcatch_attribute (SWMM_Output handle, int subcatch_idx, int period, float *values, int *count) |
| Read subcatchment variables at one report record. | |
| SWMM_ENGINE_API int | swmm_output_get_node_attribute (SWMM_Output handle, int node_idx, int period, float *values, int *count) |
| Read node variables at one report record. | |
| SWMM_ENGINE_API int | swmm_output_get_link_attribute (SWMM_Output handle, int link_idx, int period, float *values, int *count) |
| Read link variables at one report record. | |
| SWMM_ENGINE_API int | swmm_output_get_period_time (SWMM_Output handle, int period, double *time) |
| Read the exact calendar timestamp of one report record. | |
| SWMM_ENGINE_API int | swmm_output_get_node_stat_max_depth (SWMM_Output handle, int node_idx, double *value) |
| Reconstruct node maximum reported depth from report records. | |
| SWMM_ENGINE_API int | swmm_output_get_node_stat_max_overflow (SWMM_Output handle, int node_idx, double *value) |
| Reconstruct node maximum reported overflow from report records. | |
| SWMM_ENGINE_API int | swmm_output_get_node_stat_vol_flooded (SWMM_Output handle, int node_idx, double *value) |
| Reconstruct node report-sampled flooding integral from report records. | |
| SWMM_ENGINE_API int | swmm_output_get_node_stat_time_flooded (SWMM_Output handle, int node_idx, double *value) |
| Reconstruct node report-sampled flooding duration from report records. | |
| SWMM_ENGINE_API int | swmm_output_get_error_code (SWMM_Output handle) |
| Read the output simulation footer error. | |
OpenSWMM Engine — Output File Reader C API.
Provides a transparent C89-compatible API for reading binary output files (.out) produced by the DefaultOutputPlugin. The binary format is the standard SWMM 5.x output format containing:
Usage:
| typedef enum SWMM_OutLinkVar SWMM_OutLinkVar |
Link result variable indices.
Variables stored per link per output period. Pollutant concentrations follow at indices >= SWMM_OUT_LINK_POLLUT_BASE.
| typedef enum SWMM_OutNodeVar SWMM_OutNodeVar |
| typedef void* SWMM_Output |
Opaque handle to an opened output file reader.
| typedef enum SWMM_OutSubcatchVar SWMM_OutSubcatchVar |
Subcatchment result variable indices.
Variables stored per subcatchment per output period. Pollutant concentrations follow at indices >= SWMM_OUT_SUBCATCH_POLLUT_BASE.
| typedef enum SWMM_OutSystemVar SWMM_OutSystemVar |
System-wide result variable indices.
15 system-wide summary results stored per output period, in the slot order the .out writer uses (legacy SWMM 5 SysResults order).
| enum SWMM_OutLinkVar |
Link result variable indices.
Variables stored per link per output period. Pollutant concentrations follow at indices >= SWMM_OUT_LINK_POLLUT_BASE.
| enum SWMM_OutNodeVar |
| enum SWMM_OutSubcatchVar |
Subcatchment result variable indices.
Variables stored per subcatchment per output period. Pollutant concentrations follow at indices >= SWMM_OUT_SUBCATCH_POLLUT_BASE.
| enum SWMM_OutSystemVar |
System-wide result variable indices.
15 system-wide summary results stored per output period, in the slot order the .out writer uses (legacy SWMM 5 SysResults order).
| SWMM_ENGINE_API void swmm_output_close | ( | SWMM_Output | handle | ) |
Close the file and delete its independent output-reader handle.
All borrowed ID strings become invalid. Does not close or alter a separate simulation-engine handle.
| [in] | handle | Caller-owned live reader, or NULL for a no-op. Do not use afterward, close twice or close concurrently with another read. |
| SWMM_ENGINE_API int swmm_output_get_error_code | ( | SWMM_Output | handle | ) |
Read the output simulation footer error.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API int swmm_output_get_flow_units | ( | SWMM_Output | handle | ) |
Read the output file flow-unit selector.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API int swmm_output_get_link_attribute | ( | SWMM_Output | handle, |
| int | link_idx, | ||
| int | period, | ||
| float * | values, | ||
| int * | count ) |
Read link variables at one report record.
Values are in stored column order and each field retains its file unit. Provide enough space before calling; optional snow extensions are accessed by code through the subcatchment result/series APIs.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | link_idx | Zero-based link index in this output file. |
| [in] | period | Zero-based index in [0,swmm_output_get_period_count(handle)). Live readers require refresh to discover new whole records. |
| [out] | values | Non-null caller-owned destination sized for the full link-variable count floats (normally 5+species count). |
| [out] | count | Optional number of variables written, set only after the entire record read succeeds; this is not an input capacity or size-query mode. |
| SWMM_ENGINE_API int swmm_output_get_link_count | ( | SWMM_Output | handle | ) |
Read the output link count.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API const char * swmm_output_get_link_id | ( | SWMM_Output | handle, |
| int | index ) |
Borrow a link identifier from the output header.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | index | Zero-based link index in this file, independent of a model engine row order. |
| SWMM_ENGINE_API int swmm_output_get_link_result | ( | SWMM_Output | handle, |
| int | period, | ||
| int | var, | ||
| float * | values ) |
Read one link variable for all link rows at one period.
Values retain the file display-unit convention; optional UEB snow variables use their documented SI units. Reserved species use hours/degrees C. This API has no buffer-capacity argument, so allocation size is the caller responsibility.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | period | Zero-based index in [0,swmm_output_get_period_count(handle)). Live readers require refresh to discover new whole records. |
| [in] | var | SWMM_OutLinkVar variable index, including supported species slots for node/link results. |
| [out] | values | Non-null caller-owned array of at least this file's link count floats, in file object order. |
| 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 ) |
Read a closed range of link report samples.
The range endpoints are both inclusive. Returns stored reporting samples without temporal interpolation or automatic live refresh.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | link_idx | Zero-based link index in this output file. |
| [in] | var | SWMM_OutLinkVar variable index, including supported species slots for node/link results. |
| [in] | start_period | Inclusive first period, >=0 and <=end_period. |
| [in] | end_period | Inclusive last period, less than the currently known period count. |
| [out] | values | Non-null caller-owned array of end_period-start_period+1 floats, ordered chronologically in file display/extension units. |
| SWMM_ENGINE_API int swmm_output_get_node_attribute | ( | SWMM_Output | handle, |
| int | node_idx, | ||
| int | period, | ||
| float * | values, | ||
| int * | count ) |
Read node variables at one report record.
Values are in stored column order and each field retains its file unit. Provide enough space before calling; optional snow extensions are accessed by code through the subcatchment result/series APIs.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | node_idx | Zero-based node index in this output file. |
| [in] | period | Zero-based index in [0,swmm_output_get_period_count(handle)). Live readers require refresh to discover new whole records. |
| [out] | values | Non-null caller-owned destination sized for the full node-variable count floats (normally 6+species count). |
| [out] | count | Optional number of variables written, set only after the entire record read succeeds; this is not an input capacity or size-query mode. |
| SWMM_ENGINE_API int swmm_output_get_node_count | ( | SWMM_Output | handle | ) |
Read the output node count.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API const char * swmm_output_get_node_id | ( | SWMM_Output | handle, |
| int | index ) |
Borrow a node identifier from the output header.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | index | Zero-based node index in this file, independent of a model engine row order. |
| SWMM_ENGINE_API int swmm_output_get_node_result | ( | SWMM_Output | handle, |
| int | period, | ||
| int | var, | ||
| float * | values ) |
Read one node variable for all node rows at one period.
Values retain the file display-unit convention; optional UEB snow variables use their documented SI units. Reserved species use hours/degrees C. This API has no buffer-capacity argument, so allocation size is the caller responsibility.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | period | Zero-based index in [0,swmm_output_get_period_count(handle)). Live readers require refresh to discover new whole records. |
| [in] | var | SWMM_OutNodeVar variable index, including supported species slots for node/link results. |
| [out] | values | Non-null caller-owned array of at least this file's node count floats, in file object order. |
| 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 ) |
Read a closed range of node report samples.
The range endpoints are both inclusive. Returns stored reporting samples without temporal interpolation or automatic live refresh.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | node_idx | Zero-based node index in this output file. |
| [in] | var | SWMM_OutNodeVar variable index, including supported species slots for node/link results. |
| [in] | start_period | Inclusive first period, >=0 and <=end_period. |
| [in] | end_period | Inclusive last period, less than the currently known period count. |
| [out] | values | Non-null caller-owned array of end_period-start_period+1 floats, ordered chronologically in file display/extension units. |
| SWMM_ENGINE_API int swmm_output_get_node_stat_max_depth | ( | SWMM_Output | handle, |
| int | node_idx, | ||
| double * | value ) |
Reconstruct node maximum reported depth from report records.
Maximum over the currently known report samples. Scans O(period count) samples per call and may miss short events; use engine routing-step statistics when that precision is required.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | node_idx | Zero-based node index in this output file. |
| [out] | value | Non-null destination in file display length (ft US, m SI); zero when there are no report periods, unchanged on validation/read failure. |
| SWMM_ENGINE_API int swmm_output_get_node_stat_max_overflow | ( | SWMM_Output | handle, |
| int | node_idx, | ||
| double * | value ) |
Reconstruct node maximum reported overflow from report records.
Maximum over the currently known report samples. Scans O(period count) samples per call and may miss short events; use engine routing-step statistics when that precision is required.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | node_idx | Zero-based node index in this output file. |
| [out] | value | Non-null destination in file flow units selected by swmm_output_get_flow_units(); zero when there are no report periods, unchanged on validation/read failure. |
| SWMM_ENGINE_API int swmm_output_get_node_stat_time_flooded | ( | SWMM_Output | handle, |
| int | node_idx, | ||
| double * | value ) |
Reconstruct node report-sampled flooding duration from report records.
Counts positive-overflow report records and multiplies by report-step seconds. Counts full report intervals; it does not reconstruct sub-report-step onset/duration. Scans O(period count) samples per call and may miss short events; use engine routing-step statistics when that precision is required.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | node_idx | Zero-based node index in this output file. |
| [out] | value | Non-null destination in seconds; zero when there are no report periods, unchanged on validation/read failure. |
| SWMM_ENGINE_API int swmm_output_get_node_stat_vol_flooded | ( | SWMM_Output | handle, |
| int | node_idx, | ||
| double * | value ) |
Reconstruct node report-sampled flooding integral from report records.
Sums positive stored overflow*report_step with no flow-to-volume unit conversion. CFS gives ft3 and CMS gives m3; GPM/MGD/LPS/MLD outputs need caller conversion before interpreting this as a physical volume. Scans O(period count) samples per call and may miss short events; use engine routing-step statistics when that precision is required.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | node_idx | Zero-based node index in this output file. |
| [out] | value | Non-null destination in numeric file flow unit multiplied by seconds; zero when there are no report periods, unchanged on validation/read failure. |
| SWMM_ENGINE_API int swmm_output_get_period_count | ( | SWMM_Output | handle | ) |
Read the output currently known whole-report count.
A live period count does not advance automatically; call swmm_output_refresh() to discover growth.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API int swmm_output_get_period_time | ( | SWMM_Output | handle, |
| int | period, | ||
| double * | time ) |
Read the exact calendar timestamp of one report record.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | period | Zero-based index in [0,swmm_output_get_period_count(handle)). Live readers require refresh to discover new whole records. |
| [out] | time | Non-null destination for SWMM DateTime decimal days since 1899-12-30; no timezone conversion. |
| SWMM_ENGINE_API int swmm_output_get_pollut_count | ( | SWMM_Output | handle | ) |
Read the output species-column count.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API const char * swmm_output_get_pollut_id | ( | SWMM_Output | handle, |
| int | index ) |
Borrow a species identifier from the output header.
Species IDs WATER_AGE and TEMPERATURE denote hours and degrees C regardless of their stored concentration code.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | index | Zero-based species index in this file, independent of a model engine row order. |
| SWMM_ENGINE_API int swmm_output_get_pollut_units | ( | SWMM_Output | handle, |
| int | index ) |
Read a species column stored concentration-unit code.
Reserved WATER_AGE and TEMPERATURE columns reuse the concentration-unit field; identify them by species name and interpret as hours and degrees C. The unit code alone cannot identify a reserved species.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | index | Zero-based species-column index in [0,pollutant count). |
| SWMM_ENGINE_API int swmm_output_get_report_step | ( | SWMM_Output | handle | ) |
Read the output configured reporting interval.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API int swmm_output_get_start_date | ( | SWMM_Output | handle, |
| double * | start_date ) |
Read the calendar baseline stored in output report metadata.
Use actual period times for sample timestamps rather than assuming a particular origin/report-start alignment.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [out] | start_date | Non-null destination for SWMM DateTime/OADate decimal days since 1899-12-30; no timezone conversion. |
| SWMM_ENGINE_API int swmm_output_get_subcatch_attribute | ( | SWMM_Output | handle, |
| int | subcatch_idx, | ||
| int | period, | ||
| float * | values, | ||
| int * | count ) |
Read subcatchment variables at one report record.
Values are in stored column order and each field retains its file unit. Provide enough space before calling; optional snow extensions are accessed by code through the subcatchment result/series APIs.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | subcatch_idx | Zero-based subcatchment index in this output file. |
| [in] | period | Zero-based index in [0,swmm_output_get_period_count(handle)). Live readers require refresh to discover new whole records. |
| [out] | values | Non-null caller-owned destination sized for 8+pollutant count legacy floats (optional UEB process fields are excluded). |
| [out] | count | Optional number of variables written, set only after the entire record read succeeds; this is not an input capacity or size-query mode. |
| SWMM_ENGINE_API int swmm_output_get_subcatch_count | ( | SWMM_Output | handle | ) |
Read the output subcatchment count.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API const char * swmm_output_get_subcatch_id | ( | SWMM_Output | handle, |
| int | index ) |
Borrow a subcatchment identifier from the output header.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | index | Zero-based subcatchment index in this file, independent of a model engine row order. |
| SWMM_ENGINE_API int swmm_output_get_subcatch_result | ( | SWMM_Output | handle, |
| int | period, | ||
| int | var, | ||
| float * | values ) |
Read one subcatchment variable for all subcatchment rows at one period.
Values retain the file display-unit convention; optional UEB snow variables use their documented SI units. Reserved species use hours/degrees C. This API has no buffer-capacity argument, so allocation size is the caller responsibility.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | period | Zero-based index in [0,swmm_output_get_period_count(handle)). Live readers require refresh to discover new whole records. |
| [in] | var | SWMM_OutSubcatchVar variable CODE, including optional snow extension codes; not a physical column index. |
| [out] | values | Non-null caller-owned array of at least this file's subcatchment count floats, in file object order. |
| 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 ) |
Read a closed range of subcatchment report samples.
The range endpoints are both inclusive. Returns stored reporting samples without temporal interpolation or automatic live refresh.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | subcatch_idx | Zero-based subcatchment index in this output file. |
| [in] | var | SWMM_OutSubcatchVar variable CODE, including optional snow extension codes; not a physical column index. |
| [in] | start_period | Inclusive first period, >=0 and <=end_period. |
| [in] | end_period | Inclusive last period, less than the currently known period count. |
| [out] | values | Non-null caller-owned array of end_period-start_period+1 floats, ordered chronologically in file display/extension units. |
| SWMM_ENGINE_API int swmm_output_get_system_result | ( | SWMM_Output | handle, |
| int | period, | ||
| int | var, | ||
| float * | value ) |
Read one system variable for the system at one period.
Values retain the file display-unit convention; optional UEB snow variables use their documented SI units. Reserved species use hours/degrees C. This API has no buffer-capacity argument, so allocation size is the caller responsibility.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | period | Zero-based index in [0,swmm_output_get_period_count(handle)). Live readers require refresh to discover new whole records. |
| [in] | var | SWMM_OutSystemVar variable index, including supported species slots for node/link results. |
| [out] | value | Non-null caller-owned single float destination. |
| SWMM_ENGINE_API int swmm_output_get_system_series | ( | SWMM_Output | handle, |
| int | var, | ||
| int | start_period, | ||
| int | end_period, | ||
| float * | values ) |
Read a closed range of system report samples.
The range endpoints are both inclusive. Returns stored reporting samples without temporal interpolation or automatic live refresh.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | var | SWMM_OutSystemVar variable index, including supported species slots for node/link results. |
| [in] | start_period | Inclusive first period, >=0 and <=end_period. |
| [in] | end_period | Inclusive last period, less than the currently known period count. |
| [out] | values | Non-null caller-owned array of end_period-start_period+1 floats, ordered chronologically in file display/extension units. |
| SWMM_ENGINE_API int swmm_output_get_version | ( | SWMM_Output | handle | ) |
Read the output writer version.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API int swmm_output_has_subcatch_variable | ( | SWMM_Output | handle, |
| int | code ) |
Node result variable indices.
Variables stored per node per output period. Pollutant concentrations follow at indices >= SWMM_OUT_NODE_POLLUT_BASE.
Check whether a subcatchment result variable CODE is present.
Examines header codes without requiring any completed reporting period.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [in] | code | SWMM_OutSubcatchVar code, including optional UEB snow codes; not a physical column index. |
| SWMM_ENGINE_API int swmm_output_is_live | ( | SWMM_Output | handle | ) |
Read whether the output reader is still using live record counting.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| SWMM_ENGINE_API SWMM_Output swmm_output_open | ( | const char * | path | ) |
Allocate a reader for a binary output with a valid closing footer.
Opening does not imply the simulation footer error is zero; inspect swmm_output_get_error_code(). Object/species order and display units come from this output file, independently of any live model.
| [in] | path | Non-null NUL-terminated UTF-8 output path, borrowed for this call. File is opened read-only. |
| SWMM_ENGINE_API SWMM_Output swmm_output_open_live | ( | const char * | path | ) |
Allocate a reader for the complete records of an output still being written.
Forward-parses offsets and counts only whole report records; no closing footer is needed. Can inspect running or interrupted output without modifying it. Refresh later for growth; a valid final footer is adopted when it arrives.
| [in] | path | Non-null NUL-terminated UTF-8 output path with a complete parseable header; opened read-only. |
| SWMM_ENGINE_API int swmm_output_refresh | ( | SWMM_Output | handle, |
| int * | periods ) |
Update whole-period count and adopt a final footer on a live reader.
A non-live handle keeps its footer count. Live refresh sees new complete records and becomes non-live after a matching final footer appears; seek/size-query failure can return the previous count, so success does not guarantee growth. Does not retain partial report records.
| [in] | handle | Non-null live output-reader handle. Serialize access on one thread because result reads share a file cursor; release with swmm_output_close(). |
| [out] | periods | Optional destination for the current period count, written after a nonnegative refresh result. |