/**************************************************************************** * NCSA HDF * * Software Development Group * * National Center for Supercomputing Applications * * University of Illinois at Urbana-Champaign * * 605 E. Springfield, Champaign IL 61820 * * * * For conditions of distribution and use, see the accompanying * * hdf/COPYING file. * * * ****************************************************************************/ #ifdef RCSID static char RcsId[] = "$Revision$"; #endif /* $Id$ */ /*********************************************************** * * Test program: trefer * * Test the Reference functionality * *************************************************************/ #include #include #define FILE "trefer.h5" /* 1-D dataset with fixed dimensions */ #define SPACE1_NAME "Space1" #define SPACE1_RANK 1 #define SPACE1_DIM1 4 /* 2-D dataset with fixed dimensions */ #define SPACE2_NAME "Space2" #define SPACE2_RANK 2 #define SPACE2_DIM1 10 #define SPACE2_DIM2 10 /* Element selection information */ #define POINT1_NPOINTS 10 /**************************************************************** ** ** test_reference_obj(): Test basic H5R (reference) object reference code. ** Tests references to various kinds of objects ** ****************************************************************/ static void test_reference_obj(void) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset, /* Dataset ID */ dset2; /* Dereferenced dataset ID */ hid_t group; /* Group ID */ hid_t sid1; /* Dataspace ID */ hsize_t dims1[] = {SPACE1_DIM1}; hobj_ref_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temp. buffer read from disk */ uint32 *tu32; /* Temporary pointer to uint32 data */ intn i; /* counting variables */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Object Reference Functions\n")); /* Allocate write & read buffers */ wbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); rbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); tbuf=malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); /* Create file */ fid1 = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for datasets */ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a group */ group=H5Gcreate(fid1,"Group1",-1); CHECK(group, FAIL, "H5Gcreate"); /* Close group */ ret = H5Gclose(group); CHECK(ret, FAIL, "H5Gclose"); /* Create a dataset */ dataset=H5Dcreate(fid1,"Dataset1",H5T_STD_U32LE,sid1,H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate"); for(tu32=(uint32 *)wbuf,i=0; i