37#ifndef OPENSWMM_INTERFACE_FILE_HPP
38#define OPENSWMM_INTERFACE_FILE_HPP
103 int openFiles(
const std::string& infile_path,
const std::string& outfile_path);
179 double getFlow(
int node_idx,
double frac)
const;
192 double getQuality(
int node_idx,
int pollut_idx,
double frac)
const;
206 double getFrac()
const {
return iface_frac_; }
210 FILE* infile_ =
nullptr;
211 FILE* outfile_ =
nullptr;
213 double old_time_ = 0.0;
214 double new_time_ = 0.0;
215 int n_iface_polluts_ = 0;
216 int n_values_per_node_ = 1;
217 int iface_flow_units_ = 0;
219 double iface_frac_ = 0.0;
221 std::vector<int> pollut_map_;
232 bool readNextPeriod();
Definition InterfaceFile.hpp:76
int getNumIfaceNodes() const
Get number of interface nodes currently active.
Definition InterfaceFile.hpp:195
int readFileHeader(SimulationContext &ctx)
Read interface units, constituent mapping, nodes and the first data period.
Definition InterfaceFile.cpp:131
void closeFiles()
Close both owned interface streams if open.
Definition InterfaceFile.cpp:507
void init(SimulationContext &ctx)
Close prior files and reset per-run interpolation/mapping metadata.
Definition InterfaceFile.cpp:82
double getFrac() const
Get the interpolation fraction (set during readInflows)
Definition InterfaceFile.hpp:206
void readInflows(SimulationContext &ctx, double current_time)
Advance file periods and add interpolated flow/quality into model source arrays.
Definition InterfaceFile.cpp:336
int getIfaceNode(int index) const
Translate an interface file entry into a project node index.
Definition InterfaceFile.cpp:558
void writeOutfallResults(const SimulationContext &ctx, double current_time)
Append one period of selected outlet flow and pollutant results.
Definition InterfaceFile.cpp:408
void writeFileHeader(const SimulationContext &ctx)
Write the routing interface header for current outlet nodes.
Definition InterfaceFile.cpp:451
double getFlow(int node_idx, double frac) const
Interpolate flow for an interface-entry index.
Definition InterfaceFile.cpp:522
int openFiles(const std::string &infile_path, const std::string &outfile_path)
Open optional text routing interface streams.
Definition InterfaceFile.cpp:102
double getQuality(int node_idx, int pollut_idx, double frac) const
Interpolate a mapped pollutant concentration for an interface entry.
Definition InterfaceFile.cpp:536
Definition InterfaceFile.cpp:61
Definition ExchangeLaw.hpp:60
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
Definition InterfaceFile.hpp:54
std::vector< int > node_idx
Node indices in this model.
Definition InterfaceFile.hpp:56
void resize(int n)
Replace interface-node mappings while retaining value arrays.
Definition InterfaceFile.cpp:70
std::vector< double > new_values
Current timestep values (flow + polluts per node)
Definition InterfaceFile.hpp:58
int count
Definition InterfaceFile.hpp:55
std::vector< double > old_values
Previous timestep values (flow + polluts per node)
Definition InterfaceFile.hpp:57