OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
StatBaseWriter.h
Go to the documentation of this file.
1 #ifndef OPAL_STAT_BASE_WRITER_H
2 #define OPAL_STAT_BASE_WRITER_H
3 
4 #include "SDDSWriter.h"
5 #include "Utilities/Util.h"
6 
7 class StatBaseWriter : public SDDSWriter {
8 
9 public:
10  StatBaseWriter(const std::string& fname, bool restart);
11 
15  unsigned int rewindToSpos(double maxSpos);
16 };
17 
18 
19 inline
20 unsigned int StatBaseWriter::rewindToSpos(double maxSPos) {
21  if (Ippl::myNode() == 0) {
22  return Util::rewindLinesSDDS(this->fname_m, maxSPos);
23  }
24  return 0;
25 }
26 
27 #endif
static int myNode()
Definition: IpplInfo.cpp:794
std::string fname_m
Definition: SDDSWriter.h:99
unsigned int rewindToSpos(double maxSpos)
delete the last 'numberOfLines' lines of the statistics file
unsigned int rewindLinesSDDS(const std::string &fileName, double maxSPos, bool checkForTime)
rewind the SDDS file such that the spos of the last step is less or equal to maxSPos ...
Definition: Util.cpp:154
StatBaseWriter(const std::string &fname, bool restart)