OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
StatBaseWriter.h
Go to the documentation of this file.
1//
2// Class StatBaseWriter
3// This common base class for the StatWriter and MultiBunchDump class.
4//
5// Copyright (c) 2019, Matthias Frey, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved
7//
8// Implemented as part of the PhD thesis
9// "Precise Simulations of Multibunches in High Intensity Cyclotrons"
10//
11// This file is part of OPAL.
12//
13// OPAL is free software: you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation, either version 3 of the License, or
16// (at your option) any later version.
17//
18// You should have received a copy of the GNU General Public License
19// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20//
21#ifndef OPAL_STAT_BASE_WRITER_H
22#define OPAL_STAT_BASE_WRITER_H
23
24#include "SDDSWriter.h"
25#include "Utilities/Util.h"
26
27class StatBaseWriter : public SDDSWriter {
28
29public:
30 StatBaseWriter(const std::string& fname, bool restart);
31
35 unsigned int rewindToSpos(double maxSpos);
36};
37
38
39inline
40unsigned int StatBaseWriter::rewindToSpos(double maxSPos) {
41 if (Ippl::myNode() == 0) {
42 return Util::rewindLinesSDDS(this->fname_m, maxSPos);
43 }
44 return 0;
45}
46
47#endif
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:220
std::string fname_m
Definition: SDDSWriter.h:116
unsigned int rewindToSpos(double maxSpos)
delete the last 'numberOfLines' lines of the statistics file
StatBaseWriter(const std::string &fname, bool restart)
static int myNode()
Definition: IpplInfo.cpp:691