64 : isMultiBunch_m(false)
71 : isMultiBunch_m(numBunch > 1)
75 "Can not restart when HDF5 is disabled");
78 this->
init(restart, h5wrapper, numBunch);
86 :
DataSink(h5wrapper, false, numBunch)
98 double refPr,
double refPt,
double refPz,
99 double refR,
double refTheta,
double refZ,
100 double azimuth,
double elevation,
bool local)
const
104 return h5Writer_m->writePhaseSpace(beam, FDext, meanEnergy, refPr, refPt, refPz,
105 refR, refTheta, refZ, azimuth, elevation, local);
110 const double& azimuth)
const
117 const losses_t &losses,
const double& azimuth)
const
121 size_t npOutside = 0;
127 statWriter_m->write(beam, FDext, losses, azimuth, npOutside);
160 size_t numberOfFieldEmittedParticles,
bool nEmissionMode, std::string fn) {
164 double Npart_d = 0.0;
173 std::string ffn = fn + std::string(
".dat");
178 fid << std::setiosflags(std::ios::scientific);
179 double t = beam->
getT() * 1.0e9;
183 fid <<
"#Time/ns" << std::setw(18) <<
"#Geometry impacts" << std::setw(18) <<
"tot_sey" << std::setw(18)
184 <<
"TotalCharge" << std::setw(18) <<
"PartNum" <<
" numberOfFieldEmittedParticles " <<
endl;
186 fid << t << std::setw(18) << impact << std::setw(18) << sey_num << std::setw(18) << charge
187 << std::setw(18) << Npart_d << std::setw(18) << numberOfFieldEmittedParticles <<
endl;
191 fid <<
"#Time/ns" << std::setw(18) <<
"#Geometry impacts" << std::setw(18) <<
"tot_sey" << std::setw(18)
192 <<
"ParticleNumber" <<
" numberOfFieldEmittedParticles " <<
endl;
194 fid << t << std::setw(18) << impact << std::setw(18) << sey_num
195 << std::setw(18) << double(Npart) << std::setw(18) << numberOfFieldEmittedParticles <<
endl;
206 for (
short b = 0; b < mbhandler_p->
getNumBunch(); ++b) {
223 for (
short b = 0; b < mbhandler_p->
getNumBunch(); ++b) {
237 unsigned int linesToRewind = 0;
248 for (std::vector<mbWriter_t>::reverse_iterator rit =
mbWriter_m.rbegin();
251 if ((*rit)->exists()) {
252 linesToRewind = (*rit)->rewindToSpos(spos);
253 (*rit)->replaceVersionString();
264 if ( linesToRewind > 0 ) {
319 while (bunch < numBunch) {
320 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 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)
void writeGeomToVtk(BoundaryGeometry &bg, std::string fn)
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)