diff options
Diffstat (limited to 'examples/h5_read.c')
-rw-r--r-- | examples/h5_read.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/examples/h5_read.c b/examples/h5_read.c index 8384af9..ba41717 100644 --- a/examples/h5_read.c +++ b/examples/h5_read.c @@ -26,17 +26,17 @@ main () H5T_order_t order; /* data order */ size_t size; /* size of the data element stored in file */ - size_t dimsm[3]; /* memory space dimensions */ - size_t dims_out[2]; /* dataset dimensions */ + hsize_t dimsm[3]; /* memory space dimensions */ + hsize_t dims_out[2]; /* dataset dimensions */ herr_t status; int data_out[NX][NY][NZ ]; /* output buffer */ - size_t count[2]; /* size of the hyperslab in the file */ - int offset[2]; /* hyperslab offset in the file */ - size_t count_out[3]; /* size of the hyperslab in memory */ - int offset_out[3]; /* hyperslab offset in memory */ - int i, j, k, status_n, rank; + hsize_t count[2]; /* size of the hyperslab in the file */ + hsize_t offset[2]; /* hyperslab offset in the file */ + hsize_t count_out[3]; /* size of the hyperslab in memory */ + hsize_t offset_out[3]; /* hyperslab offset in memory */ + int i, j, k, status_n, rank; for (j = 0; j < NX; j++) { for (i = 0; i < NY; i++) { @@ -67,7 +67,7 @@ printf(" Data size is %d \n", size); dataspace = H5Dget_space(dataset); /* dataspace handle */ rank = H5Sget_ndims(dataspace); -status_n = H5Sget_dims(dataspace, dims_out); +status_n = H5Sget_dims(dataspace, dims_out, NULL); printf("rank %d, dimensions %d x %d \n", rank, dims_out[0], dims_out[1]); /* @@ -77,7 +77,8 @@ offset[0] = 1; offset[1] = 2; count[0] = NX_SUB; count[1] = NY_SUB; -status = H5Sset_hyperslab(dataspace, offset, count, NULL); +status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, + count, NULL); /* * Define the memory dataspace. @@ -96,7 +97,8 @@ offset_out[2] = 0; count_out[0] = NX_SUB; count_out[1] = NY_SUB; count_out[2] = 1; -status = H5Sset_hyperslab(memspace, offset_out, count_out, NULL); +status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, + count_out, NULL); /* * Read data from hyperslab in the file into the hyperslab in |