summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-31 19:21:23 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-31 19:21:23 (GMT)
commit2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a (patch)
treec23cdadb45857e5e8549bb14fd057db63cce7c26 /examples
parent473452205dcc08055486d29b6dc5f36670c3ceb5 (diff)
downloadhdf5-2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a.zip
hdf5-2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a.tar.gz
hdf5-2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a.tar.bz2
[svn-r635] Changes since 19980831
---------------------- ./Makefile.in Running `make distclean' will not fail if one of the subdirectories has already been cleaned. ./config/BlankForm ./config/irix5.3 Cleaned it up more. Added better support/documentation for systems that have more than one compiler. ./config/alpha-dec-osf4.0 [NEW] Added a new config file as a result of testing on Jim Reus's machine. ./test/chunk.c Scaled down the testing range so we can actually run it interactively. ./tools/h5import.c Included <unistd.h> to get rid of warning for close(). ./src/H5detect.c Seg-faults on Linux for some reason when NDEBUG is defined, so I just undef it at the top of the source. ./test/big.c Added a fflush(). ./tools/h5ls.c The `-d' flag now works even when `-v' isn't specified. ./examples/h5_chunk_read.c ./examples/h5_compound.c ./examples/h5_extend_write.c ./examples/h5_group.c ./examples/h5_read.c ./examples/h5_write.c Indented according to hdf5 standards. Fixed compiler warnings
Diffstat (limited to 'examples')
-rw-r--r--examples/h5_chunk_read.c324
-rw-r--r--examples/h5_compound.c263
-rw-r--r--examples/h5_extend_write.c304
-rw-r--r--examples/h5_group.c205
-rw-r--r--examples/h5_read.c198
-rw-r--r--examples/h5_write.c116
6 files changed, 713 insertions, 697 deletions
diff --git a/examples/h5_chunk_read.c b/examples/h5_chunk_read.c
index 681febc..0ee70db 100644
--- a/examples/h5_chunk_read.c
+++ b/examples/h5_chunk_read.c
@@ -12,177 +12,177 @@
#define NX 10
#define NY 5
-main ()
+int
+main (void)
{
- hid_t file; /* handles */
- hid_t datatype, dataset;
- hid_t filespace;
- hid_t memspace;
- hid_t cparms;
- H5T_class_t class; /* data type class */
- size_t elem_size; /* size of the data element
- stored in file */
- hsize_t dims[2]; /* dataset and chunk dimensions */
- hsize_t chunk_dims[2];
- hsize_t col_dims[1];
- size_t size[2];
- hsize_t count[2];
- hsize_t offset[2];
-
- herr_t status, status_n;
-
- int data_out[NX][NY]; /* buffer for dataset to be read */
- int chunk_out[2][5]; /* buffer for chunk to be read */
- int column[10]; /* buffer for column to be read */
- int i, j, rank, rank_chunk;
+ hid_t file; /* handles */
+ hid_t dataset;
+ hid_t filespace;
+ hid_t memspace;
+ hid_t cparms;
+ hsize_t dims[2]; /* dataset and chunk dimensions*/
+ hsize_t chunk_dims[2];
+ hsize_t col_dims[1];
+ hsize_t count[2];
+ hsize_t offset[2];
+
+ herr_t status, status_n;
+
+ int data_out[NX][NY]; /* buffer for dataset to be read */
+ int chunk_out[2][5]; /* buffer for chunk to be read */
+ int column[10]; /* buffer for column to be read */
+ int rank, rank_chunk;
+ hsize_t i, j;
+
-/*
- * Open the file and the dataset.
- */
-file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
-dataset = H5Dopen(file, DATASETNAME);
-
-/*
- * Get dataset rank and dimension.
- */
+ /*
+ * Open the file and the dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dataset = H5Dopen(file, DATASETNAME);
-filespace = H5Dget_space(dataset); /* Get filespace handle first. */
-rank = H5Sextent_ndims(filespace);
-status_n = H5Sextent_dims(filespace, dims, NULL);
-printf("dataset rank %d, dimensions %d x %d \n", rank, dims[0], dims[1]);
-
-/*
- * Get creation properties list.
- */
-cparms = H5Dget_create_plist(dataset); /* Get properties handle first. */
-
-/*
- * Check if dataset is chunked.
- */
- if (H5D_CHUNKED == H5Pget_layout(cparms)) {
-
-/*
- * Get chunking information: rank and dimensions
- */
-rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims);
-printf("chunk rank %d, dimensions %d x %d \n", rank_chunk,
- chunk_dims[0], chunk_dims[1]);
-}
+ /*
+ * Get dataset rank and dimension.
+ */
+
+ filespace = H5Dget_space(dataset); /* Get filespace handle first. */
+ rank = H5Sextent_ndims(filespace);
+ status_n = H5Sextent_dims(filespace, dims, NULL);
+ printf("dataset rank %d, dimensions %lu x %lu\n",
+ rank, (unsigned long)(dims[0]), (unsigned long)(dims[1]));
+
+ /*
+ * Get creation properties list.
+ */
+ cparms = H5Dget_create_plist(dataset); /* Get properties handle first. */
+
+ /*
+ * Check if dataset is chunked.
+ */
+ if (H5D_CHUNKED == H5Pget_layout(cparms)) {
+
+ /*
+ * Get chunking information: rank and dimensions
+ */
+ rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims);
+ printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk,
+ (unsigned long)(chunk_dims[0]), (unsigned long)(chunk_dims[1]));
+ }
-/*
- * Define the memory space to read dataset.
- */
-memspace = H5Screate_simple(RANK,dims,NULL);
+ /*
+ * Define the memory space to read dataset.
+ */
+ memspace = H5Screate_simple(RANK,dims,NULL);
-/*
- * Read dataset back and display.
- */
-status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, data_out);
+ /*
+ * Read dataset back and display.
+ */
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
+ H5P_DEFAULT, data_out);
printf("\n");
printf("Dataset: \n");
-for (j = 0; j < dims[0]; j++) {
- for (i = 0; i < dims[1]; i++) printf("%d ", data_out[j][i]);
+ for (j = 0; j < dims[0]; j++) {
+ for (i = 0; i < dims[1]; i++) printf("%d ", data_out[j][i]);
+ printf("\n");
+ }
+
+ /*
+ * dataset rank 2, dimensions 10 x 5
+ * chunk rank 2, dimensions 2 x 5
+
+ * Dataset:
+ * 1 1 1 3 3
+ * 1 1 1 3 3
+ * 1 1 1 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ */
+
+ /*
+ * Read the third column from the dataset.
+ * First define memory dataspace, then define hyperslab
+ * and read it into column array.
+ */
+ col_dims[0] = 10;
+ memspace = H5Screate_simple(RANKC, col_dims, NULL);
+
+ /*
+ * Define the column (hyperslab) to read.
+ */
+ offset[0] = 0;
+ offset[1] = 2;
+ count[0] = 10;
+ count[1] = 1;
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ count, NULL);
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
+ H5P_DEFAULT, column);
printf("\n");
-}
-
-/*
- dataset rank 2, dimensions 10 x 5
- chunk rank 2, dimensions 2 x 5
-
- Dataset:
- 1 1 1 3 3
- 1 1 1 3 3
- 1 1 1 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
-*/
-
-/*
- * Read the third column from the dataset.
- * First define memory dataspace, then define hyperslab
- * and read it into column array.
- */
-col_dims[0] = 10;
-memspace = H5Screate_simple(RANKC, col_dims, NULL);
-
-/*
- * Define the column (hyperslab) to read.
- */
-offset[0] = 0;
-offset[1] = 2;
-count[0] = 10;
-count[1] = 1;
-status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- count, NULL);
-status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, column);
-printf("\n");
-printf("Third column: \n");
-for (i = 0; i < 10; i++) {
- printf("%d \n", column[i]);
-}
-
-/*
-
- Third column:
- 1
- 1
- 1
- 0
- 0
- 0
- 0
- 0
- 0
- 0
-*/
-
-/*
- * Define the memory space to read a chunk.
- */
-memspace = H5Screate_simple(rank_chunk,chunk_dims,NULL);
-
-/*
- * Define chunk in the file (hyperslab) to read.
- */
-offset[0] = 2;
-offset[1] = 0;
-count[0] = chunk_dims[0];
-count[1] = chunk_dims[1];
-status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- count, NULL);
-
-/*
- * Read chunk back and display.
- */
-status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
- H5P_DEFAULT, chunk_out);
+ printf("Third column: \n");
+ for (i = 0; i < 10; i++) {
+ printf("%d \n", column[i]);
+ }
+
+ /*
+ * Third column:
+ * 1
+ * 1
+ * 1
+ * 0
+ * 0
+ * 0
+ * 0
+ * 0
+ * 0
+ * 0
+ */
+
+ /*
+ * Define the memory space to read a chunk.
+ */
+ memspace = H5Screate_simple(rank_chunk,chunk_dims,NULL);
+
+ /*
+ * Define chunk in the file (hyperslab) to read.
+ */
+ offset[0] = 2;
+ offset[1] = 0;
+ count[0] = chunk_dims[0];
+ count[1] = chunk_dims[1];
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ count, NULL);
+
+ /*
+ * Read chunk back and display.
+ */
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace,
+ H5P_DEFAULT, chunk_out);
printf("\n");
printf("Chunk: \n");
-for (j = 0; j < chunk_dims[0]; j++) {
- for (i = 0; i < chunk_dims[1]; i++) printf("%d ", chunk_out[j][i]);
- printf("\n");
-}
-/*
- Chunk:
- 1 1 1 0 0
- 2 0 0 0 0
-*/
-
-/*
- * Close/release resources.
- */
-H5Pclose(cparms);
-H5Dclose(dataset);
-H5Sclose(filespace);
-H5Sclose(memspace);
-H5Fclose(file);
-
+ for (j = 0; j < chunk_dims[0]; j++) {
+ for (i = 0; i < chunk_dims[1]; i++) printf("%d ", chunk_out[j][i]);
+ printf("\n");
+ }
+ /*
+ * Chunk:
+ * 1 1 1 0 0
+ * 2 0 0 0 0
+ */
+
+ /*
+ * Close/release resources.
+ */
+ H5Pclose(cparms);
+ H5Dclose(dataset);
+ H5Sclose(filespace);
+ H5Sclose(memspace);
+ H5Fclose(file);
+
+ return 0;
}
diff --git a/examples/h5_compound.c b/examples/h5_compound.c
index 1641ee6..00cfe34 100644
--- a/examples/h5_compound.c
+++ b/examples/h5_compound.c
@@ -11,142 +11,143 @@
#define LENGTH 10
#define RANK 1
-main()
-
+int
+main(void)
{
-
-/* First structure and dataset*/
-typedef struct s1_t {
- int a;
- float b;
- double c;
-} s1_t;
-s1_t s1[LENGTH];
-hid_t s1_tid; /* File datatype hadle */
-
-/* Second structure (subset of s1_t) and dataset*/
-typedef struct s2_t {
- double c;
- int a;
-} s2_t;
-s2_t s2[LENGTH];
-hid_t s2_tid; /* Memory datatype handle */
-
-/* Third "structure" ( will be used to read float field of s1) */
-hid_t s3_tid; /* Memory datatype handle */
-float s3[LENGTH];
-
-int i;
-hid_t file, datatype, dataset, space; /* Handles */
-herr_t status;
-hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
-
-
-/*
- * Initialize the data
- */
- for (i = 0; i< LENGTH; i++) {
+ /* First structure and dataset*/
+ typedef struct s1_t {
+ int a;
+ float b;
+ double c;
+ } s1_t;
+ s1_t s1[LENGTH];
+ hid_t s1_tid; /* File datatype hadle */
+
+ /* Second structure (subset of s1_t) and dataset*/
+ typedef struct s2_t {
+ double c;
+ int a;
+ } s2_t;
+ s2_t s2[LENGTH];
+ hid_t s2_tid; /* Memory datatype handle */
+
+ /* Third "structure" ( will be used to read float field of s1) */
+ hid_t s3_tid; /* Memory datatype handle */
+ float s3[LENGTH];
+
+ int i;
+ hid_t file, dataset, space; /* Handles */
+ herr_t status;
+ hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
+
+
+ /*
+ * Initialize the data
+ */
+ for (i = 0; i< LENGTH; i++) {
s1[i].a = i;
s1[i].b = i*i;
s1[i].c = 1./(i+1);
-}
-
-/*
- * Create the data space.
- */
-space = H5Screate_simple(RANK, dim, NULL);
-
-/*
- * Create the file.
- */
-file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
-/*
- * Create the memory data type.
- */
-s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
-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.
- */
-dataset = H5Dcreate(file, DATASETNAME, s1_tid, space, H5P_DEFAULT);
-
-/*
- * Wtite data to the dataset;
- */
-status = H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1);
-
-/*
- * Release resources
- */
-H5Tclose(s1_tid);
-H5Sclose(space);
-H5Dclose(dataset);
-H5Fclose(file);
+ }
+
+ /*
+ * Create the data space.
+ */
+ space = H5Screate_simple(RANK, dim, NULL);
+
+ /*
+ * Create the file.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create the memory data type.
+ */
+ s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t));
+ 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.
+ */
+ dataset = H5Dcreate(file, DATASETNAME, s1_tid, space, H5P_DEFAULT);
+
+ /*
+ * Wtite data to the dataset;
+ */
+ status = H5Dwrite(dataset, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1);
+
+ /*
+ * Release resources
+ */
+ H5Tclose(s1_tid);
+ H5Sclose(space);
+ H5Dclose(dataset);
+ H5Fclose(file);
-/*
- * Open the file and the dataset.
- */
-file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ /*
+ * Open the file and the dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
-dataset = H5Dopen(file, DATASETNAME);
-
-/*
- * Create a data type for s2
- */
-s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
-
-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 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);
-
-/*
- * Display the fields
- */
-printf("\n");
-printf("Field c : \n");
-for( i = 0; i < LENGTH; i++) printf("%.4f ", s2[i].c);
-printf("\n");
-
-printf("\n");
-printf("Field a : \n");
-for( i = 0; i < LENGTH; i++) printf("%d ", s2[i].a);
-printf("\n");
-
-/*
- * Create a data type for s3.
- */
-s3_tid = H5Tcreate(H5T_COMPOUND, sizeof(float));
-
-status = H5Tinsert(s3_tid, "b_name", 0, H5T_NATIVE_FLOAT);
-
-/*
- * Read field b from s1 dataset. Field in the file is found by its name.
- */
-status = H5Dread(dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3);
-
-/*
- * Display the field
- */
-printf("\n");
-printf("Field b : \n");
-for( i = 0; i < LENGTH; i++) printf("%.4f ", s3[i]);
-printf("\n");
-
-/*
- * Release resources
- */
-H5Tclose(s2_tid);
-H5Tclose(s3_tid);
-H5Dclose(dataset);
-H5Fclose(file);
+ dataset = H5Dopen(file, DATASETNAME);
+
+ /*
+ * Create a data type for s2
+ */
+ s2_tid = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
+
+ 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 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);
+
+ /*
+ * Display the fields
+ */
+ printf("\n");
+ printf("Field c : \n");
+ for( i = 0; i < LENGTH; i++) printf("%.4f ", s2[i].c);
+ printf("\n");
+
+ printf("\n");
+ printf("Field a : \n");
+ for( i = 0; i < LENGTH; i++) printf("%d ", s2[i].a);
+ printf("\n");
+
+ /*
+ * Create a data type for s3.
+ */
+ s3_tid = H5Tcreate(H5T_COMPOUND, sizeof(float));
+
+ status = H5Tinsert(s3_tid, "b_name", 0, H5T_NATIVE_FLOAT);
+
+ /*
+ * Read field b from s1 dataset. Field in the file is found by its name.
+ */
+ status = H5Dread(dataset, s3_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s3);
+
+ /*
+ * Display the field
+ */
+ printf("\n");
+ printf("Field b : \n");
+ for( i = 0; i < LENGTH; i++) printf("%.4f ", s3[i]);
+ printf("\n");
+
+ /*
+ * Release resources
+ */
+ H5Tclose(s2_tid);
+ H5Tclose(s3_tid);
+ H5Dclose(dataset);
+ H5Fclose(file);
+
+ return 0;
}
diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c
index 6b20a1e..af061bc 100644
--- a/examples/h5_extend_write.c
+++ b/examples/h5_extend_write.c
@@ -13,155 +13,159 @@
#define NX 10
#define NY 5
-main ()
+int
+main (void)
{
- hid_t file; /* handles */
- hid_t datatype, dataspace, dataset;
- hid_t filespace;
- hid_t cparms;
- hsize_t dims[2] = { 3, 3}; /* dataset dimensions
- at the creation time */
- hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */
- hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */
- hsize_t dims3[2] = { 2, 2}; /* data3 dimensions */
-
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t chunk_dims[2] ={2, 5};
- hsize_t size[2];
- hssize_t offset[2];
-
- herr_t status;
-
- int data1[3][3] = { 1, 1, 1, /* data to write */
- 1, 1, 1,
- 1, 1, 1 };
-
- int data2[7] = { 2, 2, 2, 2, 2, 2, 2};
-
- int data3[2][2] = { 3, 3,
- 3, 3};
-
-/*
- * Create the data space with ulimited dimensions.
- */
-dataspace = H5Screate_simple(RANK, dims, maxdims);
-
-/*
- * Create a new file. If file exists its contents will be overwritten.
- */
-file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
-/*
- * Modify dataset creation properties, i.e. enable chunking.
- */
-cparms = H5Pcreate (H5P_DATASET_CREATE);
-status = H5Pset_chunk( cparms, RANK, chunk_dims);
-
-/*
- * Create a new dataset within the file using cparms
- * creation properties.
- */
-dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, dataspace,
- cparms);
-
-/*
- * Extend the dataset. This call assures that dataset is at least 3 x 3.
- */
-size[0] = 3;
-size[1] = 3;
-status = H5Dextend (dataset, size);
-
-/*
- * Select a hyperslab.
- */
-filespace = H5Dget_space (dataset);
-offset[0] = 0;
-offset[1] = 0;
-status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims1, NULL);
-
-/*
- * Write the data to the hyperslab.
- */
-status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
- H5P_DEFAULT, data1);
-
-/*
- * Extend the dataset. Dataset becomes 10 x 3.
- */
-dims[0] = dims1[0] + dims2[0];
-size[0] = dims[0];
-size[1] = dims[1];
-status = H5Dextend (dataset, size);
-
-/*
- * Select a hyperslab.
- */
-filespace = H5Dget_space (dataset);
-offset[0] = 3;
-offset[1] = 0;
-status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims2, NULL);
-
-/*
- * Define memory space
- */
-dataspace = H5Screate_simple(RANK, dims2, NULL);
-
-/*
- * Write the data to the hyperslab.
- */
-status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
- H5P_DEFAULT, data2);
-
-/*
- * Extend the dataset. Dataset becomes 10 x 5.
- */
-dims[1] = dims1[1] + dims3[1];
-size[0] = dims[0];
-size[1] = dims[1];
-status = H5Dextend (dataset, size);
-
-/*
- * Select a hyperslab
- */
-filespace = H5Dget_space (dataset);
-offset[0] = 0;
-offset[1] = 3;
-status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims3, NULL);
-
-/*
- * Define memory space.
- */
-dataspace = H5Screate_simple(RANK, dims3, NULL);
-
-/*
- * Write the data to the hyperslab.
- */
-status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
- H5P_DEFAULT, data3);
-
-/*
- * Resulting dataset
- *
- 3 3 3 2 2
- 3 3 3 2 2
- 3 3 3 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- 2 0 0 0 0
- */
-/*
- * Close/release resources.
- */
-H5Dclose(dataset);
-H5Sclose(dataspace);
-H5Sclose(filespace);
-H5Fclose(file);
-
+ hid_t file; /* handles */
+ hid_t dataspace, dataset;
+ hid_t filespace;
+ hid_t cparms;
+ hsize_t dims[2] = { 3, 3}; /*
+ * dataset dimensions
+ * at the creation time
+ */
+ hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */
+ hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */
+ hsize_t dims3[2] = { 2, 2}; /* data3 dimensions */
+
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] ={2, 5};
+ hsize_t size[2];
+ hssize_t offset[2];
+
+ herr_t status;
+
+ int data1[3][3] = { {1, 1, 1}, /* data to write */
+ {1, 1, 1},
+ {1, 1, 1} };
+
+ int data2[7] = { 2, 2, 2, 2, 2, 2, 2};
+
+ int data3[2][2] = { {3, 3},
+ {3, 3} };
+
+ /*
+ * Create the data space with ulimited dimensions.
+ */
+ dataspace = H5Screate_simple(RANK, dims, maxdims);
+
+ /*
+ * Create a new file. If file exists its contents will be overwritten.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Modify dataset creation properties, i.e. enable chunking.
+ */
+ cparms = H5Pcreate (H5P_DATASET_CREATE);
+ status = H5Pset_chunk( cparms, RANK, chunk_dims);
+
+ /*
+ * Create a new dataset within the file using cparms
+ * creation properties.
+ */
+ dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, dataspace,
+ cparms);
+
+ /*
+ * Extend the dataset. This call assures that dataset is at least 3 x 3.
+ */
+ size[0] = 3;
+ size[1] = 3;
+ status = H5Dextend (dataset, size);
+
+ /*
+ * Select a hyperslab.
+ */
+ filespace = H5Dget_space (dataset);
+ offset[0] = 0;
+ offset[1] = 0;
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ dims1, NULL);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
+ H5P_DEFAULT, data1);
+
+ /*
+ * Extend the dataset. Dataset becomes 10 x 3.
+ */
+ dims[0] = dims1[0] + dims2[0];
+ size[0] = dims[0];
+ size[1] = dims[1];
+ status = H5Dextend (dataset, size);
+
+ /*
+ * Select a hyperslab.
+ */
+ filespace = H5Dget_space (dataset);
+ offset[0] = 3;
+ offset[1] = 0;
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ dims2, NULL);
+
+ /*
+ * Define memory space
+ */
+ dataspace = H5Screate_simple(RANK, dims2, NULL);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
+ H5P_DEFAULT, data2);
+
+ /*
+ * Extend the dataset. Dataset becomes 10 x 5.
+ */
+ dims[1] = dims1[1] + dims3[1];
+ size[0] = dims[0];
+ size[1] = dims[1];
+ status = H5Dextend (dataset, size);
+
+ /*
+ * Select a hyperslab
+ */
+ filespace = H5Dget_space (dataset);
+ offset[0] = 0;
+ offset[1] = 3;
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ dims3, NULL);
+
+ /*
+ * Define memory space.
+ */
+ dataspace = H5Screate_simple(RANK, dims3, NULL);
+
+ /*
+ * Write the data to the hyperslab.
+ */
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, dataspace, filespace,
+ H5P_DEFAULT, data3);
+
+ /*
+ * Resulting dataset
+ *
+ * 3 3 3 2 2
+ * 3 3 3 2 2
+ * 3 3 3 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ * 2 0 0 0 0
+ */
+ /*
+ * Close/release resources.
+ */
+ H5Dclose(dataset);
+ H5Sclose(dataspace);
+ H5Sclose(filespace);
+ H5Fclose(file);
+
+ return 0;
}
diff --git a/examples/h5_group.c b/examples/h5_group.c
index 6e34e98..1c5ab12 100644
--- a/examples/h5_group.c
+++ b/examples/h5_group.c
@@ -10,108 +10,109 @@
#define FILE "DIR.h5"
#define RANK 2
-main()
+int
+main(void)
{
- hid_t file, dir;
- hid_t dataset, dataspace;
-
- herr_t status;
- hsize_t dims[2];
- hsize_t size[1];
-
-/*
- * Create a file.
- */
-file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
-/*
- * Create two groups in a file.
- */
-dir = H5Gcreate(file, "/IntData", 0);
-status = H5Gclose(dir);
-
-dir = H5Gcreate(file,"/FloatData", 0);
-status = H5Gclose(dir);
-
-/*
- * Create dataspace for the character string
- */
-size[0] = 80;
-dataspace = H5Screate_simple(1, size, NULL);
-
-/*
- * Create dataset "String" in the root group.
- */
-dataset = H5Dcreate(file, "String", H5T_NATIVE_CHAR, dataspace, H5P_DEFAULT);
-H5Dclose(dataset);
-
-/*
- * Create dataset "String" in the /IntData group.
- */
-dataset = H5Dcreate(file, "/IntData/String", H5T_NATIVE_CHAR, dataspace,
- H5P_DEFAULT);
-H5Dclose(dataset);
-
-/*
- * Create dataset "String" in the /FloatData group.
- */
-dataset = H5Dcreate(file, "/FloatData/String", H5T_NATIVE_CHAR, dataspace,
- H5P_DEFAULT);
-H5Sclose(dataspace);
-H5Dclose(dataset);
-
-/*
- * Create IntArray dataset in the /IntData group by specifying full path.
- */
-dims[0] = 2;
-dims[1] = 3;
-dataspace = H5Screate_simple(RANK, dims, NULL);
-dataset = H5Dcreate(file, "/IntData/IntArray", H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT);
-H5Sclose(dataspace);
-H5Dclose(dataset);
-
-/*
- * Set current group to /IntData and attach to the dataset String.
- */
-
-status = H5Gset (file, "/IntData");
-dataset = H5Dopen(file, "String");
-if (dataset > 0) printf("String dataset in /IntData group is found\n");
-H5Dclose(dataset);
-
-/*
- * Set current group to /FloatData.
- */
-status = H5Gset (file, "/FloatData");
-
-/*
- * Create two datasets FlatArray and DoubleArray.
- */
-
-dims[0] = 5;
-dims[1] = 10;
-dataspace = H5Screate_simple(RANK, dims, NULL);
-dataset = H5Dcreate(file, "FloatArray", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT);
-H5Sclose(dataspace);
-H5Dclose(dataset);
-
-dims[0] = 4;
-dims[1] = 6;
-dataspace = H5Screate_simple(RANK, dims, NULL);
-dataset = H5Dcreate(file, "DoubleArray", H5T_NATIVE_DOUBLE, dataspace,
- H5P_DEFAULT);
-H5Sclose(dataspace);
-H5Dclose(dataset);
-
-/*
- * Attach to /FloatData/String dataset.
- */
-
-dataset = H5Dopen(file, "/FloatData/String");
-if (dataset > 0) printf("/FloatData/String dataset is found\n");
-H5Dclose(dataset);
-H5Fclose(file);
-
+ hid_t file, dir;
+ hid_t dataset, dataspace;
+
+ herr_t status;
+ hsize_t dims[2];
+ hsize_t size[1];
+
+ /*
+ * Create a file.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create two groups in a file.
+ */
+ dir = H5Gcreate(file, "/IntData", 0);
+ status = H5Gclose(dir);
+
+ dir = H5Gcreate(file,"/FloatData", 0);
+ status = H5Gclose(dir);
+
+ /*
+ * Create dataspace for the character string
+ */
+ size[0] = 80;
+ dataspace = H5Screate_simple(1, size, NULL);
+
+ /*
+ * Create dataset "String" in the root group.
+ */
+ dataset = H5Dcreate(file, "String", H5T_NATIVE_CHAR, dataspace,
+ H5P_DEFAULT);
+ H5Dclose(dataset);
+
+ /*
+ * Create dataset "String" in the /IntData group.
+ */
+ dataset = H5Dcreate(file, "/IntData/String", H5T_NATIVE_CHAR, dataspace,
+ H5P_DEFAULT);
+ H5Dclose(dataset);
+
+ /*
+ * Create dataset "String" in the /FloatData group.
+ */
+ dataset = H5Dcreate(file, "/FloatData/String", H5T_NATIVE_CHAR, dataspace,
+ H5P_DEFAULT);
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ /*
+ * Create IntArray dataset in the /IntData group by specifying full path.
+ */
+ dims[0] = 2;
+ dims[1] = 3;
+ dataspace = H5Screate_simple(RANK, dims, NULL);
+ dataset = H5Dcreate(file, "/IntData/IntArray", H5T_NATIVE_INT, dataspace,
+ H5P_DEFAULT);
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ /*
+ * Set current group to /IntData and attach to the dataset String.
+ */
+ status = H5Gset (file, "/IntData");
+ dataset = H5Dopen(file, "String");
+ if (dataset > 0) printf("String dataset in /IntData group is found\n");
+ H5Dclose(dataset);
+
+ /*
+ * Set current group to /FloatData.
+ */
+ status = H5Gset (file, "/FloatData");
+
+ /*
+ * Create two datasets FlatArray and DoubleArray.
+ */
+ dims[0] = 5;
+ dims[1] = 10;
+ dataspace = H5Screate_simple(RANK, dims, NULL);
+ dataset = H5Dcreate(file, "FloatArray", H5T_NATIVE_FLOAT, dataspace,
+ H5P_DEFAULT);
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ dims[0] = 4;
+ dims[1] = 6;
+ dataspace = H5Screate_simple(RANK, dims, NULL);
+ dataset = H5Dcreate(file, "DoubleArray", H5T_NATIVE_DOUBLE, dataspace,
+ H5P_DEFAULT);
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ /*
+ * Attach to /FloatData/String dataset.
+ */
+ dataset = H5Dopen(file, "/FloatData/String");
+ if (dataset > 0) printf("/FloatData/String dataset is found\n");
+ H5Dclose(dataset);
+ H5Fclose(file);
+
+ return 0;
}
diff --git a/examples/h5_read.c b/examples/h5_read.c
index 51bf381..599ba59 100644
--- a/examples/h5_read.c
+++ b/examples/h5_read.c
@@ -17,114 +17,120 @@
#define RANK 2
#define RANK_OUT 3
-main ()
+int
+main (void)
{
- hid_t file, dataset; /* handles */
- hid_t datatype, dataspace;
- hid_t memspace;
- H5T_class_t class; /* data type class */
- H5T_order_t order; /* data order */
- size_t size; /* size of the data element
- stored in file */
- hsize_t dimsm[3]; /* memory space dimensions */
- hsize_t dims_out[2]; /* dataset dimensions */
- herr_t status;
+ hid_t file, dataset; /* handles */
+ hid_t datatype, dataspace;
+ hid_t memspace;
+ H5T_class_t class; /* data type class */
+ H5T_order_t order; /* data order */
+ size_t size; /*
+ * size of the data element
+ * stored in file
+ */
+ 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 */
+ int data_out[NX][NY][NZ ]; /* output buffer */
- 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;
+ 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++) {
- for (k = 0; k < NZ ; k++)
- data_out[j][i][k] = 0;
- }
-}
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) {
+ for (k = 0; k < NZ ; k++)
+ data_out[j][i][k] = 0;
+ }
+ }
-/*
- * Open the file and the dataset.
- */
-file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
-dataset = H5Dopen(file, DATASETNAME);
+ /*
+ * Open the file and the dataset.
+ */
+ file = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT);
+ dataset = H5Dopen(file, DATASETNAME);
-/*
- * Get datatype and dataspace handles and then query
- * dataset class, order, size, rank and dimensions.
- */
+ /*
+ * Get datatype and dataspace handles and then query
+ * dataset class, order, size, rank and dimensions.
+ */
+ datatype = H5Dget_type(dataset); /* datatype handle */
+ class = H5Tget_class(datatype);
+ if (class == H5T_INTEGER) printf("Data set has INTEGER type \n");
+ order = H5Tget_order(datatype);
+ if (order == H5T_ORDER_LE) printf("Little endian order \n");
-datatype = H5Dget_type(dataset); /* datatype handle */
-class = H5Tget_class(datatype);
-if (class == H5T_INTEGER) printf("Data set has INTEGER type \n");
-order = H5Tget_order(datatype);
-if (order == H5T_ORDER_LE) printf("Little endian order \n");
+ size = H5Tget_size(datatype);
+ printf(" Data size is %d \n", size);
-size = H5Tget_size(datatype);
-printf(" Data size is %d \n", size);
+ dataspace = H5Dget_space(dataset); /* dataspace handle */
+ rank = H5Sextent_ndims(dataspace);
+ status_n = H5Sextent_dims(dataspace, dims_out, NULL);
+ printf("rank %d, dimensions %lu x %lu \n", rank,
+ (unsigned long)(dims_out[0]), (unsigned long)(dims_out[1]));
-dataspace = H5Dget_space(dataset); /* dataspace handle */
-rank = H5Sextent_ndims(dataspace);
-status_n = H5Sextent_dims(dataspace, dims_out, NULL);
-printf("rank %d, dimensions %d x %d \n", rank, dims_out[0], dims_out[1]);
-
-/*
- * Define hyperslab in the datatset.
- */
-offset[0] = 1;
-offset[1] = 2;
-count[0] = NX_SUB;
-count[1] = NY_SUB;
-status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL,
- count, NULL);
+ /*
+ * Define hyperslab in the datatset.
+ */
+ offset[0] = 1;
+ offset[1] = 2;
+ count[0] = NX_SUB;
+ count[1] = NY_SUB;
+ status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL,
+ count, NULL);
-/*
- * Define the memory dataspace.
- */
-dimsm[0] = NX;
-dimsm[1] = NY;
-dimsm[2] = NZ ;
-memspace = H5Screate_simple(RANK_OUT,dimsm,NULL);
+ /*
+ * Define the memory dataspace.
+ */
+ dimsm[0] = NX;
+ dimsm[1] = NY;
+ dimsm[2] = NZ ;
+ memspace = H5Screate_simple(RANK_OUT,dimsm,NULL);
-/*
- * Define memory hyperslab.
- */
-offset_out[0] = 3;
-offset_out[1] = 0;
-offset_out[2] = 0;
-count_out[0] = NX_SUB;
-count_out[1] = NY_SUB;
-count_out[2] = 1;
-status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL,
- count_out, NULL);
+ /*
+ * Define memory hyperslab.
+ */
+ offset_out[0] = 3;
+ offset_out[1] = 0;
+ offset_out[2] = 0;
+ count_out[0] = NX_SUB;
+ count_out[1] = NY_SUB;
+ count_out[2] = 1;
+ status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL,
+ count_out, NULL);
-/*
- * Read data from hyperslab in the file into the hyperslab in
- * memory and display.
- */
-status = H5Dread(dataset, H5T_NATIVE_INT, memspace, dataspace,
- H5P_DEFAULT, data_out);
-for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]);
- printf("\n");
-}
- /* 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0
- 3 4 5 6 0 0 0
- 4 5 6 7 0 0 0
- 5 6 7 8 0 0 0
- 0 0 0 0 0 0 0 */
+ /*
+ * Read data from hyperslab in the file into the hyperslab in
+ * memory and display.
+ */
+ status = H5Dread(dataset, H5T_NATIVE_INT, memspace, dataspace,
+ H5P_DEFAULT, data_out);
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++) printf("%d ", data_out[j][i][0]);
+ printf("\n");
+ }
+ /*
+ * 0 0 0 0 0 0 0
+ * 0 0 0 0 0 0 0
+ * 0 0 0 0 0 0 0
+ * 3 4 5 6 0 0 0
+ * 4 5 6 7 0 0 0
+ * 5 6 7 8 0 0 0
+ * 0 0 0 0 0 0 0
+ */
-/*
- * Close/release resources.
- */
-H5Tclose(datatype);
-H5Dclose(dataset);
-H5Sclose(dataspace);
-H5Sclose(memspace);
-H5Fclose(file);
+ /*
+ * Close/release resources.
+ */
+ H5Tclose(datatype);
+ H5Dclose(dataset);
+ H5Sclose(dataspace);
+ H5Sclose(memspace);
+ H5Fclose(file);
+ return 0;
}
diff --git a/examples/h5_write.c b/examples/h5_write.c
index c57fc7c..7611950 100644
--- a/examples/h5_write.c
+++ b/examples/h5_write.c
@@ -11,69 +11,73 @@
#define NY 6
#define RANK 2
-main ()
+int
+main (void)
{
- hid_t file, dataset; /* file and dataset handles */
- hid_t datatype, dataspace; /* handles */
- hsize_t dimsf[2]; /* dataset dimensions */
- herr_t status;
- int data[NX][NY]; /* data to write */
- int i, j;
+ hid_t file, dataset; /* file and dataset handles */
+ hid_t datatype, dataspace; /* handles */
+ hsize_t dimsf[2]; /* dataset dimensions */
+ herr_t status;
+ int data[NX][NY]; /* data to write */
+ int i, j;
-/*
- * Data and output buffer initialization.
- */
+ /*
+ * Data and output buffer initialization.
+ */
+ for (j = 0; j < NX; j++) {
+ for (i = 0; i < NY; i++)
+ data[j][i] = i + j;
+ }
+ /*
+ * 0 1 2 3 4 5
+ * 1 2 3 4 5 6
+ * 2 3 4 5 6 7
+ * 3 4 5 6 7 8
+ * 4 5 6 7 8 9
+ */
-for (j = 0; j < NX; j++) {
- for (i = 0; i < NY; i++)
- data[j][i] = i + j;
-}
- /* 0 1 2 3 4 5
- 1 2 3 4 5 6
- 2 3 4 5 6 7
- 3 4 5 6 7 8
- 4 5 6 7 8 9 */
+ /*
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-/*
- * Create a new file using H5F_ACC_TRUNC access,
- * default file creation properties, and default file
- * access properties.
- */
-file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /*
+ * Describe the size of the array and create the data space for fixed
+ * size dataset.
+ */
+ dimsf[0] = NX;
+ dimsf[1] = NY;
+ dataspace = H5Screate_simple(RANK, dimsf, NULL);
-/*
- * Describe the size of the array and create the data space for fixed
- * size dataset.
- */
-dimsf[0] = NX;
-dimsf[1] = NY;
-dataspace = H5Screate_simple(RANK, dimsf, NULL);
+ /*
+ * Define datatype for the data in the file.
+ * We will store little endian INT numbers.
+ */
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tset_order(datatype, H5T_ORDER_LE);
-/*
- * Define datatype for the data in the file.
- * We will store little endian INT numbers.
- */
-datatype = H5Tcopy(H5T_NATIVE_INT);
-status = H5Tset_order(datatype, H5T_ORDER_LE);
-/*
- * Create a new dataset within the file using defined dataspace and
- * datatype and default dataset creation properties.
- */
-dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace,
- H5P_DEFAULT);
+ /*
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
+ dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace,
+ H5P_DEFAULT);
-/*
- * Write the data to the dataset using default transfer properties.
- */
-status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, data);
+ /*
+ * Write the data to the dataset using default transfer properties.
+ */
+ status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, data);
-/*
- * Close/release resources.
- */
-H5Sclose(dataspace);
-H5Tclose(datatype);
-H5Dclose(dataset);
-H5Fclose(file);
+ /*
+ * Close/release resources.
+ */
+ H5Sclose(dataspace);
+ H5Tclose(datatype);
+ H5Dclose(dataset);
+ H5Fclose(file);
+ return 0;
}