summaryrefslogtreecommitdiffstats
path: root/examples/h5_vds-percival-unlim.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/h5_vds-percival-unlim.c')
-rw-r--r--examples/h5_vds-percival-unlim.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/examples/h5_vds-percival-unlim.c b/examples/h5_vds-percival-unlim.c
index f6a5f50..0823f40 100644
--- a/examples/h5_vds-percival-unlim.c
+++ b/examples/h5_vds-percival-unlim.c
@@ -12,8 +12,8 @@
/************************************************************
This example illustrates the concept of the virtual dataset.
- Percival use case. Every fifth 10x10 plane in VDS is stored in
- the corresponding 3D unlimited dataset.
+ Percival use case. Every fifth 10x10 plane in VDS is stored in
+ the corresponding 3D unlimited dataset.
There are 4 source datasets total.
This file is intended for use with HDF5 Library version 1.10
@@ -26,15 +26,15 @@
#define VFILE "vds-percival-unlim.h5"
#define DATASET "VDS-Percival-unlim"
-#define VDSDIM0 H5S_UNLIMITED
-#define VDSDIM1 10
-#define VDSDIM2 10
+#define VDSDIM0 H5S_UNLIMITED
+#define VDSDIM1 10
+#define VDSDIM2 10
-#define DIM0 H5S_UNLIMITED
+#define DIM0 H5S_UNLIMITED
#define DIM0_1 10 /* Initial size of the datasets */
-#define DIM1 10
-#define DIM2 10
-#define RANK 3
+#define DIM1 10
+#define DIM2 10
+#define RANK 3
#define PLANE_STRIDE 4
const char *SRC_FILE[] = {
@@ -59,7 +59,7 @@ main (void)
hid_t dcpl;
herr_t status;
hsize_t vdsdims[3] = {4*DIM0_1, VDSDIM1, VDSDIM2},
- vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
+ vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2},
dims[3] = {DIM0_1, DIM1, DIM2},
extdims[3] = {2*DIM0_1, DIM1, DIM2},
chunk_dims[3] = {DIM0_1, DIM1, DIM2},
@@ -95,7 +95,7 @@ main (void)
for (j = 0; j < DIM0_1*DIM1*DIM2; j++) wdata[j] = i+1;
/*
- * Create the source files and datasets. Write data to each dataset and
+ * Create the source files and datasets. Write data to each dataset and
* close all resources.
*/
@@ -111,7 +111,7 @@ main (void)
status = H5Pclose (dcpl);
status = H5Dclose (dset);
status = H5Fclose (file);
- }
+ }
vfile = H5Fcreate (VFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -123,7 +123,7 @@ main (void)
/* Create VDS creation property */
dcpl = H5Pcreate (H5P_DATASET_CREATE);
-
+
/* Initialize hyperslab values */
start[0] = 0;
@@ -142,18 +142,18 @@ main (void)
block[1] = DIM1;
block[2] = DIM2;
- /*
- * Build the mappings
+ /*
+ * Build the mappings
*
*/
status = H5Sselect_hyperslab (src_space, H5S_SELECT_SET, start, NULL, src_count, block);
for (i=0; i < PLANE_STRIDE; i++) {
status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, stride, count, block);
status = H5Pset_virtual (dcpl, vspace, SRC_FILE[i], SRC_DATASET[i], src_space);
- start[0]++;
- }
+ start[0]++;
+ }
- H5Sselect_none(vspace);
+ H5Sselect_none(vspace);
/* Create a virtual dataset */
vdset = H5Dcreate2 (vfile, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT,
@@ -179,13 +179,13 @@ main (void)
for (j = 0; j < DIM0_1*DIM1*DIM2; j++) wdata[j] = 10*(i+1);
/*
- * Create the source files and datasets. Write data to each dataset and
+ * Create the source files and datasets. Write data to each dataset and
* close all resources.
*/
file = H5Fopen (SRC_FILE[i], H5F_ACC_RDWR, H5P_DEFAULT);
dset = H5Dopen2 (file, SRC_DATASET[i], H5P_DEFAULT);
- status = H5Dset_extent (dset, extdims);
+ status = H5Dset_extent (dset, extdims);
src_space = H5Dget_space (dset);
start[0] = DIM0_1;
start[1] = 0;
@@ -197,7 +197,7 @@ main (void)
block[1] = DIM1;
block[2] = DIM2;
- mem_space = H5Screate_simple(RANK, dims, NULL);
+ mem_space = H5Screate_simple(RANK, dims, NULL);
status = H5Sselect_hyperslab (src_space, H5S_SELECT_SET, start, NULL, count, block);
status = H5Dwrite (dset, H5T_NATIVE_INT, mem_space, src_space, H5P_DEFAULT,
wdata);
@@ -207,8 +207,8 @@ main (void)
}
status = H5Dclose (vdset);
- status = H5Fclose (vfile);
-
+ status = H5Fclose (vfile);
+
/*
* Now we begin the read section of this example.
*/
@@ -229,7 +229,7 @@ main (void)
*/
layout = H5Pget_layout (dcpl);
- if (H5D_VIRTUAL == layout)
+ if (H5D_VIRTUAL == layout)
printf(" Dataset has a virtual layout \n");
else
printf(" Wrong layout found \n");
@@ -240,15 +240,15 @@ main (void)
status = H5Pget_virtual_count (dcpl, &num_map);
printf(" Number of mappings is %lu\n", (unsigned long)num_map);
- /*
+ /*
* Get mapping parameters for each mapping.
*/
- for (i = 0; i < (int)num_map; i++) {
+ for (i = 0; i < (int)num_map; i++) {
printf(" Mapping %d \n", i);
printf(" Selection in the virtual dataset \n");
/* Get selection in the virttual dataset */
vspace = H5Pget_virtual_vspace (dcpl, (size_t)i);
- if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
+ if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) {
if (H5Sis_regular_hyperslab(vspace)) {
status = H5Sget_regular_hyperslab (vspace, start_out, stride_out, count_out, block_out);
printf(" start = [%llu, %llu, %llu] \n", (unsigned long long)start_out[0], (unsigned long long)start_out[1], (unsigned long long)start_out[2]);
@@ -300,7 +300,7 @@ main (void)
/* Read all VDS data */
/* EIP We should be able to do it by using H5S_ALL instead of making selection
- * or using H5Sselect_all from vspace.
+ * or using H5Sselect_all from vspace.
*/
start[0] = 0;
start[1] = 0;
@@ -315,12 +315,12 @@ main (void)
status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, NULL, count, block);
mem_space = H5Screate_simple(RANK, vdsdims_out, NULL);
status = H5Dread (vdset, H5T_NATIVE_INT, mem_space, vspace, H5P_DEFAULT,
- rdata);
+ rdata);
printf (" All data: \n");
for (i=0; i < (int)vdsdims_out[0]; i++) {
for (j=0; j < (int)vdsdims_out[1]; j++) {
printf ("(%d, %d, 0)", i, j);
- for (k=0; k < (int)vdsdims_out[2]; k++)
+ for (k=0; k < (int)vdsdims_out[2]; k++)
printf (" %d ", rdata[i][j][k]);
printf ("\n");
}
@@ -338,16 +338,16 @@ main (void)
block[0] = 1;
block[1] = vdsdims_out[1];
block[2] = vdsdims_out[2];
- dims[0] = 2*DIM0_1;
+ dims[0] = 2*DIM0_1;
status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, stride, count, block);
mem_space = H5Screate_simple(RANK, dims, NULL);
status = H5Dread (vdset, H5T_NATIVE_INT, mem_space, vspace, H5P_DEFAULT,
- a_rdata);
+ a_rdata);
printf (" All data: \n");
for (i=0; i < 2*DIM0_1; i++) {
for (j=0; j < (int)vdsdims_out[1]; j++) {
printf ("(%d, %d, 0)", i, j);
- for (k=0; k < (int)vdsdims_out[2]; k++)
+ for (k=0; k < (int)vdsdims_out[2]; k++)
printf (" %d ", a_rdata[i][j][k]);
printf ("\n");
}