summaryrefslogtreecommitdiffstats
path: root/examples/h5_extend_write.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/h5_extend_write.c')
-rw-r--r--examples/h5_extend_write.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c
index bcb9949..9a30d46 100644
--- a/examples/h5_extend_write.c
+++ b/examples/h5_extend_write.c
@@ -12,46 +12,46 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
+/*
* This example shows how to work with extendible dataset.
* In the current version of the library dataset MUST be
* chunked.
- *
+ *
*/
-
+
#include "hdf5.h"
#define H5FILE_NAME "SDSextendible.h5"
-#define DATASETNAME "ExtendibleArray"
+#define DATASETNAME "ExtendibleArray"
#define RANK 2
#define NX 10
-#define NY 5
+#define NY 5
int
main (void)
{
hid_t file; /* handles */
- hid_t dataspace, dataset;
- hid_t filespace;
- hid_t cparms;
+ hid_t dataspace, dataset;
+ hid_t filespace;
+ hid_t cparms;
hsize_t dims[2] = { 3, 3}; /*
- * dataset dimensions
+ * 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 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];
hsize_t offset[2];
- herr_t status;
+ herr_t status;
int data1[3][3] = { {1, 1, 1}, /* data to write */
{1, 1, 1},
- {1, 1, 1} };
+ {1, 1, 1} };
int data2[7] = { 2, 2, 2, 2, 2, 2, 2};
@@ -60,16 +60,16 @@ main (void)
int fillvalue = 0;
/*
- * Create the data space with unlimited dimensions.
+ * Create the data space with unlimited dimensions.
*/
- dataspace = H5Screate_simple(RANK, dims, maxdims);
+ dataspace = H5Screate_simple(RANK, dims, maxdims);
/*
* Create a new file. If file exists its contents will be overwritten.
*/
file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- /*
+ /*
* Modify dataset creation properties, i.e. enable chunking.
*/
cparms = H5Pcreate(H5P_DATASET_CREATE);
@@ -86,8 +86,8 @@ main (void)
/*
* Extend the dataset. This call assures that dataset is at least 3 x 3.
*/
- size[0] = 3;
- size[1] = 3;
+ size[0] = 3;
+ size[1] = 3;
status = H5Dextend (dataset, size);
/*
@@ -97,7 +97,7 @@ main (void)
offset[0] = 0;
offset[1] = 0;
status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims1, NULL);
+ dims1, NULL);
/*
* Write the data to the hyperslab.
@@ -109,8 +109,8 @@ main (void)
* Extend the dataset. Dataset becomes 10 x 3.
*/
dims[0] = dims1[0] + dims2[0];
- size[0] = dims[0];
- size[1] = dims[1];
+ size[0] = dims[0];
+ size[1] = dims[1];
status = H5Dextend (dataset, size);
/*
@@ -120,12 +120,12 @@ main (void)
offset[0] = 3;
offset[1] = 0;
status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims2, NULL);
+ dims2, NULL);
/*
* Define memory space
*/
- dataspace = H5Screate_simple(RANK, dims2, NULL);
+ dataspace = H5Screate_simple(RANK, dims2, NULL);
/*
* Write the data to the hyperslab.
@@ -137,8 +137,8 @@ main (void)
* Extend the dataset. Dataset becomes 10 x 5.
*/
dims[1] = dims1[1] + dims3[1];
- size[0] = dims[0];
- size[1] = dims[1];
+ size[0] = dims[0];
+ size[1] = dims[1];
status = H5Dextend (dataset, size);
/*
@@ -147,13 +147,13 @@ main (void)
filespace = H5Dget_space (dataset);
offset[0] = 0;
offset[1] = 3;
- status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
- dims3, NULL);
+ status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL,
+ dims3, NULL);
/*
* Define memory space.
*/
- dataspace = H5Screate_simple(RANK, dims3, NULL);
+ dataspace = H5Screate_simple(RANK, dims3, NULL);
/*
* Write the data to the hyperslab.
@@ -163,7 +163,7 @@ main (void)
/*
* Resulting dataset
- *
+ *
* 3 3 3 2 2
* 3 3 3 2 2
* 3 3 3 0 0
@@ -185,4 +185,4 @@ main (void)
H5Fclose(file);
return 0;
-}
+}