DiFfRG
Loading...
Searching...
No Matches
data_output.hh
Go to the documentation of this file.
1#pragma once
2
3// DiFfRG
7
8namespace DiFfRG
9{
10 using namespace dealii;
11
19 template <uint dim, typename VectorType> class DataOutput
20 {
21 public:
31 DataOutput(std::string top_folder, std::string output_name, std::string output_folder, const JSONValue &json);
32
34
39
44 CsvOutput &csv_file(const std::string &name);
45
52 void flush(const double time);
53
59 void set_Lambda(const double Lambda);
60
66 const std::string &get_output_name() const;
67
76 void dump_to_csv(const std::string &name, const std::vector<std::vector<double>> &values, bool attach = false,
77 const std::vector<std::string> header = {});
78
79 private:
81 const std::string top_folder;
82 const std::string output_name;
83 const std::string output_folder;
84 double Lambda;
85
86 std::vector<double> time_values;
87 std::vector<double> k_values;
88
90 std::map<std::string, CsvOutput> csv_files;
91 };
92
93 template <> class DataOutput<0, Vector<double>>
94 {
95 static constexpr uint dim = 0;
96 using VectorType = Vector<double>;
97
98 public:
108 DataOutput(std::string top_folder, std::string output_name, std::string output_folder, const JSONValue &json);
109
111
117
122 CsvOutput &csv_file(const std::string &name);
123
130 void flush(const double time);
131
137 void set_Lambda(const double Lambda);
138
144 const std::string &get_output_name() const;
145
154 void dump_to_csv(const std::string &name, const std::vector<std::vector<double>> &values, bool attach = false,
155 const std::vector<std::string> header = {});
156
157 private:
159 const std::string top_folder;
160 const std::string output_name;
161 const std::string output_folder;
162 double Lambda;
163
164 std::vector<double> time_values;
165 std::vector<double> k_values;
166
168 std::map<std::string, CsvOutput> csv_files;
169 };
170} // namespace DiFfRG
A class to output data to a CSV file.
Definition csv_output.hh:20
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.
void flush(const double time)
Save all attached data vectors to a .vtu and append it to the time series. Also flush any attached sc...
CsvOutput & csv_file(const std::string &name)
Returns a reference to the CsvOutput object associated with the given name, which is used to write sc...
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.
Vector< double > VectorType
Definition data_output.hh:96
DataOutput(std::string top_folder, std::string output_name, std::string output_folder, const JSONValue &json)
Construct a new Data Output object, not associated with a DoFHandler.
std::vector< double > k_values
Definition data_output.hh:165
std::vector< double > time_values
Definition data_output.hh:164
std::map< std::string, CsvOutput > csv_files
Definition data_output.hh:168
const std::string output_folder
Definition data_output.hh:161
const std::string top_folder
Definition data_output.hh:159
FEOutput< dim, VectorType > fe_out
Definition data_output.hh:167
const std::string output_name
Definition data_output.hh:160
double Lambda
Definition data_output.hh:162
FEOutput< dim, VectorType > & fe_output()
Returns a reference to the FEOutput object used to write FEM functions to .vtu files and ....
JSONValue json
Definition data_output.hh:158
const std::string & get_output_name() const
Get the name of the output.
Class to manage writing to files. FEM functions are written to vtk files and other data is written to...
Definition data_output.hh:20
std::vector< double > k_values
Definition data_output.hh:87
const std::string top_folder
Definition data_output.hh:81
FEOutput< dim, VectorType > fe_out
Definition data_output.hh:89
std::map< std::string, CsvOutput > csv_files
Definition data_output.hh:90
const std::string output_folder
Definition data_output.hh:83
DataOutput(std::string top_folder, std::string output_name, std::string output_folder, const JSONValue &json)
Construct a new Data Output object.
FEOutput< dim, VectorType > & fe_output()
Returns a reference to the FEOutput object used to write FEM functions to .vtu files and ....
CsvOutput & csv_file(const std::string &name)
Returns a reference to the CsvOutput object associated with the given name, which is used to write sc...
DataOutput(const JSONValue &json)
std::vector< double > time_values
Definition data_output.hh:86
const std::string output_name
Definition data_output.hh:82
const std::string & get_output_name() const
Get the name of the output.
double Lambda
Definition data_output.hh:84
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.
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.
void flush(const double time)
Save all attached data vectors to a .vtu and append it to the time series. Also flush any attached sc...
JSONValue json
Definition data_output.hh:80
A class to output finite element data to disk as .vtu files and .pvd time series.
Definition fe_output.hh:25
A wrapper around the boost json value class.
Definition json.hh:19
Definition complex_math.hh:14
unsigned int uint
Definition utils.hh:22