10 template<
typename T,
typename S>
13 const std::vector<T> &
values,
14 bool firstValuePrinted,
20 return firstValuePrinted;
25 if (! firstValuePrinted)
31 for (
size_t i = startIdx; i < values.size(); i++)
41 : ofile(output), initialized(false)
44 throw std::runtime_error(
"Failed to open output file");
47 ofile << std::setprecision(std::numeric_limits<double>::max_digits10);
57 bool firstValuePrinted =
false;
59 firstValuePrinted = printSeparatedValues<std::string, char>(
64 printSeparatedValues<std::string, char>(
75 for (
const auto &kval : vars.
scalar) {
79 for (
const auto &kval : vars.
vector) {
111 bool firstValuePrinted =
false;
113 firstValuePrinted = printSeparatedValues<std::string, char>(
118 if (it != vars.
scalar.end()) {
119 output << it->second;
124 firstValuePrinted = printSeparatedValues<std::string, char>(
131 if (it != vars.
vector.end()) {
132 printSeparatedValues<double, char>(
133 output, it->second,
false,
',',
134 [] (
auto &
output,
const auto x) { output <<
x; }
void exportVars(const VarDict &vars)
std::vector< std::string > scalVarNames
Q_EXPORT QTSManip setprecision(int p)
void addScalarVar(const std::string &name)
void setPrecision(int precision)
bool printSeparatedValues(std::ostream &output, const std::vector< T > &values, bool firstValuePrinted, S separator, std::function< void(std::ostream &, const T &)> printValue)
void init(const VarDict &vars)
std::unordered_map< std::string, std::vector< double > > vector
void addVectorVar(const std::string &name)
std::vector< std::string > vectVarNames
CSVExporter(const std::string &output)
void function(int client, int *resource, int parblock, int *test, int p)
QTextStream & endl(QTextStream &s)
std::unordered_map< std::string, double > scalar