50 throw OpalException(
"DataSink::DataSink()",
"Can not restart when HDF5 is disabled");
53 this->
init(restart, h5wrapper);
71 double refPz,
double refR,
double refTheta,
double refZ,
double azimuth,
double elevation,
77 beam, FDext, meanEnergy, refPr, refPt, refPz, refR, refTheta, refZ, azimuth, elevation,
88 const double& azimuth)
const {
97 statWriter_m->write(beam, FDext, losses, azimuth, npOutside);
128 const PartBunch_t* beam,
long long& step,
size_t& impact,
double& sey_num,
129 size_t numberOfFieldEmittedParticles,
bool nEmissionMode, std::string fn) {
132 double Npart_d = 0.0;
133 if (!nEmissionMode) {
140 if (ippl::Comm->rank() == 0) {
141 std::string ffn = fn + std::string(
".dat");
143 std::unique_ptr<Inform> ofp(
new Inform(
nullptr, ffn.c_str(), Inform::APPEND, 0));
146 fid << std::setiosflags(std::ios::scientific);
148 if (!nEmissionMode) {
150 fid <<
"#Time/ns" << std::setw(18) <<
"#Geometry impacts" << std::setw(18)
151 <<
"tot_sey" << std::setw(18) <<
"TotalCharge" << std::setw(18) <<
"PartNum"
152 <<
" numberOfFieldEmittedParticles " << endl;
154 fid << t << std::setw(18) << impact << std::setw(18) << sey_num << std::setw(18)
155 << charge << std::setw(18) << Npart_d << std::setw(18)
156 << numberOfFieldEmittedParticles << endl;
159 fid <<
"#Time/ns" << std::setw(18) <<
"#Geometry impacts" << std::setw(18)
160 <<
"tot_sey" << std::setw(18) <<
"ParticleNumber"
161 <<
" numberOfFieldEmittedParticles " << endl;
163 fid << t << std::setw(18) << impact << std::setw(18) << sey_num << std::setw(18)
164 << double(Npart) << std::setw(18) << numberOfFieldEmittedParticles << endl;
170 unsigned int linesToRewind = 0;
181 if (linesToRewind > 0) {
PartBunch< PLayout_t< double, 3 >, double, 3 > PartBunch_t
ippl::Vector< T, Dim > Vector_t
bool enableVTK
If true VTK files are written.
bool enableHDF5
If true HDF5 files are written.
std::string getInputBasename()
get input file name without extension
static OpalData * getInstance()
void gatherLoadBalanceStatistics()
size_t calcNumPartsOutside(Vector_t< T, Dim > x)
returns the number of particles outside of a box defined by x
void calcBeamParameters()
double getCharge() const
get the total charge per simulation particle
Vector_t< T, Dim > get_rrms() const
double getChargePerParticle() const
get the macro particle charge
size_t getTotalNum() const
void writeGeomToVtk(std::string fn)
std::vector< sddsWriter_t > sddsWriter_m
void init(bool restart=false, H5PartWrapper *h5wrapper=nullptr)
void changeH5Wrapper(H5PartWrapper *h5wrapper)
StatWriter::losses_t losses_t
void writeImpactStatistics(const PartBunch_t *beam, long long int &step, size_t &impact, double &sey_num, size_t numberOfFieldEmittedParticles, bool nEmissionMode, std::string fn)
void writeGeomToVtk(BoundaryGeometry &bg, std::string fn)
std::unique_ptr< SDDSWriter > sddsWriter_t
void dumpH5(PartBunch_t *beam, Vector_t< double, 3 > FDext[]) const
void storeCavityInformation()
Write cavity information from H5 file.
void dumpSDDS(PartBunch_t *beam, Vector_t< double, 3 > FDext[], const double &azimuth=-1) 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
DataSink()
Default constructor.
std::unique_ptr< StatWriter > statWriter_t
The base class for all OPAL exceptions.