/* ############################################################################## # # Copyright by The HDF Group. # All rights reserved. # # This file is part of the hl_region High-Level HDF5 APIs. The full copyright # notice, including terms governing use, modification, and redistribution, # is contained in the file COPYING, which can be found at the root of the # source code distribution tree and in the documentation directory (doc/html/). # If you do not have access to this file, you may request a copy of # "the hl_region High-Level HDF5 APIs copyright and license statement" from # help@hdfgroup.org. # ############################################################################## */ /* This program shows how to create a dataset and region references associated with hyperslabs. It then creates a new dataset composed of data from the data associated with a recursive loop over all the region references. Main illustrative function: H5LRcreate_ref_to_all */ #include "hdf5.h" #include "hdf5_hl.h" #include "h5hl_region.h" #define filename "ex_ref_to_all.h5" #define dsetnamev "MY_DATA" /* dataset name */ #define dsetnamer "MY_REF" /* region references name */ #define DIM0 9 /* dataset dimensions */ #define DIM1 8 #define RANK 2 /* dataset rank */ int main(void) { hid_t file_id; /* file identifier */ hid_t space_id_ref; /* region reference dataspace identifier */ hid_t dset_id_ref; /* region reference dataset identifiers*/ hsize_t dims[RANK] = {DIM0,DIM1}; /* dataset dimensions */ hsize_t dims_ref[1] = {2}; /* region reference dimensions */ herr_t status; hdset_reg_ref_t ref[2]; /* region references */ int data[DIM0][DIM1]; /* data */ int i, j; const char *path[2]; /* paths to the data for the region references */ hsize_t block_coord[8] ={ 0, 0, 2, 2, 3, 3, 5, 5}; /* hyperslab coordinates defining region references */ /********************************************************* This section writes data to the HDF5 file. *********************************************************/ path[0] ="/MY_DATA"; path[1] ="/MY_DATA"; /* * Data initialization. */ printf("FULL 2D DATA:"); for (i=0; i