21#ifndef OPENSWMM_INTERFACE_FILE_HPP
22#define OPENSWMM_INTERFACE_FILE_HPP
56 int openFiles(
const std::string& infile_path,
const std::string& outfile_path);
75 double getFlow(
int node_idx,
double frac)
const;
78 double getQuality(
int node_idx,
int pollut_idx,
double frac)
const;
87 double getFrac()
const {
return iface_frac_; }
91 FILE* infile_ =
nullptr;
92 FILE* outfile_ =
nullptr;
94 double old_time_ = 0.0;
95 double new_time_ = 0.0;
96 int n_iface_polluts_ = 0;
97 int n_values_per_node_ = 1;
98 int iface_flow_units_ = 0;
100 double iface_frac_ = 0.0;
102 std::vector<int> pollut_map_;
105 bool readNextPeriod();
Definition InterfaceFile.hpp:51
int getNumIfaceNodes() const
Get number of interface nodes currently active.
Definition InterfaceFile.hpp:81
int readFileHeader(SimulationContext &ctx)
Definition InterfaceFile.cpp:112
void closeFiles()
Close all interface files.
Definition InterfaceFile.cpp:435
void init(SimulationContext &ctx)
Definition InterfaceFile.cpp:64
double getFrac() const
Get the interpolation fraction (set during readInflows)
Definition InterfaceFile.hpp:87
void readInflows(SimulationContext &ctx, double current_time)
Read next set of inflow values from upstream interface file.
Definition InterfaceFile.cpp:274
int getIfaceNode(int index) const
Get the node index for a given interface file entry.
Definition InterfaceFile.cpp:485
void writeOutfallResults(const SimulationContext &ctx, double current_time)
Write current outfall results to downstream interface file.
Definition InterfaceFile.cpp:339
void writeFileHeader(const SimulationContext &ctx)
Write the outflows file header. Called from SWMMEngine::start().
Definition InterfaceFile.cpp:382
double getFlow(int node_idx, double frac) const
Get interpolated interface flow for a node.
Definition InterfaceFile.cpp:450
int openFiles(const std::string &infile_path, const std::string &outfile_path)
Open routing interface files for reading/writing.
Definition InterfaceFile.cpp:84
double getQuality(int node_idx, int pollut_idx, double frac) const
Get interpolated interface quality for a node and pollutant.
Definition InterfaceFile.cpp:464
Definition InterfaceFile.cpp:43
Definition NodeCoupling.cpp:15
Central, reentrant simulation context.
Definition SimulationContext.hpp:292
Definition InterfaceFile.hpp:38
std::vector< int > node_idx
Node indices in this model.
Definition InterfaceFile.hpp:40
void resize(int n)
Definition InterfaceFile.cpp:52
std::vector< double > new_values
Current timestep values (flow + polluts per node)
Definition InterfaceFile.hpp:42
int count
Definition InterfaceFile.hpp:39
std::vector< double > old_values
Previous timestep values (flow + polluts per node)
Definition InterfaceFile.hpp:41