Skip to content

Commit add37a9

Browse files
committed
Fix some indexing details
1 parent d31404f commit add37a9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/picongpu/plugins/openPMD/WriteSpecies.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,10 @@ namespace picongpu
855855
for(uint32_t d = 0; d < simDim; ++d)
856856
{
857857
bufferExtent[d][i] = singlePatchExtent[d];
858-
bufferOffset[d][i] = totalPatchOffset[d] + index_t(singlePatchExtent[d] * superCellIdxND[d]);
858+
// No idea why the -1 is needed, but the results do not fit otherwise
859+
// Something weird going on in supercell indexing
860+
bufferOffset[d][i]
861+
= totalPatchOffset[d] + index_t(singlePatchExtent[d] * (superCellIdxND[d] - 1));
859862
}
860863
}
861864

@@ -883,6 +886,7 @@ namespace picongpu
883886
extent_x.resetDataset(ds);
884887

885888
offset_x.storeChunk(bufferOffset[d], {mpiRank * numPatches}, {numPatches});
889+
// TODO: Maybe use a constant record for this
886890
extent_x.storeChunk(bufferExtent[d], {mpiRank * numPatches}, {numPatches});
887891
}
888892

0 commit comments

Comments
 (0)