TransFlow
0.1.0
A transient pipeline flow simulation library
|
79 const std::filesystem::path& path,
80 const arma::uword interval = 60,
81 const bool append =
false,
82 const arma::uvec indicesToSample = {});
105 bool sample(
const Pipeline& pipeline,
const bool forceSample =
false);
117 static std::filesystem::path
makeOutputDir(
const std::filesystem::path& path);
const std::filesystem::path m_outputDir
Output directory.
Definition: sampler.hpp:131
std::vector< std::ofstream > m_outputFiles
Definition: sampler.hpp:126
arma::uvec m_indicesToSample
Definition: sampler.hpp:139
std::vector< details::PropertyToSample > m_samplers
Definition: sampler.hpp:129
PropertyToSample(const std::string &label, PropertyGetter function)
Construct from label and a Pipeline member function pointer.
Definition: sampler.hpp:48
arma::uword m_printInterval
How often to print (max) [s].
Definition: sampler.hpp:134
const typedef arma::vec &(Pipeline::* PropertyGetter)() const
Definition: sampler.hpp:29
Definition: pipeline.hpp:16
bool m_append
If we append to (true) or overwrite (false) existing files.
Definition: sampler.hpp:142
bool sample(const Pipeline &pipeline, const bool forceSample=false)
Sample current state. This is usually only called by Simulator, but can also be called to force a sam...
Sampler(const std::filesystem::path &path, const arma::uword interval=60, const bool append=false, const arma::uvec indicesToSample={})
Construct given output directory and (optional) print interval.
PropertyGetter function
Pipeline member function (getter) pointer.
Definition: sampler.hpp:54
std::string label
Label.
Definition: sampler.hpp:53
const std::filesystem::path & outputDir() const
Get (const ref) output directory.
Definition: sampler.hpp:108
arma::uword m_timeOfLastPrint
Time of last print [s].
Definition: sampler.hpp:136
void addPropertyToPrint(PropertyGetter samplingFunction)
Add property to save to file. This automatically determines the label and filename of the property.
The PropertyToSample struct contains information about a single property from Pipeline that we are go...
Definition: sampler.hpp:41
Sampler & setIndicesToSample(const arma::uvec &indices)
The Sampler class is used to sample selected Pipeline properties during simulations.
Definition: sampler.hpp:69
static std::string getSampleLabel(PropertyGetter samplingFunction)
static std::filesystem::path makeOutputDir(const std::filesystem::path &path)
Pipeline(const arma::uword nGridPoints=100, const double length=100e3)
Construct from number of grid points and pipeline length.