DiFfRG
Loading...
Searching...
No Matches
DiFfRG::DataOutput< dim, VectorType > Class Template Reference

Class to manage writing to files. FEM functions are written to vtk files and other data is written to csv files. More...

#include <data_output.hh>

Public Member Functions

 DataOutput (std::string top_folder, std::string output_name, std::string output_folder, const JSONValue &json)
 Construct a new Data Output object.
 
 DataOutput (const JSONValue &json)
 
FEOutput< dim, VectorType > & fe_output ()
 Returns a reference to the FEOutput object used to write FEM functions to .vtu files and .pvd time series.
 
CsvOutputcsv_file (const std::string &name)
 Returns a reference to the CsvOutput object associated with the given name, which is used to write scalar values to .csv files. If the object does not exist, it is created.
 
void flush (const double time)
 Save all attached data vectors to a .vtu and append it to the time series. Also flush any attached scalar values to the .csv files.
 
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.
 
const std::string & get_output_name () const
 Get the name of the output.
 
void dump_to_csv (const std::string &name, const std::vector< std::vector< double > > &values, bool attach=false, const std::vector< std::string > header={})
 Dump a vector of vectors to a .csv file, e.g. for a higher-dimensional grid function.
 

Private Attributes

JSONValue json
 
const std::string top_folder
 
const std::string output_name
 
const std::string output_folder
 
double Lambda
 
std::vector< double > time_values
 
std::vector< double > k_values
 
FEOutput< dim, VectorType > fe_out
 
std::map< std::string, CsvOutputcsv_files
 

Detailed Description

template<uint dim, typename VectorType>
class DiFfRG::DataOutput< dim, VectorType >

Class to manage writing to files. FEM functions are written to vtk files and other data is written to csv files.

Template Parameters
dimdimensionality of the FEM solution.
VectorTypeVector type of the FEM solution.

Constructor & Destructor Documentation

◆ DataOutput() [1/2]

template<uint dim, typename VectorType >
DiFfRG::DataOutput< dim, VectorType >::DataOutput ( std::string top_folder,
std::string output_name,
std::string output_folder,
const JSONValue & json )

Construct a new Data Output object.

Parameters
top_folderFolder where the output will be written, i.e. the folder containing the .pvd file and the .csv files.
output_nameName of the output, i.e. the name of the .pvd file and the .csv files.
output_folderFolder where the .vtu files will be written. Should be relative to top_folder.
subdivisionsNumber of subdivisions of the cells in the .vtu files.

◆ DataOutput() [2/2]

template<uint dim, typename VectorType >
DiFfRG::DataOutput< dim, VectorType >::DataOutput ( const JSONValue & json)

Member Function Documentation

◆ csv_file()

template<uint dim, typename VectorType >
CsvOutput & DiFfRG::DataOutput< dim, VectorType >::csv_file ( const std::string & name)

Returns a reference to the CsvOutput object associated with the given name, which is used to write scalar values to .csv files. If the object does not exist, it is created.

◆ dump_to_csv()

template<uint dim, typename VectorType >
void DiFfRG::DataOutput< dim, VectorType >::dump_to_csv ( const std::string & name,
const std::vector< std::vector< double > > & values,
bool attach = false,
const std::vector< std::string > header = {} )

Dump a vector of vectors to a .csv file, e.g. for a higher-dimensional grid function.

Parameters
nameName of the .csv file.
valuesVector of vectors to dump.
attachIf true, the values are appended to the file. If false, the file is truncated.
headerHeader of the .csv file. If attach is true, this is ignored.

◆ fe_output()

template<uint dim, typename VectorType >
FEOutput< dim, VectorType > & DiFfRG::DataOutput< dim, VectorType >::fe_output ( )

Returns a reference to the FEOutput object used to write FEM functions to .vtu files and .pvd time series.

◆ flush()

template<uint dim, typename VectorType >
void DiFfRG::DataOutput< dim, VectorType >::flush ( const double time)

Save all attached data vectors to a .vtu and append it to the time series. Also flush any attached scalar values to the .csv files.

Parameters
timetag attached in the .pvd time series and the .csv files.

◆ get_output_name()

template<uint dim, typename VectorType >
const std::string & DiFfRG::DataOutput< dim, VectorType >::get_output_name ( ) const

Get the name of the output.

Returns
const std::string&

◆ set_Lambda()

template<uint dim, typename VectorType >
void DiFfRG::DataOutput< dim, VectorType >::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.

Member Data Documentation

◆ csv_files

template<uint dim, typename VectorType >
std::map<std::string, CsvOutput> DiFfRG::DataOutput< dim, VectorType >::csv_files
private

◆ fe_out

template<uint dim, typename VectorType >
FEOutput<dim, VectorType> DiFfRG::DataOutput< dim, VectorType >::fe_out
private

◆ json

template<uint dim, typename VectorType >
JSONValue DiFfRG::DataOutput< dim, VectorType >::json
private

◆ k_values

template<uint dim, typename VectorType >
std::vector<double> DiFfRG::DataOutput< dim, VectorType >::k_values
private

◆ Lambda

template<uint dim, typename VectorType >
double DiFfRG::DataOutput< dim, VectorType >::Lambda
private

◆ output_folder

template<uint dim, typename VectorType >
const std::string DiFfRG::DataOutput< dim, VectorType >::output_folder
private

◆ output_name

template<uint dim, typename VectorType >
const std::string DiFfRG::DataOutput< dim, VectorType >::output_name
private

◆ time_values

template<uint dim, typename VectorType >
std::vector<double> DiFfRG::DataOutput< dim, VectorType >::time_values
private

◆ top_folder

template<uint dim, typename VectorType >
const std::string DiFfRG::DataOutput< dim, VectorType >::top_folder
private

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