enable h5 write, needs to be editted
... | ... | @@ -861,11 +861,11 @@ void ParallelTracker::writePhaseSpace(const long long /*step*/, bool psDump, boo |
msg << level3 << "* Wrote beam statistics." << endl; | ||
} | ||
/* \todo | ||
if (psDump && (itsBunch_m->getTotalNum() > 0)) { | ||
// Write fields to .h5 file. | ||
const size_t localNum = itsBunch_m->getLocalNum(); | ||
/* | ||
auto pc = itsBunch_m->getParticleContainer(); | ||
const size_t localNum = pc->getLocalNum(); | ||
double distToLastStop = stepSizes_m.getFinalZStop() - pathLength_m; | ||
Vector_t<double, 3> beta = itsBunch_m->RefPartP_m / Util::getGamma(itsBunch_m->RefPartP_m); | ||
Vector_t<double, 3> driftPerTimeStep = | ||
... | ... | @@ -909,10 +909,11 @@ void ParallelTracker::writePhaseSpace(const long long /*step*/, bool psDump, boo |
} | ||
if (!statDump && !driftToCorrectPosition) | ||
itsBunch_m->calcBeamParameters(); | ||
msg << *itsBunch_m << endl; | ||
*/ | ||
//msg << *itsBunch_m << endl; | ||
itsDataSink_m->dumpH5(itsBunch_m, FDext); | ||
|
||
/* | ||
if (driftToCorrectPosition) { | ||
if (localNum > 0) { | ||
itsBunch_m->R = stashedR; | ||
... | ... | @@ -924,10 +925,9 @@ void ParallelTracker::writePhaseSpace(const long long /*step*/, bool psDump, boo |
itsBunch_m->calcBeamParameters(); | ||
} | ||
*/ | ||
msg << level2 << "* Wrote beam phase space." << endl; | ||
} | ||
*/ | ||
} | ||
void ParallelTracker::updateReference(const BorisPusher& pusher) { | ||
... | ... |
... | ... | @@ -407,10 +407,11 @@ void H5PartWrapperForPT::writeStepHeader( |
} | ||
void H5PartWrapperForPT::writeStepData(PartBunch_t* bunch) { | ||
size_t numLocalParticles = bunch->getLocalNum(); | ||
auto pc = bunch->getParticleContainer(); | ||
size_t numLocalParticles = pc->getLocalNum(); | ||
REPORTONERROR(H5PartSetNumParticles(file_m, numLocalParticles)); | ||
/* ADA | ||
std::vector<char> buffer(numLocalParticles * sizeof(h5_float64_t)); | ||
char* buffer_ptr = Util::c_data(buffer); | ||
h5_float64_t* f64buffer = reinterpret_cast<h5_float64_t*>(buffer_ptr); | ||
... | ... | @@ -418,29 +419,29 @@ void H5PartWrapperForPT::writeStepData(PartBunch_t* bunch) { |
h5_int32_t* i32buffer = reinterpret_cast<h5_int32_t*>(buffer_ptr); | ||
for (size_t i = 0; i < numLocalParticles; ++i) | ||
f64buffer[i] = bunch->R(i)(0); | ||
f64buffer[i] = pc->R(i)[0]; | ||
|
||
WRITEDATA(Float64, file_m, "x", f64buffer); | ||
for (size_t i = 0; i < numLocalParticles; ++i) | ||
f64buffer[i] = bunch->R(i)(1); | ||
f64buffer[i] = pc->R(i)[1]; | ||
WRITEDATA(Float64, file_m, "y", f64buffer); | ||
for (size_t i = 0; i < numLocalParticles; ++i) | ||
f64buffer[i] = bunch->R(i)(2); | ||
f64buffer[i] = pc->R(i)[2]; | ||
WRITEDATA(Float64, file_m, "z", f64buffer); | ||
for (size_t i = 0; i < numLocalParticles; ++i) | ||
f64buffer[i] = bunch->P(i)(0); | ||
f64buffer[i] = pc->P(i)[0]; | ||
WRITEDATA(Float64, file_m, "px", f64buffer); | ||
for (size_t i = 0; i < numLocalParticles; ++i) | ||
f64buffer[i] = bunch->P(i)(1); | ||
f64buffer[i] = pc->P(i)[1]; | ||
WRITEDATA(Float64, file_m, "py", f64buffer); | ||
for (size_t i = 0; i < numLocalParticles; ++i) | ||
f64buffer[i] = bunch->P(i)(2); | ||
f64buffer[i] = pc->P(i)[2]; | ||
WRITEDATA(Float64, file_m, "pz", f64buffer); | ||
/* | ||
for (size_t i = 0; i < numLocalParticles; ++i) | ||
f64buffer[i] = bunch->Q(i); | ||
WRITEDATA(Float64, file_m, "q", f64buffer); | ||
... | ... | @@ -522,4 +523,4 @@ void H5PartWrapperForPT::writeStepData(PartBunch_t* bunch) { |
reportOnError(herr, __FILE__, __LINE__); | ||
} | ||
*/ | ||
} | ||
\ No newline at end of file | ||
} |