33#ifndef SAMPLE_UTILITIES_H
34#define SAMPLE_UTILITIES_H
49 return "_" + name +
"_" + StringUtil::toString<T>(value);
78 std::filesystem::create_directories(std::filesystem::path(fileName).
parent_path());
79 std::ofstream
out(fileName.c_str(), std::ios::out | std::ios::binary);
82 throw std::runtime_error(
"Could not open timeseries file " + fileName +
"!");
84 out <<
"TimeseriesOutput \n";
85 out <<
"Quantities: ";
89 out <<
"Number of points in this file: \n";
90 out << numberOfPoints <<
"\n";
91 out <<
"Positions: x, y, z\n";
92 for (
int i = 0;
i < numberOfPoints;
i++)
110 std::ofstream
out(fileName.c_str(), std::ios::app | std::ios::binary);
std::shared_ptr< T > SPtr
constexpr T computeNewTimeAverage(T oldAverage, T newValue, uint numberOfTimesteps)
void writeTimeseriesFileHeader(const std::string &fileName, int numberOfPoints, std::vector< std::string > &variableNames, const real *coordsX, const real *coordsY, const real *coordsZ)
std::string makeTimeseriesFileName(const std::string &probeName, int level, int id)
std::string makeGridFileName(const std::string &probeName, int level, int id, int t, uint part)
std::string nameComponent(const std::string &name, T value)
std::string makeParallelFileName(const std::string &probeName, int id, int t)
void appendDataToTimeseriesFile(const std::string &fileName, std::vector< std::vector< real > > &data)
Write data to timeseries file, that can be read by TimeseriesFileReader. Layout of the file is: Times...