/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the files COPYING and Copyright.html. COPYING can be found at the root * * of the source code distribution tree; Copyright.html can be found at the * * root level of an installed copy of the electronic HDF5 document set and * * is linked from the top-level documents page. It can also be found at * * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*********************************************************** * * Test program: tselect * * Test the Dataspace selection functionality * *************************************************************/ #define H5S_PACKAGE /*suppress error about including H5Spkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5S_TESTING #include "testhdf5.h" #include "hdf5.h" #include "H5Spkg.h" /* Dataspaces */ #define FILENAME "tselect.h5" /* 3-D dataset with fixed dimensions */ #define SPACE1_NAME "Space1" #define SPACE1_RANK 3 #define SPACE1_DIM1 3 #define SPACE1_DIM2 15 #define SPACE1_DIM3 13 /* 2-D dataset with fixed dimensions */ #define SPACE2_NAME "Space2" #define SPACE2_RANK 2 #define SPACE2_DIM1 30 #define SPACE2_DIM2 26 #define SPACE2A_RANK 1 #define SPACE2A_DIM1 (SPACE2_DIM1*SPACE2_DIM2) /* 2-D dataset with fixed dimensions */ #define SPACE3_NAME "Space3" #define SPACE3_RANK 2 #define SPACE3_DIM1 15 #define SPACE3_DIM2 26 /* 3-D dataset with fixed dimensions */ #define SPACE4_NAME "Space4" #define SPACE4_RANK 3 #define SPACE4_DIM1 11 #define SPACE4_DIM2 13 #define SPACE4_DIM3 17 /* Number of random hyperslabs to test */ #define NHYPERSLABS 10 /* Number of random hyperslab tests performed */ #define NRAND_HYPER 100 /* 5-D dataset with fixed dimensions */ #define SPACE5_NAME "Space5" #define SPACE5_RANK 5 #define SPACE5_DIM1 10 #define SPACE5_DIM2 10 #define SPACE5_DIM3 10 #define SPACE5_DIM4 10 #define SPACE5_DIM5 10 /* 1-D dataset with same size as 5-D dataset */ #define SPACE6_NAME "Space6" #define SPACE6_RANK 1 #define SPACE6_DIM1 (SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5) /* 2-D dataset with easy dimension sizes */ #define SPACE7_NAME "Space7" #define SPACE7_RANK 2 #define SPACE7_DIM1 10 #define SPACE7_DIM2 10 #define SPACE7_FILL 254 #define SPACE7_CHUNK_DIM1 5 #define SPACE7_CHUNK_DIM2 5 #define SPACE7_NPOINTS 8 /* 4-D dataset with fixed dimensions */ #define SPACE8_NAME "Space8" #define SPACE8_RANK 4 #define SPACE8_DIM1 11 #define SPACE8_DIM2 13 #define SPACE8_DIM3 17 #define SPACE8_DIM4 19 /* Another 2-D dataset with easy dimension sizes */ #define SPACE9_NAME "Space9" #define SPACE9_RANK 2 #define SPACE9_DIM1 12 #define SPACE9_DIM2 12 /* Element selection information */ #define POINT1_NPOINTS 10 /* Chunked dataset information */ #define DATASETNAME "ChunkArray" #define NX_SUB 87 /* hyperslab dimensions */ #define NY_SUB 61 #define NZ_SUB 181 #define NX 87 /* output buffer dimensions */ #define NY 61 #define NZ 181 #define RANK_F 3 /* File dataspace rank */ #define RANK_M 3 /* Memory dataspace rank */ #define X 87 /* dataset dimensions */ #define Y 61 #define Z 181 #define CHUNK_X 87 /* chunk dimensions */ #define CHUNK_Y 61 #define CHUNK_Z 181 /* Basic chunk size */ #define SPACE10_DIM1 180 #define SPACE10_CHUNK_SIZE 12 /* Information for bounds checking test */ #define SPACE11_RANK 2 #define SPACE11_DIM1 100 #define SPACE11_DIM2 100 #define SPACE11_NPOINTS 4 /* Information for offsets w/chunks test #2 */ #define SPACE12_RANK 1 #define SPACE12_DIM0 25 #define SPACE12_CHUNK_DIM0 5 /* Location comparison function */ int compare_size_t(const void *s1, const void *s2); herr_t test_select_hyper_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); herr_t test_select_point_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); herr_t test_select_all_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); herr_t test_select_none_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); herr_t test_select_hyper_iter2(void *_elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_operator_data); herr_t test_select_hyper_iter3(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); /**************************************************************** ** ** test_select_hyper_iter1(): Iterator for checking hyperslab iteration ** ****************************************************************/ herr_t test_select_hyper_iter1(void *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *_operator_data) { uint8_t *tbuf=(uint8_t *)_elem, /* temporary buffer pointer */ **tbuf2=(uint8_t **)_operator_data; /* temporary buffer handle */ if(*tbuf!=**tbuf2) return(-1); else { (*tbuf2)++; return(0); } } /* end test_select_hyper_iter1() */ /**************************************************************** ** ** test_select_hyper(): Test basic H5S (dataspace) selection code. ** Tests hyperslabs of various sizes and dimensionalities. ** ****************************************************************/ static void test_select_hyper(hid_t xfer_plist) { 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}; 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_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ herr_t ret; /* Generic return value */ H5S_class_t ext_type; /* Extent type */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions\n")); /* Allocate write & read buffers */ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; ibuf+(pnt_info->coord[pnt_info->offset][0]*SPACE2_DIM2)+pnt_info->coord[pnt_info->offset][1]; if(*elem!=*tmp) return(-1); else { pnt_info->offset++; return(0); } } /* end test_select_point_iter1() */ /**************************************************************** ** ** test_select_point(): Test basic H5S (dataspace) selection code. ** Tests element selections between dataspaces of various sizes ** and dimensionalities. ** ****************************************************************/ static void test_select_point(hid_t xfer_plist) { 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}; hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ hsize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hsize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ hsize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ struct pnt_iter pi; /* Custom Pointer iterator struct */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Element Selection Functions\n")); /* Allocate write & read buffers */ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=calloc(sizeof(uint8_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i*(const size_t *)s2) return(1); else return(0); } /**************************************************************** ** ** test_select_hyper_stride(): Test H5S (dataspace) selection code. ** Tests strided hyperslabs of various sizes and dimensionalities. ** ****************************************************************/ static void test_select_hyper_stride(hid_t xfer_plist) { 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}; 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 */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ size_t loc1[72]={ /* Gruesomely ugly way to make certain hyperslab locations are checked correctly */ 27, 28, 29, 53, 54, 55, 79, 80, 81, /* Block #1 */ 32, 33, 34, 58, 59, 60, 84, 85, 86, /* Block #2 */ 157,158,159,183,184,185,209,210,211, /* Block #3 */ 162,163,164,188,189,190,214,215,216, /* Block #4 */ 287,288,289,313,314,315,339,340,341, /* Block #5 */ 292,293,294,318,319,320,344,345,346, /* Block #6 */ 417,418,419,443,444,445,469,470,471, /* Block #7 */ 422,423,424,448,449,450,474,475,476, /* Block #8 */ }; size_t loc2[72]={ 0, 1, 2, 26, 27, 28, /* Block #1 */ 4, 5, 6, 30, 31, 32, /* Block #2 */ 8, 9, 10, 34, 35, 36, /* Block #3 */ 12, 13, 14, 38, 39, 40, /* Block #4 */ 104,105,106,130,131,132, /* Block #5 */ 108,109,110,134,135,136, /* Block #6 */ 112,113,114,138,139,140, /* Block #7 */ 116,117,118,142,143,144, /* Block #8 */ 208,209,210,234,235,236, /* Block #9 */ 212,213,214,238,239,240, /* Block #10 */ 216,217,218,242,243,244, /* Block #11 */ 220,221,222,246,247,248, /* Block #12 */ }; int i,j; /* Counters */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); /* Allocate write & read buffers */ wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i=start[0] && i<(start[0]+count[0])) && (j>=start[1] && j<(start[1]+count[1])) && (k>=start[2] && k<(start[2]+count[2])) && (l>=start[3] && l<(start[3]+count[3])) ) { if(*tbuf!=*tbuf2) { printf("Error: hyperslab values don't match!\n"); TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end if */ else { if(*tbuf2!=0) { printf("Error: invalid data in read buffer!\n"); TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end else */ /* Close memory dataspace */ ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); /* Close disk dataspace */ ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ HDfree(wbuf); HDfree(rbuf); } /* test_select_hyper_contig3() */ /**************************************************************** ** ** test_select_hyper_copy(): Test H5S (dataspace) selection code. ** Tests copying hyperslab selections ** ****************************************************************/ static void test_select_hyper_copy(void) { hid_t fid1; /* HDF5 File IDs */ hid_t data1,data2; /* Dataset IDs */ hid_t sid1,sid2,sid3; /* Dataspace IDs */ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; 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 */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* 1st buffer read from disk */ *rbuf2, /* 2nd buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); /* Allocate write & read buffers */ wbuf=HDmalloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); rbuf2=HDcalloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i=5 && i<=9) && (j>=5 && j<=9)) { if(*tbuf!=*tbuf2) printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ /* Close memory dataspace */ ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); /* Close disk dataspace */ ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ free(wbuf); free(rbuf); } /* test_select_hyper_and_2d() */ /**************************************************************** ** ** test_select_hyper_xor_2d(): Test basic H5S (dataspace) selection code. ** Tests 'xor' of hyperslabs in 2-D ** ****************************************************************/ static void test_select_hyper_xor_2d(void) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims2[] = {SPACE2A_DIM1}; hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ herr_t ret; /* Generic return value */ hsize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with XOR of 2-D hyperslabs\n")); /* Allocate write & read buffers */ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i=0 && i<=4) && (j>=0 && j<=9)) || ((i>=5 && i<=9) && ((j>=0 && j<=4) || (j>=10 && j<=14))) || ((i>=10 && i<=14) && (j>=5 && j<=14))) { if(*tbuf!=*tbuf2) printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ /* Close memory dataspace */ ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); /* Close disk dataspace */ ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ free(wbuf); free(rbuf); } /* test_select_hyper_xor_2d() */ /**************************************************************** ** ** test_select_hyper_notb_2d(): Test basic H5S (dataspace) selection code. ** Tests 'notb' of hyperslabs in 2-D ** ****************************************************************/ static void test_select_hyper_notb_2d(void) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims2[] = {SPACE2A_DIM1}; hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ herr_t ret; /* Generic return value */ hsize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTB of 2-D hyperslabs\n")); /* Allocate write & read buffers */ wbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i=0 && i<=4) && (j>=0 && j<=9)) || ((i>=5 && i<=9) && (j>=0 && j<=4))) { if(*tbuf!=*tbuf2) printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ /* Close memory dataspace */ ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); /* Close disk dataspace */ ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ free(wbuf); free(rbuf); } /* test_select_hyper_notb_2d() */ /**************************************************************** ** ** test_select_hyper_nota_2d(): Test basic H5S (dataspace) selection code. ** Tests 'nota' of hyperslabs in 2-D ** ****************************************************************/ static void test_select_hyper_nota_2d(void) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims2[] = {SPACE2A_DIM1}; hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ herr_t ret; /* Generic return value */ hsize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTA of 2-D hyperslabs\n")); /* Allocate write & read buffers */ wbuf=HDmalloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=HDcalloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i=10 && i<=14) && (j>=5 && j<=14)) || ((i>=5 && i<=9) && (j>=10 && j<=14))) { if(*tbuf!=*tbuf2) TestErrPrintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) TestErrPrintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ /* Close memory dataspace */ ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); /* Close disk dataspace */ ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); /* Close Dataset */ ret = H5Dclose(dataset); CHECK(ret, FAIL, "H5Dclose"); /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); /* Free memory buffers */ HDfree(wbuf); HDfree(rbuf); } /* test_select_hyper_nota_2d() */ /**************************************************************** ** ** test_select_hyper_iter2(): Iterator for checking hyperslab iteration ** ****************************************************************/ herr_t test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, unsigned ndim, const hsize_t *point, void *_operator_data) { int *tbuf=(int *)_elem, /* temporary buffer pointer */ **tbuf2=(int **)_operator_data; /* temporary buffer handle */ unsigned u; /* Local counting variable */ if(*tbuf!=**tbuf2) { TestErrPrintf("Error in hyperslab iteration!\n"); printf("location: { "); for(u=0; ufill_value) return(-1); else { /* Check number of dimensions */ if(ndim!=SPACE7_RANK) return(-1); else { /* Check Coordinates */ coord_ptr=iter_info->coords+(2*iter_info->curr_coord); iter_info->curr_coord++; if(coord_ptr[0]!=point[0]) return(-1); else if(coord_ptr[1]!=point[1]) return(-1); else return(0); } /* end else */ } /* end else */ } /* end test_select_hyper_iter3() */ /**************************************************************** ** ** test_select_fill_all(): Test basic H5S (dataspace) selection code. ** Tests filling "all" selections ** ****************************************************************/ static void test_select_fill_all(void) { hid_t sid1; /* Dataspace ID */ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; int fill_value; /* Fill value */ fill_iter_info iter_info; /* Iterator information structure */ hsize_t points[SPACE7_DIM1*SPACE7_DIM2][SPACE7_RANK]; /* Coordinates of selection */ unsigned short *wbuf, /* buffer to write to disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Filling 'all' Selections\n")); /* Allocate memory buffer */ wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); /* Initialize memory buffer */ for(i=0, tbuf=wbuf; i=(int)(start[0]+real_offset[0]) && i<(int)(start[0]+count[0]+real_offset[0])) && (j>=(int)(start[1]+real_offset[1]) && j<(int)(start[1]+count[1]+real_offset[1]))) { if(*tbuf!=(unsigned short)fill_value) TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* end if */ else { if(*tbuf!=((unsigned short)(i*SPACE7_DIM2)+j)) TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); } /* end else */ } /* end for */ /* Initialize the iterator structure */ iter_info.fill_value=SPACE7_FILL; iter_info.curr_coord=0; iter_info.coords=(hsize_t *)points; /* Set the coordinates of the selection (with the offset) */ for(i=0, num_points=0; i<(int)count[0]; i++) for(j=0; j<(int)count[1]; j++, num_points++) { points[num_points][0]=i+start[0]+real_offset[0]; points[num_points][1]=j+start[1]+real_offset[1]; } /* end for */ /* Iterate through selection, verifying correct data */ ret = H5Diterate(wbuf,H5T_NATIVE_USHORT,sid1,test_select_hyper_iter3,&iter_info); CHECK(ret, FAIL, "H5Diterate"); /* Close dataspace */ ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); /* Free memory buffers */ HDfree(wbuf); } /* test_select_fill_hyper_simple() */ /**************************************************************** ** ** test_select_fill_hyper_regular(): Test basic H5S (dataspace) selection code. ** Tests filling "regular" (i.e. strided block) hyperslab selections ** ****************************************************************/ static void test_select_fill_hyper_regular(hssize_t *offset) { hid_t sid1; /* Dataspace ID */ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */ hsize_t start[SPACE7_RANK]; /* Hyperslab start */ hsize_t stride[SPACE7_RANK]; /* Hyperslab stride size */ hsize_t count[SPACE7_RANK]; /* Hyperslab block count */ hsize_t block[SPACE7_RANK]; /* Hyperslab block size */ hsize_t points[16][SPACE7_RANK] = { {2,2}, {2,3}, {2,6}, {2,7}, {3,2}, {3,3}, {3,6}, {3,7}, {6,2}, {6,3}, {6,6}, {6,7}, {7,2}, {7,3}, {7,6}, {7,7}, }; size_t num_points=16; /* Number of points selected */ int fill_value; /* Fill value */ fill_iter_info iter_info; /* Iterator information structure */ unsigned short *wbuf, /* buffer to write to disk */ *tbuf; /* temporary buffer pointer */ int i,j,k; /* Counters */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Filling Regular 'hyperslab' Selections\n")); /* Allocate memory buffer */ wbuf=HDmalloc(sizeof(unsigned short)*SPACE7_DIM1*SPACE7_DIM2); /* Initialize memory buffer */ for(i=0, tbuf=wbuf; i=POINT1_NPOINTS); /* Create dataspace for "all" selection */ all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(all_sid, FAIL, "H5Screate_simple"); /* Select entire extent for dataspace */ ret = H5Sselect_all(all_sid); CHECK(ret, FAIL, "H5Sselect_all"); /* Create dataspace for "none" selection */ none_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(none_sid, FAIL, "H5Screate_simple"); /* Un-Select entire extent for dataspace */ ret = H5Sselect_none(none_sid); CHECK(ret, FAIL, "H5Sselect_none"); /* Create dataspace for single point selection */ single_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(single_pt_sid, FAIL, "H5Screate_simple"); /* Select sequence of ten points for multiple point selection */ coord1[0][0]=2; coord1[0][1]=2; ret = H5Sselect_elements(single_pt_sid,H5S_SELECT_SET,1,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create dataspace for multiple point selection */ mult_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(mult_pt_sid, FAIL, "H5Screate_simple"); /* Select sequence of ten points for multiple point selection */ coord2[0][0]=2; coord2[0][1]=2; coord2[1][0]=7; coord2[1][1]=2; coord2[2][0]=1; coord2[2][1]=4; coord2[3][0]=2; coord2[3][1]=6; coord2[4][0]=0; coord2[4][1]=8; coord2[5][0]=3; coord2[5][1]=2; coord2[6][0]=4; coord2[6][1]=4; coord2[7][0]=1; coord2[7][1]=0; coord2[8][0]=5; coord2[8][1]=1; coord2[9][0]=9; coord2[9][1]=3; ret = H5Sselect_elements(mult_pt_sid,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create dataspace for single hyperslab selection */ single_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(single_hyper_sid, FAIL, "H5Screate_simple"); /* Select 10x10 hyperslab for single hyperslab selection */ start[0]=1; start[1]=1; stride[0]=1; stride[1]=1; count[0]=1; count[1]=1; block[0]=(SPACE9_DIM1-2); block[1]=(SPACE9_DIM2-2); ret = H5Sselect_hyperslab(single_hyper_sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Create dataspace for single hyperslab selection with entire extent selected */ single_hyper_all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(single_hyper_all_sid, FAIL, "H5Screate_simple"); /* Select entire extent for hyperslab selection */ start[0]=0; start[1]=0; stride[0]=1; stride[1]=1; count[0]=1; count[1]=1; block[0]=SPACE9_DIM1; block[1]=SPACE9_DIM2; ret = H5Sselect_hyperslab(single_hyper_all_sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Create dataspace for single hyperslab selection with single point selected */ single_hyper_pt_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(single_hyper_pt_sid, FAIL, "H5Screate_simple"); /* Select entire extent for hyperslab selection */ start[0]=2; start[1]=2; stride[0]=1; stride[1]=1; count[0]=1; count[1]=1; block[0]=1; block[1]=1; ret = H5Sselect_hyperslab(single_hyper_pt_sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Create dataspace for regular hyperslab selection */ regular_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(regular_hyper_sid, FAIL, "H5Screate_simple"); /* Select regular, strided hyperslab selection */ start[0]=2; start[1]=2; stride[0]=2; stride[1]=2; count[0]=5; count[1]=2; block[0]=1; block[1]=1; ret = H5Sselect_hyperslab(regular_hyper_sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Create dataspace for irregular hyperslab selection */ irreg_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(irreg_hyper_sid, FAIL, "H5Screate_simple"); /* Create irregular hyperslab selection by OR'ing two blocks together */ start[0]=2; start[1]=2; stride[0]=1; stride[1]=1; count[0]=1; count[1]=1; block[0]=1; block[1]=1; ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); start[0]=4; start[1]=4; stride[0]=1; stride[1]=1; count[0]=1; count[1]=1; block[0]=3; block[1]=3; ret = H5Sselect_hyperslab(irreg_hyper_sid,H5S_SELECT_OR,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Create dataspace for "no" hyperslab selection */ none_hyper_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(none_hyper_sid, FAIL, "H5Screate_simple"); /* Create "no" hyperslab selection by XOR'ing same blocks together */ start[0]=2; start[1]=2; stride[0]=1; stride[1]=1; count[0]=1; count[1]=1; block[0]=1; block[1]=1; ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); ret = H5Sselect_hyperslab(none_hyper_sid,H5S_SELECT_XOR,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Compare "all" selection to all the selections created */ /* Compare against itself */ check=H5S_select_shape_same_test(all_sid,all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); check=H5S_select_shape_same_test(all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "none" selection */ check=H5S_select_shape_same_test(all_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ check=H5S_select_shape_same_test(all_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ check=H5S_select_shape_same_test(all_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ check=H5S_select_shape_same_test(all_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ check=H5S_select_shape_same_test(all_sid,single_hyper_all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ check=H5S_select_shape_same_test(all_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ check=H5S_select_shape_same_test(all_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ check=H5S_select_shape_same_test(all_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ check=H5S_select_shape_same_test(all_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare "none" selection to all the selections created */ /* Compare against itself */ check=H5S_select_shape_same_test(none_sid,none_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(none_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); check=H5S_select_shape_same_test(none_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ check=H5S_select_shape_same_test(none_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ check=H5S_select_shape_same_test(none_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ check=H5S_select_shape_same_test(none_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ check=H5S_select_shape_same_test(none_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ check=H5S_select_shape_same_test(none_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ check=H5S_select_shape_same_test(none_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ check=H5S_select_shape_same_test(none_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ check=H5S_select_shape_same_test(none_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ check=H5S_select_shape_same_test(none_sid,none_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare single point selection to all the selections created */ /* Compare against itself */ check=H5S_select_shape_same_test(single_pt_sid,single_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(single_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); check=H5S_select_shape_same_test(single_pt_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ check=H5S_select_shape_same_test(single_pt_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ check=H5S_select_shape_same_test(single_pt_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ check=H5S_select_shape_same_test(single_pt_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ check=H5S_select_shape_same_test(single_pt_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ check=H5S_select_shape_same_test(single_pt_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ check=H5S_select_shape_same_test(single_pt_sid,single_hyper_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ check=H5S_select_shape_same_test(single_pt_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ check=H5S_select_shape_same_test(single_pt_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ check=H5S_select_shape_same_test(single_pt_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare multiple point selection to all the selections created */ /* Compare against itself */ check=H5S_select_shape_same_test(mult_pt_sid,mult_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(mult_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); check=H5S_select_shape_same_test(mult_pt_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ check=H5S_select_shape_same_test(mult_pt_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ check=H5S_select_shape_same_test(mult_pt_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ check=H5S_select_shape_same_test(mult_pt_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ check=H5S_select_shape_same_test(mult_pt_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ check=H5S_select_shape_same_test(mult_pt_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ check=H5S_select_shape_same_test(mult_pt_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare single "normal" hyperslab selection to all the selections created */ /* Compare against itself */ check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(single_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ check=H5S_select_shape_same_test(single_hyper_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ check=H5S_select_shape_same_test(single_hyper_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ check=H5S_select_shape_same_test(single_hyper_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ check=H5S_select_shape_same_test(single_hyper_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); #ifdef NOT_YET /* In theory, these two selections are the same shape, but the * H5S_select_shape_same() routine is just not this sophisticated yet and it * would take too much effort to make this work. The worst case is that the * non-optimized chunk mapping routines will be invoked instead of the more * optimized routines, so this only hurts performance, not correctness */ /* Construct point selection which matches "plain" hyperslab selection */ /* Create dataspace for point selection */ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Select sequence of points for point selection */ for(u=1; u<(SPACE9_DIM1-1); u++) { for(v=1; v<(SPACE9_DIM2-1); v++) { coord2[v-1][0]=u; coord2[v-1][1]=v; } /* end for */ ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,(SPACE9_DIM2-2),(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ /* Compare against hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); #endif /* NOT_YET */ /* Construct hyperslab selection which matches "plain" hyperslab selection */ /* Create dataspace for hyperslab selection */ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Un-select entire extent */ ret = H5Sselect_none(tmp_sid); CHECK(ret, FAIL, "H5Sselect_none"); /* Select sequence of rows for hyperslab selection */ for(u=1; u<(SPACE9_DIM1-1); u++) { start[0]=u; start[1]=1; stride[0]=1; stride[1]=1; count[0]=1; count[1]=1; block[0]=1; block[1]=(SPACE9_DIM2-2); ret = H5Sselect_hyperslab(tmp_sid,H5S_SELECT_OR,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ /* Compare against hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare single "all" hyperslab selection to all the selections created */ /* Compare against itself */ check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(single_hyper_all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ check=H5S_select_shape_same_test(single_hyper_all_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); #ifdef NOT_YET /* In theory, these two selections are the same shape, but the * H5S_select_shape_same() routine is just not this sophisticated yet and it * would take too much effort to make this work. The worst case is that the * non-optimized chunk mapping routines will be invoked instead of the more * optimized routines, so this only hurts performance, not correctness */ /* Construct point selection which matches "all" hyperslab selection */ /* Create dataspace for point selection */ tmp_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Select sequence of points for point selection */ for(u=0; u=((2*SPACE10_CHUNK_SIZE)/3)) if(wbuf[i+j]!=rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j]) TestErrPrintf("Line: %d - Error! i=%d, j=%d, rbuf=%d, wbuf=%d\n",__LINE__,i,j,rbuf[((SPACE10_DIM1-i)-SPACE10_CHUNK_SIZE)+j],wbuf[i+j]); /* Close the memory dataspace */ ret=H5Sclose (msid); CHECK(ret, FAIL, "H5Sclose"); /* Close the dataset */ ret=H5Dclose (did); CHECK(ret, FAIL, "H5Dclose"); /* Close the file */ ret=H5Fclose (fid); CHECK(ret, FAIL, "H5Fclose"); /* Free the buffers */ HDfree(wbuf); HDfree(rbuf); } /* test_select_hyper_chunk_offset() */ /**************************************************************** ** ** test_select_hyper_chunk_offset2(): Tests selections on dataspace, ** another test to verify that offsets for hyperslab selections are ** working in chunked datasets. ** ****************************************************************/ static void test_select_hyper_chunk_offset2(void) { hid_t file, dataset; /* handles */ hid_t dataspace; hid_t memspace; hid_t dcpl; /* Dataset creation property list */ herr_t status; unsigned data_out[SPACE12_DIM0]; /* output buffer */ unsigned data_in[SPACE12_CHUNK_DIM0]; /* input buffer */ hsize_t dims[SPACE12_RANK]={SPACE12_DIM0}; /* Dimension size */ hsize_t chunk_dims[SPACE12_RANK]={SPACE12_CHUNK_DIM0}; /* Chunk size */ hsize_t start[SPACE12_RANK]; /* Start of hyperslab */ hsize_t count[SPACE12_RANK]; /* Size of hyperslab */ hssize_t offset[SPACE12_RANK]; /* hyperslab offset in the file */ unsigned u, v; /* Local index variables */ /* Output message about test being performed */ MESSAGE(6, ("Testing more hyperslab selections using offsets in chunked datasets\n")); /* Initialize data to write out */ for (u = 0; u < SPACE12_DIM0; u++) data_out[u] = u; /* Create the file */ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); /* Create dataspace */ dataspace = H5Screate_simple(SPACE12_RANK, dims, NULL); CHECK(dataspace, FAIL, "H5Screate_simple"); /* Create dataset creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); /* Set chunk sizes */ status = H5Pset_chunk(dcpl, SPACE12_RANK, chunk_dims); CHECK(status, FAIL, "H5Pset_chunk"); /* Create dataset */ dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_UINT, dataspace, dcpl); CHECK(dataset, FAIL, "H5Dcreate"); /* Close DCPL */ status = H5Pclose(dcpl); CHECK(status, FAIL, "H5Pclose"); /* Write out entire dataset */ status = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out); CHECK(status, FAIL, "H5Dclose"); /* Create memory dataspace (same size as a chunk) */ memspace = H5Screate_simple(SPACE12_RANK, chunk_dims, NULL); CHECK(dataspace, FAIL, "H5Screate_simple"); /* * Define hyperslab in the file dataspace. */ start[0] = 0; count[0] = SPACE12_CHUNK_DIM0; status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, NULL, count, NULL); CHECK(status, FAIL, "H5Sselect_hyperslab"); /* Loop through retrieving data from file, checking it against data written */ for(u = 0; u < SPACE12_DIM0; u += SPACE12_CHUNK_DIM0) { /* Set the offset of the file selection */ offset[0] = u; status = H5Soffset_simple(dataspace, offset); CHECK(status, FAIL, "H5Soffset_simple"); /* Read in buffer of data */ status = H5Dread(dataset, H5T_NATIVE_UINT, memspace, dataspace, H5P_DEFAULT, data_in); CHECK(status, FAIL, "H5Dread"); /* Check data read in */ for(v = 0; v < SPACE12_CHUNK_DIM0; v++) if(data_out[u + v] != data_in[v]) TestErrPrintf("Error! data_out[%u]=%u, data_in[%u]=%u\n",(unsigned)(u + v), data_out[u + v], v, data_in[v]); } /* end for */ status = H5Dclose(dataset); CHECK(status, FAIL, "H5Dclose"); status = H5Sclose(dataspace); CHECK(status, FAIL, "H5Sclose"); status = H5Sclose(memspace); CHECK(status, FAIL, "H5Sclose"); status = H5Fclose(file); CHECK(status, FAIL, "H5Fclose"); } /* test_select_hyper_chunk_offset2() */ /**************************************************************** ** ** test_select_bounds(): Tests selection bounds on dataspaces, ** both with and without offsets. ** ****************************************************************/ static void test_select_bounds(void) { hid_t sid; /* Dataspace ID */ const hsize_t dims[SPACE11_RANK] = { SPACE11_DIM1, SPACE11_DIM2 }; /* Dataspace dimensions */ hsize_t coord[SPACE11_NPOINTS][SPACE11_RANK]; /* Coordinates for point selection */ hsize_t start[SPACE11_RANK]; /* The start of the hyperslab */ hsize_t stride[SPACE11_RANK]; /* The stride between block starts for the hyperslab */ hsize_t count[SPACE11_RANK]; /* The number of blocks for the hyperslab */ hsize_t block[SPACE11_RANK]; /* The size of each block for the hyperslab */ hssize_t offset[SPACE11_RANK]; /* Offset amount for selection */ hsize_t low_bounds[SPACE11_RANK]; /* The low bounds for the selection */ hsize_t high_bounds[SPACE11_RANK]; /* The high bounds for the selection */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(6, ("Testing selection bounds\n")); /* Create dataspace */ sid = H5Screate_simple (SPACE11_RANK, dims, NULL); CHECK(sid, FAIL, "H5Screate_simple"); /* Get bounds for 'all' selection */ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); CHECK(ret, FAIL, "H5Sget_select_bounds"); VERIFY(low_bounds[0],0,"H5Sget_select_bounds"); VERIFY(low_bounds[1],0,"H5Sget_select_bounds"); VERIFY(high_bounds[0],SPACE11_DIM1-1,"H5Sget_select_bounds"); VERIFY(high_bounds[1],SPACE11_DIM2-1,"H5Sget_select_bounds"); /* Set offset for selection */ offset[0]=1; offset[1]=1; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for 'all' selection with offset (which should be ignored) */ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); CHECK(ret, FAIL, "H5Sget_select_bounds"); VERIFY(low_bounds[0],0,"H5Sget_select_bounds"); VERIFY(low_bounds[1],0,"H5Sget_select_bounds"); VERIFY(high_bounds[0],SPACE11_DIM1-1,"H5Sget_select_bounds"); VERIFY(high_bounds[1],SPACE11_DIM2-1,"H5Sget_select_bounds"); /* Reset offset for selection */ offset[0]=0; offset[1]=0; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Set 'none' selection */ ret=H5Sselect_none(sid); CHECK(ret, FAIL, "H5Sselect_none"); /* Get bounds for 'none' selection */ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_select_bounds"); /* Set point selection */ coord[0][0]= 3; coord[0][1]= 3; coord[1][0]= 3; coord[1][1]= 96; coord[2][0]= 96; coord[2][1]= 3; coord[3][0]= 96; coord[3][1]= 96; ret = H5Sselect_elements(sid,H5S_SELECT_SET,SPACE11_NPOINTS,(const hsize_t **)coord); CHECK(ret, FAIL, "H5Sselect_elements"); /* Get bounds for point selection */ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); CHECK(ret, FAIL, "H5Sget_select_bounds"); VERIFY(low_bounds[0],3,"H5Sget_select_bounds"); VERIFY(low_bounds[1],3,"H5Sget_select_bounds"); VERIFY(high_bounds[0],SPACE11_DIM1-4,"H5Sget_select_bounds"); VERIFY(high_bounds[1],SPACE11_DIM2-4,"H5Sget_select_bounds"); /* Set bad offset for selection */ offset[0]=5; offset[1]=-5; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for hyperslab selection with negative offset */ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_select_bounds"); /* Set valid offset for selection */ offset[0]=2; offset[1]=-2; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for point selection with offset */ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); CHECK(ret, FAIL, "H5Sget_select_bounds"); VERIFY(low_bounds[0],5,"H5Sget_select_bounds"); VERIFY(low_bounds[1],1,"H5Sget_select_bounds"); VERIFY(high_bounds[0],SPACE11_DIM1-2,"H5Sget_select_bounds"); VERIFY(high_bounds[1],SPACE11_DIM2-6,"H5Sget_select_bounds"); /* Reset offset for selection */ offset[0]=0; offset[1]=0; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Set "regular" hyperslab selection */ start[0]= 2; start[1]= 2; stride[0]= 10; stride[1]= 10; count[0]= 4; count[1]= 4; block[0]= 5; block[1]= 5; ret = H5Sselect_hyperslab(sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Get bounds for hyperslab selection */ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); CHECK(ret, FAIL, "H5Sget_select_bounds"); VERIFY(low_bounds[0],2,"H5Sget_select_bounds"); VERIFY(low_bounds[1],2,"H5Sget_select_bounds"); VERIFY(high_bounds[0],36,"H5Sget_select_bounds"); VERIFY(high_bounds[1],36,"H5Sget_select_bounds"); /* Set bad offset for selection */ offset[0]=5; offset[1]=-5; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for hyperslab selection with negative offset */ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_select_bounds"); /* Set valid offset for selection */ offset[0]=5; offset[1]=-2; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for hyperslab selection with offset */ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); CHECK(ret, FAIL, "H5Sget_select_bounds"); VERIFY(low_bounds[0],7,"H5Sget_select_bounds"); VERIFY(low_bounds[1],0,"H5Sget_select_bounds"); VERIFY(high_bounds[0],41,"H5Sget_select_bounds"); VERIFY(high_bounds[1],34,"H5Sget_select_bounds"); /* Reset offset for selection */ offset[0]=0; offset[1]=0; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Make "irregular" hyperslab selection */ start[0]= 20; start[1]= 20; stride[0]= 20; stride[1]= 20; count[0]= 2; count[1]= 2; block[0]= 10; block[1]= 10; ret = H5Sselect_hyperslab(sid,H5S_SELECT_OR,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Get bounds for hyperslab selection */ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); CHECK(ret, FAIL, "H5Sget_select_bounds"); VERIFY(low_bounds[0],2,"H5Sget_select_bounds"); VERIFY(low_bounds[1],2,"H5Sget_select_bounds"); VERIFY(high_bounds[0],49,"H5Sget_select_bounds"); VERIFY(high_bounds[1],49,"H5Sget_select_bounds"); /* Set bad offset for selection */ offset[0]=5; offset[1]=-5; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for hyperslab selection with negative offset */ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sget_select_bounds"); /* Set valid offset for selection */ offset[0]=5; offset[1]=-2; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Get bounds for hyperslab selection with offset */ ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); CHECK(ret, FAIL, "H5Sget_select_bounds"); VERIFY(low_bounds[0],7,"H5Sget_select_bounds"); VERIFY(low_bounds[1],0,"H5Sget_select_bounds"); VERIFY(high_bounds[0],54,"H5Sget_select_bounds"); VERIFY(high_bounds[1],47,"H5Sget_select_bounds"); /* Reset offset for selection */ offset[0]=0; offset[1]=0; ret=H5Soffset_simple(sid, offset); CHECK(ret, FAIL, "H5Soffset_simple"); /* Close the dataspace */ ret=H5Sclose (sid); CHECK(ret, FAIL, "H5Sclose"); } /* test_select_bounds() */ /**************************************************************** ** ** test_select(): Main H5S selection testing routine. ** ****************************************************************/ void test_select(void) { hid_t plist_id; /* Property list for reading random hyperslabs */ hid_t fapl; /* Property list accessing the file */ int mdc_nelmts; /* Metadata number of elements */ #ifdef H5_WANT_H5_V1_4_COMPAT int rdcc_nelmts; /* Raw data number of elements */ #else /* H5_WANT_H5_V1_4_COMPAT */ size_t rdcc_nelmts; /* Raw data number of elements */ #endif /* H5_WANT_H5_V1_4_COMPAT */ size_t rdcc_nbytes; /* Raw data number of bytes */ double rdcc_w0; /* Raw data write percentage */ hssize_t offset[SPACE7_RANK]={1,1}; /* Offset for testing selection offsets */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Selections\n")); /* Create a dataset transfer property list */ plist_id=H5Pcreate(H5P_DATASET_XFER); CHECK(plist_id, FAIL, "H5Pcreate"); /* test I/O with a very small buffer for reads */ #ifdef H5_WANT_H5_V1_4_COMPAT ret=H5Pset_buffer(plist_id,(hsize_t)59,NULL,NULL); #else /* H5_WANT_H5_V1_4_COMPAT */ ret=H5Pset_buffer(plist_id,(size_t)59,NULL,NULL); #endif /* H5_WANT_H5_V1_4_COMPAT */ CHECK(ret, FAIL, "H5Pset_buffer"); /* These next tests use the same file */ test_select_hyper(H5P_DEFAULT); /* Test basic H5S hyperslab selection code */ test_select_hyper(plist_id); /* Test basic H5S hyperslab selection code */ test_select_point(H5P_DEFAULT); /* Test basic H5S element selection code, also tests appending to existing element selections */ test_select_point(plist_id); /* Test basic H5S element selection code, also tests appending to existing element selections */ test_select_all(H5P_DEFAULT); /* Test basic all & none selection code */ test_select_all(plist_id); /* Test basic all & none selection code */ test_select_all_hyper(H5P_DEFAULT); /* Test basic all & none selection code */ test_select_all_hyper(plist_id); /* Test basic all & none selection code */ /* These next tests use the same file */ test_select_combo(); /* Test combined hyperslab & element selection code */ test_select_hyper_stride(H5P_DEFAULT); /* Test strided hyperslab selection code */ test_select_hyper_stride(plist_id); /* Test strided hyperslab selection code */ test_select_hyper_contig(H5T_STD_U16LE,H5P_DEFAULT); /* Test contiguous hyperslab selection code */ test_select_hyper_contig(H5T_STD_U16LE,plist_id); /* Test contiguous hyperslab selection code */ test_select_hyper_contig(H5T_STD_U16BE,H5P_DEFAULT); /* Test contiguous hyperslab selection code */ test_select_hyper_contig(H5T_STD_U16BE,plist_id); /* Test contiguous hyperslab selection code */ test_select_hyper_contig2(H5T_STD_U16LE,H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */ test_select_hyper_contig2(H5T_STD_U16LE,plist_id); /* Test more contiguous hyperslab selection cases */ test_select_hyper_contig2(H5T_STD_U16BE,H5P_DEFAULT); /* Test more contiguous hyperslab selection cases */ test_select_hyper_contig2(H5T_STD_U16BE,plist_id); /* Test more contiguous hyperslab selection cases */ test_select_hyper_contig3(H5T_STD_U16LE,H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */ test_select_hyper_contig3(H5T_STD_U16LE,plist_id); /* Test yet more contiguous hyperslab selection cases */ test_select_hyper_contig3(H5T_STD_U16BE,H5P_DEFAULT); /* Test yet more contiguous hyperslab selection cases */ test_select_hyper_contig3(H5T_STD_U16BE,plist_id); /* Test yet more contiguous hyperslab selection cases */ test_select_hyper_copy(); /* Test hyperslab selection copying code */ test_select_point_copy(); /* Test point selection copying code */ test_select_hyper_offset(); /* Test selection offset code with hyperslabs */ test_select_hyper_offset2();/* Test more selection offset code with hyperslabs */ test_select_point_offset(); /* Test selection offset code with elements */ test_select_hyper_union(); /* Test hyperslab union code */ test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */ test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */ test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */ test_select_hyper_nota_2d(); /* Test hyperslab NOTA code for 2-D dataset */ /* test the random hyperslab I/O with the default property list for reading */ test_select_hyper_union_random_5d(H5P_DEFAULT); /* Test hyperslab union code for random 5-D hyperslabs */ /* test random hyperslab I/O with a small buffer for reads */ test_select_hyper_union_random_5d(plist_id); /* Test hyperslab union code for random 5-D hyperslabs */ /* Create a dataset transfer property list */ fapl=H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); /* Get the default file access properties for caching */ ret=H5Pget_cache(fapl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0); CHECK(ret, FAIL, "H5Pget_cache"); /* Increase the size of the raw data cache */ rdcc_nbytes=10*1024*1024; /* Set the file access properties for caching */ ret=H5Pset_cache(fapl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0); CHECK(ret, FAIL, "H5Pset_cache"); /* Test reading in a large hyperslab with a chunked dataset */ test_select_hyper_chunk(fapl,H5P_DEFAULT); /* Test reading in a large hyperslab with a chunked dataset a small amount at a time */ test_select_hyper_chunk(fapl,plist_id); /* Close file access property list */ ret=H5Pclose(fapl); CHECK(ret, FAIL, "H5Pclose"); /* Close dataset transfer property list */ ret=H5Pclose(plist_id); CHECK(ret, FAIL, "H5Pclose"); /* More tests for checking validity of selections */ test_select_valid(); /* Tests for combining "all" and "none" selections with hyperslabs */ test_select_combine(); /* Test filling selections */ /* (Also tests iterating through each selection */ test_select_fill_all(); test_select_fill_point(NULL); test_select_fill_point(offset); test_select_fill_hyper_simple(NULL); test_select_fill_hyper_simple(offset); test_select_fill_hyper_regular(NULL); test_select_fill_hyper_regular(offset); test_select_fill_hyper_irregular(NULL); test_select_fill_hyper_irregular(offset); /* Test 0-sized selections */ test_select_none(); /* Test selections on scalar dataspaces */ test_scalar_select(); test_scalar_select2(); /* Test "same shape" routine */ test_shape_same(); /* Test point selections in chunked datasets */ test_select_point_chunk(); /* Test scalar dataspaces in chunked datasets */ test_select_scalar_chunk(); /* Test using selection offset on hyperslab in chunked dataset */ test_select_hyper_chunk_offset(); test_select_hyper_chunk_offset2(); /* Test selection bounds with & without offsets */ test_select_bounds(); } /* test_select() */ /*------------------------------------------------------------------------- * Function: cleanup_select * * Purpose: Cleanup temporary test files * * Return: none * * Programmer: Albert Cheng * July 2, 1998 * * Modifications: * *------------------------------------------------------------------------- */ void cleanup_select(void) { remove(FILENAME); }