21#ifndef OPENSWMM_INTERFACE_FILE_HPP
22#define OPENSWMM_INTERFACE_FILE_HPP
30struct SimulationContext;
56 int openFiles(
const std::string& infile_path,
const std::string& outfile_path);
68 double getFlow(
int node_idx,
double frac)
const;
71 double getQuality(
int node_idx,
int pollut_idx,
double frac)
const;
80 double getFrac()
const {
return iface_frac_; }
84 FILE* infile_ =
nullptr;
85 FILE* outfile_ =
nullptr;
87 double old_time_ = 0.0;
88 double new_time_ = 0.0;
89 int n_iface_polluts_ = 0;
90 int n_values_per_node_ = 1;
91 int iface_flow_units_ = 0;
93 double iface_frac_ = 0.0;
95 std::vector<int> pollut_map_;
101 bool readNextPeriod();
Definition InterfaceFile.hpp:51
int getNumIfaceNodes() const
Get number of interface nodes currently active.
Definition InterfaceFile.hpp:74
void closeFiles()
Close all interface files.
Definition InterfaceFile.cpp:421
void init(SimulationContext &ctx)
Definition InterfaceFile.cpp:64
double getFrac() const
Get the interpolation fraction (set during readInflows)
Definition InterfaceFile.hpp:80
void readInflows(SimulationContext &ctx, double current_time)
Read next set of inflow values from upstream interface file.
Definition InterfaceFile.cpp:270
int getIfaceNode(int index) const
Get the node index for a given interface file entry.
Definition InterfaceFile.cpp:471
void writeOutfallResults(const SimulationContext &ctx, double current_time)
Write current outfall results to downstream interface file.
Definition InterfaceFile.cpp:328
double getFlow(int node_idx, double frac) const
Get interpolated interface flow for a node.
Definition InterfaceFile.cpp:436
int openFiles(const std::string &infile_path, const std::string &outfile_path)
Open routing interface files for reading/writing.
Definition InterfaceFile.cpp:80
double getQuality(int node_idx, int pollut_idx, double frac) const
Get interpolated interface quality for a node and pollutant.
Definition InterfaceFile.cpp:450
Definition Controls.cpp:24
Central, reentrant simulation context.
Definition SimulationContext.hpp:141
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