Skip to content

Commit 47ce69b

Browse files
committed
outp: fix EveryNth output
This had worked, then I broke it, this should undo the breakage.
1 parent 62b350c commit 47ce69b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/libpsc/psc_output_particles/output_particles_hdf5_impl.hxx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,22 @@ struct OutputParticlesHdf5
445445
int nr_kinds = grid.kinds.size();
446446

447447
// count all particles to be written locally
448-
size_t n_write = mprts.size();
448+
size_t n_write = 0;
449+
for (int p = 0; p < mprts.n_patches(); p++) {
450+
auto& patch = grid.patches[p];
451+
int ilo[3], ihi[3], ld[3];
452+
int sz = find_patch_bounds(grid.ldims, patch.off, ilo, ihi, ld);
453+
for (int jz = ilo[2]; jz < ihi[2]; jz++) {
454+
for (int jy = ilo[1]; jy < ihi[1]; jy++) {
455+
for (int jx = ilo[0]; jx < ihi[0]; jx++) {
456+
for (int kind = 0; kind < nr_kinds; kind++) {
457+
int si = sort_index(grid.ldims, nr_kinds, {jx, jy, jz}, kind);
458+
n_write += off[p][si + 1] - off[p][si];
459+
}
460+
}
461+
}
462+
}
463+
}
449464

450465
assert(sizeof(size_t) == sizeof(unsigned long));
451466
size_t n_total, n_off = 0;

0 commit comments

Comments
 (0)