30#include "OPALconfig.h"
72 "Can not restart when HDF5 is disabled");
75 this->
init(restart, h5wrapper, numBunch);
83 :
DataSink(h5wrapper, false, numBunch)
95 double refPr,
double refPt,
double refPz,
96 double refR,
double refTheta,
double refZ,
97 double azimuth,
double elevation,
bool local)
const
101 return h5Writer_m->writePhaseSpace(beam, FDext, meanEnergy, refPr, refPt, refPz,
102 refR, refTheta, refZ, azimuth, elevation, local);
107 const double& azimuth)
const
114 const losses_t& losses,
const double& azimuth)
const
118 size_t npOutside = 0;
124 statWriter_m->write(beam, FDext, losses, azimuth, npOutside);
158 size_t numberOfFieldEmittedParticles,
bool nEmissionMode, std::string fn) {
162 double Npart_d = 0.0;
163 if (!nEmissionMode) {
171 std::string ffn = fn + std::string(
".dat");
176 fid << std::setiosflags(std::ios::scientific);
178 if (!nEmissionMode) {
181 fid <<
"#Time/ns" << std::setw(18) <<
"#Geometry impacts" << std::setw(18) <<
"tot_sey" << std::setw(18)
182 <<
"TotalCharge" << std::setw(18) <<
"PartNum" <<
" numberOfFieldEmittedParticles " <<
endl;
184 fid << t << std::setw(18) << impact << std::setw(18) << sey_num << std::setw(18) << charge
185 << std::setw(18) << Npart_d << std::setw(18) << numberOfFieldEmittedParticles <<
endl;
189 fid <<
"#Time/ns" << std::setw(18) <<
"#Geometry impacts" << std::setw(18) <<
"tot_sey" << std::setw(18)
190 <<
"ParticleNumber" <<
" numberOfFieldEmittedParticles " <<
endl;
192 fid << t << std::setw(18) << impact << std::setw(18) << sey_num
193 << std::setw(18) << double(Npart) << std::setw(18) << numberOfFieldEmittedParticles <<
endl;
204 for (
short b = 0; b < mbhandler_p->
getNumBunch(); ++b) {
221 for (
short b = 0; b < mbhandler_p->
getNumBunch(); ++b) {
235 unsigned int linesToRewind = 0;
246 for (std::vector<mbWriter_t>::reverse_iterator rit =
mbWriter_m.rbegin();
249 if ((*rit)->exists()) {
250 linesToRewind = (*rit)->rewindToSpos(spos);
251 (*rit)->replaceVersionString();
262 if ( linesToRewind > 0 ) {
317 while (bunch < numBunch) {
318 std::string fname = fn + std::string(
"-bunch-") +
Inform & endl(Inform &inf)
bool enableVTK
If true VTK files are written.
bool enableHDF5
If true HDF5 files are written.
bool amr
Enable AMR if true.
double getChargePerParticle() const
get the macro particle charge
size_t getTotalNum() const
size_t calcNumPartsOutside(Vector_t x)
returns the number of particles outside of a box defined by x
Vector_t get_rrms() const
void calcBeamParameters()
double getCharge() const
get the total charge per simulation particle
void gatherLoadBalanceStatistics()
std::string getInputBasename()
get input file name without extension
static OpalData * getInstance()
bool inRestartRun()
true if we do a restart run
bool calcBunchBeamParameters(PartBunchBase< double, 3 > *beam, short bunchNr)
beaminfo_t & getBunchInfo(short bunchNr)
short getNumBunch() const
void writeGeomToVtk(std::string fn)
void setMultiBunchInitialPathLengh(MultiBunchHandler *mbhandler_p)
std::unique_ptr< MultiBunchDump > mbWriter_t
void writeImpactStatistics(const PartBunchBase< double, 3 > *beam, long long int &step, size_t &impact, double &sey_num, size_t numberOfFieldEmittedParticles, bool nEmissionMode, std::string fn)
std::vector< sddsWriter_t > sddsWriter_m
void writeGeomToVtk(BoundaryGeometry &bg, const std::string &fn)
void changeH5Wrapper(H5PartWrapper *h5wrapper)
const bool isMultiBunch_m
StatWriter::losses_t losses_t
void initMultiBunchDump(short numBunch)
void dumpSDDS(PartBunchBase< double, 3 > *beam, Vector_t FDext[], const double &azimuth=-1) const
void init(bool restart=false, H5PartWrapper *h5wrapper=nullptr, short numBunch=1)
std::unique_ptr< SDDSWriter > sddsWriter_t
static std::string convertToString(int number, int setw=5)
std::vector< mbWriter_t > mbWriter_m
void storeCavityInformation()
Write cavity information from H5 file.
void dumpH5(PartBunchBase< double, 3 > *beam, Vector_t FDext[]) const
IpplTimings::TimerRef StatMarkerTimer_m
Timer to track statistics write time.
std::unique_ptr< H5Writer > h5Writer_t
unsigned int lossWrCounter_m
needed to create index for vtk file
statWriter_t statWriter_m
void writeMultiBunchStatistics(PartBunchBase< double, 3 > *beam, MultiBunchHandler *mbhandler)
DataSink()
Default constructor.
std::unique_ptr< StatWriter > statWriter_t
The base class for all OPAL exceptions.
static TimerRef getTimer(const char *nm)
static void stopTimer(TimerRef t)
static void startTimer(TimerRef t)
Vektor< double, 3 > Vector_t