60 : isMultiBunch_m(false)
67 : isMultiBunch_m(numBunch > 1)
71 "Can not restart when HDF5 is disabled");
74 this->
init(restart, h5wrapper, numBunch);
82 :
DataSink(h5wrapper, false, numBunch)
94 double refPr,
double refPt,
double refPz,
95 double refR,
double refTheta,
double refZ,
96 double azimuth,
double elevation,
bool local)
const
100 return h5Writer_m->writePhaseSpace(beam, FDext, meanEnergy, refPr, refPt, refPz,
101 refR, refTheta, refZ, azimuth, elevation, local);
106 const double& azimuth)
const
113 const losses_t &losses,
const double& azimuth)
const
117 size_t npOutside = 0;
123 statWriter_m->write(beam, FDext, losses, azimuth, npOutside);
156 size_t numberOfFieldEmittedParticles,
bool nEmissionMode, std::string fn) {
160 double Npart_d = 0.0;
169 std::string ffn = fn + std::string(
".dat");
174 fid << std::setiosflags(std::ios::scientific);
179 fid <<
"#Time/ns" << std::setw(18) <<
"#Geometry impacts" << std::setw(18) <<
"tot_sey" << std::setw(18)
180 <<
"TotalCharge" << std::setw(18) <<
"PartNum" <<
" numberOfFieldEmittedParticles " <<
endl;
182 fid << t << std::setw(18) << impact << std::setw(18) << sey_num << std::setw(18) << charge
183 << std::setw(18) << Npart_d << std::setw(18) << numberOfFieldEmittedParticles <<
endl;
187 fid <<
"#Time/ns" << std::setw(18) <<
"#Geometry impacts" << std::setw(18) <<
"tot_sey" << std::setw(18)
188 <<
"ParticleNumber" <<
" numberOfFieldEmittedParticles " <<
endl;
190 fid << t << std::setw(18) << impact << std::setw(18) << sey_num
191 << std::setw(18) << double(Npart) << std::setw(18) << numberOfFieldEmittedParticles <<
endl;
202 for (
short b = 0; b < mbhandler_p->
getNumBunch(); ++b) {
219 for (
short b = 0; b < mbhandler_p->
getNumBunch(); ++b) {
233 unsigned int linesToRewind = 0;
244 for (std::vector<mbWriter_t>::reverse_iterator rit =
mbWriter_m.rbegin();
247 if ((*rit)->exists()) {
248 linesToRewind = (*rit)->rewindToSpos(spos);
249 (*rit)->replaceVersionString();
260 if ( linesToRewind > 0 ) {
315 while (bunch < numBunch) {
316 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)