![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Reads SWMM 5.x binary .out files produced by DefaultOutputPlugin. More...
#include <OutputReader.hpp>
Public Member Functions | |
| OutputReader ()=default | |
| ~OutputReader () | |
| OutputReader (const OutputReader &)=delete | |
| OutputReader & | operator= (const OutputReader &)=delete |
| bool | open (const char *path) |
| Open and parse the header/footer of a binary output file. | |
| bool | openLive (const char *path) |
| Open a file that is still being written (no footer yet). | |
| int | refresh () |
| Re-count periods on a live file. | |
| bool | is_live () const noexcept |
| True while opened via openLive() and the footer has not yet been seen. | |
| void | close () |
| Close the file and release resources. | |
| bool | is_open () const noexcept |
| Whether the reader has a file open and valid. | |
| int | version () const noexcept |
| int | flow_units () const noexcept |
| int | subcatch_count () const noexcept |
| int | node_count () const noexcept |
| int | link_count () const noexcept |
| int | pollut_count () const noexcept |
| int | period_count () const noexcept |
| double | start_date () const noexcept |
| int | report_step () const noexcept |
| int | error_code () const noexcept |
| int | subcatch_var_count () const noexcept |
| int | node_var_count () const noexcept |
| int | link_var_count () const noexcept |
| int | system_var_count () const noexcept |
| const char * | subcatch_id (int index) const |
| const char * | node_id (int index) const |
| const char * | link_id (int index) const |
| const char * | pollut_id (int index) const |
| Species (pollutant) ID at a column index, or nullptr. | |
| bool | get_subcatch_result (int period, int var, float *values) const |
| Read one subcatch variable for all subcatchments at a period. | |
| bool | get_node_result (int period, int var, float *values) const |
| Read one node variable for all nodes at a period. | |
| bool | get_link_result (int period, int var, float *values) const |
| Read one link variable for all links at a period. | |
| bool | get_system_result (int period, int var, float *value) const |
| Read one system variable at a period. | |
| bool | get_subcatch_series (int obj_idx, int var, int start_period, int end_period, float *values) const |
| bool | get_node_series (int obj_idx, int var, int start_period, int end_period, float *values) const |
| bool | get_link_series (int obj_idx, int var, int start_period, int end_period, float *values) const |
| bool | get_system_series (int var, int start_period, int end_period, float *values) const |
| bool | get_subcatch_attribute (int obj_idx, int period, float *values, int *count) const |
| All variables for one subcatchment at one period. | |
| bool | get_node_attribute (int obj_idx, int period, float *values, int *count) const |
| All variables for one node at one period. | |
| bool | get_link_attribute (int obj_idx, int period, float *values, int *count) const |
| All variables for one link at one period. | |
| bool | get_period_time (int period, double *time) const |
| Get the simulation time for a given period. | |
| bool | get_node_stat_max_depth (int node_idx, double *value) const |
| bool | get_node_stat_max_overflow (int node_idx, double *value) const |
| bool | get_node_stat_vol_flooded (int node_idx, double *value) const |
| bool | get_node_stat_time_flooded (int node_idx, double *value) const |
Reads SWMM 5.x binary .out files produced by DefaultOutputPlugin.
|
default |
| openswmm::OutputReader::~OutputReader | ( | ) |
|
delete |
| void openswmm::OutputReader::close | ( | ) |
Close the file and release resources.
|
inlinenoexcept |
|
inlinenoexcept |
| bool openswmm::OutputReader::get_link_attribute | ( | int | obj_idx, |
| int | period, | ||
| float * | values, | ||
| int * | count ) const |
All variables for one link at one period.
| bool openswmm::OutputReader::get_link_result | ( | int | period, |
| int | var, | ||
| float * | values ) const |
Read one link variable for all links at a period.
| bool openswmm::OutputReader::get_link_series | ( | int | obj_idx, |
| int | var, | ||
| int | start_period, | ||
| int | end_period, | ||
| float * | values ) const |
| bool openswmm::OutputReader::get_node_attribute | ( | int | obj_idx, |
| int | period, | ||
| float * | values, | ||
| int * | count ) const |
All variables for one node at one period.
| bool openswmm::OutputReader::get_node_result | ( | int | period, |
| int | var, | ||
| float * | values ) const |
Read one node variable for all nodes at a period.
| bool openswmm::OutputReader::get_node_series | ( | int | obj_idx, |
| int | var, | ||
| int | start_period, | ||
| int | end_period, | ||
| float * | values ) const |
| bool openswmm::OutputReader::get_node_stat_max_depth | ( | int | node_idx, |
| double * | value ) const |
| bool openswmm::OutputReader::get_node_stat_max_overflow | ( | int | node_idx, |
| double * | value ) const |
| bool openswmm::OutputReader::get_node_stat_time_flooded | ( | int | node_idx, |
| double * | value ) const |
| bool openswmm::OutputReader::get_node_stat_vol_flooded | ( | int | node_idx, |
| double * | value ) const |
| bool openswmm::OutputReader::get_period_time | ( | int | period, |
| double * | time ) const |
Get the simulation time for a given period.
| bool openswmm::OutputReader::get_subcatch_attribute | ( | int | obj_idx, |
| int | period, | ||
| float * | values, | ||
| int * | count ) const |
All variables for one subcatchment at one period.
| bool openswmm::OutputReader::get_subcatch_result | ( | int | period, |
| int | var, | ||
| float * | values ) const |
Read one subcatch variable for all subcatchments at a period.
| period | Zero-based period index. |
| var | Variable index within the subcatch result block. |
| values | Caller-allocated array of subcatch_count floats. |
| bool openswmm::OutputReader::get_subcatch_series | ( | int | obj_idx, |
| int | var, | ||
| int | start_period, | ||
| int | end_period, | ||
| float * | values ) const |
| bool openswmm::OutputReader::get_system_result | ( | int | period, |
| int | var, | ||
| float * | value ) const |
Read one system variable at a period.
| bool openswmm::OutputReader::get_system_series | ( | int | var, |
| int | start_period, | ||
| int | end_period, | ||
| float * | values ) const |
|
inlinenoexcept |
True while opened via openLive() and the footer has not yet been seen.
|
inlinenoexcept |
Whether the reader has a file open and valid.
|
inlinenoexcept |
| const char * openswmm::OutputReader::link_id | ( | int | index | ) | const |
|
inlinenoexcept |
|
inlinenoexcept |
| const char * openswmm::OutputReader::node_id | ( | int | index | ) | const |
|
inlinenoexcept |
| bool openswmm::OutputReader::open | ( | const char * | path | ) |
Open and parse the header/footer of a binary output file.
| path | File path to the .out file. |
| bool openswmm::OutputReader::openLive | ( | const char * | path | ) |
Open a file that is still being written (no footer yet).
Every offset the footer would supply is derived by parsing the header forward, and the period count is derived from the file size: floor((size - output_start) / bytes_per_period), so a partially flushed last record is never counted. Call refresh() to pick up periods appended since. Works on any file with a complete header — including one from a run that died before writing its footer. Never writes to the file.
|
delete |
|
inlinenoexcept |
|
inlinenoexcept |
| const char * openswmm::OutputReader::pollut_id | ( | int | index | ) | const |
Species (pollutant) ID at a column index, or nullptr.
The writer has always emitted a fourth ID list after the link IDs — the species names, one per pollutant column — but the reader stopped after three and no public entry point exposed them. Water age reports as a trailing __WATER_AGE__ column whose unit field necessarily reuses a concentration code (the .out unit enum has no HOURS slot), so the NAME is the only way a consumer can tell hours from mg/L. That made this reader a prerequisite for water age being usable at all, not a convenience.
| int openswmm::OutputReader::refresh | ( | ) |
Re-count periods on a live file.
Re-reads the file size and updates period_count(). When the footer has appeared (the run finished) it is adopted — period count and error code become the writer's own — and the reader leaves live mode; subsequent calls are no-ops. On a reader opened with open() this returns period_count() unchanged.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
| const char * openswmm::OutputReader::subcatch_id | ( | int | index | ) | const |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |