optmize sampling HDF5 access
Each call to sample_from_particles_system
opens the particle file, writes, and then closes the particle file.
As far as I know, this means flushing the buffer, so we lose any "small data writes" optimization that HDF5 can supply.
Related: see https://gitlab.mpcdf.mpg.de/clalescu/bfps_addons/blob/feature/new-multiscale-particles/bfps_addons/cpp/full_code/multi_scale_particles.cpp. That file shows the common usage pattern for the sampling functionality, that is what needs to be optimized.
All of this applies to sample_particle_system_position
as well, obviously.