From 70686065d082ad5f3bbce84decc066a9028a0a01 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 20 May 2004 10:31:12 -0500 Subject: [svn-r8543] Purpose: Code optimization Description: Expand the use of macros to inline trivial function pointer lookup and calls to reduce the overall number of functions invoked during normal operation of the library. Platforms tested: Solaris 2.7 (arabica) FreeBSD 4.9 (sleipnir) w/parallel Too minor to require h5committest --- src/H5.c | 2 +- src/H5D.c | 4 +- src/H5Dio.c | 86 +++++++------- src/H5R.c | 9 +- src/H5S.c | 40 +++++-- src/H5Sall.c | 45 ++++---- src/H5Shyper.c | 41 +------ src/H5Smpio.c | 18 +-- src/H5Snone.c | 38 ++++--- src/H5Spkg.h | 9 +- src/H5Spoint.c | 88 ++------------ src/H5Sprivate.h | 52 +++++++++ src/H5Sselect.c | 341 +++++++++++++++++++++++++++++++++++++++++++++++++------ 13 files changed, 511 insertions(+), 262 deletions(-) diff --git a/src/H5.c b/src/H5.c index b338cce..94e90d8 100644 --- a/src/H5.c +++ b/src/H5.c @@ -2139,7 +2139,7 @@ H5_trace (double *returning, const char *func, const char *type, ...) /* This may generate recursive call to the library... -QAK */ { H5S_t *space = H5I_object(obj); - if (H5S_SIMPLE==H5S_get_simple_extent_type(space)) { + if (H5S_SIMPLE==H5S_GET_SIMPLE_EXTENT_TYPE(space)) { asize[argno] = H5S_get_simple_extent_ndims(space); } } diff --git a/src/H5D.c b/src/H5D.c index 1eb550f..17e956c 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -2040,7 +2040,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space new_dset->alloc_time=H5D_ALLOC_TIME_EARLY; /* Set up layout information */ - new_dset->layout.ndims = H5S_get_simple_extent_ndims(new_dset->space) + 1; + new_dset->layout.ndims = H5S_GET_SIMPLE_EXTENT_NDIMS(new_dset->space) + 1; assert((unsigned)(new_dset->layout.ndims) <= NELMTS(new_dset->layout.dim)); new_dset->layout.dim[new_dset->layout.ndims-1] = H5T_get_size(new_dset->type); new_dset->layout.addr = HADDR_UNDEF; /* Initialize to no address */ @@ -2084,7 +2084,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space * Chunked storage allows any type of data space extension, so we * don't even bother checking. */ - if(chunk_ndims != H5S_get_simple_extent_ndims(new_dset->space)) + if(chunk_ndims != H5S_GET_SIMPLE_EXTENT_NDIMS(new_dset->space)) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "dimensionality of chunks doesn't match the data space"); if (new_dset->efl.nused>0) HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL, "external storage not supported with chunked layout"); diff --git a/src/H5Dio.c b/src/H5Dio.c index 8629744..d39112d 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -462,7 +462,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); /* Check for valid selection */ - if(H5S_select_valid(mem_space)!=TRUE) + if(H5S_SELECT_VALID(mem_space)!=TRUE) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); } if (H5S_ALL != file_space_id) { @@ -470,7 +470,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); /* Check for valid selection */ - if(H5S_select_valid(file_space)!=TRUE) + if(H5S_SELECT_VALID(file_space)!=TRUE) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); } @@ -553,7 +553,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); /* Check for valid selection */ - if (H5S_select_valid(mem_space)!=TRUE) + if (H5S_SELECT_VALID(mem_space)!=TRUE) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); } if (H5S_ALL != file_space_id) { @@ -561,7 +561,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); /* Check for valid selection */ - if (H5S_select_valid(file_space)!=TRUE) + if (H5S_SELECT_VALID(file_space)!=TRUE) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent"); } @@ -658,7 +658,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, file_space = dataset->space; if (!mem_space) mem_space = file_space; - if((snelmts = H5S_get_select_npoints(mem_space))<0) + if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space))<0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection"); H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t); @@ -678,7 +678,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #endif /*H5_HAVE_PARALLEL*/ /* Make certain that the number of elements in each selection is the same */ - if (nelmts!=(hsize_t)H5S_get_select_npoints(file_space)) + if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes"); /* Retrieve dataset properties */ @@ -885,7 +885,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, file_space = dataset->space; if (!mem_space) mem_space = file_space; - if((snelmts = H5S_get_select_npoints(mem_space))<0) + if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space))<0) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection"); H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t); @@ -901,7 +901,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #endif /*H5_HAVE_PARALLEL*/ /* Make certain that the number of elements in each selection is the same */ - if (nelmts!=(hsize_t)H5S_get_select_npoints(file_space)) + if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes"); /* Retrieve dataset properties */ @@ -1157,7 +1157,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, /* Start strip mining... */ for (smine_start=0; smine_startchunk_points; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ - assert(H5S_select_iter_nelmts(&file_iter)==(chunk_info->chunk_points-smine_start)); + assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(chunk_info->chunk_points-smine_start)); smine_nelmts = MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); /* @@ -1721,17 +1721,17 @@ UNUSED /* Release selection iterators */ if(file_iter_init) { - if(H5S_select_iter_release(&file_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&file_iter)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") file_iter_init=0; } /* end if */ if(mem_iter_init) { - if(H5S_select_iter_release(&mem_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") mem_iter_init=0; } /* end if */ if(bkg_iter_init) { - if(H5S_select_iter_release(&bkg_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") bkg_iter_init=0; } /* end if */ @@ -1743,15 +1743,15 @@ UNUSED done: /* Release selection iterators, if necessary */ if(file_iter_init) { - if(H5S_select_iter_release(&file_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&file_iter)<0) HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") - } /* end if */ + } /* end if */ if(mem_iter_init) { - if(H5S_select_iter_release(&mem_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0) HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") } /* end if */ if(bkg_iter_init) { - if(H5S_select_iter_release(&bkg_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0) HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") } /* end if */ @@ -1993,7 +1993,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, for (smine_start=0; smine_startchunk_points; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ - assert(H5S_select_iter_nelmts(&file_iter)==(chunk_info->chunk_points-smine_start)); + assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(chunk_info->chunk_points-smine_start)); smine_nelmts = MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); /* @@ -2060,17 +2060,17 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Release selection iterators */ if(file_iter_init) { - if(H5S_select_iter_release(&file_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&file_iter)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") file_iter_init=0; } /* end if */ if(mem_iter_init) { - if(H5S_select_iter_release(&mem_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") mem_iter_init=0; } /* end if */ if(bkg_iter_init) { - if(H5S_select_iter_release(&bkg_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0) HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") bkg_iter_init=0; } /* end if */ @@ -2082,15 +2082,15 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, done: /* Release selection iterators, if necessary */ if(file_iter_init) { - if(H5S_select_iter_release(&file_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&file_iter)<0) HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") } /* end if */ if(mem_iter_init) { - if(H5S_select_iter_release(&mem_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0) HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") } /* end if */ if(bkg_iter_init) { - if(H5S_select_iter_release(&bkg_iter)<0) + if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0) HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") } /* end if */ @@ -2256,7 +2256,7 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp fm->layout = &(dataset->layout); /* Check if the memory space is scalar & make equivalent memory space */ - if((sm_ndims = H5S_get_simple_extent_ndims(mem_space))<0) + if((sm_ndims = H5S_GET_SIMPLE_EXTENT_NDIMS(mem_space))<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number") if(sm_ndims==0) { hsize_t dims[H5O_LAYOUT_NDIMS]; /* Temporary dimension information */ @@ -2320,9 +2320,9 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp fm->mem_space_copy=equiv_mspace_init; /* Make certain to copy memory dataspace if necessary */ /* Get type of selection on disk & in memory */ - if((fsel_type=H5S_get_select_type(file_space))<0) + if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<0) HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space") - if((fm->msel_type=H5S_get_select_type(equiv_mspace))<0) + if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<0) HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space") /* Check if file selection is a point selection */ @@ -2472,7 +2472,7 @@ done: HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template"); } /* end if */ if(iter_init) { - if (H5S_select_iter_release(&(fm->mem_iter))<0) + if (H5S_SELECT_ITER_RELEASE(&(fm->mem_iter))<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } if(f_tid!=(-1)) { @@ -2604,11 +2604,11 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) assert(fm->f_ndims>0); /* Get number of elements selected in file */ - if((sel_points=H5S_get_select_npoints(fm->file_space))<0) + if((sel_points=H5S_GET_SELECT_NPOINTS(fm->file_space))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements"); /* Get bounding box for selection (to reduce the number of chunks to iterate over) */ - if(H5S_get_select_bounds(fm->file_space, sel_start, sel_end)<0) + if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info"); /* Set initial chunk location & hyperslab size */ @@ -2693,7 +2693,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) } /* end if */ /* Get number of elements selected in chunk */ - if((schunk_points=H5S_get_select_npoints(tmp_fchunk))<0) + if((schunk_points=H5S_GET_SELECT_NPOINTS(tmp_fchunk))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements") H5_ASSIGN_OVERFLOW(new_chunk_info->chunk_points,schunk_points,hssize_t,hsize_t); @@ -2817,11 +2817,11 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm) } /* end if */ else { /* Get bounding box for file selection */ - if(H5S_get_select_bounds(fm->file_space, file_sel_start, file_sel_end)<0) + if(H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") /* Get bounding box for memory selection */ - if(H5S_get_select_bounds(fm->mem_space, mem_sel_start, mem_sel_end)<0) + if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") /* Calculate the adjustment for memory selection from file selection */ @@ -2861,7 +2861,7 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") /* Release the current selection */ - if(H5S_select_release(chunk_info->mspace)<0) + if(H5S_SELECT_RELEASE(chunk_info->mspace)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection"); /* Copy the file chunk's selection */ @@ -3113,7 +3113,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_ } /* end else */ /* Get coordinates of selection iterator for memory */ - if(H5S_select_iter_coords(&fm->mem_iter,coords_in_mem)<0) + if(H5S_SELECT_ITER_COORDS(&fm->mem_iter,coords_in_mem)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates"); /* Add point to memory selection for chunk */ @@ -3127,7 +3127,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_ } /* end else */ /* Move memory selection iterator to next element in selection */ - if(H5S_select_iter_next(&fm->mem_iter,1)<0) + if(H5S_SELECT_ITER_NEXT(&fm->mem_iter,1)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location"); done: diff --git a/src/H5R.c b/src/H5R.c index 50e8745..1916edc 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -12,10 +12,7 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - #define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ #include "H5private.h" /* Generic Functions */ #include "H5Iprivate.h" /* ID Functions */ @@ -26,7 +23,7 @@ #include "H5HGprivate.h" /* Global Heaps */ #include "H5MMprivate.h" /* Memory Management */ #include "H5Rprivate.h" /* References */ -#include "H5Spkg.h" /* Dataspaces */ +#include "H5Sprivate.h" /* Dataspace functions */ #include "H5Tprivate.h" /* Datatypes */ /* Interface initialization */ @@ -198,7 +195,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, HDmemset(ref->heapid,H5R_DSET_REG_REF_BUF_SIZE,0); /* Get the amount of space required to serialize the selection */ - if ((buf_size = (*space->select.serial_size)(space)) < 0) + if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection"); /* Increase buffer size to allow for the dataset OID */ @@ -215,7 +212,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, H5F_addr_encode(loc->file,&p,addr); /* Serialize the selection */ - if ((*space->select.serialize)(space,p) < 0) + if (H5S_SELECT_SERIALIZE(space,p) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection"); /* Save the serialized buffer for later */ diff --git a/src/H5S.c b/src/H5S.c index a5a8f4e..faf6c7a 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -448,7 +448,7 @@ H5S_close(H5S_t *ds) assert(ds); /* Release selection (this should come before the extent release) */ - H5S_select_release(ds); + H5S_SELECT_RELEASE(ds); /* Release extent */ H5S_extent_release(ds); @@ -907,7 +907,7 @@ H5Sget_simple_extent_ndims(hid_t space_id) if (NULL == (ds = H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); - ret_value = H5S_get_simple_extent_ndims(ds); + ret_value = H5S_GET_SIMPLE_EXTENT_NDIMS(ds); done: FUNC_LEAVE_API(ret_value); @@ -927,6 +927,10 @@ done: * Programmer: Robb Matzke * Thursday, December 11, 1997 * + * Note: This routine participates in the "Inlining C function pointers" + * pattern, don't call it directly, use the appropriate macro + * defined in H5Sprivate.h. + * * Modifications: * *------------------------------------------------------------------------- @@ -943,9 +947,6 @@ H5S_get_simple_extent_ndims(const H5S_t *ds) switch (ds->extent.type) { case H5S_SCALAR: - ret_value = 0; - break; - case H5S_SIMPLE: ret_value = ds->extent.u.simple.rank; break; @@ -1383,9 +1384,6 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, /* Check args */ assert(rank<=H5S_MAX_RANK); assert(0==rank || dims); - - /* Set offset to zeros */ - HDmemset(space->select.offset,0,sizeof(hssize_t)*rank); /* shift out of the previous state to a "simple" dataspace */ switch (space->extent.type) { @@ -1435,6 +1433,16 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, } /* end if */ } + /* Selection related cleanup */ + + /* Set offset to zeros */ + HDmemset(space->select.offset,0,sizeof(hssize_t)*rank); + + /* If the selection is 'all', update the number of elements selected */ + if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL) + if(H5S_select_all(space, FALSE)<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); + done: FUNC_LEAVE_NOAPI(ret_value); } @@ -1653,6 +1661,11 @@ H5S_extend (H5S_t *space, const hsize_t *size) nelem*=space->extent.u.simple.size[u]; } space->extent.nelem = nelem; + + /* If the selection is 'all', update the number of elements selected */ + if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL) + if(H5S_select_all(space, FALSE)<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); } done: @@ -1790,6 +1803,10 @@ done: * Programmer: Quincey Koziol * Thursday, September 28, 2000 * + * Note: This routine participates in the "Inlining C function pointers" + * pattern, don't call it directly, use the appropriate macro + * defined in H5Sprivate.h. + * * Modifications: * *------------------------------------------------------------------------- @@ -1841,7 +1858,7 @@ H5Sget_simple_extent_type(hid_t sid) if (NULL == (space = H5I_object_verify(sid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace"); - ret_value=H5S_get_simple_extent_type(space); + ret_value=H5S_GET_SIMPLE_EXTENT_TYPE(space); done: FUNC_LEAVE_API(ret_value); @@ -2008,6 +2025,11 @@ H5S_set_extent_real( H5S_t *space, const hsize_t *size ) } /* end for */ space->extent.nelem = nelem; + /* If the selection is 'all', update the number of elements selected */ + if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL) + if(H5S_select_all(space, FALSE)<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); + done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5S_set_extent_real() */ diff --git a/src/H5Sall.c b/src/H5Sall.c index edff4ba..19a0a02 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -71,7 +71,7 @@ H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space) assert (iter); /* Initialize the number of elements to iterate over */ - iter->elmt_left=H5S_get_simple_extent_npoints(space); + iter->elmt_left=H5S_GET_SELECT_NPOINTS(space); /* Start at the upper left location */ iter->u.all.elmt_offset=0; @@ -342,6 +342,9 @@ H5S_all_release (H5S_t UNUSED * space) /* Check args */ assert (space); + /* Reset the number of elements in the selection */ + space->select.num_elem=0; + done: FUNC_LEAVE_NOAPI(ret_value); } /* H5S_all_release() */ @@ -349,37 +352,39 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_all_npoints + H5S_all_copy PURPOSE - Compute number of elements in current selection + Copy a selection from one dataspace to another USAGE - hsize_t H5S_all_npoints(space) - H5S_t *space; IN: Pointer to dataspace + herr_t H5S_all_copy(dst, src) + H5S_t *dst; OUT: Pointer to the destination dataspace + H5S_t *src; IN: Pointer to the source dataspace RETURNS - The number of elements in selection on success, 0 on failure + Non-negative on success/Negative on failure DESCRIPTION - Compute number of elements in current selection. For "all" selections, - this is the same as the number of points in the extent. + Copies the 'all' selection information from the source + dataspace to the destination dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hsize_t -H5S_all_npoints (const H5S_t *space) +herr_t +H5S_all_copy (H5S_t *dst, const H5S_t *src) { - hsize_t ret_value; + herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(H5S_all_npoints, 0); + FUNC_ENTER_NOAPI(H5S_all_copy, FAIL); - /* Check args */ - assert (space); + assert(src); + assert(dst); + + /* Set number of elements in selection */ + dst->select.num_elem=(hsize_t)H5S_get_simple_extent_npoints(dst); - ret_value=(hsize_t)H5S_get_simple_extent_npoints(space); - done: FUNC_LEAVE_NOAPI(ret_value); -} /* H5S_all_npoints() */ +} /* end H5S_all_copy() */ /*-------------------------------------------------------------------------- @@ -714,15 +719,17 @@ H5S_select_all (H5S_t *space, unsigned rel_prev) /* Remove current selection first */ if(rel_prev) - if((*space->select.release)(space)<0) + if(H5S_SELECT_RELEASE(space)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection"); + /* Set number of elements in selection */ + space->select.num_elem=(hsize_t)H5S_get_simple_extent_npoints(space); + /* Set selection type */ space->select.type=H5S_SEL_ALL; /* Set selection methods */ space->select.get_seq_list=H5S_all_get_seq_list; - space->select.get_npoints=H5S_all_npoints; space->select.release=H5S_all_release; space->select.is_valid=H5S_all_is_valid; space->select.serial_size=H5S_all_serial_size; diff --git a/src/H5Shyper.c b/src/H5Shyper.c index b5c87a2..cb7c5d7 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -980,41 +980,6 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter) /*-------------------------------------------------------------------------- NAME - H5S_hyper_npoints - PURPOSE - Compute number of elements in current selection - USAGE - hsize_t H5S_hyper_npoints(space) - H5S_t *space; IN: Pointer to dataspace - RETURNS - The number of elements in selection on success, 0 on failure - DESCRIPTION - Compute number of elements in current selection. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -hsize_t -H5S_hyper_npoints (const H5S_t *space) -{ - hsize_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(H5S_hyper_npoints, 0); - - /* Check args */ - assert (space); - - /* Set return value */ - ret_value=space->select.num_elem; - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* H5S_hyper_npoints() */ - - -/*-------------------------------------------------------------------------- - NAME H5S_hyper_new_span PURPOSE Make a new hyperslab span node @@ -3392,7 +3357,6 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hssize_t *coords) /* Set selection methods */ space->select.get_seq_list=H5S_hyper_get_seq_list; - space->select.get_npoints=H5S_hyper_npoints; space->select.release=H5S_hyper_release; space->select.is_valid=H5S_hyper_is_valid; space->select.serial_size=H5S_hyper_serial_size; @@ -5749,7 +5713,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, if(op==H5S_SELECT_SET) { /* If we are setting a new selection, remove current selection first */ - if((*space->select.release)(space)<0) + if(H5S_SELECT_RELEASE(space)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab"); /* Save the diminfo */ @@ -5797,7 +5761,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* Set selection methods */ space->select.get_seq_list=H5S_hyper_get_seq_list; - space->select.get_npoints=H5S_hyper_npoints; space->select.release=H5S_hyper_release; space->select.is_valid=H5S_hyper_is_valid; space->select.serial_size=H5S_hyper_serial_size; @@ -5853,7 +5816,7 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[], /* Check args */ if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); - if (H5S_SCALAR==H5S_get_simple_extent_type(space)) + if (H5S_SCALAR==H5S_GET_SIMPLE_EXTENT_TYPE(space)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space"); if(start==NULL || count==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified"); diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 209ca91..bea5982 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -344,7 +344,7 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, * Construct contig type for inner contig dims: *******************************************************/ #ifdef H5Smpi_DEBUG - HDfprintf(stderr, "%s: Making contig type %d MPI_BYTEs\n", FUNC, elmt_size ); + HDfprintf(stderr, "%s: Making contig type %d MPI_BYTEs\n", FUNC,elmt_size ); for (i=rank-1; i>=0; --i) HDfprintf(stderr, "d[%d].xtent=%Hu \n", i, d[i].xtent); #endif @@ -363,12 +363,12 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, #endif #ifdef H5Smpi_DEBUG - HDfprintf(stderr, "%s: i=%d Making vector-type \n", FUNC, i); + HDfprintf(stderr, "%s: i=%d Making vector-type \n", FUNC,i); #endif /**************************************** * Build vector in current dimension: ****************************************/ - mpi_code =MPI_Type_vector((int)(d[i].count), /* count */ + mpi_code =MPI_Type_vector((int)(d[i].count), /* count */ (int)(d[i].block), /* blocklength */ (int)(d[i].strid), /* stride */ inner_type, /* old type */ @@ -486,7 +486,7 @@ empty: done: /* Release selection iterator */ if(sel_iter_init) { - if (H5S_select_iter_release(&sel_iter)<0) + if (H5S_SELECT_ITER_RELEASE(&sel_iter)<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } /* end if */ @@ -629,9 +629,9 @@ done: */ static herr_t H5S_mpio_spaces_xfer(H5F_t *f, const H5O_layout_t *layout, size_t elmt_size, - const H5S_t *file_space, const H5S_t *mem_space, - hid_t dxpl_id, void *_buf /*out*/, - hbool_t do_write ) + const H5S_t *file_space, const H5S_t *mem_space, + hid_t dxpl_id, void *_buf /*out*/, + hbool_t do_write ) { haddr_t addr; /* Address of dataset (or selection) within file */ size_t mpi_buf_count, mpi_file_count; /* Number of "objects" to transfer */ @@ -837,8 +837,8 @@ H5S_mpio_opt_possible( const H5S_t *mem_space, const H5S_t *file_space, const un HGOTO_DONE(FALSE); /* Check whether both selections are "regular" */ - c1=(*file_space->select.is_regular)(file_space); - c2=(*mem_space->select.is_regular)(mem_space); + c1=H5S_SELECT_IS_REGULAR(file_space); + c2=H5S_SELECT_IS_REGULAR(mem_space); if(c1==FAIL || c2==FAIL) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "invalid check for single selection blocks"); if(c1==FALSE || c2==FALSE) diff --git a/src/H5Snone.c b/src/H5Snone.c index 1e6a1d5..4409d2b 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -320,35 +320,39 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_none_npoints + H5S_none_copy PURPOSE - Compute number of elements in current selection + Copy a selection from one dataspace to another USAGE - hsize_t H5S_none_npoints(space) - H5S_t *space; IN: Pointer to dataspace + herr_t H5S_none_copy(dst, src) + H5S_t *dst; OUT: Pointer to the destination dataspace + H5S_t *src; IN: Pointer to the source dataspace RETURNS - The number of elements in selection on success, 0 on failure + Non-negative on success/Negative on failure DESCRIPTION - Compute number of elements in current selection. For "none" selections, - this is always 0. + Copies the 'none' selection information from the source + dataspace to the destination dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hsize_t -H5S_none_npoints (const H5S_t UNUSED *space) +herr_t +H5S_none_copy (H5S_t *dst, const H5S_t *src) { - hsize_t ret_value=0; /* Return value */ + herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI(H5S_none_npoints, 0); + FUNC_ENTER_NOAPI(H5S_none_copy, FAIL); - /* Check args */ - assert (space); + assert(src); + assert(dst); + + /* Set number of elements in selection */ + dst->select.num_elem=0; done: FUNC_LEAVE_NOAPI(ret_value); -} /* H5S_none_npoints() */ +} /* end H5S_none_copy() */ /*-------------------------------------------------------------------------- @@ -666,15 +670,17 @@ herr_t H5S_select_none (H5S_t *space) assert(space); /* Remove current selection first */ - if((*space->select.release)(space)<0) + if(H5S_SELECT_RELEASE(space)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab"); + /* Set number of elements in selection */ + space->select.num_elem=0; + /* Set selection type */ space->select.type=H5S_SEL_NONE; /* Set selection methods */ space->select.get_seq_list=H5S_none_get_seq_list; - space->select.get_npoints=H5S_none_npoints; space->select.release=H5S_none_release; space->select.is_valid=H5S_none_is_valid; space->select.serial_size=H5S_none_serial_size; diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 06a18d4..d93ec1e 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -117,8 +117,6 @@ typedef struct { typedef herr_t (*H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); -/* Method to compute number of elements in current selection */ -typedef hsize_t (*H5S_sel_get_npoints_func_t)(const H5S_t *space); /* Method to release current selection */ typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space); /* Method to determine if current selection is valid for dataspace */ @@ -149,7 +147,6 @@ typedef struct { H5S_hyper_sel_t hslab; /* Info about new-style hyperslab selections */ } sel_info; H5S_sel_get_seq_list_func_t get_seq_list; /* Method to retrieve a list of offset/length sequences for selection */ - H5S_sel_get_npoints_func_t get_npoints; /* Method to compute number of elements in current selection */ H5S_sel_release_func_t release; /* Method to release current selection */ H5S_sel_is_valid_func_t is_valid; /* Method to determine if current selection is valid for dataspace */ H5S_sel_serial_size_func_t serial_size; /* Method to determine number of bytes required to store current selection */ @@ -179,7 +176,6 @@ H5_DLL herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Point selection functions */ H5_DLL herr_t H5S_point_release(H5S_t *space); -H5_DLL hsize_t H5S_point_npoints(const H5S_t *space); H5_DLL herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src); H5_DLL htri_t H5S_point_is_valid(const H5S_t *space); H5_DLL hssize_t H5S_point_serial_size(const H5S_t *space); @@ -198,7 +194,7 @@ H5_DLL herr_t H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* "All" selection functions */ H5_DLL herr_t H5S_all_release(H5S_t *space); -H5_DLL hsize_t H5S_all_npoints(const H5S_t *space); +H5_DLL herr_t H5S_all_copy(H5S_t *dst, const H5S_t *src); H5_DLL htri_t H5S_all_is_valid(const H5S_t *space); H5_DLL hssize_t H5S_all_serial_size(const H5S_t *space); H5_DLL herr_t H5S_all_serialize(const H5S_t *space, uint8_t *buf); @@ -216,7 +212,6 @@ H5_DLL herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Hyperslab selection functions */ H5_DLL herr_t H5S_hyper_release(H5S_t *space); -H5_DLL hsize_t H5S_hyper_npoints(const H5S_t *space); H5_DLL herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); H5_DLL htri_t H5S_hyper_is_valid(const H5S_t *space); H5_DLL hssize_t H5S_hyper_serial_size(const H5S_t *space); @@ -235,7 +230,7 @@ H5_DLL herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* "None" selection functions */ H5_DLL herr_t H5S_none_release(H5S_t *space); -H5_DLL hsize_t H5S_none_npoints(const H5S_t *space); +H5_DLL herr_t H5S_none_copy(H5S_t *dst, const H5S_t *src); H5_DLL htri_t H5S_none_is_valid(const H5S_t *space); H5_DLL hssize_t H5S_none_serial_size(const H5S_t *space); H5_DLL herr_t H5S_none_serialize(const H5S_t *space, uint8_t *buf); diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 7342efb..d2b2562 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -399,8 +399,11 @@ H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t * space->select.sel_info.pnt_lst->head=top; } /* end else */ - /* Add the number of elements in the new selection */ - space->select.num_elem+=num_elem; + /* Set the number of elements in the new selection */ + if(op==H5S_SELECT_SET) + space->select.num_elem=num_elem; + else + space->select.num_elem+=num_elem; done: FUNC_LEAVE_NOAPI(ret_value); @@ -458,40 +461,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_point_npoints - PURPOSE - Compute number of elements in current selection - USAGE - hsize_t H5S_point_npoints(space) - H5S_t *space; IN: Pointer to dataspace - RETURNS - The number of elements in selection on success, 0 on failure - DESCRIPTION - Compute number of elements in current selection. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -hsize_t -H5S_point_npoints (const H5S_t *space) -{ - hsize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5S_point_npoints, 0); - - /* Check args */ - assert (space); - - /* Set return value */ - ret_value=space->select.num_elem; - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* H5S_point_npoints() */ - - -/*-------------------------------------------------------------------------- - NAME H5S_select_elements PURPOSE Specify a series of elements in the dataspace to select @@ -535,8 +504,8 @@ H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem, assert(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND); /* If we are setting a new selection, remove current selection first */ - if(op==H5S_SELECT_SET) { - if((*space->select.release)(space)<0) + if(op==H5S_SELECT_SET || space->select.type!=H5S_SEL_POINTS) { + if(H5S_SELECT_RELEASE(space)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection"); } /* end if */ @@ -555,7 +524,6 @@ H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem, /* Set selection methods */ space->select.get_seq_list=H5S_point_get_seq_list; - space->select.get_npoints=H5S_point_npoints; space->select.release=H5S_point_release; space->select.is_valid=H5S_point_is_valid; space->select.serial_size=H5S_point_serial_size; @@ -687,38 +655,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_get_select_elem_npoints - PURPOSE - Get the number of points in current element selection - USAGE - hssize_t H5S_get_select_elem_npoints(space) - H5S_t *space; IN: Dataspace ptr of selection to query - RETURNS - The number of element points in selection on success, negative on failure - DESCRIPTION - Returns the number of element points in current selection for dataspace. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static hssize_t -H5S_get_select_elem_npoints(H5S_t *space) -{ - hssize_t ret_value=FAIL; /* return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_get_select_elem_npoints); - - assert(space); - - ret_value = space->select.num_elem; - - FUNC_LEAVE_NOAPI(ret_value); -} /* H5Sget_select_elem_npoints() */ - - -/*-------------------------------------------------------------------------- - NAME H5Sget_select_elem_npoints PURPOSE Get the number of points in current element selection @@ -749,7 +685,7 @@ H5Sget_select_elem_npoints(hid_t spaceid) if(space->select.type!=H5S_SEL_POINTS) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection"); - ret_value = H5S_get_select_elem_npoints(space); + ret_value = H5S_GET_SELECT_NPOINTS(space); done: FUNC_LEAVE_API(ret_value); @@ -1282,13 +1218,13 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, /* Check args */ if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); - if (H5S_SCALAR==H5S_get_simple_extent_type(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); + if (H5S_SCALAR==H5S_GET_SIMPLE_EXTENT_TYPE(space)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_SCALAR space"); if(coord==NULL || num_elem==0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "elements not specified"); if(!(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operations other than H5S_SELECT_SET not supported currently"); + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "unsupported operation attempted"); /* Call the real element selection routine */ if((ret_value=H5S_select_elements(space,op,num_elem,coord))<0) diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index e766b52..0bc6dc7 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -172,6 +172,52 @@ typedef struct H5S_conv_t { #endif } H5S_conv_t; +/* If the module using this macro is allowed access to the private variables, access them directly */ +#ifdef H5S_PACKAGE +#define H5S_GET_SIMPLE_EXTENT_TYPE(S) ((S)->extent.type) +#define H5S_GET_SIMPLE_EXTENT_NDIMS(S) ((S)->extent.u.simple.rank) +#define H5S_GET_SELECT_NPOINTS(S) ((S)->select.num_elem) +#define H5S_GET_SELECT_TYPE(S) ((S)->select.type) +#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) +#define H5S_SELECT_VALID(S) ((*(S)->select.is_valid)(S)) +#define H5S_SELECT_RELEASE(S) ((*(S)->select.release)(S)) +#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.serial_size)(S)) +#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.serialize)(S,BUF)) +#define H5S_SELECT_BOUNDS(S,START,END) ((*(S)->select.bounds)(S,START,END)) +#define H5S_SELECT_IS_CONTIGUOUS(S) ((*(S)->select.is_contiguous)(S)) +#define H5S_SELECT_IS_SINGLE(S) ((*(S)->select.is_single)(S)) +#define H5S_SELECT_IS_REGULAR(S) ((*(S)->select.is_regular)(S)) +#define H5S_SELECT_ITER_COORDS(ITER,COORDS) ((*(ITER)->iter_coords)(ITER,COORDS)) +#define H5S_SELECT_ITER_BLOCK(ITER,START,END) ((*(ITER)->iter_block)(ITER,START,END)) +#define H5S_SELECT_ITER_NELMTS(ITER) ((*(ITER)->iter_nelmts)(ITER)) +#define H5S_SELECT_ITER_HAS_NEXT_BLOCK(ITER) ((*(ITER)->iter_has_next_block)(ITER)) +#define H5S_SELECT_ITER_NEXT(ITER,NELEM)((*(ITER)->iter_next)(ITER,NELEM)) +#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) ((*(ITER)->iter_next_block)(ITER)) +#define H5S_SELECT_ITER_RELEASE(ITER) ((*(ITER)->iter_release)(ITER)) +#else /* H5S_PACKAGE */ +#define H5S_GET_SIMPLE_EXTENT_TYPE(S) (H5S_get_simple_extent_type(S)) +#define H5S_GET_SIMPLE_EXTENT_NDIMS(S) (H5S_get_simple_extent_ndims(S)) +#define H5S_GET_SELECT_NPOINTS(S) (H5S_get_select_npoints(S)) +#define H5S_GET_SELECT_TYPE(S) (H5S_get_select_type(S)) +#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) +#define H5S_SELECT_VALID(S) (H5S_select_valid(S)) +#define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) +#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S)) +#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF)) +#define H5S_SELECT_BOUNDS(S,START,END) (H5S_get_select_bounds(S,START,END)) +#define H5S_SELECT_IS_CONTIGUOUS(S) (H5S_select_is_contiguous(S)) +#define H5S_SELECT_IS_SINGLE(S) (H5S_select_is_single(S)) +#define H5S_SELECT_IS_REGULAR(S) (H5S_select_is_regular(S)) +#define H5S_SELECT_ITER_COORDS(ITER,COORDS) (H5S_select_iter_coords(ITER,COORDS)) +#define H5S_SELECT_ITER_BLOCK(ITER,START,END) (H5S_select_iter_block(ITER,START,END)) +#define H5S_SELECT_ITER_NELMTS(ITER) (H5S_select_iter_nelmts(ITER)) +#define H5S_SELECT_ITER_HAS_NEXT_BLOCK(ITER) (H5S_select_iter_has_next_block(ITER)) +#define H5S_SELECT_ITER_NEXT(ITER,NELEM)(H5S_select_iter_next(ITER,NELEM)) +#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) (H5S_select_iter_next_block(ITER)) +#define H5S_SELECT_ITER_RELEASE(ITER) (H5S_select_iter_release(ITER)) +#endif /* H5S_PACKAGE */ + + /* Operations on dataspaces */ H5_DLL H5S_t *H5S_copy(const H5S_t *src, hbool_t share_selection); H5_DLL herr_t H5S_close(H5S_t *ds); @@ -231,6 +277,12 @@ H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset); H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); H5_DLL htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2); H5_DLL herr_t H5S_select_release(H5S_t *ds); +H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags, + H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, + size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); +H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); +H5_DLL htri_t H5S_select_is_single(const H5S_t *space); +H5_DLL htri_t H5S_select_is_regular(const H5S_t *space); /* Operations on all selections */ H5_DLL herr_t H5S_select_all(H5S_t *space, unsigned rel_prev); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 6e70a31..5f281c5 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -143,8 +143,11 @@ H5S_select_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection) /* Deep copy extra stuff */ switch(src->select.type) { case H5S_SEL_NONE: + ret_value=H5S_none_copy(dst,src); + break; + case H5S_SEL_ALL: - /*nothing needed */ + ret_value=H5S_all_copy(dst,src); break; case H5S_SEL_POINTS: @@ -185,6 +188,10 @@ done: * Programmer: Quincey Koziol * Friday, May 30, 2003 * + * Note: This routine participates in the "Inlining C function pointers" + * pattern, don't call it directly, use the appropriate macro + * defined in H5Sprivate.h. + * * Modifications: * *------------------------------------------------------------------------- @@ -206,6 +213,120 @@ done: } /* end H5S_select_release() */ +/*------------------------------------------------------------------------- + * Function: H5S_select_get_seq_list + * + * Purpose: Retrieves the next sequence of offset/length pairs for an + * iterator on a dataspace + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, May 18, 2004 + * + * Note: This routine participates in the "Inlining C function pointers" + * pattern, don't call it directly, use the appropriate macro + * defined in H5Sprivate.h. + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5S_select_get_seq_list(const H5S_t *space, unsigned flags, + H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, + size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5S_select_get_seq_list, FAIL); + + assert(space); + + /* Call the selection type's get_seq_list function */ + (*space->select.get_seq_list)(space,flags,iter,maxseq,maxbytes,nseq,nbytes,off,len); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5S_select_get_seq_list() */ + + +/*------------------------------------------------------------------------- + * Function: H5S_select_serial_size + * + * Purpose: Determines the number of bytes required to store the current + * selection + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, May 18, 2004 + * + * Note: This routine participates in the "Inlining C function pointers" + * pattern, don't call it directly, use the appropriate macro + * defined in H5Sprivate.h. + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5S_select_serial_size(const H5S_t *space) +{ + hssize_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5S_select_serial_size, FAIL); + + assert(space); + + /* Call the selection type's serial_size function */ + ret_value=(*space->select.serial_size)(space); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5S_select_serial_size() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_select_serialize + PURPOSE + Serialize the selection for a dataspace into a buffer + USAGE + herr_t H5S_select_serialize(space, buf) + const H5S_t *space; IN: Dataspace with selection to serialize + uint8_t *buf; OUT: Buffer to put serialized selection + RETURNS + Non-negative on success/Negative on failure + DESCRIPTION + Calls the appropriate dataspace selection callback to serialize the + current selection into a buffer. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5S_select_serialize(const H5S_t *space, uint8_t *buf) +{ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5S_select_serialize, FAIL); + + assert(space); + assert(buf); + + /* Call the selection type's serialize function */ + ret_value=(*space->select.serialize)(space,buf); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5S_select_serialize() */ + + /*-------------------------------------------------------------------------- NAME H5Sget_select_npoints @@ -236,7 +357,7 @@ H5Sget_select_npoints(hid_t spaceid) if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); - ret_value = H5S_get_select_npoints(space); + ret_value = H5S_GET_SELECT_NPOINTS(space); done: FUNC_LEAVE_API(ret_value); @@ -257,6 +378,9 @@ done: Returns the number of elements in current selection for dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -270,7 +394,8 @@ H5S_get_select_npoints(const H5S_t *space) /* Check args */ assert(space); - ret_value = (*space->select.get_npoints)(space); + /* Set return value */ + ret_value=space->select.num_elem; done: FUNC_LEAVE_NOAPI(ret_value); @@ -310,7 +435,7 @@ H5Sselect_valid(hid_t spaceid) if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace"); - ret_value = H5S_select_valid(space); + ret_value = H5S_SELECT_VALID(space); done: FUNC_LEAVE_API(ret_value); @@ -334,6 +459,9 @@ done: extent for the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -438,6 +566,9 @@ done: selection within the dataspace extent. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -460,7 +591,7 @@ H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end) if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); - ret_value = H5S_get_select_bounds(space,tstart,tend); + ret_value = H5S_SELECT_BOUNDS(space,tstart,tend); if(ret_value>=0) { /* Copy over the start & end values */ @@ -489,7 +620,7 @@ H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_t *end) if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); - ret_value = H5S_get_select_bounds(space,start,end); + ret_value = H5S_SELECT_BOUNDS(space,start,end); done: FUNC_LEAVE_API(ret_value); @@ -545,6 +676,120 @@ done: /*-------------------------------------------------------------------------- NAME + H5S_select_is_contiguous + PURPOSE + Determines if a selection is contiguous in the dataspace + USAGE + htri_t H5S_select_is_contiguous(space) + const H5S_t *space; IN: Dataspace of selection to query + RETURNS + Non-negative (TRUE/FALSE) on success, negative on failure + DESCRIPTION + Checks the selection to determine if the points to iterated over will be + contiguous in the particular dataspace. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5S_select_is_contiguous(const H5S_t *space) +{ + herr_t ret_value; /* return value */ + + FUNC_ENTER_NOAPI(H5S_select_is_contiguous, FAIL); + + /* Check args */ + assert(space); + + ret_value = (*space->select.is_contiguous)(space); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5S_select_is_contiguous() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_select_is_single + PURPOSE + Determines if a selection is a single block in the dataspace + USAGE + htri_t H5S_select_is_single(space) + const H5S_t *space; IN: Dataspace of selection to query + RETURNS + Non-negative (TRUE/FALSE) on success, negative on failure + DESCRIPTION + Checks the selection to determine if it occupies a single block in the + particular dataspace. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5S_select_is_single(const H5S_t *space) +{ + herr_t ret_value; /* return value */ + + FUNC_ENTER_NOAPI(H5S_select_is_single, FAIL); + + /* Check args */ + assert(space); + + ret_value = (*space->select.is_single)(space); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5S_select_is_single() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_select_is_regular + PURPOSE + Determines if a selection is "regular" in the dataspace + USAGE + htri_t H5S_select_is_regular(space) + const H5S_t *space; IN: Dataspace of selection to query + RETURNS + Non-negative (TRUE/FALSE) on success, negative on failure + DESCRIPTION + Checks the selection to determine if it is "regular" (i.e. a single + block or a strided pattern) in the particular dataspace. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5S_select_is_regular(const H5S_t *space) +{ + herr_t ret_value; /* return value */ + + FUNC_ENTER_NOAPI(H5S_select_is_regular, FAIL); + + /* Check args */ + assert(space); + + ret_value = (*space->select.is_regular)(space); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5S_select_is_regular() */ + + +/*-------------------------------------------------------------------------- + NAME H5S_select_iter_init PURPOSE Initializes iteration information for a selection. @@ -610,6 +855,9 @@ done: the COORDS array. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -649,6 +897,9 @@ done: the COORDS array. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -685,6 +936,9 @@ H5S_select_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *en Returns the number of elements in current selection for dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -721,6 +975,9 @@ done: iterator. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -757,6 +1014,9 @@ H5S_select_iter_has_next_block (const H5S_sel_iter_t *iter) element in the selection. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -788,7 +1048,7 @@ done: PURPOSE Advance selection iterator to next block USAGE - herr_t H5S_select_iter_next(iter) + herr_t H5S_select_iter_next_block(iter) H5S_sel_iter_t *iter; IN/OUT: Selection iterator to change RETURNS Non-negative on success, negative on failure. @@ -798,6 +1058,10 @@ done: GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Doesn't maintain the 'elmt_left' field of the selection iterator. + + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -832,6 +1096,9 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter) Returns the number of elements in current selection for dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -927,7 +1194,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t iter_init=1; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ - if((nelmts = H5S_get_select_npoints(space))<0) + if((nelmts = H5S_GET_SELECT_NPOINTS(space))<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); /* Get the rank of the dataspace */ @@ -946,7 +1213,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t /* Loop, while elements left in selection */ while(max_elem>0 && user_ret==0) { /* Get the sequences of bytes */ - if((*space->select.get_seq_list)(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) + if(H5S_SELECT_GET_SEQ_LIST(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -989,7 +1256,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t done: /* Release selection iterator */ if(iter_init) { - if (H5S_select_iter_release(&iter)<0) + if (H5S_SELECT_ITER_RELEASE(&iter)<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } /* end if */ @@ -1026,7 +1293,7 @@ H5Sget_select_type(hid_t space_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5S_SEL_ERROR, "not a dataspace"); /* Set return value */ - ret_value=H5S_get_select_type(space); + ret_value=H5S_GET_SELECT_TYPE(space); done: FUNC_LEAVE_API(ret_value); @@ -1047,6 +1314,10 @@ done: DESCRIPTION This function retrieves the type of selection currently defined for a dataspace. + COMMENTS + This routine participates in the "Inlining C function pointers" + pattern, don't call it directly, use the appropriate macro + defined in H5Sprivate.h. --------------------------------------------------------------------------*/ H5S_sel_type H5S_get_select_type(const H5S_t *space) @@ -1111,7 +1382,7 @@ HDfprintf(stderr,"%s: Entering\n",FUNC); HGOTO_DONE(FALSE); /* Check for different number of elements selected */ - if(H5S_get_select_npoints(space1)!=H5S_get_select_npoints(space2)) + if(H5S_GET_SELECT_NPOINTS(space1)!=H5S_GET_SELECT_NPOINTS(space2)) HGOTO_DONE(FALSE); /* Check for "easy" cases before getting into generalized block iteration code */ @@ -1192,7 +1463,7 @@ else { /* Iterate over all the blocks in each selection */ while(1) { /* Get the current block for each selection iterator */ - if(H5S_select_iter_block(&iter1,start1,end1)<0) + if(H5S_SELECT_ITER_BLOCK(&iter1,start1,end1)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block"); #ifdef QAK { @@ -1204,7 +1475,7 @@ else { HDfprintf(stderr,"%Hd%s",end1[u],(u<(space1->extent.u.simple.rank-1) ? ", " : "}\n")); } #endif /* QAK */ - if(H5S_select_iter_block(&iter2,start2,end2)<0) + if(H5S_SELECT_ITER_BLOCK(&iter2,start2,end2)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block"); #ifdef QAK { @@ -1246,9 +1517,9 @@ else { } /* end else */ /* Check if we are able to advance to the next selection block */ - if((status1=H5S_select_iter_has_next_block(&iter1))<0) + if((status1=H5S_SELECT_ITER_HAS_NEXT_BLOCK(&iter1))<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block"); - if((status2=H5S_select_iter_has_next_block(&iter2))<0) + if((status2=H5S_SELECT_ITER_HAS_NEXT_BLOCK(&iter2))<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block"); #ifdef QAK HDfprintf(stderr,"%s: status1=%d, status2=%d\n",FUNC,(int)status1,(int)status2); @@ -1262,9 +1533,9 @@ HDfprintf(stderr,"%s: status1=%d, status2=%d\n",FUNC,(int)status1,(int)status2); } /* end if */ else { /* Advance to next block in selection iterators */ - if(H5S_select_iter_next_block(&iter1)<0) + if(H5S_SELECT_ITER_NEXT_BLOCK(&iter1)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to advance to next iterator block"); - if(H5S_select_iter_next_block(&iter2)<0) + if(H5S_SELECT_ITER_NEXT_BLOCK(&iter2)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to advance to next iterator block"); } /* end else */ } /* end while */ @@ -1272,11 +1543,11 @@ HDfprintf(stderr,"%s: status1=%d, status2=%d\n",FUNC,(int)status1,(int)status2); done: if(iter1_init) { - if (H5S_select_iter_release(&iter1)<0) + if (H5S_SELECT_ITER_RELEASE(&iter1)<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } /* end if */ if(iter2_init) { - if (H5S_select_iter_release(&iter2)<0) + if (H5S_SELECT_ITER_RELEASE(&iter2)<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } /* end if */ #ifdef QAK @@ -1345,7 +1616,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) iter_init=1; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ - if((nelmts = H5S_get_select_npoints(space))<0) + if((nelmts = H5S_GET_SELECT_NPOINTS(space))<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); /* Compute the number of bytes to process */ @@ -1354,7 +1625,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) /* Loop, while elements left in selection */ while(max_elem>0) { /* Get the sequences of bytes */ - if((*space->select.get_seq_list)(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) + if(H5S_SELECT_GET_SEQ_LIST(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop over sequences */ @@ -1374,7 +1645,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) done: /* Release selection iterator */ if(iter_init) { - if (H5S_select_iter_release(&iter)<0) + if (H5S_SELECT_ITER_RELEASE(&iter)<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } /* end if */ @@ -1455,7 +1726,7 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if(H5S_SELECT_GET_SEQ_LIST(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Reset the current sequence information */ @@ -1558,7 +1829,7 @@ H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if(H5S_SELECT_GET_SEQ_LIST(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Reset the current sequence information */ @@ -1650,7 +1921,7 @@ H5S_select_mscat (const void *_tscat_buf, const H5S_t *space, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if(H5S_SELECT_GET_SEQ_LIST(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1743,7 +2014,7 @@ H5S_select_mgath (const void *_buf, const H5S_t *space, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if(H5S_SELECT_GET_SEQ_LIST(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1859,7 +2130,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc /* Check if more file sequences are needed */ if(curr_file_seq>=file_nseq) { /* Get sequences for file selection */ - if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,nelmts,&file_nseq,&file_nelem,file_off,file_len)<0) + if(H5S_SELECT_GET_SEQ_LIST(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,nelmts,&file_nseq,&file_nelem,file_off,file_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -1869,7 +2140,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc /* Check if more memory sequences are needed */ if(curr_mem_seq>=mem_nseq) { /* Get sequences for memory selection */ - if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,dxpl_cache->vec_size,nelmts,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) + if(H5S_SELECT_GET_SEQ_LIST(mem_space,0,&mem_iter,dxpl_cache->vec_size,nelmts,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -1897,13 +2168,13 @@ HDfprintf(stderr,"%s: mem_off[%Zu]=%Hu, mem_len[%Zu]=%Zu\n",FUNC,curr_mem_seq,me done: /* Release file selection iterator */ if(file_iter_init) { - if (H5S_select_iter_release(&file_iter)<0) + if (H5S_SELECT_ITER_RELEASE(&file_iter)<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } /* end if */ /* Release memory selection iterator */ if(mem_iter_init) { - if (H5S_select_iter_release(&mem_iter)<0) + if (H5S_SELECT_ITER_RELEASE(&mem_iter)<0) HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); } /* end if */ @@ -2027,7 +2298,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca #endif /* QAK */ if(curr_file_seq>=file_nseq) { /* Get sequences for file selection */ - if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,nelmts,&file_nseq,&file_nelem,file_off,file_len)<0) + if(H5S_SELECT_GET_SEQ_LIST(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,nelmts,&file_nseq,&file_nelem,file_off,file_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -2046,7 +2317,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca /* Check if more memory sequences are needed */ if(curr_mem_seq>=mem_nseq) { /* Get sequences for memory selection */ - if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,dxpl_cache->vec_size,nelmts,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) + if(H5S_SELECT_GET_SEQ_LIST(mem_space,0,&mem_iter,dxpl_cache->vec_size,nelmts,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -2089,13 +2360,13 @@ for(u=curr_mem_seq; u