Skip to content

Commit

Permalink
Merge pull request #340 from germasch/pr/outp-fix
Browse files Browse the repository at this point in the history
outp: fix EveryNth output
  • Loading branch information
germasch authored Oct 3, 2024
2 parents 62b350c + 47ce69b commit 177e6e5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/libpsc/psc_output_particles/output_particles_hdf5_impl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,22 @@ struct OutputParticlesHdf5
int nr_kinds = grid.kinds.size();

// count all particles to be written locally
size_t n_write = mprts.size();
size_t n_write = 0;
for (int p = 0; p < mprts.n_patches(); p++) {
auto& patch = grid.patches[p];
int ilo[3], ihi[3], ld[3];
int sz = find_patch_bounds(grid.ldims, patch.off, ilo, ihi, ld);
for (int jz = ilo[2]; jz < ihi[2]; jz++) {
for (int jy = ilo[1]; jy < ihi[1]; jy++) {
for (int jx = ilo[0]; jx < ihi[0]; jx++) {
for (int kind = 0; kind < nr_kinds; kind++) {
int si = sort_index(grid.ldims, nr_kinds, {jx, jy, jz}, kind);
n_write += off[p][si + 1] - off[p][si];
}
}
}
}
}

assert(sizeof(size_t) == sizeof(unsigned long));
size_t n_total, n_off = 0;
Expand Down

0 comments on commit 177e6e5

Please sign in to comment.