37#ifndef OPENSWMM_INTERFACE_FILE_HPP
38#define OPENSWMM_INTERFACE_FILE_HPP
72 int openFiles(
const std::string& infile_path,
const std::string& outfile_path);
91 double getFlow(
int node_idx,
double frac)
const;
94 double getQuality(
int node_idx,
int pollut_idx,
double frac)
const;
103 double getFrac()
const {
return iface_frac_; }
107 FILE* infile_ =
nullptr;
108 FILE* outfile_ =
nullptr;
110 double old_time_ = 0.0;
111 double new_time_ = 0.0;
112 int n_iface_polluts_ = 0;
113 int n_values_per_node_ = 1;
114 int iface_flow_units_ = 0;
116 double iface_frac_ = 0.0;
118 std::vector<int> pollut_map_;
121 bool readNextPeriod();
Definition InterfaceFile.hpp:67
int getNumIfaceNodes() const
Get number of interface nodes currently active.
Definition InterfaceFile.hpp:97
int readFileHeader(SimulationContext &ctx)
Definition InterfaceFile.cpp:128
void closeFiles()
Close all interface files.
Definition InterfaceFile.cpp:451
void init(SimulationContext &ctx)
Definition InterfaceFile.cpp:80
double getFrac() const
Get the interpolation fraction (set during readInflows)
Definition InterfaceFile.hpp:103
void readInflows(SimulationContext &ctx, double current_time)
Read next set of inflow values from upstream interface file.
Definition InterfaceFile.cpp:290
int getIfaceNode(int index) const
Get the node index for a given interface file entry.
Definition InterfaceFile.cpp:501
void writeOutfallResults(const SimulationContext &ctx, double current_time)
Write current outfall results to downstream interface file.
Definition InterfaceFile.cpp:355
void writeFileHeader(const SimulationContext &ctx)
Write the outflows file header. Called from SWMMEngine::start().
Definition InterfaceFile.cpp:398
double getFlow(int node_idx, double frac) const
Get interpolated interface flow for a node.
Definition InterfaceFile.cpp:466
int openFiles(const std::string &infile_path, const std::string &outfile_path)
Open routing interface files for reading/writing.
Definition InterfaceFile.cpp:100
double getQuality(int node_idx, int pollut_idx, double frac) const
Get interpolated interface quality for a node and pollutant.
Definition InterfaceFile.cpp:480
Definition InterfaceFile.cpp:59
Definition NodeCoupling.cpp:16
Central, reentrant simulation context.
Definition SimulationContext.hpp:353
Definition InterfaceFile.hpp:54
std::vector< int > node_idx
Node indices in this model.
Definition InterfaceFile.hpp:56
void resize(int n)
Definition InterfaceFile.cpp:68
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