Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit e4d4101a authored by Sadr Mohsen's avatar Sadr Mohsen
Browse files

enable h5 write, needs to be editted

parent 11842c57
No related branches found
No related tags found
1 merge request!16Resolve "Enable writing phase space in a file"
......@@ -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);
  • Developer

    @adelmann There are some transformations on the particle position before writing hdf5 file that I commented out for now. It looks like OPAL allocates memory to store the old values, stashedR.create(localNum);, then does some operations on R before writing to a file, resets R to the stashed values, and then deletes the allocated memory after dumpH5 call. Should I replicate that? Or, we can just write phase space as it is without these transformations, and leave this post-processing task to the user.

    Edited by sadr_m
  • Please register or sign in to reply
/*
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];
  • Developer

    @adelmann should I replace these with kokkos for loops? I am a bit confused. Is f64buffer on the host or device? Should I deep copy views from device to the host, and then pass it to WRITEDATA in the following line.

  • Please register or sign in to reply
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
}
  • Owner

    yes we need a buffer. You can look in my branch fixSolverUnits and mybe just cheery pick this one. I know I should merge to the master ...

  • Owner

    and no there are no transformation on the data, just pain write

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment