basic read_strided example implemented
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
#define DEFAULT_VERBOSITY H5_VERBOSE_DEFAULT
|
||||
|
||||
#define FNAME "example_particles.h5"
|
||||
#define FNAME "example_strided.h5"
|
||||
|
||||
int
|
||||
main (
|
||||
@@ -32,8 +32,21 @@ main (
|
||||
|
||||
H5SetStep (file, 0);
|
||||
|
||||
// TODO
|
||||
|
||||
// Get number of particles in datasets and allocate memory
|
||||
h5_int64_t num_particles = H5PartGetNumParticles (file);
|
||||
h5_float64_t* data = calloc (6*num_particles, sizeof (*data));
|
||||
|
||||
// set number of particles and memory stride
|
||||
H5PartSetNumParticlesStrided (file, num_particles, 6);
|
||||
|
||||
// read data
|
||||
H5PartReadDataFloat64 (file, "x", data+0);
|
||||
H5PartReadDataFloat64 (file, "y", data+1);
|
||||
H5PartReadDataFloat64 (file, "z", data+2);
|
||||
H5PartReadDataFloat64 (file, "px", data+3);
|
||||
H5PartReadDataFloat64 (file, "py", data+4);
|
||||
H5PartReadDataFloat64 (file, "pz", data+5);
|
||||
|
||||
H5CloseFile (file);
|
||||
return MPI_Finalize ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user