27#include "Utility/IpplInfo.h"
35 namespace fs = boost::filesystem;
37 if (fs::exists(
fname_m) && restart) {
39 *
gmsg<<
"* Appending data to existing data file: '" <<
fname_m <<
"'" << endl;
41 *
gmsg <<
"* Creating new file for data: '" <<
fname_m <<
"'" << endl;
46 if (numberOfLines == 0 || ippl::Comm->rank() != 0) {
51 std::queue<std::string> allLines;
54 fs.open(
fname_m.c_str(), std::fstream::in);
59 while (getline(fs, line)) {
64 fs.open(
fname_m.c_str(), std::fstream::out);
69 while (allLines.size() > numberOfLines) {
70 fs << allLines.front() <<
"\n";
77 if (ippl::Comm->rank() != 0)
80 std::string versionFile;
86 std::queue<std::string> allLines;
89 fs.open(
fname_m.c_str(), std::fstream::in);
94 while (getline(fs, line)) {
99 fs.open(
fname_m.c_str(), std::fstream::out);
104 while (!allLines.empty()) {
105 line = allLines.front();
107 if (line != versionFile) {
129 if (ippl::Comm->rank() != 0 ||
os_m.is_open())
134 os_m.setf(std::ios::scientific, std::ios::floatfield);
138 if (ippl::Comm->rank() == 0 &&
os_m.is_open()) {
144 if (ippl::Comm->rank() != 0 ||
mode_m == std::ios::app)
159 os_m <<
"SDDS1" << std::endl;
160 os_m <<
"&description\n"
170 os_m <<
"¶meter\n"
171 <<
indent_m <<
"name=" << std::get<0>(param) <<
",\n"
172 <<
indent_m <<
"type=" << std::get<1>(param) <<
",\n"
173 <<
indent_m <<
"description=\"" << std::get<2>(param) <<
"\"\n"
200 std::stringstream revision;
208 flavor =
"opal-cycl";
213 addParameter(
"processors",
"long",
"Number of Cores used", ippl::Comm->size());
215 addParameter(
"revision",
"string",
"git revision of opal", revision.str());
217 addParameter(
"flavor",
"string",
"OPAL flavor that wrote file", flavor);
#define OPAL_PROJECT_VERSION
#define OPAL_PROJECT_NAME
std::string getGitRevision()
static OpalData * getInstance()
void replaceVersionString()
SDDSWriter(const std::string &fname, bool restart)
void rewindLines(size_t numberOfLines)
delete the last 'numberOfLines' lines of the file 'fileName'
static constexpr unsigned int precision_m
double getLastValue(const std::string &column)
void addDefaultParameters()
std::queue< std::string > paramValues_m
void writeHeader()
Write SDDS header.
std::ios_base::openmode mode_m
First write to the statistics output file.
std::tuple< std::string, std::string, std::string > param_t
std::queue< param_t > params_m
void addParameter(const std::string &name, const std::string &type, const std::string &desc, const T &value)
void getParameterValue(std::string parameter_name, T &nval)
void getValue(int t, std::string column_name, T &nval)