DiFfRG
Loading...
Searching...
No Matches
DiFfRG::CsvOutput Class Reference

A class to output data to a CSV file. More...

#include <csv_output.hh>

Public Member Functions

 CsvOutput (const std::string top_folder, const std::string output_name, const JSONValue &json)
 Construct a new Csv Output object.
 
void value (const std::string &name, const double value)
 Add a value to the output.
 
void flush (const double time)
 Add a value to the output.
 
void set_Lambda (const double Lambda)
 Set the value of Lambda. If Lambda is set, the output will contain a column for k = exp(-t) * Lambda.
 

Private Attributes

const JSONValuejson
 
const std::string top_folder
 
const std::string output_name
 
std::ofstream output_stream
 
std::vector< std::string > insertion_order
 
std::map< std::string, std::vector< double > > values
 
std::vector< std::string > header
 
std::vector< double > time_values
 
std::vector< double > k_values
 
double Lambda
 

Detailed Description

A class to output data to a CSV file.

In every time step, the user can add values to the output, which will be written to the file when flush is called. Every timestep has to contain the same values, but the order in which they are added can change.

Constructor & Destructor Documentation

◆ CsvOutput()

DiFfRG::CsvOutput::CsvOutput ( const std::string top_folder,
const std::string output_name,
const JSONValue & json )

Construct a new Csv Output object.

Parameters
top_folderThe top folder to store the output in.
output_nameThe name of the output file.
jsonThe JSON object containing the parameters.

Member Function Documentation

◆ flush()

void DiFfRG::CsvOutput::flush ( const double time)

Add a value to the output.

Parameters
nameThe name of the value.
valueThe value to add.

◆ set_Lambda()

void DiFfRG::CsvOutput::set_Lambda ( const double Lambda)

Set the value of Lambda. If Lambda is set, the output will contain a column for k = exp(-t) * Lambda.

Parameters
LambdaThe value of Lambda.

◆ value()

void DiFfRG::CsvOutput::value ( const std::string & name,
const double value )

Add a value to the output.

Parameters
nameThe name of the value.
valueThe value to add.

Member Data Documentation

◆ header

std::vector<std::string> DiFfRG::CsvOutput::header
private

◆ insertion_order

std::vector<std::string> DiFfRG::CsvOutput::insertion_order
private

◆ json

const JSONValue& DiFfRG::CsvOutput::json
private

◆ k_values

std::vector<double> DiFfRG::CsvOutput::k_values
private

◆ Lambda

double DiFfRG::CsvOutput::Lambda
private

◆ output_name

const std::string DiFfRG::CsvOutput::output_name
private

◆ output_stream

std::ofstream DiFfRG::CsvOutput::output_stream
private

◆ time_values

std::vector<double> DiFfRG::CsvOutput::time_values
private

◆ top_folder

const std::string DiFfRG::CsvOutput::top_folder
private

◆ values

std::map<std::string, std::vector<double> > DiFfRG::CsvOutput::values
private

The documentation for this class was generated from the following file: