/* ############################################################################## # # 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 examples creates a file and writes a two dimensional real dataset to it. It then reopens the file, and copies a region described by blocks to another region described by another block. Main illustrative function: H5LTcopy_region */ #include "hdf5.h" #include "hdf5_hl.h" #include "h5hl_region.h" #define filename "ex_lite_copy_region.h5" #define DSETNAME "DS" /* dataset name */ #define DIM0 6 /* dataset dimensions */ #define DIM1 7 #define rank 2 /* dataset rank */ int main(void) { hid_t file_id; /* file identifier */ hsize_t dims[rank] = {DIM0, DIM1}; /* dataset dimension */ herr_t status; int data[DIM0][DIM1]; /* data */ int i, j; hsize_t block_coord_src[4] ={ 0, 0, 1, 2}; /* hyperslab coordinates to copy from */ hsize_t block_coord_dest[4] ={2, 3, 3, 5 }; /* destinations block coordinates to copy data to */ int rdata[DIM0][DIM1]; /* read data buffer */ /********************************************************* This writes data to the HDF5 file. *********************************************************/ /* * Data and output buffer initialization. */ printf("FULL 2D ARRAY:"); for (i=0; i [(%d,%d)-(%d,%d)]", (int)block_coord_src[0],(int)block_coord_src[1], (int)block_coord_src[2],(int)block_coord_src[3], (int)block_coord_dest[0], (int)block_coord_dest[1],(int)block_coord_dest[2], (int)block_coord_dest[3]); for (i=0; i< DIM0; i++) { printf("\n [ "); for (j=0; j< DIM1; j++) { printf("%02d ", rdata[i][j]); } printf("]"); } printf("\n"); return 0; }