#include <InterfaceFile.hpp>
|
| void | init (SimulationContext &ctx) |
| | Close prior files and reset per-run interpolation/mapping metadata.
|
| |
| int | openFiles (const std::string &infile_path, const std::string &outfile_path) |
| | Open optional text routing interface streams.
|
| |
| int | readFileHeader (SimulationContext &ctx) |
| | Read interface units, constituent mapping, nodes and the first data period.
|
| |
| void | writeFileHeader (const SimulationContext &ctx) |
| | Write the routing interface header for current outlet nodes.
|
| |
| void | readInflows (SimulationContext &ctx, double current_time) |
| | Advance file periods and add interpolated flow/quality into model source arrays.
|
| |
| void | writeOutfallResults (const SimulationContext &ctx, double current_time) |
| | Append one period of selected outlet flow and pollutant results.
|
| |
| void | closeFiles () |
| | Close both owned interface streams if open.
|
| |
| double | getFlow (int node_idx, double frac) const |
| | Interpolate flow for an interface-entry index.
|
| |
| double | getQuality (int node_idx, int pollut_idx, double frac) const |
| | Interpolate a mapped pollutant concentration for an interface entry.
|
| |
| int | getNumIfaceNodes () const |
| | Get number of interface nodes currently active.
|
| |
| int | getIfaceNode (int index) const |
| | Translate an interface file entry into a project node index.
|
| |
| double | getFrac () const |
| | Get the interpolation fraction (set during readInflows)
|
| |
◆ closeFiles()
| void openswmm::iface::InterfaceManager::closeFiles |
( |
| ) |
|
Close both owned interface streams if open.
Sets handles NULL and ignores fclose results. Preserves mappings, interpolation values and times; call init for a per-run metadata reset.
◆ getFlow()
| double openswmm::iface::InterfaceManager::getFlow |
( |
int | node_idx, |
|
|
double | frac ) const |
Interpolate flow for an interface-entry index.
Requires old/new arrays sized to parsed stride. Does not read more data or verify temporal bracketing.
- Parameters
-
| [in] | node_idx | Interface file entry index, not the project node index; outside [0,getNumIfaceNodes()) returns zero. |
| [in] | frac | Interpolation fraction; normally getFrac() in [0,1], but this method does not clamp. |
- Returns
- (1-frac)*old+frac*new in internal cfs; out-of-range entry returns zero.
◆ getFrac()
| double openswmm::iface::InterfaceManager::getFrac |
( |
| ) |
const |
|
inline |
Get the interpolation fraction (set during readInflows)
◆ getIfaceNode()
| int openswmm::iface::InterfaceManager::getIfaceNode |
( |
int | index | ) |
const |
Translate an interface file entry into a project node index.
- Parameters
-
| [in] | index | Zero-based interface entry index. |
- Returns
- Mapped project node index, or -1 for out-of-range entry or unresolved node name.
◆ getNumIfaceNodes()
| int openswmm::iface::InterfaceManager::getNumIfaceNodes |
( |
| ) |
const |
|
inline |
Get number of interface nodes currently active.
◆ getQuality()
| double openswmm::iface::InterfaceManager::getQuality |
( |
int | node_idx, |
|
|
int | pollut_idx, |
|
|
double | frac ) const |
Interpolate a mapped pollutant concentration for an interface entry.
Caller ensures parsed value arrays/mapping are coherent. No pollutant unit conversion or concentration-range check.
- Parameters
-
| [in] | node_idx | Interface entry index, not project node index. |
| [in] | pollut_idx | Project pollutant index; absent or out-of-range mapping returns zero. |
| [in] | frac | Interpolation fraction, passed through without clamping. |
- Returns
- Stored-file-unit concentration, or zero for invalid entry/missing pollutant.
◆ init()
Close prior files and reset per-run interpolation/mapping metadata.
Sets active count zero, times/fraction zero and pollutant stride one; clears pollutant mapping but retains SoA vector contents and the prior flow-unit/report-step fields until a new header is parsed. Call before openFiles when reusing a manager.
- Parameters
-
| [in,out] | ctx | Context argument retained for the interface; current implementation does not read or modify it. |
◆ openFiles()
| int openswmm::iface::InterfaceManager::openFiles |
( |
const std::string & | infile_path, |
|
|
const std::string & | outfile_path ) |
Open optional text routing interface streams.
Output opens first and remains open if input later fails. Caller closes existing streams before reuse and calls closeFiles on failure/end; no destructor cleanup is declared. Path aliases are not checked for file identity.
- Parameters
-
| [in] | infile_path | UTF-8 input path; empty disables opening input. |
| [in] | outfile_path | UTF-8 output path; empty disables opening output. Existing file is truncated. |
- Returns
- 0 on success; -1 for exactly equal nonempty path strings, -2 for output-open failure, -3 for input-open failure.
◆ readFileHeader()
Read interface units, constituent mapping, nodes and the first data period.
Populates manager incrementally without rollback; unmatched node IDs map to -1, unmatched pollutants remain absent. Unknown flow-unit text falls back to CFS; pollutant unit labels are read but not converted. First-period parse failure is ignored by this method, so success is not complete data validation.
- Parameters
-
| [in,out] | ctx | Borrowed model names/counts for lookup; model data is not changed by this header parser. |
- Returns
- 0 after a syntactically accepted header; -1 for no input or header read/format refusal.
◆ readInflows()
| void openswmm::iface::InterfaceManager::readInflows |
( |
SimulationContext & | ctx, |
|
|
double | current_time ) |
Advance file periods and add interpolated flow/quality into model source arrays.
Lazily reads header if old_values is empty; header refusal closes both streams. Skips flows below FLOW_TOL and adds quality load only for positive flow and positive interpolated concentration. Input flow is converted to cfs; quality stays in file concentration units. No rollback on partial data parsing; no error code or clock advancement.
- Parameters
-
| [in,out] | ctx | Aligned model source arrays; caller clears per-step iface accumulators before this additive load. |
| [in] | current_time | Absolute OADate days, expected nondecreasing; not elapsed simulation seconds. |
◆ writeFileHeader()
| void openswmm::iface::InterfaceManager::writeFileHeader |
( |
const SimulationContext & | ctx | ) |
|
Write the routing interface header for current outlet nodes.
No-op without output stream. Lists FLOW in project display units, all pollutant labels as MG/L regardless of their configured units, then selected outlets. Uses printf IO without returning/checking write errors; does not flush.
- Parameters
-
| [in] | ctx | Borrowed aligned model options/names/type/degree arrays; report_step must be int-representable seconds. |
◆ writeOutfallResults()
| void openswmm::iface::InterfaceManager::writeOutfallResults |
( |
const SimulationContext & | ctx, |
|
|
double | current_time ) |
Append one period of selected outlet flow and pollutant results.
No-op without output stream. Writes node inflow converted from cfs to project flow units; unavailable concentration entries become zero. Uses current concentrations as stored, does not interpolate to report time or check/flush write errors.
- Parameters
-
| [in] | ctx | Borrowed model with aligned node names/inflow/type/degree arrays and optional pollutant concentration storage. |
| [in] | current_time | Absolute OADate timestamp decoded without timezone conversion. |
The documentation for this class was generated from the following files: