From 227f5af63c8554d026cd6dbe73e6cdab91028223 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 14 Jul 1998 23:12:54 -0500 Subject: [svn-r498] Added test to read data from a hyperslab in memory into a selection of points in the file and back from the selection of points into a differently oriented hyperslab in memory. --- test/tselect.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 135 insertions(+), 3 deletions(-) diff --git a/test/tselect.c b/test/tselect.c index ce2c936..a488e7a 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -238,7 +238,7 @@ test_select_point(void) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,coord1); + ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Select sequence of ten points for write dataset */ @@ -252,7 +252,7 @@ test_select_point(void) coord2[7][0]=29; coord2[7][1]= 4; coord2[8][0]= 8; coord2[8][1]= 8; coord2[9][0]=19; coord2[9][1]=17; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,coord2); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create a dataset */ @@ -281,7 +281,7 @@ test_select_point(void) coord3[7][0]= 1; coord3[7][1]=22; coord3[8][0]=12; coord3[8][1]=21; coord3[9][0]=11; coord3[9][1]= 6; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,coord3); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Read selection from disk */ @@ -320,6 +320,137 @@ test_select_point(void) /**************************************************************** ** +** test_select_combo(): Test basic H5S (dataspace) selection code. +** Tests combinations of element and hyperslab selections between +** dataspaces of various sizes and dimensionalities. +** +****************************************************************/ +static void +test_select_combo(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + uint8 *wbuf, /* buffer to write to disk */ + *rbuf, /* buffer read from disk */ + *tbuf, /* temporary buffer pointer */ + *tbuf2; /* temporary buffer pointer */ + intn i,j; /* Counters */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Combination of Hyperslab & Element Selection Functions\n")); + + /* Allocate write & read buffers */ + wbuf=malloc(sizeof(uint8)*SPACE2_DIM1*SPACE2_DIM2); + rbuf=calloc(sizeof(uint8),SPACE3_DIM1*SPACE3_DIM2); + + /* Initialize write buffer */ + for(i=0, tbuf=wbuf; i