/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id$ */ /*********************************************************** * * 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 /* 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, hsize_t ndim, hssize_t *point, void *operator_data); herr_t test_select_point_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); herr_t test_select_all_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); herr_t test_select_none_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); herr_t test_select_hyper_iter2(void *_elem, hid_t type_id, hsize_t ndim, hssize_t *point, void *_operator_data); herr_t test_select_hyper_iter3(void *elem,hid_t type_id, hsize_t ndim, hssize_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, hsize_t UNUSED ndim, hssize_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}; hssize_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_hyper_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}; hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ hssize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hssize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ hssize_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}; hssize_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=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); /* Initialize write buffer */ for(i=0, tbuf=wbuf; i=start[0] && i<(int)(start[0]+count[0])) && (j>=start[1] && j<(int)(start[1]+count[1])) && (k>=start[2] && k<(int)(start[2]+count[2])) && (l>=start[3] && l<(int)(start[3]+count[3])) ) { if(*tbuf!=*tbuf2) { num_errs++; printf("Error: hyperslab values don't match!\n"); printf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end if */ else { if(*tbuf2!=0) { num_errs++; printf("Error: invalid data in read buffer!\n"); printf("Line: %d, i=%d, j=%d, k=%d, l=%d, *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 */ free(wbuf); free(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}; hssize_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=malloc(sizeof(uint16_t)*SPACE2_DIM1*SPACE2_DIM2); rbuf=calloc(sizeof(uint16_t),SPACE3_DIM1*SPACE3_DIM2); rbuf2=calloc(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}; hssize_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}; hssize_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}; hssize_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=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=10 && i<=14) && (j>=5 && j<=14)) || ((i>=5 && i<=9) && (j>=10 && 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_nota_2d() */ /**************************************************************** ** ** test_select_hyper_iter2(): Iterator for checking hyperslab iteration ** ****************************************************************/ herr_t test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, hsize_t ndim, hssize_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) { num_errs++; printf("Error in hyperslab iteration!\n"); printf("location: { "); for(u=0; u<(unsigned)ndim; u++) { printf("%2d",(int)point[u]); if(u<(unsigned)(ndim-1)) printf(", "); } /* end for */ printf("}\n"); printf("*tbuf=%d, **tbuf2=%d\n",*tbuf,**tbuf2); return(-1); } /* end if */ else { (*tbuf2)++; return(0); } } /* end test_select_hyper_iter1() */ /**************************************************************** ** ** test_select_hyper_union_random_5d(): Test basic H5S (dataspace) selection code. ** Tests random unions of 5-D hyperslabs ** ****************************************************************/ static void test_select_hyper_union_random_5d(hid_t read_plist) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE5_DIM1, SPACE5_DIM2, SPACE5_DIM3, SPACE5_DIM4, SPACE5_DIM5}; hsize_t dims2[] = {SPACE6_DIM1}; hssize_t start[SPACE5_RANK]; /* Starting location of hyperslab */ hsize_t count[SPACE5_RANK]; /* Element count of hyperslab */ int *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j,k,l,m; /* Counters */ herr_t ret; /* Generic return value */ hssize_t npoints, /* Number of elements in file selection */ npoints2; /* Number of elements in memory selection */ unsigned seed; /* Random number seed for each test */ unsigned test_num; /* Count of tests being executed */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with random unions of 5-D hyperslabs\n")); /* Allocate write & read buffers */ wbuf=malloc(sizeof(int)*SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5); rbuf=calloc(sizeof(int),SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5); /* Initialize write buffer */ for(i=0, tbuf=wbuf; ifill_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 */ hssize_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=malloc(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) { num_errs++; printf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); } /* end if */ } /* end if */ else { if(*tbuf!=((unsigned short)(i*SPACE7_DIM2)+j)) { num_errs++; printf("Error! j=%d, i=%d, *tbuf=%u, should be: %u\n",j,i,(unsigned)*tbuf,(unsigned)((i*SPACE7_DIM2)+j)); } /* end if */ } /* end else */ } /* end for */ /* Initialize the iterator structure */ iter_info.fill_value=SPACE7_FILL; iter_info.curr_coord=0; iter_info.coords=(hssize_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 */ free(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 */ hssize_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 */ hssize_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=malloc(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 hssize_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 hssize_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 hssize_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