diff options
-rw-r--r-- | examples/Attributes.txt | 6 | ||||
-rw-r--r-- | examples/Makefile.am | 2 | ||||
-rw-r--r-- | examples/h5_cmprss.c | 40 | ||||
-rw-r--r-- | examples/h5_crtatt.c | 2 | ||||
-rw-r--r-- | examples/h5_crtdat.c | 10 | ||||
-rw-r--r-- | examples/h5_crtgrpar.c | 2 | ||||
-rw-r--r-- | examples/h5_crtgrpd.c | 2 | ||||
-rw-r--r-- | examples/h5_extend.c | 38 | ||||
-rw-r--r-- | examples/h5_rdwt.c | 6 | ||||
-rw-r--r-- | examples/h5_ref_extern.c | 2 | ||||
-rw-r--r-- | examples/h5_subset.c | 48 | ||||
-rw-r--r-- | examples/h5_vds-eiger.c | 36 | ||||
-rw-r--r-- | examples/h5_vds-exc.c | 40 | ||||
-rw-r--r-- | examples/h5_vds-exclim.c | 38 | ||||
-rw-r--r-- | examples/h5_vds-percival-unlim-maxmin.c | 58 | ||||
-rw-r--r-- | examples/h5_vds-percival-unlim.c | 66 | ||||
-rw-r--r-- | examples/h5_vds-percival.c | 50 | ||||
-rw-r--r-- | examples/h5_vds-simpleIO.c | 34 | ||||
-rw-r--r-- | examples/h5_vds.c | 52 | ||||
-rw-r--r-- | examples/run-c-ex.sh.in | 4 | ||||
-rw-r--r-- | examples/testh5cc.sh.in | 6 |
21 files changed, 271 insertions, 271 deletions
diff --git a/examples/Attributes.txt b/examples/Attributes.txt index 0f25f68..6cba42b 100644 --- a/examples/Attributes.txt +++ b/examples/Attributes.txt @@ -1,4 +1,4 @@ -Attribute Examples: +Attribute Examples: H5Acreate2 example: Show how to create an attribute for a dataset and a group ---------------- @@ -19,7 +19,7 @@ H5Acreate2 example: Show how to create an attribute for a dataset and a group rank=2; dimsf[0] = H5S_UNLIMITED; dimsf[1] = H5S_UNLIMITED; - dataspace = H5Screate_simple(rank, dimsf, NULL); + dataspace = H5Screate_simple(rank, dimsf, NULL); /* Create a dataset */ dataset = H5Dcreate2(file, "Dataset1", H5T_UINT8, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -122,7 +122,7 @@ H5Alink Example: Shows how to share an attribute between two datasets. /* Get the OID of the attribute */ attr=H5Aopen(dataset1, "Foo", H5P_DEFAULT); - /* + /* * Create an attribute in the second dataset to the attribute in dataset1, * changing the name of the attribute information in dataset2. */ diff --git a/examples/Makefile.am b/examples/Makefile.am index 5b428cd..b7850a7 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -39,7 +39,7 @@ EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ h5_ref2reg_deprec h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \ h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \ h5_vds-percival-unlim h5_vds-percival-unlim-maxmin -TEST_SCRIPT=testh5cc.sh +TEST_SCRIPT=testh5cc.sh TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES) # Install files diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index b51ec44..5feadd3 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -11,10 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* +/* * This example illustrates how to create a compressed dataset. * It is used in the HDF5 Tutorial. - */ + */ #include "hdf5.h" @@ -22,11 +22,11 @@ #define RANK 2 #define DIM0 100 #define DIM1 20 - + int main () { hid_t file_id, dataset_id, dataspace_id; /* identifiers */ - hid_t plist_id; + hid_t plist_id; size_t nelmts; unsigned flags, filter_info; @@ -35,12 +35,12 @@ int main () { herr_t status; hsize_t dims[2]; hsize_t cdims[2]; - + int i,j, numfilt; int buf[DIM0][DIM1]; int rbuf [DIM0][DIM1]; - /* Uncomment these variables to use SZIP compression + /* Uncomment these variables to use SZIP compression unsigned szip_options_mask; unsigned szip_pixels_per_block; */ @@ -62,21 +62,21 @@ int main () { status = H5Pset_chunk (plist_id, 2, cdims); /* Set ZLIB / DEFLATE Compression using compression level 6. - * To use SZIP Compression comment out these lines. - */ - status = H5Pset_deflate (plist_id, 6); + * To use SZIP Compression comment out these lines. + */ + status = H5Pset_deflate (plist_id, 6); - /* Uncomment these lines to set SZIP Compression + /* Uncomment these lines to set SZIP Compression szip_options_mask = H5_SZIP_NN_OPTION_MASK; szip_pixels_per_block = 16; status = H5Pset_szip (plist_id, szip_options_mask, szip_pixels_per_block); */ - - dataset_id = H5Dcreate2 (file_id, "Compressed_Data", H5T_STD_I32BE, - dataspace_id, H5P_DEFAULT, plist_id, H5P_DEFAULT); - for (i = 0; i< DIM0; i++) - for (j=0; j<DIM1; j++) + dataset_id = H5Dcreate2 (file_id, "Compressed_Data", H5T_STD_I32BE, + dataspace_id, H5P_DEFAULT, plist_id, H5P_DEFAULT); + + for (i = 0; i< DIM0; i++) + for (j=0; j<DIM1; j++) buf[i][j] = i+j; status = H5Dwrite (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); @@ -92,10 +92,10 @@ int main () { /* Retrieve filter information. */ plist_id = H5Dget_create_plist (dataset_id); - + numfilt = H5Pget_nfilters (plist_id); printf ("Number of filters associated with dataset: %i\n", numfilt); - + for (i=0; i<numfilt; i++) { nelmts = 0; filter_type = H5Pget_filter2 (plist_id, 0, &flags, &nelmts, NULL, 0, NULL, @@ -113,9 +113,9 @@ int main () { } } - status = H5Dread (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, rbuf); - + status = H5Dread (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, rbuf); + status = H5Dclose (dataset_id); status = H5Pclose (plist_id); status = H5Fclose (file_id); diff --git a/examples/h5_crtatt.c b/examples/h5_crtatt.c index ade17ba..aa997e7 100644 --- a/examples/h5_crtatt.c +++ b/examples/h5_crtatt.c @@ -41,7 +41,7 @@ int main() { dataspace_id = H5Screate_simple(1, &dims, NULL); /* Create a dataset attribute. */ - attribute_id = H5Acreate2 (dataset_id, "Units", H5T_STD_I32BE, dataspace_id, + attribute_id = H5Acreate2 (dataset_id, "Units", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT); /* Write the attribute data. */ diff --git a/examples/h5_crtdat.c b/examples/h5_crtdat.c index 4a876d2..9fcb186 100644 --- a/examples/h5_crtdat.c +++ b/examples/h5_crtdat.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * This example illustrates how to create a dataset that is a 4 x 6 + * This example illustrates how to create a dataset that is a 4 x 6 * array. It is used in the HDF5 Tutorial. */ @@ -29,18 +29,18 @@ int main() { file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* Create the data space for the dataset. */ - dims[0] = 4; - dims[1] = 6; + dims[0] = 4; + dims[1] = 6; dataspace_id = H5Screate_simple(2, dims, NULL); /* Create the dataset. */ - dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id, + dataset_id = H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* End access to the dataset and release resources used by it. */ status = H5Dclose(dataset_id); - /* Terminate access to the data space. */ + /* Terminate access to the data space. */ status = H5Sclose(dataspace_id); /* Close the file. */ diff --git a/examples/h5_crtgrpar.c b/examples/h5_crtgrpar.c index 6f8c6e8..21a37c5 100644 --- a/examples/h5_crtgrpar.c +++ b/examples/h5_crtgrpar.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * This example illustrates the creation of groups using absolute and + * This example illustrates the creation of groups using absolute and * relative names. It is used in the HDF5 Tutorial. */ diff --git a/examples/h5_crtgrpd.c b/examples/h5_crtgrpd.c index 35c4389..d0d535b 100644 --- a/examples/h5_crtgrpd.c +++ b/examples/h5_crtgrpd.c @@ -67,7 +67,7 @@ int main() { dataspace_id = H5Screate_simple(2, dims, NULL); /* Create the second dataset in group "Group_A". */ - dataset_id = H5Dcreate2(group_id, "dset2", H5T_STD_I32BE, dataspace_id, + dataset_id = H5Dcreate2(group_id, "dset2", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write the second dataset. */ diff --git a/examples/h5_extend.c b/examples/h5_extend.c index 6e3cff2..6018e65 100644 --- a/examples/h5_extend.c +++ b/examples/h5_extend.c @@ -12,9 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * This example how to work with extendible datasets. The dataset + * This example how to work with extendible datasets. The dataset * must be chunked in order to be extendible. - * + * * It is used in the HDF5 Tutorial. */ @@ -29,28 +29,28 @@ int main (void) { hid_t file; /* handles */ - hid_t dataspace, dataset; + hid_t dataspace, dataset; hid_t filespace, memspace; - hid_t prop; + hid_t prop; - hsize_t dims[2] = {3, 3}; /* dataset dimensions at creation time */ + hsize_t dims[2] = {3, 3}; /* dataset dimensions at creation time */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - herr_t status; + herr_t status; hsize_t chunk_dims[2] = {2, 5}; int data[3][3] = { {1, 1, 1}, /* data to write */ {1, 1, 1}, - {1, 1, 1} }; + {1, 1, 1} }; /* Variables used in extending and writing to the extended portion of dataset */ hsize_t size[2]; hsize_t offset[2]; hsize_t dimsext[2] = {7, 3}; /* extend dimensions */ - int dataext[7][3] = { {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, + int dataext[7][3] = { {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, {2, 3, 4} }; /* Variables used in reading data back */ @@ -58,11 +58,11 @@ main (void) hsize_t dimsr[2]; hsize_t i, j; int rdata[10][3]; - herr_t status_n; + herr_t status_n; int rank, rank_chunk; /* 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 (FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -71,7 +71,7 @@ main (void) prop = H5Pcreate (H5P_DATASET_CREATE); status = H5Pset_chunk (prop, RANK, chunk_dims); - /* Create a new dataset within the file using chunk + /* Create a new dataset within the file using chunk creation properties. */ dataset = H5Dcreate2 (file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, prop, H5P_DEFAULT); @@ -90,10 +90,10 @@ main (void) offset[0] = 3; offset[1] = 0; status = H5Sselect_hyperslab (filespace, H5S_SELECT_SET, offset, NULL, - dimsext, NULL); + dimsext, NULL); /* Define memory space */ - memspace = H5Screate_simple (RANK, dimsext, NULL); + memspace = H5Screate_simple (RANK, dimsext, NULL); /* Write the data to the extended portion of dataset */ status = H5Dwrite (dataset, H5T_NATIVE_INT, memspace, filespace, @@ -120,7 +120,7 @@ main (void) prop = H5Dget_create_plist (dataset); - if (H5D_CHUNKED == H5Pget_layout (prop)) + if (H5D_CHUNKED == H5Pget_layout (prop)) rank_chunk = H5Pget_chunk (prop, rank, chunk_dimsr); memspace = H5Screate_simple (rank, dimsr, NULL); diff --git a/examples/h5_rdwt.c b/examples/h5_rdwt.c index 6cd7f0f..f7196c0 100644 --- a/examples/h5_rdwt.c +++ b/examples/h5_rdwt.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* +/* * This example illustrates how to write and read data in an existing * dataset. It is used in the HDF5 Tutorial. */ @@ -37,10 +37,10 @@ int main() { dataset_id = H5Dopen2(file_id, "/dset", H5P_DEFAULT); /* Write the dataset. */ - status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); - status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); /* Close the dataset. */ diff --git a/examples/h5_ref_extern.c b/examples/h5_ref_extern.c index 17082ba..5403814 100644 --- a/examples/h5_ref_extern.c +++ b/examples/h5_ref_extern.c @@ -14,7 +14,7 @@ * The example below illustrates the use of the new API with files that are * opened read-only. Created references to the objects in that file are * stored into a separate file, and accessed from that file, without the user - * explicitly opening the original file that was referenced. + * explicitly opening the original file that was referenced. */ #include <stdlib.h> diff --git a/examples/h5_subset.c b/examples/h5_subset.c index 904d3f8..ad2eaba 100644 --- a/examples/h5_subset.c +++ b/examples/h5_subset.c @@ -11,44 +11,44 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * This example illustrates how to read/write a subset of data (a slab) +/* + * This example illustrates how to read/write a subset of data (a slab) * from/to a dataset in an HDF5 file. It is used in the HDF5 Tutorial. */ - + #include "hdf5.h" #define FILE "subset.h5" -#define DATASETNAME "IntArray" +#define DATASETNAME "IntArray" #define RANK 2 -#define DIM0_SUB 3 /* subset dimensions */ -#define DIM1_SUB 4 +#define DIM0_SUB 3 /* subset dimensions */ +#define DIM1_SUB 4 -#define DIM0 8 /* size of dataset */ -#define DIM1 10 +#define DIM0 8 /* size of dataset */ +#define DIM1 10 int main (void) { - hsize_t dims[2], dimsm[2]; + hsize_t dims[2], dimsm[2]; int data[DIM0][DIM1]; /* data to write */ int sdata[DIM0_SUB][DIM1_SUB]; /* subset to write */ int rdata[DIM0][DIM1]; /* buffer for read */ - + hid_t file_id, dataset_id; /* handles */ - hid_t dataspace_id, memspace_id; + hid_t dataspace_id, memspace_id; + + herr_t status; - herr_t status; - hsize_t count[2]; /* size of subset in the file */ hsize_t offset[2]; /* subset offset in the file */ hsize_t stride[2]; hsize_t block[2]; int i, j; - + /***************************************************************** * Create a new file with default creation and access properties.* * Then create a dataset and write data to it and close the file * @@ -59,7 +59,7 @@ main (void) dims[0] = DIM0; dims[1] = DIM1; - dataspace_id = H5Screate_simple (RANK, dims, NULL); + dataspace_id = H5Screate_simple (RANK, dims, NULL); dataset_id = H5Dcreate2 (file_id, DATASETNAME, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -71,7 +71,7 @@ main (void) data[j][i] = 1; else data[j][i] = 2; - } + } status = H5Dwrite (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); @@ -89,7 +89,7 @@ main (void) /***************************************************** * Reopen the file and dataset and write a subset of * - * values to the dataset. + * values to the dataset. *****************************************************/ file_id = H5Fopen (FILE, H5F_ACC_RDWR, H5P_DEFAULT); @@ -100,7 +100,7 @@ main (void) offset[0] = 1; offset[1] = 2; - count[0] = DIM0_SUB; + count[0] = DIM0_SUB; count[1] = DIM1_SUB; stride[0] = 1; @@ -109,18 +109,18 @@ main (void) block[0] = 1; block[1] = 1; - /* Create memory space with size of subset. Get file dataspace + /* Create memory space with size of subset. Get file dataspace and select subset from file dataspace. */ dimsm[0] = DIM0_SUB; dimsm[1] = DIM1_SUB; - memspace_id = H5Screate_simple (RANK, dimsm, NULL); + memspace_id = H5Screate_simple (RANK, dimsm, NULL); dataspace_id = H5Dget_space (dataset_id); status = H5Sselect_hyperslab (dataspace_id, H5S_SELECT_SET, offset, stride, count, block); - /* Write a subset of data to the dataset, then read the + /* Write a subset of data to the dataset, then read the entire dataset back from the file. */ printf ("\nWrite subset to file specifying:\n"); @@ -128,11 +128,11 @@ main (void) for (j = 0; j < DIM0_SUB; j++) { for (i = 0; i < DIM1_SUB; i++) sdata[j][i] = 5; - } + } status = H5Dwrite (dataset_id, H5T_NATIVE_INT, memspace_id, dataspace_id, H5P_DEFAULT, sdata); - + status = H5Dread (dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); @@ -147,5 +147,5 @@ main (void) status = H5Sclose (dataspace_id); status = H5Dclose (dataset_id); status = H5Fclose (file_id); - + } diff --git a/examples/h5_vds-eiger.c b/examples/h5_vds-eiger.c index 13b5d93..a02f4f8 100644 --- a/examples/h5_vds-eiger.c +++ b/examples/h5_vds-eiger.c @@ -12,7 +12,7 @@ /************************************************************ This example illustrates the concept of the virtual dataset. - Eiger use case. Every 5 frames 10x10 are in the source + Eiger use case. Every 5 frames 10x10 are in the source dataset "/A" in file with the name f-<#>.h5 This file is intended for use with HDF5 Library version 1.10 @@ -25,13 +25,13 @@ #define FILE "vds-eiger.h5" #define DATASET "VDS-Eiger" -#define VDSDIM0 5 -#define VDSDIM1 10 -#define VDSDIM2 10 -#define DIM0 5 -#define DIM1 10 -#define DIM2 10 -#define RANK 3 +#define VDSDIM0 5 +#define VDSDIM1 10 +#define VDSDIM2 10 +#define DIM0 5 +#define DIM1 10 +#define DIM2 10 +#define RANK 3 int main (void) @@ -69,7 +69,7 @@ main (void) /* Create VDS creation property */ dcpl = H5Pcreate (H5P_DATASET_CREATE); - + /* Initialize hyperslab values */ start[0] = 0; @@ -85,13 +85,13 @@ main (void) block[1] = DIM1; block[2] = DIM2; - /* - * Build the mappings + /* + * Build the mappings * */ status = H5Sselect_hyperslab (vspace, H5S_SELECT_SET, start, stride, count, block); status = H5Pset_virtual (dcpl, vspace, "f-%b.h5", "/A", src_space); - + /* Create a virtual dataset */ @@ -100,8 +100,8 @@ main (void) status = H5Sclose (vspace); status = H5Sclose (src_space); status = H5Dclose (dset); - status = H5Fclose (file); - + status = H5Fclose (file); + /* * Now we begin the read section of this example. @@ -123,7 +123,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"); @@ -134,15 +134,15 @@ main (void) status = H5Pget_virtual_count (dcpl, &num_map); printf(" Number of mappings is %d\n", (int)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]); diff --git a/examples/h5_vds-exc.c b/examples/h5_vds-exc.c index aaf1fa8..b113c36 100644 --- a/examples/h5_vds-exc.c +++ b/examples/h5_vds-exc.c @@ -24,16 +24,16 @@ #define FILE "vds-exc.h5" #define DATASET "VDS-Excalibur" -#define VDSDIM0 0 -#define VDSDIM1 15 -#define VDSDIM2 6 -#define KDIM0 0 -#define KDIM1 2 -#define KDIM2 6 -#define NDIM0 0 -#define NDIM1 3 -#define NDIM2 6 -#define RANK 3 +#define VDSDIM0 0 +#define VDSDIM1 15 +#define VDSDIM2 6 +#define KDIM0 0 +#define KDIM1 2 +#define KDIM2 6 +#define NDIM0 0 +#define NDIM1 3 +#define NDIM2 6 +#define RANK 3 const char *SRC_FILE[] = { "a.h5", @@ -96,7 +96,7 @@ main (void) /* Create VDS creation property */ dcpl = H5Pcreate (H5P_DATASET_CREATE); - + /* Initialize hyperslab values */ start[0] = 0; @@ -109,7 +109,7 @@ main (void) block[1] = k; block[2] = VDSDIM2; - /* + /* * Build the mappings for A, C and E source datasets. * Unlimited hyperslab selection is the same in the source datasets. * Unlimited hyperslab selections in the virtual dataset have different offsets. @@ -124,7 +124,7 @@ main (void) /* Reinitialize start[1] and block[1] to build the second set of mappings. */ start[1] = 0; block[1] = n; - /* + /* * Build the mappings for B, D and F source datasets. * Unlimited hyperslab selection is the same in the source datasets. * Unlimited hyperslab selections in the virtual dataset have different offsets. @@ -143,8 +143,8 @@ main (void) status = H5Sclose (nsrc_space); status = H5Sclose (ksrc_space); status = H5Dclose (dset); - status = H5Fclose (file); - + status = H5Fclose (file); + /* * Now we begin the read section of this example. @@ -166,7 +166,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"); @@ -177,15 +177,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]); @@ -209,7 +209,7 @@ main (void) /* Get selection in the source dataset */ printf(" Selection in the source dataset \n"); src_space = H5Pget_virtual_srcspace (dcpl, (size_t)i); - if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) { + if (H5Sget_select_type(src_space) == H5S_SEL_HYPERSLABS) { if (H5Sis_regular_hyperslab(vspace)) { status = H5Sget_regular_hyperslab (src_space, 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]); diff --git a/examples/h5_vds-exclim.c b/examples/h5_vds-exclim.c index fea096a..152731c 100644 --- a/examples/h5_vds-exclim.c +++ b/examples/h5_vds-exclim.c @@ -25,16 +25,16 @@ #define FILE "vds-exclim.h5" #define DATASET "VDS-Excaliburlim" -#define VDSDIM0 3 -#define VDSDIM1 15 -#define VDSDIM2 6 -#define KDIM0 3 -#define KDIM1 2 -#define KDIM2 6 -#define NDIM0 3 -#define NDIM1 3 -#define NDIM2 6 -#define RANK 3 +#define VDSDIM0 3 +#define VDSDIM1 15 +#define VDSDIM2 6 +#define KDIM0 3 +#define KDIM1 2 +#define KDIM2 6 +#define NDIM0 3 +#define NDIM1 3 +#define NDIM2 6 +#define RANK 3 const char *SRC_FILE[] = { "a.h5", @@ -94,7 +94,7 @@ main (void) /* Create VDS creation property */ dcpl = H5Pcreate (H5P_DATASET_CREATE); - + /* Initialize hyperslab values */ start[0] = 0; @@ -107,7 +107,7 @@ main (void) block[1] = k; block[2] = VDSDIM2; - /* + /* * Build the mappings for A, C and E source datasets. * */ @@ -121,7 +121,7 @@ main (void) /* Reinitialize start[0] and block[1] */ start[0] = 0; block[1] = n; - /* + /* * Build the mappings for B, D and F source datasets. * */ @@ -139,8 +139,8 @@ main (void) status = H5Sclose (nsrc_space); status = H5Sclose (ksrc_space); status = H5Dclose (dset); - status = H5Fclose (file); - + status = H5Fclose (file); + /* * Now we begin the read section of this example. @@ -162,7 +162,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"); @@ -173,15 +173,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]); diff --git a/examples/h5_vds-percival-unlim-maxmin.c b/examples/h5_vds-percival-unlim-maxmin.c index 0273bbc..7b0d532 100644 --- a/examples/h5_vds-percival-unlim-maxmin.c +++ b/examples/h5_vds-percival-unlim-maxmin.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. Each of the source datasets is extended to different sizes. VDS access property can be used to get max and min extent. @@ -28,15 +28,15 @@ #define VFILE "vds-percival-unlim-maxmin.h5" #define DATASET "VDS-Percival-unlim-maxmin" -#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 4 /* Initial size of the source 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[] = { @@ -61,7 +61,7 @@ main (void) hid_t dcpl, dapl; 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}, memdims[3] = {DIM0_1, DIM1, DIM2}, extdims[3] = {0, DIM1, DIM2}, /* Dimensions of the extended source datasets */ @@ -96,7 +96,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. */ @@ -112,7 +112,7 @@ main (void) status = H5Pclose (dcpl); status = H5Dclose (dset); status = H5Fclose (file); - } + } vfile = H5Fcreate (VFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -124,7 +124,7 @@ main (void) /* Create VDS creation property */ dcpl = H5Pcreate (H5P_DATASET_CREATE); - + /* Initialize hyperslab values */ start[0] = 0; @@ -143,18 +143,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, @@ -174,14 +174,14 @@ main (void) for (j = 0; j < (i+1)*DIM1*DIM2; j++) wdata[j] = 10*(i+1); /* - * Open the source files and datasets. Appen data to each dataset and + * Open the source files and datasets. Appen 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); extdims[0] = DIM0_1+i+1; - status = H5Dset_extent (dset, extdims); + status = H5Dset_extent (dset, extdims); src_space = H5Dget_space (dset); start[0] = DIM0_1; start[1] = 0; @@ -194,7 +194,7 @@ main (void) block[2] = DIM2; memdims[0] = i+1; - mem_space = H5Screate_simple(RANK, memdims, NULL); + mem_space = H5Screate_simple(RANK, memdims, 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); @@ -204,8 +204,8 @@ main (void) } status = H5Dclose (vdset); - status = H5Fclose (vfile); - + status = H5Fclose (vfile); + /* * Now we begin the read section of this example. */ @@ -214,8 +214,8 @@ main (void) * Open file and dataset using the default properties. */ vfile = H5Fopen (VFILE, H5F_ACC_RDONLY, H5P_DEFAULT); - - /* + + /* * Open VDS using different access properties to use max or * min extents depending on the sizes of the underlying datasets */ @@ -252,7 +252,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"); @@ -263,15 +263,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]); 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"); } diff --git a/examples/h5_vds-percival.c b/examples/h5_vds-percival.c index 11a974b..aeca368 100644 --- a/examples/h5_vds-percival.c +++ b/examples/h5_vds-percival.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. EIP: For now we will use finite dimension. There are 4 source datasets total. This file is intended for use with HDF5 Library version 1.10 @@ -28,18 +28,18 @@ #define FILE "vds-percival.h5" #define DATASET "VDS-Percival" /* later -#define VDSDIM0 H5S_UNLIMITED +#define VDSDIM0 H5S_UNLIMITED */ #define VDSDIM0 40 -#define VDSDIM1 10 -#define VDSDIM2 10 +#define VDSDIM1 10 +#define VDSDIM2 10 /* later -#define DIM0 H5S_UNLIMITED +#define DIM0 H5S_UNLIMITED */ -#define DIM0 10 -#define DIM1 10 -#define DIM2 10 -#define RANK 3 +#define DIM0 10 +#define DIM1 10 +#define DIM2 10 +#define RANK 3 #define PLANE_STRIDE 4 const char *SRC_FILE[] = { @@ -64,7 +64,7 @@ main (void) hid_t dcpl; herr_t status; hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2}, - vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2}, + vdsdims_max[3] = {VDSDIM0, VDSDIM1, VDSDIM2}, dims[3] = {DIM0, DIM1, DIM2}, dims_max[3] = {DIM0, DIM1, DIM2}, start[3], /* Hyperslab start parameter for VDS */ @@ -94,7 +94,7 @@ main (void) for (j = 0; j < DIM0*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. */ @@ -107,7 +107,7 @@ main (void) status = H5Sclose (src_space); status = H5Dclose (dset); status = H5Fclose (file); - } + } file = H5Fcreate (FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -119,7 +119,7 @@ main (void) /* Create VDS creation property */ dcpl = H5Pcreate (H5P_DATASET_CREATE); - + /* Initialize hyperslab values */ start[0] = 0; @@ -144,18 +144,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 */ dset = H5Dcreate2 (file, DATASET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, @@ -163,8 +163,8 @@ main (void) status = H5Sclose (vspace); status = H5Sclose (src_space); status = H5Dclose (dset); - status = H5Fclose (file); - + status = H5Fclose (file); + /* * Now we begin the read section of this example. */ @@ -185,7 +185,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"); @@ -196,15 +196,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]); diff --git a/examples/h5_vds-simpleIO.c b/examples/h5_vds-simpleIO.c index 56fa72b..5fd5c52 100644 --- a/examples/h5_vds-simpleIO.c +++ b/examples/h5_vds-simpleIO.c @@ -14,7 +14,7 @@ This example illustrates the concept of virtual dataset I/O The program creates 2-dim source dataset and writes data to it. Then it creates 2-dim virtual dataset that has - the same dimension sizes and maps the all elements of the + the same dimension sizes and maps the all elements of the virtual dataset to all elements of the source dataset. Then VDS is read back. @@ -30,7 +30,7 @@ #define FILE "vds-simpleIO.h5" #define DATASET "VDS" #define DIM1 6 -#define DIM0 4 +#define DIM0 4 #define RANK 2 #define SRC_FILE "a.h5" @@ -40,27 +40,27 @@ int main (void) { - hid_t file, space, src_space, vspace, dset; /* Handles */ + hid_t file, space, src_space, vspace, dset; /* Handles */ hid_t dcpl; herr_t status; hsize_t vdsdims[2] = {DIM0, DIM1}, /* Virtual dataset dimension */ dims[2] = {DIM0, DIM1}; /* Source dataset dimensions */ int wdata[DIM0][DIM1], /* Write buffer for source dataset */ rdata[DIM0][DIM1], /* Read buffer for virtual dataset */ - i, j; + i, j; H5D_layout_t layout; /* Storage layout */ size_t num_map; /* Number of mappings */ ssize_t len; /* Length of the string; also a return value */ - char *filename; + char *filename; char *dsetname; /* * Initialize data. */ - for (i = 0; i < DIM0; i++) + for (i = 0; i < DIM0; i++) for (j = 0; j < DIM1; j++) wdata[i][j] = i+1; - + /* - * Create the source file and the dataset. Write data to the source dataset + * Create the source file and the dataset. Write data to the source dataset * and close all resources. */ @@ -82,12 +82,12 @@ main (void) /* Set VDS creation property. */ dcpl = H5Pcreate (H5P_DATASET_CREATE); - - /* + + /* * Build the mappings. * Selections in the source datasets are H5S_ALL. - * In the virtual dataset we select the first, the second and the third rows - * and map each row to the data in the corresponding source dataset. + * In the virtual dataset we select the first, the second and the third rows + * and map each row to the data in the corresponding source dataset. */ src_space = H5Screate_simple (RANK, dims, NULL); status = H5Pset_virtual (dcpl, vspace, SRC_FILE, SRC_DATASET, src_space); @@ -98,8 +98,8 @@ main (void) status = H5Sclose (vspace); status = H5Sclose (src_space); status = H5Dclose (dset); - status = H5Fclose (file); - + status = H5Fclose (file); + /* * Now we begin the read section of this example. */ @@ -118,7 +118,7 @@ main (void) * Get storage layout. */ 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"); @@ -129,10 +129,10 @@ 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 "); /* Get selection in the virttual dataset */ diff --git a/examples/h5_vds.c b/examples/h5_vds.c index 76b849a..cce7b88 100644 --- a/examples/h5_vds.c +++ b/examples/h5_vds.c @@ -16,15 +16,15 @@ This example illustrates the concept of virtual dataset. The program creates three 1-dim source datasets and writes data to them. Then it creates a 2-dim virtual dataset and - maps the first three rows of the virtual dataset to the data - in the source datasets. Elements of a row are mapped to all + maps the first three rows of the virtual dataset to the data + in the source datasets. Elements of a row are mapped to all elements of the corresponding source dataset. - The fourth row is not mapped and will be filled with the fill - values when virtual dataset is read back. - + The fourth row is not mapped and will be filled with the fill + values when virtual dataset is read back. + The program closes all datasets, and then reopens the virtual dataset, and finds and prints its creation properties. - Then it reads the values. + Then it reads the values. This file is intended for use with HDF5 Library version 1.10 @@ -37,9 +37,9 @@ #define FILE "vds.h5" #define DATASET "VDS" -#define VDSDIM1 6 -#define VDSDIM0 4 -#define DIM0 6 +#define VDSDIM1 6 +#define VDSDIM0 4 +#define DIM0 6 #define RANK1 1 #define RANK2 2 @@ -58,7 +58,7 @@ const char *SRC_DATASET[] = { int main (void) { - hid_t file, space, src_space, vspace, dset; /* Handles */ + hid_t file, space, src_space, vspace, dset; /* Handles */ hid_t dcpl; herr_t status; hsize_t vdsdims[2] = {VDSDIM0, VDSDIM1}, /* Virtual datasets dimension */ @@ -73,12 +73,12 @@ main (void) block_out[2]; int wdata[DIM0], /* Write buffer for source dataset */ rdata[VDSDIM0][VDSDIM1], /* Read buffer for virtual dataset */ - i, j, k, l; + i, j, k, l; int fill_value = -1; /* Fill value for VDS */ H5D_layout_t layout; /* Storage layout */ size_t num_map; /* Number of mappings */ ssize_t len; /* Length of the string; also a return value */ - char *filename; + char *filename; char *dsetname; hsize_t nblocks; hsize_t *buf; /* Buffer to hold hyperslab coordinates */ @@ -91,9 +91,9 @@ main (void) * Initialize data for i-th source dataset. */ for (j = 0; j < DIM0; 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. */ @@ -117,7 +117,7 @@ main (void) /* Set VDS creation property. */ dcpl = H5Pcreate (H5P_DATASET_CREATE); status = H5Pset_fill_value (dcpl, H5T_NATIVE_INT, &fill_value); - + /* Initialize hyperslab values. */ start[0] = 0; start[1] = 0; @@ -126,11 +126,11 @@ main (void) block[0] = 1; block[1] = VDSDIM1; - /* + /* * Build the mappings. * Selections in the source datasets are H5S_ALL. - * In the virtual dataset we select the first, the second and the third rows - * and map each row to the data in the corresponding source dataset. + * In the virtual dataset we select the first, the second and the third rows + * and map each row to the data in the corresponding source dataset. */ src_space = H5Screate_simple (RANK1, dims, NULL); for (i = 0; i < 3; i++) { @@ -146,8 +146,8 @@ main (void) status = H5Sclose (space); status = H5Sclose (src_space); status = H5Dclose (dset); - status = H5Fclose (file); - + status = H5Fclose (file); + /* * Now we begin the read section of this example. */ @@ -167,7 +167,7 @@ main (void) * Get storage layout. */ 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"); @@ -178,26 +178,26 @@ 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 "); /* Get selection in the virttual dataset */ vspace = H5Pget_virtual_vspace (dcpl, (size_t)i); /* Make sure that this is a hyperslab selection and then print information. */ - if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) { + if (H5Sget_select_type(vspace) == H5S_SEL_HYPERSLABS) { nblocks = H5Sget_select_hyper_nblocks (vspace); buf = (hsize_t *)malloc(sizeof(hsize_t)*2*RANK2*nblocks); status = H5Sget_select_hyper_blocklist (vspace, (hsize_t)0, nblocks, buf); for (l=0; l<nblocks; l++) { printf("("); - for (k=0; k<RANK2-1; k++) + for (k=0; k<RANK2-1; k++) printf("%d,", (int)buf[k]); printf("%d ) - (", (int)buf[k]); - for (k=0; k<RANK2-1; k++) + for (k=0; k<RANK2-1; k++) printf("%d,", (int)buf[RANK2+k]); printf("%d)\n", (int)buf[RANK2+k]); } diff --git a/examples/run-c-ex.sh.in b/examples/run-c-ex.sh.in index 90d5c6a..b649d98 100644 --- a/examples/run-c-ex.sh.in +++ b/examples/run-c-ex.sh.in @@ -53,7 +53,7 @@ fi ) # Where the tool is installed. -# default is relative path to installed location of the tools +# default is relative path to installed location of the tools prefix="${prefix:-../${prefix_relto_examplesdir}}" PARALLEL=@PARALLEL@ # Am I in parallel mode? AR="@AR@" @@ -179,5 +179,5 @@ rm *.h5 rm -rf red blue u2w echo -exit $EXIT_VALUE +exit $EXIT_VALUE diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 40ca466..9f766dd 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -100,9 +100,9 @@ main (void) printf("HDF5 C Sample program ran successfully. File %s generated.\n", H5FILE_NAME); remove(H5FILE_NAME); - + return 0; -} +} EOF # generate prog1 @@ -143,7 +143,7 @@ main (void) remove(H5FILE_NAME); return 0; -} +} EOF # Generate HDF5 v1.6 Main Program: |