summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/h5_chunk_read.c22
-rw-r--r--examples/h5_compound.c17
-rw-r--r--examples/h5_extend_write.c9
-rw-r--r--examples/h5_group.c4
-rw-r--r--examples/h5_read.c22
-rw-r--r--examples/h5_write.c14
6 files changed, 46 insertions, 42 deletions
diff --git a/examples/h5_chunk_read.c b/examples/h5_chunk_read.c
index 6668c5c..40dfeed 100644
--- a/examples/h5_chunk_read.c
+++ b/examples/h5_chunk_read.c
@@ -22,12 +22,12 @@ main ()
H5T_class_t class; /* data type class */
size_t elem_size; /* size of the data element
stored in file */
- size_t dims[2]; /* dataset and chunk dimensions */
- size_t chunk_dims[2];
- size_t col_dims[1];
+ hsize_t dims[2]; /* dataset and chunk dimensions */
+ hsize_t chunk_dims[2];
+ hsize_t col_dims[1];
size_t size[2];
- size_t count[2];
- int offset[2];
+ hsize_t count[2];
+ hsize_t offset[2];
herr_t status, status_n;
@@ -49,13 +49,13 @@ dataset = H5Dopen(file, DATASETNAME);
filespace = H5Dget_space(dataset); /* Get filespace handle first. */
rank = H5Sget_ndims(filespace);
-status_n = H5Sget_dims(filespace, dims);
+status_n = H5Sget_dims(filespace, dims, NULL);
printf("dataset rank %d, dimensions %d x %d \n", rank, dims[0], dims[1]);
/*
- * Get creation properties.
+ * Get creation properties list.
*/
-cparms = H5Dget_create_parms(dataset); /* Get properties handle first. */
+cparms = H5Dget_create_plist(dataset); /* Get properties handle first. */
/*
* Check if dataset is chunked.
@@ -119,7 +119,8 @@ offset[0] = 0;
offset[1] = 2;
count[0] = 10;
count[1] = 1;
-status = H5Sset_hyperslab(filespace, offset, count, NULL);
+status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ count, NULL);
status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
H5P_DEFAULT, column);
printf("\n");
@@ -155,7 +156,8 @@ offset[0] = 2;
offset[1] = 0;
count[0] = chunk_dims[0];
count[1] = chunk_dims[1];
-status = H5Sset_hyperslab(filespace, offset, count, NULL);
+status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ count, NULL);
/*
* Read chunk back and display.
diff --git a/examples/h5_compound.c b/examples/h5_compound.c
index 1abd4c2..1641ee6 100644
--- a/examples/h5_compound.c
+++ b/examples/h5_compound.c
@@ -40,10 +40,8 @@ float s3[LENGTH];
int i;
hid_t file, datatype, dataset, space; /* Handles */
herr_t status;
-size_t dim[] = {LENGTH}; /* Dataspace dimensions */
+hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
-H5T_class_t class;
-size_t size;
/*
* Initialize the data
@@ -68,9 +66,9 @@ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
* Create the memory data type.
*/
s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
-status = H5Tinsert(s1_tid, "a_name", HPOFFSET(s1, a), H5T_NATIVE_INT);
-status = H5Tinsert(s1_tid, "c_name", HPOFFSET(s1, c), H5T_NATIVE_DOUBLE);
-status = H5Tinsert(s1_tid, "b_name", HPOFFSET(s1, b), H5T_NATIVE_FLOAT);
+H5Tinsert(s1_tid, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT);
+H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE);
+H5Tinsert(s1_tid, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT);
/*
* Create the dataset.
@@ -102,11 +100,11 @@ dataset = H5Dopen(file, DATASETNAME);
*/
s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
-status = H5Tinsert(s2_tid, "c_name", HPOFFSET(s2, c), H5T_NATIVE_DOUBLE);
-status = H5Tinsert(s2_tid, "a_name", HPOFFSET(s2, a), H5T_NATIVE_INT);
+H5Tinsert(s2_tid, "c_name", HOFFSET(s2_t, c), H5T_NATIVE_DOUBLE);
+H5Tinsert(s2_tid, "a_name", HOFFSET(s2_t, a), H5T_NATIVE_INT);
/*
- * Read two fields c and a from s1 dataset. Fields iin the file
+ * Read two fields c and a from s1 dataset. Fields in the file
* are found by their names "c_name" and "a_name".
*/
status = H5Dread(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s2);
@@ -150,6 +148,5 @@ printf("\n");
H5Tclose(s2_tid);
H5Tclose(s3_tid);
H5Dclose(dataset);
-H5Sclose(space);
H5Fclose(file);
}
diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c
index d97f420..6b20a1e 100644
--- a/examples/h5_extend_write.c
+++ b/examples/h5_extend_write.c
@@ -77,7 +77,8 @@ status = H5Dextend (dataset, size);
filespace = H5Dget_space (dataset);
offset[0] = 0;
offset[1] = 0;
-status = H5Sset_hyperslab(filespace, offset, dims1, NULL);
+status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ dims1, NULL);
/*
* Write the data to the hyperslab.
@@ -99,7 +100,8 @@ status = H5Dextend (dataset, size);
filespace = H5Dget_space (dataset);
offset[0] = 3;
offset[1] = 0;
-status = H5Sset_hyperslab(filespace, offset, dims2, NULL);
+status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ dims2, NULL);
/*
* Define memory space
@@ -126,7 +128,8 @@ status = H5Dextend (dataset, size);
filespace = H5Dget_space (dataset);
offset[0] = 0;
offset[1] = 3;
-status = H5Sset_hyperslab(filespace, offset, dims3, NULL);
+status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ dims3, NULL);
/*
* Define memory space.
diff --git a/examples/h5_group.c b/examples/h5_group.c
index 9835bcf..6e34e98 100644
--- a/examples/h5_group.c
+++ b/examples/h5_group.c
@@ -17,8 +17,8 @@ main()
hid_t dataset, dataspace;
herr_t status;
- size_t dims[2];
- size_t size[1];
+ hsize_t dims[2];
+ hsize_t size[1];
/*
* Create a file.
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
diff --git a/examples/h5_write.c b/examples/h5_write.c
index 98e321f..c57fc7c 100644
--- a/examples/h5_write.c
+++ b/examples/h5_write.c
@@ -1,9 +1,9 @@
/*
- * This example writes data to HDF5 file.
+ * This example writes data to the HDF5 file.
* Data conversion is performed during write operation.
*/
-#include "hdf5.h"
+#include <hdf5.h>
#define FILE "SDS.h5"
#define DATASETNAME "IntArray"
@@ -15,9 +15,9 @@ main ()
{
hid_t file, dataset; /* file and dataset handles */
hid_t datatype, dataspace; /* handles */
- size_t dimsf[2]; /* dataset dimensions */
+ hsize_t dimsf[2]; /* dataset dimensions */
herr_t status;
- int32 data[NX][NY]; /* data to write */
+ int data[NX][NY]; /* data to write */
int i, j;
/*
@@ -51,9 +51,9 @@ dataspace = H5Screate_simple(RANK, dimsf, NULL);
/*
* Define datatype for the data in the file.
- * We will store little endian INT32 numbers.
+ * We will store little endian INT numbers.
*/
-datatype = H5Tcopy(H5T_NATIVE_INT32);
+datatype = H5Tcopy(H5T_NATIVE_INT);
status = H5Tset_order(datatype, H5T_ORDER_LE);
/*
* Create a new dataset within the file using defined dataspace and
@@ -65,7 +65,7 @@ dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace,
/*
* Write the data to the dataset using default transfer properties.
*/
-status = H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL,
+status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
H5P_DEFAULT, data);
/*