diff options
author | Quincey Koziol <koziol@lbl.gov> | 2019-02-14 00:13:18 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@lbl.gov> | 2019-02-14 00:13:18 (GMT) |
commit | 10cdff5ca45786832bf5e6c3e3408bc725464fd6 (patch) | |
tree | c94b2c6f2f6475a836a99e509833c7046b0df28c | |
parent | 40589e28d8bd98a1af906e34c56b8b908a7eddab (diff) | |
parent | fb5d1a37c11bca613175a48262a2147e99c9dede (diff) | |
download | hdf5-10cdff5ca45786832bf5e6c3e3408bc725464fd6.zip hdf5-10cdff5ca45786832bf5e6c3e3408bc725464fd6.tar.gz hdf5-10cdff5ca45786832bf5e6c3e3408bc725464fd6.tar.bz2 |
Merge pull request #1540 in HDFFV/hdf5 from merge_hyperslab_changes_01 to develop
* commit 'fb5d1a37c11bca613175a48262a2147e99c9dede':
Align develop with incoming hyperslab_updates branch changes.
-rw-r--r-- | src/H5CX.c | 2 | ||||
-rw-r--r-- | src/H5Dchunk.c | 89 | ||||
-rw-r--r-- | src/H5Dmpio.c | 72 | ||||
-rw-r--r-- | src/H5Osdspace.c | 8 | ||||
-rw-r--r-- | src/H5S.c | 391 | ||||
-rw-r--r-- | src/H5Sall.c | 100 | ||||
-rw-r--r-- | src/H5Sdbg.c | 10 | ||||
-rw-r--r-- | src/H5Shyper.c | 354 | ||||
-rw-r--r-- | src/H5Smpio.c | 811 | ||||
-rw-r--r-- | src/H5Snone.c | 393 | ||||
-rw-r--r-- | src/H5Spkg.h | 23 | ||||
-rw-r--r-- | src/H5Spoint.c | 503 | ||||
-rw-r--r-- | src/H5Sprivate.h | 24 | ||||
-rw-r--r-- | src/H5Spublic.h | 69 | ||||
-rw-r--r-- | src/H5Sselect.c | 319 | ||||
-rw-r--r-- | src/H5Stest.c | 57 | ||||
-rw-r--r-- | test/objcopy.c | 4 | ||||
-rw-r--r-- | test/tselect.c | 1214 | ||||
-rw-r--r-- | testpar/t_shapesame.c | 32 | ||||
-rw-r--r-- | testpar/t_span_tree.c | 28 |
20 files changed, 2256 insertions, 2247 deletions
@@ -53,7 +53,7 @@ * each thread individually. The association of contexts to threads will * be handled by the pthread library. * - * In order for this macro to work, H5E__get_my_stack() must be preceeded + * In order for this macro to work, H5CX_get_my_context() must be preceeded * by "H5CX_node_t *ctx =". */ #define H5CX_get_my_context() H5CX__get_context() diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index af8ff91..6d1067b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1073,21 +1073,19 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf if((file_space_normalized = H5S_hyper_normalize_offset((H5S_t *)file_space, old_offset)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to normalize selection") - /* Decide the number of chunks in each dimension*/ - for(u = 0; u < f_ndims; u++) { + /* Decide the number of chunks in each dimension */ + for(u = 0; u < f_ndims; u++) /* Keep the size of the chunk dimensions as hsize_t for various routines */ fm->chunk_dim[u] = fm->layout->u.chunk.dim[u]; - } /* end for */ #ifdef H5_HAVE_PARALLEL /* Calculate total chunk in file map*/ fm->select_chunk = NULL; if(io_info->using_mpi_vfd) { H5_CHECK_OVERFLOW(fm->layout->u.chunk.nchunks, hsize_t, size_t); - if(fm->layout->u.chunk.nchunks) { + if(fm->layout->u.chunk.nchunks) if(NULL == (fm->select_chunk = (H5D_chunk_info_t **)H5MM_calloc((size_t)fm->layout->u.chunk.nchunks * sizeof(H5D_chunk_info_t *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") - } } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -1129,10 +1127,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf HDassert(fm->single_space); /* Allocate the single chunk information */ - if(NULL == dataset->shared->cache.chunk.single_chunk_info) { + if(NULL == dataset->shared->cache.chunk.single_chunk_info) if(NULL == (dataset->shared->cache.chunk.single_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") - } /* end if */ fm->single_chunk_info = dataset->shared->cache.chunk.single_chunk_info; HDassert(fm->single_chunk_info); @@ -1147,10 +1144,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf hbool_t sel_hyper_flag; /* Whether file selection is a hyperslab */ /* Initialize skip list for chunk selections */ - if(NULL == dataset->shared->cache.chunk.sel_chunks) { + if(NULL == dataset->shared->cache.chunk.sel_chunks) if(NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE, NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for chunk selections") - } /* end if */ fm->sel_chunks = dataset->shared->cache.chunk.sel_chunks; HDassert(fm->sel_chunks); @@ -1245,10 +1241,9 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf fm->mchunk_tmpl = tmp_mspace; /* Create temporary datatypes for selection iteration */ - if(!file_type) { + if(!file_type) if(NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype") - } /* end if */ /* Create selection iterator for memory selection */ if(0 == (elmt_size = H5T_get_size(mem_type))) @@ -1540,7 +1535,7 @@ done: /*------------------------------------------------------------------------- * Function: H5D__create_chunk_file_map_hyper * - * Purpose: Create all chunk selections in file. + * Purpose: Create all chunk selections in file, for a hyperslab selection. * * Return: Non-negative on success/Negative on failure * @@ -1556,8 +1551,8 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t #endif /* H5_HAVE_PARALLEL */ *io_info) { - hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ - hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ + hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ + hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ hsize_t sel_points; /* Number of elements in file selection */ hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ @@ -1572,7 +1567,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t FUNC_ENTER_STATIC /* Sanity check */ - HDassert(fm->f_ndims>0); + HDassert(fm->f_ndims > 0); /* Get number of elements selected in file */ sel_points = fm->nelmts; @@ -1596,7 +1591,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t /* Iterate through each chunk in the dataset */ while(sel_points) { - /* Check for intersection of temporary chunk and file selection */ + /* Check for intersection of current chunk and file selection */ /* (Casting away const OK - QAK) */ if(TRUE == H5S_hyper_intersect_block((H5S_t *)fm->file_space, coords, end)) { H5S_t *tmp_fchunk; /* Temporary file dataspace */ @@ -1634,7 +1629,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t /* Add temporary chunk to the list of chunks */ /* Allocate the file & memory chunk information */ - if (NULL==(new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) { + if(NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) { (void)H5S_close(tmp_fchunk); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") } /* end if */ @@ -1642,7 +1637,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t /* Initialize the chunk information */ /* Set the chunk index */ - new_chunk_info->index=chunk_index; + new_chunk_info->index = chunk_index; #ifdef H5_HAVE_PARALLEL /* Store chunk selection information, for multi-chunk I/O */ @@ -1655,16 +1650,13 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t new_chunk_info->fspace_shared = FALSE; /* Set the memory chunk dataspace */ - new_chunk_info->mspace=NULL; + new_chunk_info->mspace = NULL; new_chunk_info->mspace_shared = FALSE; /* Copy the chunk's scaled coordinates */ HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); new_chunk_info->scaled[fm->f_ndims] = 0; - /* Copy the chunk's scaled coordinates */ - HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); - /* Insert the new chunk into the skip list */ if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) { H5D__free_chunk_info(new_chunk_info, NULL, NULL); @@ -1688,12 +1680,11 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t chunk_index++; /* Set current increment dimension */ - curr_dim=(int)fm->f_ndims-1; + curr_dim = (int)fm->f_ndims - 1; /* Increment chunk location in fastest changing dimension */ - H5_CHECK_OVERFLOW(fm->chunk_dim[curr_dim],hsize_t,hssize_t); - coords[curr_dim]+=fm->chunk_dim[curr_dim]; - end[curr_dim]+=fm->chunk_dim[curr_dim]; + coords[curr_dim] += fm->chunk_dim[curr_dim]; + end[curr_dim] += fm->chunk_dim[curr_dim]; scaled[curr_dim]++; /* Bring chunk location back into bounds, if necessary */ @@ -1707,11 +1698,14 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t /* Decrement current dimension */ curr_dim--; - /* Increment chunk location in current dimension */ - scaled[curr_dim]++; - coords[curr_dim] += fm->chunk_dim[curr_dim]; - end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1; - } while(coords[curr_dim] > sel_end[curr_dim]); + /* Check for valid current dim */ + if(curr_dim >= 0) { + /* Increment chunk location in current dimension */ + scaled[curr_dim]++; + coords[curr_dim] += fm->chunk_dim[curr_dim]; + end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1; + } /* end if */ + } while(curr_dim >= 0 && (coords[curr_dim] > sel_end[curr_dim])); /* Re-calculate the index of this chunk */ chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled); @@ -1743,12 +1737,12 @@ static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) { H5SL_node_t *curr_node; /* Current node in skip list */ - hsize_t file_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ - hsize_t file_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ - hsize_t mem_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ - hsize_t mem_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ - hssize_t adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to all file chunks */ - hssize_t chunk_adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to a particular chunk */ + hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ + hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ + hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ + hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ + hssize_t adjust[H5S_MAX_RANK]; /* Adjustment to make to all file chunks */ + hssize_t chunk_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1762,7 +1756,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */ /* Get the node */ - curr_node=H5SL_first(fm->sel_chunks); + curr_node = H5SL_first(fm->sel_chunks); /* Get pointer to chunk's information */ chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node); @@ -1785,15 +1779,15 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") /* Calculate the adjustment for memory selection from file selection */ - HDassert(fm->m_ndims==fm->f_ndims); - for(u=0; u<fm->f_ndims; u++) { - H5_CHECK_OVERFLOW(file_sel_start[u],hsize_t,hssize_t); - H5_CHECK_OVERFLOW(mem_sel_start[u],hsize_t,hssize_t); - adjust[u]=(hssize_t)file_sel_start[u]-(hssize_t)mem_sel_start[u]; + HDassert(fm->m_ndims == fm->f_ndims); + for(u = 0; u < fm->f_ndims; u++) { + H5_CHECK_OVERFLOW(file_sel_start[u], hsize_t, hssize_t); + H5_CHECK_OVERFLOW(mem_sel_start[u], hsize_t, hssize_t); + adjust[u] = (hssize_t)file_sel_start[u] - (hssize_t)mem_sel_start[u]; } /* end for */ /* Iterate over each chunk in the chunk list */ - curr_node=H5SL_first(fm->sel_chunks); + curr_node = H5SL_first(fm->sel_chunks); while(curr_node) { H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */ @@ -1832,7 +1826,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection") /* Get the next chunk node in the skip list */ - curr_node=H5SL_next(curr_node); + curr_node = H5SL_next(curr_node); } /* end while */ } /* end else */ @@ -1976,7 +1970,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u { H5D_chunk_map_t *fm = (H5D_chunk_map_t *)_fm; /* File<->memory chunk mapping info */ H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */ - hsize_t coords_in_mem[H5O_LAYOUT_NDIMS]; /* Coordinates of element in memory */ + hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */ hsize_t chunk_index; /* Chunk index */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2001,11 +1995,10 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, H5_ITER_ERROR, "can't locate chunk in skip list") /* Check if the chunk already has a memory space */ - if(NULL == chunk_info->mspace) { + if(NULL == chunk_info->mspace) /* Copy the template memory chunk dataspace */ if(NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy file space") - } /* end else */ /* Update the "last chunk seen" information */ fm->last_index = chunk_index; diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 0423006..01cf932 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -2841,30 +2841,30 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty size_t mod_data_size; /* Look up the chunk and get its file and memory dataspaces */ - if (NULL == (chunk_info = (H5D_chunk_info_t *) H5SL_search(fm->sel_chunks, &chunk_entry->index))) + if(NULL == (chunk_info = (H5D_chunk_info_t *) H5SL_search(fm->sel_chunks, &chunk_entry->index))) HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, FAIL, "can't locate chunk in skip list") /* Determine size of serialized chunk file dataspace, plus the size of * the data being written */ - if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) + if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size") - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) + if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") mod_data_size += (size_t) iter_nelmts * type_info->src_type_size; - if (NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size))) + if(NULL == (mod_data[num_send_requests] = (unsigned char *) H5MM_malloc(mod_data_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk modification send buffer") /* Serialize the chunk's file dataspace into the buffer */ mod_data_p = mod_data[num_send_requests]; - if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) + if(H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace") /* Initialize iterator for memory selection */ - if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0) + if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") mem_iter_init = TRUE; @@ -2875,11 +2875,11 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Send modification data to new owner */ H5_CHECK_OVERFLOW(mod_data_size, size_t, int) H5_CHECK_OVERFLOW(chunk_entry->index, hsize_t, int) - if (MPI_SUCCESS != (mpi_code = MPI_Isend(mod_data[num_send_requests], (int) mod_data_size, MPI_BYTE, + if(MPI_SUCCESS != (mpi_code = MPI_Isend(mod_data[num_send_requests], (int) mod_data_size, MPI_BYTE, chunk_entry->owners.new_owner, (int) chunk_entry->index, io_info->comm, &send_requests[num_send_requests]))) HMPI_GOTO_ERROR(FAIL, "MPI_Isend failed", mpi_code) - if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release memory selection iterator") mem_iter_init = FALSE; @@ -3048,11 +3048,11 @@ H5D__mpio_filtered_collective_write_type(H5D_filtered_collective_io_info_t *chun } /* end if */ done: - if (write_buf_array) + if(write_buf_array) H5MM_free(write_buf_array); - if (file_offset_array) + if(file_offset_array) H5MM_free(file_offset_array); - if (length_array) + if(length_array) H5MM_free(length_array); FUNC_LEAVE_NOAPI(ret_value) @@ -3170,7 +3170,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk if (NULL == (mem_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate memory iterator") - if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0) + if(H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") mem_iter_init = TRUE; @@ -3180,53 +3180,53 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk * from the current process, then apply any modifications from other processes. Finally, * filter the newly-updated chunk. */ - switch (io_info->op_type) { + switch(io_info->op_type) { case H5D_IO_OP_READ: - if (NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t)))) + if(NULL == (file_iter = (H5S_sel_iter_t *) H5MM_malloc(sizeof(H5S_sel_iter_t)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate file iterator") - if (H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size) < 0) + if(H5S_select_iter_init(file_iter, chunk_info->fspace, type_info->src_type_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") file_iter_init = TRUE; - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0) + if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - if (NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size))) + if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer") - if (!H5D__gather_mem(chunk_entry->buf, chunk_info->fspace, file_iter, (size_t) iter_nelmts, tmp_gath_buf)) + if(!H5D__gather_mem(chunk_entry->buf, chunk_info->fspace, file_iter, (size_t) iter_nelmts, tmp_gath_buf)) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't gather from chunk buffer") - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) + if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - if (H5D__scatter_mem(tmp_gath_buf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer") + if(H5D__scatter_mem(tmp_gath_buf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, io_info->u.rbuf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to read buffer") break; case H5D_IO_OP_WRITE: - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) + if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - if (NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size))) + if(NULL == (tmp_gath_buf = H5MM_malloc((hsize_t) iter_nelmts * type_info->src_type_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate temporary gather buffer") /* Gather modification data from the application write buffer into a temporary buffer */ if(!H5D__gather_mem(io_info->u.wbuf, chunk_info->mspace, mem_iter, (size_t) iter_nelmts, tmp_gath_buf)) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't gather from write buffer") - if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator") mem_iter_init = FALSE; /* Initialize iterator for file selection */ - if (H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size) < 0) + if(H5S_select_iter_init(mem_iter, chunk_info->fspace, type_info->dst_type_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information") mem_iter_init = TRUE; - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0) + if((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") /* Scatter the owner's modification data into the chunk data buffer according to @@ -3235,44 +3235,44 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk if(H5D__scatter_mem(tmp_gath_buf, chunk_info->fspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't scatter to chunk data buffer") - if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator") mem_iter_init = FALSE; - if (MPI_SUCCESS != (mpi_code = MPI_Waitall(chunk_entry->async_info.num_receive_requests, + if(MPI_SUCCESS != (mpi_code = MPI_Waitall(chunk_entry->async_info.num_receive_requests, chunk_entry->async_info.receive_requests_array, MPI_STATUSES_IGNORE))) HMPI_GOTO_ERROR(FAIL, "MPI_Waitall failed", mpi_code) /* For each asynchronous receive call previously posted, receive the chunk modification * buffer from another rank and update the chunk data */ - for (i = 0; i < (size_t) chunk_entry->async_info.num_receive_requests; i++) { + for(i = 0; i < (size_t) chunk_entry->async_info.num_receive_requests; i++) { const unsigned char *mod_data_p; /* Decode the process' chunk file dataspace */ mod_data_p = chunk_entry->async_info.receive_buffer_array[i]; - if (NULL == (dataspace = H5S_decode(&mod_data_p))) + if(NULL == (dataspace = H5S_decode(&mod_data_p))) HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, FAIL, "unable to decode dataspace") - if (H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size) < 0) + if(H5S_select_iter_init(mem_iter, dataspace, type_info->dst_type_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") mem_iter_init = TRUE; - if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace)) < 0) + if((iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") /* Update the chunk data with the received modification data */ if(H5D__scatter_mem(mod_data_p, dataspace, mem_iter, (size_t) iter_nelmts, chunk_entry->buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't scatter to write buffer") - if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + if(H5S_SELECT_ITER_RELEASE(mem_iter) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator") mem_iter_init = FALSE; - if (dataspace) { - if (H5S_close(dataspace) < 0) + if(dataspace) { + if(H5S_close(dataspace) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") dataspace = NULL; - } + } /* end if */ H5MM_free(chunk_entry->async_info.receive_buffer_array[i]); } /* end for */ diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 74fa72e..b7f70d1 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -189,7 +189,7 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, done: if(!ret_value && sdim) { - H5S_extent_release(sdim); + H5S__extent_release(sdim); sdim = H5FL_FREE(H5S_extent_t, sdim); } /* end if */ @@ -310,7 +310,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy extent information */ - if(H5S_extent_copy_real(dest, mesg, TRUE) < 0) + if(H5S__extent_copy_real(dest, mesg, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent") /* Set return value */ @@ -391,7 +391,7 @@ H5O__sdspace_reset(void *_mesg) FUNC_ENTER_STATIC_NOERR - H5S_extent_release(mesg); + H5S__extent_release(mesg); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__sdspace_reset() */ @@ -470,7 +470,7 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed") /* Create a copy of the dataspace extent */ - if(H5S_extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0) + if(H5S__extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") } /* end if */ @@ -46,7 +46,12 @@ /********************/ /* Local Prototypes */ /********************/ -static htri_t H5S_is_simple(const H5S_t *sdim); +static htri_t H5S__is_simple(const H5S_t *sdim); + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ /*********************/ @@ -63,15 +68,6 @@ const unsigned H5O_sdspace_ver_bounds[] = { H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; -/*****************************/ -/* Library Private Variables */ -/*****************************/ - - -/*******************/ -/* Local Variables */ -/*******************/ - /* Declare a free list to manage the H5S_extent_t struct */ H5FL_DEFINE(H5S_extent_t); @@ -81,6 +77,11 @@ H5FL_DEFINE(H5S_t); /* Declare a free list to manage the array's of hsize_t's */ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK); + +/*******************/ +/* Local Variables */ +/*******************/ + /* Dataspace ID class */ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ H5I_DATASPACE, /* ID class value */ @@ -112,9 +113,9 @@ H5S__init_package(void) FUNC_ENTER_PACKAGE - /* Initialize the atom group for the file IDs */ + /* Initialize the atom group for the dataspace IDs */ if(H5I_register_type(H5I_DATASPACE_CLS) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class") /* Mark "top" of interface as initialized, too */ H5S_top_package_initialize_s = TRUE; @@ -329,10 +330,9 @@ H5S_create(H5S_class_t type) ret_value = new_ds; done: - if(ret_value == NULL) { + if(ret_value == NULL) if(new_ds && H5S_close(new_ds) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace") - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_create() */ @@ -359,7 +359,7 @@ done: hid_t H5Screate(H5S_class_t type) { - H5S_t *new_ds=NULL; /* New dataspace structure */ + H5S_t *new_ds = NULL; /* New dataspace structure */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -373,21 +373,20 @@ H5Screate(H5S_class_t type) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace") /* Atomize */ - if((ret_value = H5I_register (H5I_DATASPACE, new_ds, TRUE)) < 0) + if((ret_value = H5I_register(H5I_DATASPACE, new_ds, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") done: - if(ret_value < 0) { + if(ret_value < 0) if(new_ds && H5S_close(new_ds) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Screate() */ /*------------------------------------------------------------------------- - * Function: H5S_extent_release + * Function: H5S__extent_release * * Purpose: Releases all memory associated with a dataspace extent. * @@ -396,16 +395,12 @@ done: * Programmer: Quincey Koziol * Thursday, July 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5S_extent_release(H5S_extent_t *extent) +H5S__extent_release(H5S_extent_t *extent) { - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE_NOERR HDassert(extent); @@ -417,9 +412,8 @@ H5S_extent_release(H5S_extent_t *extent) extent->max = H5FL_ARR_FREE(hsize_t, extent->max); } /* end if */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_extent_release() */ + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5S__extent_release() */ /*------------------------------------------------------------------------- @@ -445,11 +439,11 @@ H5S_close(H5S_t *ds) /* Release selection (this should come before the extent release) */ if(H5S_SELECT_RELEASE(ds) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection") /* Release extent */ - if(H5S_extent_release(&ds->extent) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent") + if(H5S__extent_release(&ds->extent) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent") /* Release the main structure */ ds = H5FL_FREE(H5S_t, ds); @@ -466,13 +460,9 @@ done: * * Return: Non-negative on success/Negative on failure * - * Errors: - * * Programmer: Robb Matzke * Tuesday, December 9, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -484,7 +474,7 @@ H5Sclose(hid_t space_id) H5TRACE1("e", "i", space_id); /* Check args */ - if (NULL == H5I_object_verify(space_id,H5I_DATASPACE)) + if(NULL == H5I_object_verify(space_id, H5I_DATASPACE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* When the reference count reaches zero the resources are freed */ @@ -502,14 +492,11 @@ done: * Purpose: Copies a dataspace. * * Return: Success: ID of the new dataspace - * * Failure: Negative * * Programmer: Robb Matzke * Friday, January 30, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t @@ -535,10 +522,9 @@ H5Scopy(hid_t space_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") done: - if(ret_value < 0) { + if(ret_value < 0) if(dst && H5S_close(dst) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Scopy() */ @@ -554,8 +540,6 @@ done: * Programmer: Quincey Koziol * Thursday, July 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -593,8 +577,6 @@ done: * Programmer: Neil Fortner * Monday, February 23, 2015 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -608,7 +590,7 @@ H5S_extent_copy(H5S_t *dst, const H5S_t *src) HDassert(src); /* Copy extent */ - if(H5S_extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0) + if(H5S__extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") /* If the selection is 'all', update the number of elements selected in the @@ -623,7 +605,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5S_extent_copy_real + * Function: H5S__extent_copy_real * * Purpose: Copies a dataspace extent * @@ -632,20 +614,18 @@ done: * Programmer: Quincey Koziol * Wednesday, June 3, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max) +H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max) { unsigned u; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Release destination extent before we copy over it */ - if(H5S_extent_release(dst) < 0) + if(H5S__extent_release(dst) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent") /* Copy the regular fields */ @@ -690,7 +670,7 @@ H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_ma done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_extent_copy_real() */ +} /* end H5S__extent_copy_real() */ /*------------------------------------------------------------------------- @@ -704,14 +684,11 @@ done: * selection) * * Return: Success: A pointer to a new copy of SRC - * * Failure: NULL * * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ H5S_t * @@ -726,7 +703,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the source dataspace's extent */ - if(H5S_extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0) + if(H5S__extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent") /* Copy the source dataspace's selection */ @@ -751,7 +728,6 @@ done: * Purpose: Determines how many data points a dataset extent has. * * Return: Success: Number of data points in the dataset extent. - * * Failure: negative * * Programmer: Robb Matzke @@ -761,9 +737,6 @@ done: * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. * - * Modifications: - * Changed Name - QAK 7/7/98 - * *------------------------------------------------------------------------- */ hssize_t @@ -790,15 +763,11 @@ done: * Purpose: Determines how many data points a dataset extent has. * * Return: Success: Number of data points in the dataset. - * * Failure: negative * * Programmer: Robb Matzke * Tuesday, December 9, 1997 * - * Modifications: - * Changed Name - QAK 7/7/98 - * *------------------------------------------------------------------------- */ hssize_t @@ -832,14 +801,11 @@ done: * * Return: Success: Maximum number of data points the dataspace * may have. - * * Failure: 0 * * Programmer: Robb Matzke * Tuesday, December 9, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ hsize_t @@ -853,7 +819,7 @@ H5S_get_npoints_max(const H5S_t *ds) /* check args */ HDassert(ds); - switch (H5S_GET_EXTENT_TYPE(ds)) { + switch(H5S_GET_EXTENT_TYPE(ds)) { case H5S_NULL: ret_value = 0; break; @@ -863,31 +829,30 @@ H5S_get_npoints_max(const H5S_t *ds) break; case H5S_SIMPLE: - if (ds->extent.max) { - for (ret_value=1, u=0; u<ds->extent.rank; u++) { - if (H5S_UNLIMITED==ds->extent.max[u]) { + if(ds->extent.max) { + for(ret_value = 1, u = 0; u < ds->extent.rank; u++) { + if(H5S_UNLIMITED == ds->extent.max[u]) { ret_value = HSIZET_MAX; break; - } + } /* end if */ else ret_value *= ds->extent.max[u]; - } - } - else { - for (ret_value=1, u=0; u<ds->extent.rank; u++) + } /* end for */ + } /* end if */ + else + for(ret_value = 1, u = 0; u < ds->extent.rank; u++) ret_value *= ds->extent.size[u]; - } break; case H5S_NO_CLASS: default: HDassert("unknown dataspace class" && 0); HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0, "internal error (unknown dataspace class)") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5S_get_npoints_max() */ /*------------------------------------------------------------------------- @@ -896,21 +861,18 @@ done: * Purpose: Determines the dimensionality of a dataspace. * * Return: Success: The number of dimensions in a dataspace. - * * Failure: Negative * * Programmer: Robb Matzke * Thursday, December 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ int H5Sget_simple_extent_ndims(hid_t space_id) { - H5S_t *ds; - int ret_value; + H5S_t *ds; + int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("Is", "i", space_id); @@ -933,7 +895,6 @@ done: * * Return: Success: Non-negative number of dimensions. Zero * implies a scalar. - * * Failure: Negative * * Programmer: Robb Matzke @@ -943,8 +904,6 @@ done: * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -979,43 +938,36 @@ done: * Function: H5Sget_simple_extent_dims * * Purpose: Returns the size and maximum sizes in each dimension of - * a dataspace DS through the DIMS and MAXDIMS arguments. + * a dataspace DS through the DIMS and MAXDIMS arguments. * * Return: Success: Number of dimensions, the same value as * returned by H5Sget_simple_extent_ndims(). - * * Failure: Negative * * Programmer: Robb Matzke * Thursday, December 11, 1997 * - * Modifications: - * June 18, 1998 Albert Cheng - * Added maxdims argument. Removed dims argument check - * since it can still return ndims even if both dims and - * maxdims are NULLs. - * *------------------------------------------------------------------------- */ int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/, - hsize_t maxdims[]/*out*/) + hsize_t maxdims[]/*out*/) { - H5S_t *ds; - int ret_value; + H5S_t *ds; + int ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("Is", "ixx", space_id, dims, maxdims); /* Check args */ - if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + if(NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sget_simple_extent_dims() */ /*------------------------------------------------------------------------- @@ -1081,14 +1033,11 @@ done: * function may not be meaningful for all types of dataspaces. * * Return: Success: Number of dimensions. Zero implies scalar. - * * Failure: Negative * * Programmer: Robb Matzke * Thursday, December 11, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -1155,13 +1104,6 @@ done: * Programmer: Quincey Koziol * Tuesday, December 31, 2002 * - * Modifications: - * - * John Mainzer, 6/6/05 - * Updated function to use the new dirtied parameter of - * H5AC_unprotect() instead of manipulating the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ herr_t @@ -1191,7 +1133,6 @@ done: * Purpose: Reads the dataspace from an object header. * * Return: Success: Pointer to a new dataspace. - * * Failure: NULL * * Programmer: Robb Matzke @@ -1224,10 +1165,9 @@ H5S_read(const H5O_loc_t *loc) ret_value = ds; done: - if(ret_value == NULL) { + if(ret_value == NULL) if(ds != NULL) ds = H5FL_FREE(H5S_t, ds); - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_read() */ @@ -1235,11 +1175,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_is_simple + H5S__is_simple PURPOSE Check if a dataspace is simple (internal) USAGE - htri_t H5S_is_simple(sdim) + htri_t H5S__is_simple(sdim) H5S_t *sdim; IN: Pointer to dataspace object to query RETURNS TRUE/FALSE/FAIL @@ -1248,21 +1188,21 @@ done: has orthogonal, evenly spaced dimensions. --------------------------------------------------------------------------*/ static htri_t -H5S_is_simple(const H5S_t *sdim) +H5S__is_simple(const H5S_t *sdim) { htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args and all the boring stuff. */ HDassert(sdim); /* H5S_NULL shouldn't be simple dataspace */ ret_value = (H5S_GET_EXTENT_TYPE(sdim) == H5S_SIMPLE || - H5S_GET_EXTENT_TYPE(sdim) == H5S_SCALAR) ? TRUE : FALSE; + H5S_GET_EXTENT_TYPE(sdim) == H5S_SCALAR) ? TRUE : FALSE; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_is_simple() */ +} /* end H5S__is_simple() */ /*-------------------------------------------------------------------------- @@ -1282,21 +1222,21 @@ H5S_is_simple(const H5S_t *sdim) htri_t H5Sis_simple(hid_t space_id) { - H5S_t *space; /* dataspace to modify */ - htri_t ret_value; + H5S_t *space; /* Dataspace to check */ + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "i", space_id); /* Check args and all the boring stuff. */ - if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL) + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") - ret_value = H5S_is_simple(space); + ret_value = H5S__is_simple(space); - done: +done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sis_simple() */ /*-------------------------------------------------------------------------- @@ -1324,56 +1264,44 @@ H5Sis_simple(hid_t space_id) Currently, only the first dimension in the array (the slowest) may be unlimited in size. - MODIFICATION - A null dataspace cannot be created from simple space with this function. - - Christian Chilan 01/17/2007 - Verifies that each element of DIMS is not equal to H5S_UNLIMITED. - - Raymond Lu 03/30/2011 - We allow 0 dimension size for non-unlimited dimension starting from 1.8.7 - release. --------------------------------------------------------------------------*/ herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], - const hsize_t max[/*rank*/]) + const hsize_t max[/*rank*/]) { - H5S_t *space; /* dataspace to modify */ - int u; /* local counting variable */ - herr_t ret_value=SUCCEED; /* Return value */ + H5S_t *space; /* Dataspace to modify */ + int u; /* Local counting variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max); /* Check args */ - if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL) + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") - if (rank > 0 && dims == NULL) + if(rank > 0 && dims == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified") - if (rank<0 || rank>H5S_MAX_RANK) + if(rank < 0 || rank > H5S_MAX_RANK) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank") - if (dims) { - for (u=0; u<rank; u++) { - if (H5S_UNLIMITED==dims[u]) + if(dims) + for(u = 0; u < rank; u++) + if(H5S_UNLIMITED == dims[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "current dimension must have a specific size, not H5S_UNLIMITED") - } - } - if (max!=NULL) { - if(dims==NULL) + if(max != NULL) { + if(dims == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maximum dimension specified, but no current dimensions specified") - for (u=0; u<rank; u++) { - if (max[u]!=H5S_UNLIMITED && max[u]<dims[u]) + for(u = 0; u < rank; u++) + if(max[u] != H5S_UNLIMITED && max[u] < dims[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid maximum dimension size") - } - } + } /* end if */ /* Do it */ - if (H5S_set_extent_simple(space, (unsigned)rank, dims, max)<0) + if(H5S_set_extent_simple(space, (unsigned)rank, dims, max) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sset_extent_simple() */ /*------------------------------------------------------------------------- @@ -1384,19 +1312,17 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke (copied from H5Sset_extent_simple) + * Programmer: Robb Matzke * Wednesday, July 8, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, - const hsize_t *max) + const hsize_t *max) { unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1405,7 +1331,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, HDassert(0 == rank || dims); /* shift out of the previous state to a "simple" dataspace. */ - if(H5S_extent_release(&space->extent) < 0) + if(H5S__extent_release(&space->extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent") if(rank == 0) { /* scalar variable */ @@ -1432,12 +1358,11 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, /* Copy the maximum dimensions if specified. Otherwise, the maximal dimensions are the * same as the dimension */ space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank); - if(max != NULL) { + if(max != NULL) HDmemcpy(space->extent.max, max, sizeof(hsize_t) * rank); - } else { + else for(u = 0; u < space->extent.rank; u++) space->extent.max[u] = dims[u]; - } } /* end else */ /* Selection related cleanup */ @@ -1453,7 +1378,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_set_extent_simple() */ +} /* end H5S_set_extent_simple() */ /*------------------------------------------------------------------------- @@ -1469,26 +1394,20 @@ done: * than the corresponding element of DIMS. * * Return: Success: The ID for the new simple dataspace object. - * * Failure: Negative * * Programmer: Quincey Koziol * Tuesday, January 27, 1998 * - * Modification: - * Raymond Lu 03/30/2011 - * We allow 0-dimension for non-unlimited dimension starting - * from 1.8.7 release. - * *------------------------------------------------------------------------- */ hid_t H5Screate_simple(int rank, const hsize_t dims[/*rank*/], - const hsize_t maxdims[/*rank*/]) + const hsize_t maxdims[/*rank*/]) { H5S_t *space = NULL; int i; - hid_t ret_value; + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "Is*[a0]h*[a0]h", rank, dims, maxdims); @@ -1514,7 +1433,7 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], } /* end for */ /* Create the space and set the extent */ - if(NULL == (space = H5S_create_simple((unsigned)rank,dims,maxdims))) + if(NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* Atomize */ @@ -1522,10 +1441,9 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") done: - if(ret_value < 0) { + if(ret_value < 0) if(space && H5S_close(space) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Screate_simple() */ @@ -1539,32 +1457,26 @@ done: * Return: Success: The ID for the new simple dataspace object. * Failure: Negative * - * Errors: - * * Programmer: Quincey Koziol * Thursday, April 3, 2003 * - * Modifications: - * Extracted from H5Screate_simple - * Quincey Koziol, Thursday, April 3, 2003 - * *------------------------------------------------------------------------- */ H5S_t * H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], - const hsize_t maxdims[/*rank*/]) + const hsize_t maxdims[/*rank*/]) { H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Check arguments */ - HDassert(rank <=H5S_MAX_RANK); + HDassert(rank <= H5S_MAX_RANK); /* Create the space and set the extent */ - if(NULL==(ret_value=H5S_create(H5S_SIMPLE))) + if(NULL == (ret_value = H5S_create(H5S_SIMPLE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace") - if(H5S_set_extent_simple(ret_value,rank,dims,maxdims)<0) + if(H5S_set_extent_simple(ret_value, rank, dims, maxdims) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't set dimensions") done: @@ -1579,15 +1491,12 @@ done: * (including selection) into binary in a buffer. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Raymond Lu * slu@ncsa.uiuc.edu * July 14, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1600,15 +1509,15 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc) H5TRACE3("e", "i*x*z", obj_id, buf, nalloc); /* Check argument and retrieve object */ - if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE))) + if(NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0) + if(H5S_encode(dspace, (unsigned char **)&buf, nalloc) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sencode() */ /*------------------------------------------------------------------------- @@ -1697,7 +1606,6 @@ done: * return a new object handle. * * Return: Success: dataspace ID(non-negative) - * * Failure: negative * * Programmer: Raymond Lu @@ -1737,7 +1645,6 @@ done: * description of dataspace and returns a new object handle. * * Return: Success: dataspace ID(non-negative) - * * Failure: negative * * Programmer: Raymond Lu @@ -1784,11 +1691,11 @@ H5S_decode(const unsigned char **p) pp += extent_size; /* Copy the extent into dataspace structure */ - if((ds = H5FL_CALLOC(H5S_t))==NULL) + if(NULL == (ds = H5FL_CALLOC(H5S_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for dataspace conversion path table") - if(H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL) + if(NULL == H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object") - if(H5S_extent_release(extent) < 0) + if(H5S__extent_release(extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace") extent = H5FL_FREE(H5S_extent_t, extent); @@ -1819,11 +1726,8 @@ done: * Purpose: Internal function for retrieving the type of extent for a dataspace object * * Return: Success: The class of the dataspace object - * * Failure: N5S_NO_CLASS * - * Errors: - * * Programmer: Quincey Koziol * Thursday, September 28, 2000 * @@ -1831,8 +1735,6 @@ done: * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. * - * Modifications: - * *------------------------------------------------------------------------- */ H5S_class_t @@ -1844,11 +1746,11 @@ H5S_get_simple_extent_type(const H5S_t *space) HDassert(space); - ret_value=H5S_GET_EXTENT_TYPE(space); + ret_value = H5S_GET_EXTENT_TYPE(space); done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5S_get_simple_extent_type() */ /*------------------------------------------------------------------------- @@ -1857,36 +1759,31 @@ done: * Purpose: Retrieves the type of extent for a dataspace object * * Return: Success: The class of the dataspace object - * * Failure: N5S_NO_CLASS * - * Errors: - * * Programmer: Quincey Koziol * Thursday, July 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ H5S_class_t H5Sget_simple_extent_type(hid_t sid) { H5S_t *space; - H5S_class_t ret_value; + H5S_class_t ret_value; /* Return value */ FUNC_ENTER_API(H5S_NO_CLASS) H5TRACE1("Sc", "i", sid); /* Check arguments */ - if (NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE))) + if(NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace") - ret_value=H5S_GET_EXTENT_TYPE(space); + ret_value = H5S_GET_EXTENT_TYPE(space); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Sget_simple_extent_type() */ /*-------------------------------------------------------------------------- @@ -1906,68 +1803,25 @@ done: herr_t H5Sset_extent_none(hid_t space_id) { - H5S_t *space; /* dataspace to modify */ - herr_t ret_value=SUCCEED; /* Return value */ + H5S_t *space; /* Dataspace to modify */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", space_id); /* Check args */ - if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") /* Clear the previous extent from the dataspace */ - if(H5S_extent_release(&space->extent)<0) + if(H5S__extent_release(&space->extent) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace") - space->extent.type=H5S_NO_CLASS; - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Sset_extent_none() */ - - -/*-------------------------------------------------------------------------- - NAME - H5Soffset_simple - PURPOSE - Changes the offset of a selection within a simple dataspace extent - USAGE - herr_t H5Soffset_simple(space_id, offset) - hid_t space_id; IN: Dataspace object to reset - const hssize_t *offset; IN: Offset to position the selection at - RETURNS - Non-negative on success/Negative on failure - DESCRIPTION - This function creates an offset for the selection within an extent, allowing - the same shaped selection to be moved to different locations within a - dataspace without requiring it to be re-defined. ---------------------------------------------------------------------------*/ -herr_t -H5Soffset_simple(hid_t space_id, const hssize_t *offset) -{ - H5S_t *space; /* dataspace to modify */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Hs", space_id, offset); - - /* Check args */ - if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") - if (space->extent.rank==0 || (H5S_GET_EXTENT_TYPE(space)==H5S_SCALAR - || H5S_GET_EXTENT_TYPE(space)==H5S_NULL)) - HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace") - if (offset == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified") - - /* Set the selection offset */ - if(H5S_select_offset(space,offset)<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset") + space->extent.type = H5S_NO_CLASS; done: FUNC_LEAVE_API(ret_value) -} /* end H5Soffset_simple() */ +} /* end H5Sset_extent_none() */ /*------------------------------------------------------------------------- @@ -1996,7 +1850,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) HDassert(size); /* Verify that the dimensions being changed are allowed to change */ - for(u = 0; u < space->extent.rank; u++) { + for(u = 0; u < space->extent.rank; u++) if(space->extent.size[u] != size[u]) { /* Check for invalid dimension size modification */ if(space->extent.max && H5S_UNLIMITED != space->extent.max[u] && @@ -2006,7 +1860,6 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) /* Indicate that dimension size can be modified */ ret_value = TRUE; } /* end if */ - } /* end for */ /* Update dimension size(s) */ if(ret_value) @@ -2033,7 +1886,7 @@ done: * *------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5S_has_extent(const H5S_t *ds) { hbool_t ret_value = FALSE; /* Return value */ @@ -2104,7 +1957,6 @@ done: * Purpose: Determines if two dataspace extents are equal. * * Return: Success: TRUE if equal, FALSE if unequal - * * Failure: Negative * * Programmer: Quincey Koziol @@ -2116,7 +1968,7 @@ htri_t H5Sextent_equal(hid_t space1_id, hid_t space2_id) { const H5S_t *ds1, *ds2; /* Dataspaces to compare */ - htri_t ret_value; + htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("t", "ii", space1_id, space2_id); @@ -2148,7 +2000,7 @@ done: DESCRIPTION Compare two dataspaces if their extents are identical. --------------------------------------------------------------------------*/ -htri_t +H5_ATTR_PURE htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2) { unsigned u; /* Local index variable */ @@ -2209,7 +2061,7 @@ done: * *------------------------------------------------------------------------- */ -hsize_t +H5_ATTR_PURE hsize_t H5S_extent_nelem(const H5S_extent_t *ext) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2257,6 +2109,5 @@ H5S_set_version(H5F_t *f, H5S_t *ds) done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5S_set_version() */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 3b77b98..76181d1 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -18,16 +18,36 @@ * Purpose: "All" selection dataspace I/O functions. */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5Smodule.h" /* This source code file is part of the H5S module */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* ID Functions */ #include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ + + +/****************/ +/* Local Macros */ +/****************/ + -/* Static function prototypes */ +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ /* Selection callbacks */ static herr_t H5S__all_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); @@ -60,6 +80,16 @@ static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); static herr_t H5S__all_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S__all_iter_release(H5S_sel_iter_t *sel_iter); + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + /* Selection properties for "all" selections */ const H5S_select_class_t H5S_sel_all[1] = {{ H5S_SEL_ALL, @@ -85,6 +115,11 @@ const H5S_select_class_t H5S_sel_all[1] = {{ H5S__all_iter_init, }}; + +/*******************/ +/* Local Variables */ +/*******************/ + /* Iteration properties for "all" selections */ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{ H5S_SEL_ALL, @@ -99,13 +134,14 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{ H5S__all_iter_release, }}; + /*------------------------------------------------------------------------- * Function: H5S__all_iter_init * * Purpose: Initializes iteration information for "all" selection. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 @@ -132,7 +168,7 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) iter->type = H5S_sel_iter_all; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_iter_init() */ +} /* end H5S__all_iter_init() */ /*------------------------------------------------------------------------- @@ -141,7 +177,7 @@ H5S__all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Tuesday, April 22, 2003 @@ -165,7 +201,7 @@ H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S__all_iter_coords() */ +} /* end H5S__all_iter_coords() */ /*------------------------------------------------------------------------- @@ -174,7 +210,7 @@ done: * Purpose: Retrieve the current block of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Monday, June 2, 2003 @@ -204,7 +240,7 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_iter_block() */ +} /* end H5S__all_iter_block() */ /*------------------------------------------------------------------------- @@ -212,7 +248,7 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) * * Purpose: Return number of elements left to process in iterator * - * Return: non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 @@ -228,7 +264,7 @@ H5S__all_iter_nelmts(const H5S_sel_iter_t *iter) HDassert(iter); FUNC_LEAVE_NOAPI(iter->elmt_left) -} /* H5S__all_iter_nelmts() */ +} /* end H5S__all_iter_nelmts() */ /*-------------------------------------------------------------------------- @@ -257,7 +293,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) HDassert(iter); FUNC_LEAVE_NOAPI(FALSE) -} /* H5S__all_iter_has_next_block() */ +} /* end H5S__all_iter_has_next_block() */ /*-------------------------------------------------------------------------- @@ -292,7 +328,7 @@ H5S__all_iter_next(H5S_sel_iter_t *iter, size_t nelem) iter->u.all.byte_offset += (nelem * iter->elmt_size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_iter_next() */ +} /* end H5S__all_iter_next() */ /*-------------------------------------------------------------------------- @@ -321,7 +357,7 @@ H5S__all_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter) HDassert(iter); FUNC_LEAVE_NOAPI(FAIL) -} /* H5S__all_iter_next_block() */ +} /* end H5S__all_iter_next_block() */ /*-------------------------------------------------------------------------- @@ -350,7 +386,7 @@ H5S__all_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter) HDassert(iter); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_iter_release() */ +} /* end H5S__all_iter_release() */ /*-------------------------------------------------------------------------- @@ -382,7 +418,7 @@ H5S__all_release(H5S_t *space) space->select.num_elem = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_release() */ +} /* end H5S__all_release() */ /*-------------------------------------------------------------------------- @@ -391,9 +427,10 @@ H5S__all_release(H5S_t *space) PURPOSE Copy a selection from one dataspace to another USAGE - herr_t H5S__all_copy(dst, src) + herr_t H5S__all_copy(dst, src, share_selection) H5S_t *dst; OUT: Pointer to the destination dataspace H5S_t *src; IN: Pointer to the source dataspace + hbool_t; IN: Whether to share the selection between the dataspaces RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -527,7 +564,7 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p) *p = pp; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_serialize() */ +} /* end H5S__all_serialize() */ /*-------------------------------------------------------------------------- @@ -572,7 +609,7 @@ H5S__all_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_A done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S__all_deserialize() */ +} /* end H5S__all_deserialize() */ /*-------------------------------------------------------------------------- @@ -622,7 +659,7 @@ H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_bounds() */ +} /* end H5S__all_bounds() */ /*-------------------------------------------------------------------------- @@ -657,7 +694,7 @@ H5S__all_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) *offset = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_offset() */ +} /* end H5S__all_offset() */ /*-------------------------------------------------------------------------- @@ -716,7 +753,7 @@ H5S__all_is_contiguous(const H5S_t H5_ATTR_UNUSED *space) HDassert(space); FUNC_LEAVE_NOAPI(TRUE) -} /* H5S__all_is_contiguous() */ +} /* end H5S__all_is_contiguous() */ /*-------------------------------------------------------------------------- @@ -745,7 +782,7 @@ H5S__all_is_single(const H5S_t H5_ATTR_UNUSED *space) HDassert(space); FUNC_LEAVE_NOAPI(TRUE) -} /* H5S__all_is_single() */ +} /* end H5S__all_is_single() */ /*-------------------------------------------------------------------------- @@ -776,7 +813,7 @@ H5S__all_is_regular(const H5S_t H5_ATTR_UNUSED *space) HDassert(space); FUNC_LEAVE_NOAPI(TRUE) -} /* H5S__all_is_regular() */ +} /* end H5S__all_is_regular() */ /*-------------------------------------------------------------------------- @@ -807,7 +844,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off HDassert(offset); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_adjust_u() */ +} /* end H5S__all_adjust_u() */ /*------------------------------------------------------------------------- @@ -816,7 +853,7 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off * Purpose: Projects a single element 'all' selection into a scalar * dataspace * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -836,7 +873,7 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) *offset = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S__all_project_scalar() */ +} /* end H5S__all_project_scalar() */ /*------------------------------------------------------------------------- @@ -845,7 +882,7 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) * Purpose: Projects an 'all' selection onto/into a simple dataspace * of a different rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -853,7 +890,8 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) *------------------------------------------------------------------------- */ static herr_t -H5S__all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset) +H5S__all_project_simple(const H5S_t H5_ATTR_UNUSED *base_space, + H5S_t *new_space, hsize_t H5_ATTR_UNUSED *offset) { herr_t ret_value = SUCCEED; /* Return value */ @@ -870,7 +908,7 @@ H5S__all_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offs done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S__all_project_simple() */ +} /* end H5S__all_project_simple() */ /*-------------------------------------------------------------------------- @@ -914,7 +952,7 @@ H5S_select_all(H5S_t *space, hbool_t rel_prev) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_all() */ +} /* end H5S_select_all() */ /*-------------------------------------------------------------------------- @@ -953,7 +991,7 @@ H5Sselect_all(hid_t spaceid) done: FUNC_LEAVE_API(ret_value) -} /* H5Sselect_all() */ +} /* end H5Sselect_all() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index ebd05ce..b13e921 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -57,16 +57,16 @@ /********************/ -/*********************/ -/* Package Variables */ -/*********************/ - - /*****************************/ /* Library Private Variables */ /*****************************/ +/*********************/ +/* Package Variables */ +/*********************/ + + /*******************/ /* Local Variables */ /*******************/ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 88c570d..e9354ca 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -18,21 +18,37 @@ * Purpose: Hyperslab selection dataspace I/O functions. */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5Smodule.h" /* This source code file is part of the H5S module */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ #include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5VMprivate.h" /* Vector functions */ + +/****************/ /* Local Macros */ +/****************/ + -/* Local datatypes */ +/******************/ +/* Local Typedefs */ +/******************/ -/* Static function prototypes */ + +/********************/ +/* Local Prototypes */ +/********************/ static H5S_hyper_span_t *H5S__hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next); static herr_t H5S__hyper_span_precompute(H5S_hyper_span_info_t *spans, size_t elmt_size); @@ -64,7 +80,6 @@ static herr_t H5S__hyper_generate_spans(H5S_t *space); static herr_t H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]); -/* Needed for use in hyperslab code (H5Shyper.c) */ #ifdef NEW_HYPERSLAB_API static herr_t H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2); #endif /*NEW_HYPERSLAB_API*/ @@ -111,6 +126,15 @@ static hbool_t H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab_info[], unsigned rank); static hbool_t H5S__hyper_rebuild(H5S_t *space); +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + /* Selection properties for hyperslab selections */ const H5S_select_class_t H5S_sel_hyper[1] = {{ H5S_SEL_HYPERSLABS, @@ -136,6 +160,11 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{ H5S__hyper_iter_init, }}; + +/*******************/ +/* Local Variables */ +/*******************/ + /* Iteration properties for hyperslab selections */ static const H5S_sel_iter_class_t H5S_sel_iter_hyper[1] = {{ H5S_SEL_HYPERSLABS, @@ -153,16 +182,16 @@ static const H5S_sel_iter_class_t H5S_sel_iter_hyper[1] = {{ /* Static variables */ /* Arrays for default stride, block, etc. */ -static const hsize_t H5S_hyper_zeros_g[H5O_LAYOUT_NDIMS] = { +static const hsize_t H5S_hyper_zeros_g[H5S_MAX_RANK] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, - 0,0,0,0, 0,0,0,0,0}; -static const hsize_t H5S_hyper_ones_g[H5O_LAYOUT_NDIMS] = { + 0,0,0,0, 0,0,0,0}; +static const hsize_t H5S_hyper_ones_g[H5S_MAX_RANK] = { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, - 1,1,1,1, 1,1,1,1,1}; + 1,1,1,1, 1,1,1,1}; /* Declare a free list to manage the H5S_hyper_sel_t struct */ H5FL_DEFINE_STATIC(H5S_hyper_sel_t); @@ -261,9 +290,9 @@ H5S__hyper_print_diminfo(FILE *f, const H5S_t *space) /*------------------------------------------------------------------------- * Function: H5S__hyper_iter_init * - * Purpose: Initializes iteration information for hyperslab span tree selection. + * Purpose: Initializes iteration information for hyperslab selection. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Saturday, February 24, 2001 @@ -334,7 +363,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) /* Check if the regular selection can be "flattened" */ if(cont_dim > 0) { hsize_t acc; /* Accumulator for "flattened" dimension's sizes */ - unsigned last_dim_flattened = 1; /* Flag to indicate that the last dimension was flattened */ + hbool_t last_dim_flattened = TRUE; /* Flag to indicate that the last dimension was flattened */ unsigned flat_rank = rank-cont_dim; /* Number of dimensions after flattening */ unsigned curr_dim; /* Current dimension */ int i; /* Index variable */ @@ -351,7 +380,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) acc *= mem_size[i]; /* Indicate that the dimension was flattened */ - last_dim_flattened = 1; + last_dim_flattened = TRUE; } /* end if */ else { if(last_dim_flattened) { @@ -369,7 +398,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) iter->u.hyp.sel_off[curr_dim] = space->select.offset[i] * (hssize_t)acc; /* Reset the "last dim flattened" flag to avoid flattened any further dimensions */ - last_dim_flattened = 0; + last_dim_flattened = FALSE; /* Reset the "accumulator" for possible further dimension flattening */ acc = 1; @@ -414,10 +443,9 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) /* Initialize irregular region information also (for release) */ iter->u.hyp.spans = NULL; } /* end if */ - else { + else { /* Initialize the information needed for non-regular hyperslab I/O */ H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */ -/* Initialize the information needed for non-regular hyperslab I/O */ HDassert(space->select.sel_info.hslab->span_lst); /* Make a copy of the span tree to iterate over */ iter->u.hyp.spans = H5S__hyper_copy_span(space->select.sel_info.hslab->span_lst); @@ -459,7 +487,7 @@ H5S__hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Tuesday, April 22, 2003 @@ -544,7 +572,7 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) * Purpose: Retrieve the current block of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Monday, June 2, 2003 @@ -570,7 +598,7 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) /* Check for a single "regular" hyperslab */ if(iter->u.hyp.diminfo_valid) { - /* Compute the end of the block */ + /* Copy the start and compute the end of the block */ for(u = 0; u < iter->rank; u++) { start[u] = iter->u.hyp.off[u]; end[u] = (start[u] + iter->u.hyp.diminfo[u].block) - 1; @@ -595,7 +623,7 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) * * Purpose: Return number of elements left to process in iterator * - * Return: non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 @@ -631,7 +659,7 @@ H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static htri_t +static H5_ATTR_PURE htri_t H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *iter) { unsigned u; /* Local index variable */ @@ -689,7 +717,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) { unsigned ndims; /* Number of dimensions of dataset */ int fast_dim; /* Rank of the fastest changing dimension for the dataspace */ - unsigned i; /* Counters */ + unsigned u; /* Counters */ FUNC_ENTER_STATIC_NOERR @@ -697,19 +725,17 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) /* (i.e. a regular hyperslab selection */ if(iter->u.hyp.diminfo_valid) { const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ - hsize_t iter_offset[H5O_LAYOUT_NDIMS]; - hsize_t iter_count[H5O_LAYOUT_NDIMS]; + hsize_t iter_offset[H5S_MAX_RANK]; + hsize_t iter_count[H5S_MAX_RANK]; int temp_dim; /* Temporary rank holder */ /* Check if this is a "flattened" regular hyperslab selection */ - if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) { + if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) /* Set the aliases for the dimension rank */ ndims = iter->u.hyp.iter_rank; - } /* end if */ - else { + else /* Set the aliases for the dimension rank */ ndims = iter->rank; - } /* end else */ /* Set the fastest dimension rank */ fast_dim = (int)ndims - 1; @@ -718,14 +744,14 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) tdiminfo = iter->u.hyp.diminfo; /* Calculate the offset and block count for each dimension */ - for(i = 0; i < ndims; i++) { - if(tdiminfo[i].count == 1) { - iter_offset[i] = iter->u.hyp.off[i] - tdiminfo[i].start; - iter_count[i] = 0; + for(u = 0; u < ndims; u++) { + if(tdiminfo[u].count == 1) { + iter_offset[u] = iter->u.hyp.off[u] - tdiminfo[u].start; + iter_count[u] = 0; } /* end if */ else { - iter_offset[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) % tdiminfo[i].stride; - iter_count[i] = (iter->u.hyp.off[i] - tdiminfo[i].start) / tdiminfo[i].stride; + iter_offset[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride; + iter_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride; } /* end else */ } /* end for */ @@ -750,10 +776,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) /* Decrement the number of elements advanced */ nelem -= actual_elem; } /* end if */ - else { + else /* Move to the next row in the current dimension */ iter_offset[temp_dim]++; - } /* end else */ /* If this block is still in the range of blocks to output for the dimension, break out of loop */ if(iter_offset[temp_dim] < tdiminfo[temp_dim].block) @@ -776,8 +801,8 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) } /* end while */ /* Translate current iter_offset and iter_count into iterator position */ - for(i = 0; i < ndims; i++) - iter->u.hyp.off[i] = tdiminfo[i].start + (tdiminfo[i].stride * iter_count[i]) + iter_offset[i]; + for(u = 0; u < ndims; u++) + iter->u.hyp.off[u] = tdiminfo[u].start + (tdiminfo[u].stride * iter_count[u]) + iter_offset[u]; } /* end if */ /* Must be an irregular hyperslab selection */ else { @@ -821,15 +846,13 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) /* Decrement the number of elements advanced */ nelem -= actual_elem; } /* end if */ - else { + else /* Move to the next row in the current dimension */ abs_arr[curr_dim]++; - } /* end else */ /* Check if we are still within the span */ - if(abs_arr[curr_dim] <= curr_span->high) { + if(abs_arr[curr_dim] <= curr_span->high) break; - } /* end if */ /* If we walked off that span, advance to the next span */ else { /* Advance span in this dimension */ @@ -845,10 +868,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) break; } /* end if */ - else { + else /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */ curr_dim--; - } /* end else */ } /* end else */ } /* end while */ @@ -907,22 +929,20 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) FUNC_ENTER_STATIC_NOERR /* Check for the special case of just one H5Sselect_hyperslab call made */ - /* (i.e. a regular hyperslab selection */ + /* (i.e. a regular hyperslab selection) */ if(iter->u.hyp.diminfo_valid) { const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ - hsize_t iter_offset[H5O_LAYOUT_NDIMS]; - hsize_t iter_count[H5O_LAYOUT_NDIMS]; + hsize_t iter_offset[H5S_MAX_RANK]; + hsize_t iter_count[H5S_MAX_RANK]; int temp_dim; /* Temporary rank holder */ /* Check if this is a "flattened" regular hyperslab selection */ - if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) { + if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < iter->rank) /* Set the aliases for the dimension rank */ ndims = iter->u.hyp.iter_rank; - } /* end if */ - else { + else /* Set the aliases for the dimension rank */ ndims = iter->rank; - } /* end else */ /* Set the fastest dimension rank */ fast_dim = (int)ndims - 1; @@ -945,14 +965,12 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) /* Advance one block */ temp_dim = fast_dim; /* Start with the fastest changing dimension */ while(temp_dim >= 0) { - if(temp_dim == fast_dim) { + if(temp_dim == fast_dim) /* Move iterator over current block */ iter_offset[temp_dim] += tdiminfo[temp_dim].block; - } /* end if */ - else { + else /* Move to the next row in the current dimension */ iter_offset[temp_dim]++; - } /* end else */ /* If this block is still in the range of blocks to output for the dimension, break out of loop */ if(iter_offset[temp_dim] < tdiminfo[temp_dim].block) @@ -1001,19 +1019,16 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) curr_span = ispan[curr_dim]; /* Increment absolute position */ - if(curr_dim == fast_dim) { + if(curr_dim == fast_dim) /* Move the iterator over rest of element in span */ abs_arr[curr_dim] = curr_span->high + 1; - } /* end if */ - else { + else /* Move to the next row in the current dimension */ abs_arr[curr_dim]++; - } /* end else */ /* Check if we are still within the span */ - if(abs_arr[curr_dim] <= curr_span->high) { + if(abs_arr[curr_dim] <= curr_span->high) break; - } /* end if */ /* If we walked off that span, advance to the next span */ else { /* Advance span in this dimension */ @@ -1029,10 +1044,9 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) break; } /* end if */ - else { + else /* If we finished the span list in this dimension, decrement the dimension worked on and loop again */ curr_dim--; - } /* end else */ } /* end else */ } /* end while */ @@ -1063,7 +1077,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5S__hyper_iter_next() */ +} /* end H5S__hyper_iter_next_block() */ /*-------------------------------------------------------------------------- @@ -1404,6 +1418,7 @@ H5S__hyper_copy_span(H5S_hyper_span_info_t *spans) FUNC_ENTER_STATIC + /* Sanity check */ HDassert(spans); /* Copy the hyperslab span tree */ @@ -1422,23 +1437,24 @@ done: NAME H5S__hyper_cmp_spans PURPOSE - Check if two hyperslab slabs are the same + Check if two hyperslab span trees are the same USAGE hbool_t H5S__hyper_cmp_spans(span1, span2) - H5S_hyper_span_t *span1; IN: First span tree to compare - H5S_hyper_span_t *span2; IN: Second span tree to compare + H5S_hyper_span_info_t *span_info1; IN: First span tree to compare + H5S_hyper_span_info_t *span_info2; IN: Second span tree to compare RETURNS TRUE (1) or FALSE (0) on success, can't fail DESCRIPTION - Compare two hyperslab slabs to determine if they refer to the same - selection. If span1 & span2 are both NULL, that counts as equal + Compare two hyperslab span trees to determine if they refer to the same + selection. If span1 & span2 are both NULL, that counts as equal. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static hbool_t -H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_span_info_t *span_info2) +static H5_ATTR_PURE hbool_t +H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, + const H5S_hyper_span_info_t *span_info2) { hbool_t ret_value = FALSE; /* Return value */ @@ -1610,9 +1626,10 @@ done: PURPOSE Copy a selection from one dataspace to another USAGE - herr_t H5S__hyper_copy(dst, src) + herr_t H5S__hyper_copy(dst, src, share_selection) H5S_t *dst; OUT: Pointer to the destination dataspace H5S_t *src; IN: Pointer to the source dataspace + hbool_t; IN: Whether to share the selection between the dataspaces RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -2045,7 +2062,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, HDassert(spans); HDassert(start); HDassert(end); - HDassert(rank < H5O_LAYOUT_NDIMS); + HDassert(rank < H5S_MAX_RANK); HDassert(p && pp); /* Walk through the list of spans, recursing or outputting them */ @@ -2088,7 +2105,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, *p = pp; FUNC_LEAVE_NOAPI_VOID -} /* H5S__hyper_serialize_helper() */ +} /* end H5S__hyper_serialize_helper() */ /*-------------------------------------------------------------------------- @@ -2170,8 +2187,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) /* Check for a "regular" hyperslab selection */ else if(space->select.sel_info.hslab->diminfo_valid) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ - hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ + hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */ + hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */ unsigned ndims; /* Rank of the dataspace */ unsigned u; /* Local counting variable */ @@ -2261,8 +2278,8 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p) } /* end while */ } /* end if */ else { - hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ - hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ + hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */ + hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */ /* Encode number of hyperslabs */ block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); @@ -2318,8 +2335,8 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl { unsigned rank; /* Rank of points */ const uint8_t *pp; /* Local pointer for decoding */ - hsize_t start[H5O_LAYOUT_NDIMS]; /* Hyperslab start information */ - hsize_t block[H5O_LAYOUT_NDIMS]; /* Hyperslab block information */ + hsize_t start[H5S_MAX_RANK]; /* Hyperslab start information */ + hsize_t block[H5S_MAX_RANK]; /* Hyperslab block information */ unsigned u; /* Local counting variable */ herr_t ret_value = FAIL; /* Return value */ @@ -2337,8 +2354,8 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl /* If there is an unlimited dimension, only encode opt_unlim_diminfo */ if(flags & H5S_SELECT_FLAG_UNLIM) { - hsize_t stride[H5O_LAYOUT_NDIMS]; /* Hyperslab stride information */ - hsize_t count[H5O_LAYOUT_NDIMS]; /* Hyperslab count information */ + hsize_t stride[H5S_MAX_RANK]; /* Hyperslab stride information */ + hsize_t count[H5S_MAX_RANK]; /* Hyperslab count information */ /* Sanity checks */ HDassert(H5S_UNLIMITED == HSIZE_UNDEF); @@ -2360,7 +2377,7 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl else { const hsize_t *stride; /* Hyperslab stride information */ const hsize_t *count; /* Hyperslab count information */ - hsize_t end[H5O_LAYOUT_NDIMS]; /* Hyperslab end information */ + hsize_t end[H5S_MAX_RANK]; /* Hyperslab end information */ hsize_t *tstart; /* Temporary hyperslab pointers */ hsize_t *tend; /* Temporary hyperslab pointers */ hsize_t *tblock; /* Temporary hyperslab pointers */ @@ -2447,7 +2464,7 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[], /* Sanity checks */ HDassert(spans); - HDassert(rank < H5O_LAYOUT_NDIMS); + HDassert(rank < H5S_MAX_RANK); HDassert(start); HDassert(end); HDassert(startblock); @@ -2551,8 +2568,8 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ - hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ + hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary hyperslab counts */ + hsize_t offset[H5S_MAX_RANK]; /* Offset of element in dataspace */ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */ unsigned ndims; /* Rank of the dataspace */ hbool_t done; /* Whether we are done with the iteration */ @@ -2662,8 +2679,8 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo } /* end while */ } /* end if */ else { - hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ - hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ + hsize_t start[H5S_MAX_RANK]; /* Location of start of hyperslab */ + hsize_t end[H5S_MAX_RANK]; /* Location of end of hyperslab */ ret_value = H5S__hyper_span_blocklist(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, &startblock, &numblocks, &buf); } /* end else */ @@ -2771,7 +2788,7 @@ H5S_hyper_bounds_helper(const H5S_hyper_span_info_t *spans, const hssize_t *offs HDassert(spans); HDassert(offset); - HDassert(rank < H5O_LAYOUT_NDIMS); + HDassert(rank < H5S_MAX_RANK); HDassert(start); HDassert(end); @@ -3075,7 +3092,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static htri_t +static H5_ATTR_PURE htri_t H5S__hyper_is_contiguous(const H5S_t *space) { hbool_t small_contiguous, /* Flag for small contiguous block */ @@ -3145,10 +3162,10 @@ H5S__hyper_is_contiguous(const H5S_t *space) /* * For a hyperslab to be contiguous, it must have only one block and - * (either it's size must be the same as the dataspace extent's in all - * but the slowest changing dimension - * OR - * block size must be 1 in all but the fastest changing dimension). + * either it's size must be the same as the dataspace extent's in all + * but the slowest changing dimension + * OR + * block size must be 1 in all but the fastest changing dimension. */ /* Initialize flags */ large_contiguous = TRUE; /* assume true and reset if the dimensions don't match */ @@ -3260,7 +3277,7 @@ H5S__hyper_is_contiguous(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static htri_t +static H5_ATTR_PURE htri_t H5S__hyper_is_single(const H5S_t *space) { htri_t ret_value = TRUE; /* return value */ @@ -4242,7 +4259,7 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) * Purpose: Projects a single element hyperslab selection into a scalar * dataspace * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -4305,7 +4322,7 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset) * Purpose: Projects a hyperslab selection onto/into a simple dataspace * of a lower rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -4352,7 +4369,7 @@ H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space) * Purpose: Projects a hyperslab selection onto/into a simple dataspace * of a higher rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -4442,7 +4459,7 @@ done: * Purpose: Projects a hyperslab selection onto/into a simple dataspace * of a different rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -4450,7 +4467,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset) +H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, + hsize_t *offset) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4939,9 +4957,10 @@ done: DESCRIPTION Clip one span tree ('a') against another span tree ('b'). Creates span trees for the area defined by the 'a' span tree which does not overlap the - 'b' span tree, the area defined by the overlap of the 'a' hyperslab span - tree and the 'b' span tree, and the area defined by the 'b' hyperslab span - tree which does not overlap the 'a' span tree. + 'b' span tree ("a not b"), the area defined by the overlap of the 'a' + hyperslab span tree and the 'b' span tree ("a and b"), and the area defined + by the 'b' hyperslab span tree which does not overlap the 'a' span + tree ("b not a"). GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -5850,12 +5869,12 @@ H5S__hyper_spans_nelem(const H5S_hyper_span_info_t *spans) Create a span tree USAGE H5S_hyper_span_t *H5S__hyper_make_spans(rank, start, stride, count, block) - unsigned rank; IN: # of dimensions of the space - const hsize_t *start; IN: Starting location of the hyperslabs - const hsize_t *stride; IN: Stride from the beginning of one block to + unsigned rank; IN: # of dimensions of the space + const hsize_t *start; IN: Starting location of the hyperslabs + const hsize_t *stride; IN: Stride from the beginning of one block to the next - const hsize_t *count; IN: Number of blocks - const hsize_t *block; IN: Size of hyperslab block + const hsize_t *count; IN: Number of blocks + const hsize_t *block; IN: Size of hyperslab block RETURNS Pointer to new span tree on success, NULL on failure DESCRIPTION @@ -6139,7 +6158,7 @@ done: static hbool_t H5S__hyper_rebuild(H5S_t *space) { - H5S_hyper_dim_t top_span_slab_info[H5O_LAYOUT_NDIMS]; + H5S_hyper_dim_t top_span_slab_info[H5S_MAX_RANK]; unsigned rank, curr_dim; hbool_t ret_value = TRUE; /* Return value */ @@ -6201,12 +6220,12 @@ done: static herr_t H5S__hyper_generate_spans(H5S_t *space) { - hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ - hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */ - hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */ - hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + hsize_t tmp_start[H5S_MAX_RANK]; /* Temporary start information */ + hsize_t tmp_stride[H5S_MAX_RANK]; /* Temporary stride information */ + hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary count information */ + hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block information */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -6247,19 +6266,14 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol (split from HS_select_hyperslab()). + * Programmer: Quincey Koziol * Tuesday, September 12, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5S__generate_hyperslab (H5S_t *space, H5S_seloper_t op, - const hsize_t start[], - const hsize_t stride[], - const hsize_t count[], - const hsize_t block[]) +H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], + const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { H5S_hyper_span_info_t *new_spans=NULL; /* Span tree for new hyperslab */ H5S_hyper_span_info_t *a_not_b = NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */ @@ -6291,7 +6305,7 @@ H5S__generate_hyperslab (H5S_t *space, H5S_seloper_t op, space->select.num_elem = H5S__hyper_spans_nelem(new_spans); /* Indicate that the new_spans are owned */ - new_spans=NULL; + new_spans = NULL; } /* end if */ else { hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */ @@ -6500,9 +6514,9 @@ herr_t H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], const hsize_t *stride, const hsize_t count[], const hsize_t *block) { - hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */ - hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */ - hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */ + hsize_t int_stride[H5S_MAX_RANK]; /* Internal storage for stride information */ + hsize_t int_count[H5S_MAX_RANK]; /* Internal storage for count information */ + hsize_t int_block[H5S_MAX_RANK]; /* Internal storage for block information */ const hsize_t *opt_stride; /* Optimized stride information */ const hsize_t *opt_count; /* Optimized count information */ const hsize_t *opt_block; /* Optimized block information */ @@ -6526,9 +6540,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], if(block == NULL) block = H5S_hyper_ones_g; - /* - * Check new selection. - */ + /* Check new selection */ for(u = 0; u < space->extent.rank; u++) { /* Check for overlapping hyperslab blocks in new selection. */ if(count[u] > 1 && stride[u] < block[u]) @@ -6564,7 +6576,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], if(unlim_dim >= 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot have more than one unlimited dimension in selection") else { - if(count[u] == block[u] /* == H5S_UNLIMITED */) + if(count[u] == block[u]) /* Both are H5S_UNLIMITED */ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "count and block cannot both be unlimited") unlim_dim = (int)u; } /* end else */ @@ -6793,7 +6805,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") /* Patch count and block to remove unlimited and include the - * existing selection */ + * existing selection. + */ H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, bounds_end[unlim_dim] + (hsize_t)1); HDassert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g)); HDassert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g)); @@ -7193,9 +7206,9 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hsize_t count[], const hsize_t *block) { - hsize_t int_stride[H5O_LAYOUT_NDIMS]; /* Internal storage for stride information */ - hsize_t int_count[H5O_LAYOUT_NDIMS]; /* Internal storage for count information */ - hsize_t int_block[H5O_LAYOUT_NDIMS]; /* Internal storage for block information */ + hsize_t int_stride[H5S_MAX_RANK]; /* Internal storage for stride information */ + hsize_t int_count[H5S_MAX_RANK]; /* Internal storage for count information */ + hsize_t int_block[H5S_MAX_RANK]; /* Internal storage for block information */ const hsize_t *opt_stride; /* Optimized stride information */ const hsize_t *opt_count; /* Optimized count information */ const hsize_t *opt_block; /* Optimized block information */ @@ -7212,11 +7225,11 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID); /* Point to the correct stride values */ - if(stride==NULL) + if(stride == NULL) stride = H5S_hyper_ones_g; /* Point to the correct block values */ - if(block==NULL) + if(block == NULL) block = H5S_hyper_ones_g; /* Check for unlimited dimension */ @@ -7236,7 +7249,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, */ for(u=0; u<space->extent.rank; u++) { /* Check for overlapping hyperslab blocks in new selection. */ - if(count[u]>1 && stride[u]<block[u]) + if(count[u] > 1 && stride[u] < block[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap") /* Detect zero-sized hyperslabs in new selection */ @@ -7364,10 +7377,10 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* Convert current "all" selection to "real" hyperslab selection */ /* Then allow operation to proceed */ { - hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ - hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */ - hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */ - hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */ + hsize_t tmp_start[H5S_MAX_RANK]; /* Temporary start information */ + hsize_t tmp_stride[H5S_MAX_RANK]; /* Temporary stride information */ + hsize_t tmp_count[H5S_MAX_RANK]; /* Temporary count information */ + hsize_t tmp_block[H5S_MAX_RANK]; /* Temporary block information */ /* Fill in temporary information for the dimensions */ for(u=0; u<space->extent.rank; u++) { @@ -7657,9 +7670,6 @@ done: * Programmer: Quincey Koziol * Tuesday, October 30, 2001 * - * Chao Mei - * Wednesday, June 29, 2011 - * *------------------------------------------------------------------------- */ static H5S_t * @@ -7789,8 +7799,6 @@ done: * Programmer: Quincey Koziol * Tuesday, October 30, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -7892,7 +7900,7 @@ H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections") /* Go refine the first selection */ - if (H5S_select_select(space1, op, space2)<0) + if(H5S_select_select(space1, op, space2) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection") done: @@ -7938,7 +7946,7 @@ H5S__hyper_get_seq_list_gen(const H5S_t *space, H5S_sel_iter_t *iter, { H5S_hyper_span_t *curr_span; /* Current hyperslab span node */ H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hsize_t slab[H5O_LAYOUT_NDIMS]; /* Cumulative size of each dimension in bytes */ + hsize_t slab[H5S_MAX_RANK]; /* Cumulative size of each dimension in bytes */ hsize_t acc; /* Accumulator for computing cumulative sizes */ hsize_t loc_off; /* Element offset in the dataspace */ hsize_t last_span_end = 0; /* The offset of the end of the last span */ @@ -8358,13 +8366,13 @@ H5S__hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter, hsize_t *off, size_t *len) { hsize_t *mem_size; /* Size of the source buffer */ - hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */ + hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */ const hssize_t *sel_off; /* Selection offset in dataspace */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */ - hsize_t tmp_count[H5O_LAYOUT_NDIMS];/* Temporary block count */ - hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */ - hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */ - hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */ + hsize_t offset[H5S_MAX_RANK]; /* Coordinate offset in dataspace */ + hsize_t tmp_count[H5S_MAX_RANK];/* Temporary block count */ + hsize_t tmp_block[H5S_MAX_RANK];/* Temporary block offset */ + hsize_t wrap[H5S_MAX_RANK]; /* Bytes to wrap around at the end of a row */ + hsize_t skip[H5S_MAX_RANK]; /* Bytes to skip between blocks */ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */ fast_dim_stride, @@ -8807,9 +8815,9 @@ H5S__hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ const hssize_t *sel_off; /* Selection offset in dataspace */ hsize_t *mem_size; /* Size of the source buffer */ - hsize_t base_offset[H5O_LAYOUT_NDIMS]; /* Base coordinate offset in dataspace */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */ - hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */ + hsize_t base_offset[H5S_MAX_RANK]; /* Base coordinate offset in dataspace */ + hsize_t offset[H5S_MAX_RANK]; /* Coordinate offset in dataspace */ + hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */ hsize_t fast_dim_block; /* Local copies of fastest changing dimension info */ hsize_t acc; /* Accumulator */ hsize_t loc; /* Coordinate offset */ @@ -8949,8 +8957,8 @@ H5S__hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, offset[skip_dim] += tot_blk_count; } /* end if */ else { - hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */ - hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */ + hsize_t tmp_block[H5S_MAX_RANK];/* Temporary block offset */ + hsize_t skip[H5S_MAX_RANK]; /* Bytes to skip between blocks */ int temp_dim; /* Temporary rank holder */ /* Set the starting block location */ @@ -9144,7 +9152,7 @@ H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_s /* Check if we stopped in the middle of a sequence of elements */ if((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 || ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)) { - hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */ + hsize_t slab[H5S_MAX_RANK]; /* Hyperslab size */ hsize_t loc; /* Coordinate offset */ hsize_t acc; /* Accumulator */ size_t leftover; /* The number of elements left over from the last sequence */ @@ -9249,11 +9257,10 @@ H5S__hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_s DESCRIPTION Projects the intersection of of the selections of src_space and src_intersect_space within the selection of src_space as a selection - within the selection of dst_space. The result is placed in the - selection of proj_space. Note src_space, dst_space, and - src_intersect_space do not need to use hyperslab selections, but they - cannot use point selections. The result is always a hyperslab - selection. + within the selection of dst_space. The result is placed in the selection + of proj_space. Note src_space, dst_space, and src_intersect_space do not + need to use hyperslab selections, but they cannot use point selections. + The result is always a hyperslab selection. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -9312,7 +9319,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(dst_space); HDassert(src_intersect_space); HDassert(proj_space); - + /* Assert that src_space and src_intersect_space have same extent and there * are no point selections */ HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); @@ -9475,7 +9482,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, * selection and advance any sequences we complete */ if(ss_off[ss_i] >= sis_off[sis_i]) int_sel_off = ss_sel_off; - else + else int_sel_off = sis_off[sis_i] - ss_off[ss_i] + ss_sel_off; if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) <= (sis_off[sis_i] + (hsize_t)sis_len[sis_i])) { @@ -9599,8 +9606,9 @@ loop_end: /* Set the number of elements in current selection */ proj_space->select.num_elem = H5S__hyper_spans_nelem(proj_space->select.sel_info.hslab->span_lst); - /* Attempt to rebuild "optimized" start/stride/count/block information. - * from resulting hyperslab span tree */ + /* Attempt to build "optimized" start/stride/count/block information + * from resulting hyperslab span tree. + */ H5S__hyper_rebuild(proj_space); } /* end if */ else @@ -9841,7 +9849,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) hsize_t orig_count; /* Original count in unlimited dimension */ int orig_unlim_dim; /* Original unliminted dimension */ H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -10225,7 +10233,7 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index) /* Create output space, copy extent */ if(NULL == (space_out = H5S_create(H5S_SIMPLE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "unable to create output dataspace") - if(H5S_extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0) + if(H5S__extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "unable to copy destination space extent") /* Select block as defined by start/stride/count/block computed above */ @@ -10352,7 +10360,7 @@ H5Sis_regular_hyperslab(hid_t spaceid) done: FUNC_LEAVE_API(ret_value) -} /* H5Sis_regular_hyperslab() */ +} /* end H5Sis_regular_hyperslab() */ /*-------------------------------------------------------------------------- @@ -10416,5 +10424,5 @@ H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], done: FUNC_LEAVE_API(ret_value) -} /* H5Sget_regular_hyperslab() */ +} /* end H5Sget_regular_hyperslab() */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 935d279..2ebe987 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -14,15 +14,20 @@ /* * Programmer: rky 980813 * - * Purpose: Functions to read/write directly between app buffer and file. + * Purpose: Create MPI data types for HDF5 selections. * - * Beware of the ifdef'ed print statements. - * I didn't make them portable. */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5Smodule.h" /* This source code file is part of the H5S module */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ @@ -37,37 +42,61 @@ #ifdef H5_HAVE_PARALLEL -static herr_t H5S_mpio_all_type(const H5S_t *space, size_t elmt_size, +/****************/ +/* Local Macros */ +/****************/ +#define H5S_MPIO_INITIAL_ALLOC_COUNT 256 +#define TWO_GIG_LIMIT 2147483648 +#ifndef H5S_MAX_MPI_COUNT +#define H5S_MAX_MPI_COUNT 536870911 /* (2^29)-1 */ +#endif + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ +static herr_t H5S__mpio_all_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type); -static herr_t H5S_mpio_none_type(MPI_Datatype *new_type, int *count, +static herr_t H5S__mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type); -static herr_t H5S_mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, +static herr_t H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint *disp, MPI_Datatype *new_type); -static herr_t H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, +static herr_t H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute_map, hbool_t *is_permuted); -static herr_t H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, +static herr_t H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute_map, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type); -static herr_t H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, +static herr_t H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type); -static herr_t H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, +static herr_t H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type); -static herr_t H5S_obtain_datatype(const hsize_t down[], H5S_hyper_span_t* span, +static herr_t H5S__obtain_datatype(const hsize_t down[], H5S_hyper_span_t* span, const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size); -static herr_t H5S_mpio_create_large_type (hsize_t, MPI_Aint, MPI_Datatype , MPI_Datatype *); +static herr_t H5S__mpio_create_large_type(hsize_t, MPI_Aint, MPI_Datatype , MPI_Datatype *); -#define H5S_MPIO_INITIAL_ALLOC_COUNT 256 +/*****************************/ +/* Library Private Variables */ +/*****************************/ -#define TWO_GIG_LIMIT 2147483648 -#ifndef H5S_MAX_MPI_COUNT -#define H5S_MAX_MPI_COUNT 536870911 /* (2^29)-1 */ -#endif +/*********************/ +/* Package Variables */ +/*********************/ + +/*******************/ +/* Local Variables */ +/*******************/ static hsize_t bigio_count = H5S_MAX_MPI_COUNT; + /*------------------------------------------------------------------------- * Function: H5S_mpio_set_bigio_count * @@ -75,7 +104,7 @@ static hsize_t bigio_count = H5S_MAX_MPI_COUNT; * when we utilize derived datatypes. This is of * particular interest for allowing nightly testing * - * Return: the current/previous value of bigio_count. + * Return: The current/previous value of bigio_count. * * Programmer: Richard Warren, March 10, 2017 * @@ -85,19 +114,20 @@ hsize_t H5S_mpio_set_bigio_count(hsize_t new_count) { hsize_t orig_count = bigio_count; - if ((new_count > 0) && (new_count < TWO_GIG_LIMIT)) { + + if((new_count > 0) && (new_count < TWO_GIG_LIMIT)) bigio_count = new_count; - } + return orig_count; -} +} /* end H5S_mpio_set_bigio_count() */ /*------------------------------------------------------------------------- - * Function: H5S_mpio_all_type + * Function: H5S__mpio_all_type * * Purpose: Translate an HDF5 "all" selection into an MPI type. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -105,16 +135,11 @@ H5S_mpio_set_bigio_count(hsize_t new_count) * *is_derived_type 0 if MPI primitive type, 1 if derived * * Programmer: rky 980813 - * Modifications: - * Mohamad Chaarawi - * Adding support for large datatypes (beyond the limit of a - * 32 bit integer. - * * *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_all_type(const H5S_t *space, size_t elmt_size, +H5S__mpio_all_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) { hsize_t total_bytes; @@ -122,7 +147,7 @@ H5S_mpio_all_type(const H5S_t *space, size_t elmt_size, hsize_t nelmts; /* Total number of elmts */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -133,34 +158,33 @@ H5S_mpio_all_type(const H5S_t *space, size_t elmt_size, H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t); total_bytes = (hsize_t)elmt_size * nelmts; + /* Verify that the size can be expressed as a 32 bit integer */ if(bigio_count >= total_bytes) { - /* fill in the return values */ - *new_type = MPI_BYTE; - H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t); - *is_derived_type = FALSE; - } + /* fill in the return values */ + *new_type = MPI_BYTE; + H5_CHECKED_ASSIGN(*count, int, total_bytes, hsize_t); + *is_derived_type = FALSE; + } /* end if */ else { - /* Create a LARGE derived datatype for this transfer */ - if (H5S_mpio_create_large_type (total_bytes, 0, MPI_BYTE, new_type) < 0) { - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large datatype from the all selection") - } - *count = 1; - *is_derived_type = TRUE; - } + /* Create a LARGE derived datatype for this transfer */ + if(H5S__mpio_create_large_type(total_bytes, 0, MPI_BYTE, new_type) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large datatype from the all selection") + *count = 1; + *is_derived_type = TRUE; + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_mpio_all_type() */ +} /* H5S__mpio_all_type() */ /*------------------------------------------------------------------------- - * Function: H5S_mpio_none_type + * Function: H5S__mpio_none_type * * Purpose: Translate an HDF5 "none" selection into an MPI type. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -172,9 +196,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) +H5S__mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* fill in the return values */ *new_type = MPI_BYTE; @@ -182,15 +206,15 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) *is_derived_type = FALSE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_mpio_none_type() */ +} /* H5S__mpio_none_type() */ /*------------------------------------------------------------------------- - * Function: H5S_mpio_create_point_datatype + * Function: H5S__mpio_create_point_datatype * * Purpose: Create a derived datatype for point selections. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * @@ -198,18 +222,23 @@ H5S_mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) * *------------------------------------------------------------------------- */ -static herr_t -H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points, - MPI_Aint *disp, MPI_Datatype *new_type) +static herr_t +H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, + MPI_Aint *disp, MPI_Datatype *new_type) { MPI_Datatype elmt_type; /* MPI datatype for individual element */ hbool_t elmt_type_created = FALSE; /* Whether the element MPI datatype was created */ - int mpi_code; /* MPI error code */ + int *inner_blocks = NULL; /* Arrays for MPI datatypes when "large" datatype needed */ + MPI_Aint *inner_disps = NULL; + MPI_Datatype *inner_types = NULL; +#if MPI_VERSION < 3 int *blocks = NULL; /* Array of block sizes for MPI hindexed create call */ hsize_t u; /* Local index variable */ +#endif + int mpi_code; /* MPI error code */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Create an MPI datatype for an element */ if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type))) @@ -219,146 +248,127 @@ H5S_mpio_create_point_datatype (size_t elmt_size, hsize_t num_points, /* Check whether standard or BIGIO processing will be employeed */ if(bigio_count >= num_points) { #if MPI_VERSION >= 3 - /* Create an MPI datatype for the whole point selection */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code) + /* Create an MPI datatype for the whole point selection */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block((int)num_points, 1, disp, elmt_type, new_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_indexed_block failed", mpi_code) #else - /* Allocate block sizes for MPI datatype call */ - if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + /* Allocate block sizes for MPI datatype call */ + if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") - for(u = 0; u < num_points; u++) - blocks[u] = 1; + for(u = 0; u < num_points; u++) + blocks[u] = 1; - /* Create an MPI datatype for the whole point selection */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) + /* Create an MPI datatype for the whole point selection */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)num_points, blocks, disp, elmt_type, new_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) #endif - /* Commit MPI datatype for later use */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - } - else { - /* use LARGE_DATATYPE:: - * We'll create an hindexed_block type for every 2G point count and then combine - * those and any remaining points into a single large datatype. - */ - int total_types, i; - int remaining_points; - int num_big_types; - hsize_t leftover; - - int *inner_blocks; - MPI_Aint *inner_disps; - MPI_Datatype *inner_types = NULL; + /* Commit MPI datatype for later use */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + } /* end if */ + else { + /* use LARGE_DATATYPE:: + * We'll create an hindexed_block type for every 2G point count and then combine + * those and any remaining points into a single large datatype. + */ + int total_types, i; + int remaining_points; + int num_big_types; + hsize_t leftover; - /* Calculate how many Big MPI datatypes are needed to represent the buffer */ - num_big_types = (int)(num_points/bigio_count); + /* Calculate how many Big MPI datatypes are needed to represent the buffer */ + num_big_types = (int)(num_points / bigio_count); - leftover = (hsize_t)num_points - (hsize_t)num_big_types * (hsize_t)bigio_count; - H5_CHECKED_ASSIGN(remaining_points, int, leftover, hsize_t); + leftover = (hsize_t)num_points - (hsize_t)num_big_types * (hsize_t)bigio_count; + H5_CHECKED_ASSIGN(remaining_points, int, leftover, hsize_t); - total_types = (int)(remaining_points) ? (num_big_types + 1) : num_big_types; + total_types = (int)(remaining_points) ? (num_big_types + 1) : num_big_types; - /* Allocate array if MPI derived types needed */ - if(NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types)))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + /* Allocate array if MPI derived types needed */ + if(NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types)))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") - if(NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + if(NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") - if(NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + if(NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") #if MPI_VERSION < 3 - /* Allocate block sizes for MPI datatype call */ - if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + /* Allocate block sizes for MPI datatype call */ + if(NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") - for(u = 0; u < bigio_count; u++) - blocks[u] = 1; + for(u = 0; u < bigio_count; u++) + blocks[u] = 1; #endif - for(i=0 ; i<num_big_types ; i++) { + for(i = 0; i < num_big_types; i++) { #if MPI_VERSION >= 3 - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count, - 1, - &disp[i*bigio_count], - elmt_type, - &inner_types[i]))) { - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code); - } + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(bigio_count, + 1, &disp[i*bigio_count], elmt_type, &inner_types[i]))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code) #else - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count, - blocks, - &disp[i*bigio_count], - elmt_type, - &inner_types[i]))) { - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - } + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)bigio_count, + blocks, &disp[i*bigio_count], elmt_type, &inner_types[i]))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) #endif - inner_blocks[i] = 1; - inner_disps[i] = 0; - } + inner_blocks[i] = 1; + inner_disps[i] = 0; + } /* end for*/ - if(remaining_points) { + if(remaining_points) { #if MPI_VERSION >= 3 - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points, - 1, - &disp[num_big_types*bigio_count], - elmt_type, - &inner_types[num_big_types]))) { - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code); - } + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed_block(remaining_points, + 1, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types]))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed_block failed", mpi_code) #else - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points, - blocks, - &disp[num_big_types*bigio_count], - elmt_type, - &inner_types[num_big_types]))) { - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - } + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)remaining_points, + blocks, &disp[num_big_types*bigio_count], elmt_type, &inner_types[num_big_types]))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) #endif - inner_blocks[num_big_types] = 1; - inner_disps[num_big_types] = 0; - } - - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types, - inner_blocks, - inner_disps, - inner_types, - new_type))) { - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code); - } - for(i=0 ; i<total_types ; i++) - MPI_Type_free(&inner_types[i]); - - H5MM_free(inner_types); - H5MM_free(inner_blocks); - H5MM_free(inner_disps); - - /* Commit MPI datatype for later use */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - } + inner_blocks[num_big_types] = 1; + inner_disps[num_big_types] = 0; + } /* end if */ + + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(total_types, + inner_blocks, inner_disps, inner_types, new_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct", mpi_code) + for(i = 0; i < total_types; i++) + MPI_Type_free(&inner_types[i]); + + /* Commit MPI datatype for later use */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + } /* end else */ + done: if(elmt_type_created) MPI_Type_free(&elmt_type); +#if MPI_VERSION < 3 if(blocks) H5MM_free(blocks); +#endif + if(inner_types) + H5MM_free(inner_types); + if(inner_blocks) + H5MM_free(inner_blocks); + if(inner_disps) + H5MM_free(inner_disps); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_mpio_create_point_datatype() */ +} /* H5S__mpio_create_point_datatype() */ /*------------------------------------------------------------------------- - * Function: H5S_mpio_point_type + * Function: H5S__mpio_point_type * * Purpose: Translate an HDF5 "point" selection into an MPI type. * Create a permutation array to handle out-of-order point selections. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -373,7 +383,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, +H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute, hbool_t *is_permuted) { @@ -384,7 +394,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type hsize_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -406,23 +416,23 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type /* Iterate through list of elements */ curr = space->select.sel_info.pnt_lst->head; for(u = 0 ; u < num_points ; u++) { - /* calculate the displacement of the current point */ + /* Calculate the displacement of the current point */ disp[u] = H5VM_array_offset(space->extent.rank, space->extent.size, curr->pnt); disp[u] *= elmt_size; - /* This is a File Space used to set the file view, so adjust the displacements + /* This is a File Space used to set the file view, so adjust the displacements * to have them monotonically non-decreasing. - * Generate the permutation array by indicating at each point being selected, - * the position it will shifted in the new displacement. Example: - * Suppose 4 points with corresponding are selected - * Pt 1: disp=6 ; Pt 2: disp=3 ; Pt 3: disp=0 ; Pt 4: disp=4 + * Generate the permutation array by indicating at each point being selected, + * the position it will shifted in the new displacement. Example: + * Suppose 4 points with corresponding are selected + * Pt 1: disp=6 ; Pt 2: disp=3 ; Pt 3: disp=0 ; Pt 4: disp=4 * The permute map to sort the displacements in order will be: * point 1: map[0] = L, indicating that this point is not moved (1st point selected) - * point 2: map[1] = 0, indicating that this point is moved to the first position, + * point 2: map[1] = 0, indicating that this point is moved to the first position, * since disp_pt1(6) > disp_pt2(3) - * point 3: map[2] = 0, move to position 0, bec it has the lowest disp between + * point 3: map[2] = 0, move to position 0, bec it has the lowest disp between * the points selected so far. - * point 4: map[3] = 2, move the 2nd position since point 1 has a higher disp, + * point 4: map[3] = 2, move the 2nd position since point 1 has a higher disp, * but points 2 and 3 have lower displacements. */ if(do_permute) { @@ -447,7 +457,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type HDmemmove(disp + m + 1, disp + m, (u - m) * sizeof(MPI_Aint)); disp[m] = temp; } /* end if */ - (*permute)[u] = m; + (*permute)[u] = m; } /* end if */ else (*permute)[u] = num_points; @@ -455,7 +465,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type /* this is a memory space, and no permutation is necessary to create the derived datatype */ else { - ;/* do nothing */ + ; /* do nothing */ } /* end else */ /* get the next point */ @@ -463,7 +473,7 @@ H5S_mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type } /* end for */ /* Create the MPI datatype for the set of element displacements */ - if(H5S_mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0) + if(H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection") /* Set values about MPI datatype created */ @@ -481,11 +491,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_mpio_point_type() */ +} /* H5S__mpio_point_type() */ /*------------------------------------------------------------------------- - * Function: H5S_mpio_permute_type + * Function: H5S__mpio_permute_type * * Purpose: Translate an HDF5 "all/hyper/point" selection into an MPI type, * while applying the permutation map. This function is called if @@ -496,7 +506,7 @@ done: * Note: This routine is called from H5S_mpio_space_type(), which is * called first for the file dataspace and creates * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -508,7 +518,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute, +H5S__mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) { MPI_Aint *disp = NULL; /* Datatype displacement for each point*/ @@ -520,7 +530,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute, hsize_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -571,12 +581,12 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute, /* Set the displacement of the current point */ disp[u] = curr_off; - /* This is a memory displacement, so for each point selected, + /* This is a memory displacement, so for each point selected, * apply the map that was generated by the file selection */ if((*permute)[u] != num_points) { MPI_Aint temp = disp[u]; - HDmemmove(disp + (*permute)[u] + 1, disp + (*permute)[u], + HDmemmove(disp + (*permute)[u] + 1, disp + (*permute)[u], (u - (*permute)[u]) * sizeof(MPI_Aint)); disp[(*permute)[u]] = temp; } /* end if */ @@ -597,7 +607,7 @@ H5S_mpio_permute_type(const H5S_t *space, size_t elmt_size, hsize_t **permute, } /* end while */ /* Create the MPI datatype for the set of element displacements */ - if(H5S_mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0) + if(H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection") /* Set values about MPI datatype created */ @@ -619,15 +629,15 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_mpio_permute_type() */ +} /* H5S__mpio_permute_type() */ /*------------------------------------------------------------------------- - * Function: H5S_mpio_hyper_type + * Function: H5S__mpio_reg_hyper_type * - * Purpose: Translate an HDF5 hyperslab selection into an MPI type. + * Purpose: Translate a regular HDF5 hyperslab selection into an MPI type. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -635,14 +645,11 @@ done: * *is_derived_type 0 if MPI primitive type, 1 if derived * * Programmer: rky 980813 - * Modifications: - * Mohamad Chaarawi - * Adding support for large datatypes (beyond the limit of a - * 32 bit integer. + * *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, +H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) { H5S_sel_iter_t sel_iter; /* Selection iteration info */ @@ -668,7 +675,7 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -683,16 +690,15 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, diminfo = sel_iter.u.hyp.diminfo; HDassert(diminfo); - /* make a local copy of the dimension info so we can operate with them */ + /* Make a local copy of the dimension info so we can operate with them */ /* Check if this is a "flattened" regular hyperslab selection */ if(sel_iter.u.hyp.iter_rank != 0 && sel_iter.u.hyp.iter_rank < space->extent.rank) { /* Flattened selection */ rank = sel_iter.u.hyp.iter_rank; - HDassert(rank <= H5S_MAX_RANK); /* within array bounds */ #ifdef H5S_DEBUG - if(H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC); +if(H5DEBUG(S)) + HDfprintf(H5DEBUG(S), "%s: Flattened selection\n",FUNC); #endif for(u = 0; u < rank; ++u) { H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) @@ -701,33 +707,30 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, d[u].block = diminfo[u].block; d[u].count = diminfo[u].count; d[u].xtent = sel_iter.u.hyp.size[u]; + #ifdef H5S_DEBUG - if(H5DEBUG(S)){ - HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", - FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent ); - if (u==0) - HDfprintf(H5DEBUG(S), " rank=%u\n", rank ); - else - HDfprintf(H5DEBUG(S), "\n" ); - } +if(H5DEBUG(S)) { + HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", + FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + if(u == 0) + HDfprintf(H5DEBUG(S), " rank=%u\n", rank); + else + HDfprintf(H5DEBUG(S), "\n"); +} #endif - if(0 == d[u].block) - goto empty; - if(0 == d[u].count) - goto empty; - if(0 == d[u].xtent) - goto empty; + + /* Sanity check */ + HDassert(d[u].block > 0); + HDassert(d[u].count > 0); + HDassert(d[u].xtent > 0); } /* end for */ } /* end if */ else { /* Non-flattened selection */ rank = space->extent.rank; - HDassert(rank <= H5S_MAX_RANK); /* within array bounds */ - if(0 == rank) - goto empty; #ifdef H5S_DEBUG - if(H5DEBUG(S)) - HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC); +if(H5DEBUG(S)) + HDfprintf(H5DEBUG(S),"%s: Non-flattened selection\n",FUNC); #endif for(u = 0; u < rank; ++u) { H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) @@ -736,22 +739,22 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, d[u].block = diminfo[u].block; d[u].count = diminfo[u].count; d[u].xtent = space->extent.size[u]; + #ifdef H5S_DEBUG - if(H5DEBUG(S)){ +if(H5DEBUG(S)) { HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", - FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent ); - if (u==0) - HDfprintf(H5DEBUG(S), " rank=%u\n", rank ); + FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + if(u == 0) + HDfprintf(H5DEBUG(S), " rank=%u\n", rank); else - HDfprintf(H5DEBUG(S), "\n" ); - } + HDfprintf(H5DEBUG(S), "\n"); +} #endif - if(0 == d[u].block) - goto empty; - if(0 == d[u].count) - goto empty; - if(0 == d[u].xtent) - goto empty; + + /* Sanity check */ + HDassert(d[u].block > 0); + HDassert(d[u].count > 0); + HDassert(d[u].xtent > 0); } /* end for */ } /* end else */ @@ -762,56 +765,52 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, offset[rank - 1] = 1; max_xtent[rank - 1] = d[rank - 1].xtent; #ifdef H5S_DEBUG - if(H5DEBUG(S)) { - i = ((int)rank) - 1; - HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", - i, offset[i], i, max_xtent[i]); - } +if(H5DEBUG(S)) { + i = ((int)rank) - 1; + HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]); +} #endif for(i = ((int)rank) - 2; i >= 0; --i) { offset[i] = offset[i + 1] * d[i + 1].xtent; max_xtent[i] = max_xtent[i + 1] * d[i].xtent; #ifdef H5S_DEBUG - if(H5DEBUG(S)) - HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", - i, offset[i], i, max_xtent[i]); +if(H5DEBUG(S)) + HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]); #endif } /* end for */ /* Create a type covering the selected hyperslab. * Multidimensional dataspaces are stored in row-major order. * The type is built from the inside out, going from the - * fastest-changing (i.e., inner) dimension * to the slowest (outer). */ + * fastest-changing (i.e., inner) dimension * to the slowest (outer). + */ /******************************************************* * Construct contig type for inner contig dims: *******************************************************/ #ifdef H5S_DEBUG - if(H5DEBUG(S)) { +if(H5DEBUG(S)) { HDfprintf(H5DEBUG(S), "%s: Making contig type %Zu MPI_BYTEs\n", FUNC, elmt_size); for(i = ((int)rank) - 1; i >= 0; --i) HDfprintf(H5DEBUG(S), "d[%d].xtent=%Hu \n", i, d[i].xtent); - } +} #endif /* LARGE_DATATYPE:: - * Check if the number of elements to form the inner type fits into a 32 bit integer. + * Check if the number of elements to form the inner type fits into a 32 bit integer. * If yes then just create the innertype with MPI_Type_contiguous. * Otherwise create a compound datatype by iterating as many times as needed * for the innertype to be created. */ if(bigio_count >= elmt_size) { - /* Use a single MPI datatype that has a 32 bit size */ - if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - } - else { - /* Create the compound datatype for this operation (> 2GB) */ - if (H5S_mpio_create_large_type (elmt_size, 0, MPI_BYTE, &inner_type) < 0) { - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't ccreate a large inner datatype in hyper selection") - } - } + /* Use a single MPI datatype that has a 32 bit size */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &inner_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) + } /* end if */ + else + /* Create the compound datatype for this operation (> 2GB) */ + if(H5S__mpio_create_large_type(elmt_size, 0, MPI_BYTE, &inner_type) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large inner datatype in hyper selection") /******************************************************* * Construct the type by walking the hyperslab dims @@ -819,65 +818,57 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, *******************************************************/ for(i = ((int)rank) - 1; i >= 0; --i) { #ifdef H5S_DEBUG - if(H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n" - "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n", - FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); +if(H5DEBUG(S)) + HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n" + "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n", + FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); #endif #ifdef H5S_DEBUG - if(H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC,i); +if(H5DEBUG(S)) + HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC,i); #endif /**************************************** - * Build vector type of the selection. - ****************************************/ - if (bigio_count >= d[i].count && - bigio_count >= d[i].block && - bigio_count >= d[i].strid) { - - /* All the parameters fit into 32 bit integers so create the vector type normally */ - mpi_code = MPI_Type_vector((int)(d[i].count), /* count */ - (int)(d[i].block), /* blocklength */ - (int)(d[i].strid), /* stride */ - inner_type, /* old type */ - &outer_type); /* new type */ - - MPI_Type_free(&inner_type); - if(mpi_code != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code) - } + * Build vector type of the selection. + ****************************************/ + if(bigio_count >= d[i].count && + bigio_count >= d[i].block && bigio_count >= d[i].strid) { + /* All the parameters fit into 32 bit integers so create the vector type normally */ + mpi_code = MPI_Type_vector((int)(d[i].count), /* count */ + (int)(d[i].block), /* blocklength */ + (int)(d[i].strid), /* stride */ + inner_type, /* old type */ + &outer_type); /* new type */ + + MPI_Type_free(&inner_type); + if(mpi_code != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "couldn't create MPI vector type", mpi_code) + } /* end if */ else { - /* Things get a bit more complicated and require LARGE_DATATYPE processing - * There are two MPI datatypes that need to be created: - * 1) an internal contiguous block; and - * 2) a collection of elements where an element is a contiguous block(1). - * Remember that the input arguments to the MPI-IO functions use integer - * values to represent element counts. We ARE allowed however, in the - * more recent MPI implementations to use constructed datatypes whereby - * the total number of bytes in a transfer could be : - * (2GB-1)number_of_blocks * the_datatype_extent. - */ + /* Things get a bit more complicated and require LARGE_DATATYPE processing + * There are two MPI datatypes that need to be created: + * 1) an internal contiguous block; and + * 2) a collection of elements where an element is a contiguous block(1). + * Remember that the input arguments to the MPI-IO functions use integer + * values to represent element counts. We ARE allowed however, in the + * more recent MPI implementations to use constructed datatypes whereby + * the total number of bytes in a transfer could be : + * (2GB-1)number_of_blocks * the_datatype_extent. + */ MPI_Aint stride_in_bytes, inner_extent; MPI_Datatype block_type; - /* create a contiguous datatype inner_type x number of BLOCKS. - * Again we need to check that the number of BLOCKS can fit into + /* Create a contiguous datatype inner_type x number of BLOCKS. + * Again we need to check that the number of BLOCKS can fit into * a 32 bit integer */ - if (bigio_count < d[i].block) { - if (H5S_mpio_create_large_type(d[i].block, 0, inner_type, - &block_type) < 0) { - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't ccreate a large block datatype in hyper selection") - } - } - else { - if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block, - inner_type, - &block_type))) + if(bigio_count < d[i].block) { + if(H5S__mpio_create_large_type(d[i].block, 0, inner_type, &block_type) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large block datatype in hyper selection") + } /* end if */ + else + if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block, inner_type, &block_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - } /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, * so we're using the MPI-2 version even though we don't need the lb @@ -892,40 +883,38 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, /* If the element count is larger than what a 32 bit integer can hold, * we call the large type creation function to handle that */ - if (bigio_count < d[i].count) { - if (H5S_mpio_create_large_type (d[i].count, stride_in_bytes, block_type, - &outer_type) < 0) { - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large outer datatype in hyper selection") - } - } + if(bigio_count < d[i].count) { + if(H5S__mpio_create_large_type(d[i].count, stride_in_bytes, block_type, &outer_type) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large outer datatype in hyper selection") + } /* end if */ /* otherwise a regular create_hvector will do */ - else { - mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */ - 1, /* blocklength */ - stride_in_bytes, /* stride in bytes*/ - block_type, /* old type */ - &outer_type); /* new type */ - if(MPI_SUCCESS != mpi_code) + else + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */ + 1, /* blocklength */ + stride_in_bytes, /* stride in bytes*/ + block_type, /* old type */ + &outer_type))) /* new type */ HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) - } + MPI_Type_free(&block_type); MPI_Type_free(&inner_type); - } - /**************************************** - * Then build the dimension type as (start, vector type, xtent). - ****************************************/ - /* calculate start and extent values of this dimension */ + } /* end else */ + + /**************************************** + * Then build the dimension type as (start, vector type, xtent). + ****************************************/ + + /* Calculate start and extent values of this dimension */ start_disp = d[i].start * offset[i] * elmt_size; new_extent = (MPI_Aint)elmt_size * max_xtent[i]; if(MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(outer_type, &lb, &extent_len))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent failed", mpi_code) /************************************************* - * Restructure this datatype ("outer_type") - * so that it still starts at 0, but its extent - * is the full extent in this dimension. - *************************************************/ + * Restructure this datatype ("outer_type") + * so that it still starts at 0, but its extent + * is the full extent in this dimension. + *************************************************/ if(start_disp > 0 || extent_len < new_extent) { MPI_Datatype interm_type; int block_len = 1; @@ -957,13 +946,6 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, /* fill in the remaining return values */ *count = 1; /* only have to move one of these suckers! */ *is_derived_type = TRUE; - HGOTO_DONE(SUCCEED); - -empty: - /* special case: empty hyperslab */ - *new_type = MPI_BYTE; - *count = 0; - *is_derived_type = FALSE; done: /* Release selection iterator */ @@ -972,21 +954,20 @@ done: HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") #ifdef H5S_DEBUG - if(H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n", - FUNC, *count, *is_derived_type ); +if(H5DEBUG(S)) + HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n", FUNC, *count, *is_derived_type); #endif FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_mpio_hyper_type() */ +} /* end H5S__mpio_reg_hyper_type() */ /*------------------------------------------------------------------------- - * Function: H5S_mpio_span_hyper_type + * Function: H5S__mpio_span_hyper_type * * Purpose: Translate an HDF5 irregular hyperslab selection into an MPI type. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -995,14 +976,10 @@ done: * * Programmer: kyang * - * Modifications: - * Mohamad Chaarawi - * Adding support for large datatypes (beyond the limit of a - * 32 bit integer. *------------------------------------------------------------------------- */ static herr_t -H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, +H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type) { MPI_Datatype elmt_type; /* MPI datatype for an element */ @@ -1012,7 +989,7 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -1021,17 +998,13 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, HDassert(space->select.sel_info.hslab->span_lst->head); /* Create the base type for an element */ - if (bigio_count >= elmt_size) { - if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type))) { - HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - } - } - else { - if (H5S_mpio_create_large_type (elmt_size, 0, MPI_BYTE, &elmt_type) < 0) { - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large element datatype in span_hyper selection") - } - } + if(bigio_count >= elmt_size) { + if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)elmt_size, MPI_BYTE, &elmt_type))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) + } /* end if */ + else + if(H5S__mpio_create_large_type(elmt_size, 0, MPI_BYTE, &elmt_type) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection") elmt_type_is_derived = TRUE; /* Compute 'down' sizes for each dimension */ @@ -1039,8 +1012,8 @@ H5S_mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGETSIZE, FAIL, "couldn't compute 'down' dimension sizes") /* Obtain derived data type */ - if(H5S_obtain_datatype(down, space->select.sel_info.hslab->span_lst->head, &elmt_type, &span_type, elmt_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type") + if(H5S__obtain_datatype(down, space->select.sel_info.hslab->span_lst->head, &elmt_type, &span_type, elmt_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type") if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&span_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) *new_type = span_type; @@ -1056,16 +1029,15 @@ done: HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_mpio_span_hyper_type() */ +} /* end H5S__mpio_span_hyper_type() */ /*------------------------------------------------------------------------- - * Function: H5S_obtain_datatype + * Function: H5S__obtain_datatype * - * Purpose: Obtain an MPI derived datatype based on span-tree - * implementation + * Purpose: Obtain an MPI derived datatype for span-tree hyperslab selection * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *span_type the MPI type corresponding to the selection * @@ -1074,11 +1046,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, +H5S__obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, const MPI_Datatype *elmt_type, MPI_Datatype *span_type, size_t elmt_size) { size_t alloc_count = 0; /* Number of span tree nodes allocated at this level */ - size_t outercount = 0; /* Number of span tree nodes at this level */ + size_t outercount; /* Number of span tree nodes at this level */ MPI_Datatype *inner_type = NULL; hbool_t inner_types_freed = FALSE; /* Whether the inner_type MPI datatypes have been freed */ hbool_t span_type_valid = FALSE; /* Whether the span_type MPI datatypes is valid */ @@ -1089,7 +1061,7 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, int mpi_code; /* MPI return status code */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(span); @@ -1129,16 +1101,14 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, blocklen[outercount] = (int)tspan->nelem; tspan = tspan->next; - if (bigio_count < blocklen[outercount]) { + if(bigio_count < blocklen[outercount]) large_block = TRUE; /* at least one block type is large, so set this flag to true */ - } outercount++; } /* end while */ /* Everything fits into integers, so cast them and use hindexed */ - if (bigio_count >= outercount && large_block == FALSE) { - + if(bigio_count >= outercount && large_block == FALSE) { if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed((int)outercount, blocklen, disp, *elmt_type, span_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) span_type_valid = TRUE; @@ -1150,7 +1120,7 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, MPI_Datatype temp_type = MPI_DATATYPE_NULL, outer_type = MPI_DATATYPE_NULL; /* create the block type from elmt_type while checking the 32 bit int limit */ if (blocklen[i] > bigio_count) { - if (H5S_mpio_create_large_type (blocklen[i], 0, *elmt_type, &temp_type) < 0) { + if (H5S__mpio_create_large_type (blocklen[i], 0, *elmt_type, &temp_type) < 0) { HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create a large element datatype in span_hyper selection") } @@ -1233,7 +1203,7 @@ H5S_obtain_datatype(const hsize_t *down, H5S_hyper_span_t *span, blocklen[outercount] = 1; /* Generate MPI datatype for next dimension down */ - if(H5S_obtain_datatype(down + 1, tspan->down->head, elmt_type, &down_type, elmt_size) < 0) + if(H5S__obtain_datatype(down + 1, tspan->down->head, elmt_type, &down_type, elmt_size) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type") /* Build the MPI datatype for this node */ @@ -1291,7 +1261,7 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_obtain_datatype() */ +} /* end H5S__obtain_datatype() */ /*------------------------------------------------------------------------- @@ -1300,7 +1270,7 @@ done: * Purpose: Translate an HDF5 dataspace selection into an MPI type. * Currently handle only hyperslab and "all" selections. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Outputs: *new_type the MPI type corresponding to the selection * *count how many objects of the new_type in selection @@ -1312,7 +1282,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, +H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int *count, hbool_t *is_derived_type, hbool_t do_permute, hsize_t **permute_map, hbool_t *is_permuted) { @@ -1333,10 +1303,10 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type * out-of-order point selection, then permute this selection which * should be a memory selection to match the file space permutation. */ - if(TRUE == *is_permuted) { + if(TRUE == *is_permuted) { switch(H5S_GET_SELECT_TYPE(space)) { case H5S_SEL_NONE: - if(H5S_mpio_none_type(new_type, count, is_derived_type) < 0) + if(H5S__mpio_none_type(new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'none' selection to MPI type") break; @@ -1346,7 +1316,7 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type /* Sanity check */ HDassert(!do_permute); - if(H5S_mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0) + if(H5S__mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'all' selection to MPI type") break; @@ -1361,29 +1331,28 @@ H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type else { switch(H5S_GET_SELECT_TYPE(space)) { case H5S_SEL_NONE: - if(H5S_mpio_none_type(new_type, count, is_derived_type) < 0) + if(H5S__mpio_none_type(new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert 'none' selection to MPI type") break; case H5S_SEL_ALL: - if(H5S_mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0) + if(H5S__mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert 'all' selection to MPI type") break; case H5S_SEL_POINTS: - if(H5S_mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0) + if(H5S__mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't convert 'point' selection to MPI type") break; case H5S_SEL_HYPERSLABS: if((H5S_SELECT_IS_REGULAR(space) == TRUE)) { - if(H5S_mpio_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0) + if(H5S__mpio_reg_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert regular 'hyperslab' selection to MPI type") } /* end if */ - else { - if(H5S_mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0) + else + if(H5S__mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL,"couldn't convert irregular 'hyperslab' selection to MPI type") - } /* end else */ break; case H5S_SEL_ERROR: @@ -1407,12 +1376,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5S_mpio_create_large_type + * Function: H5S__mpio_create_large_type * - * Purpose: Create a large datatype of size larger than what a 32 bit integer + * Purpose: Create a large datatype of size larger than what a 32 bit integer * can hold. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * *new_type the new datatype created * @@ -1420,10 +1389,9 @@ done: * *------------------------------------------------------------------------- */ -static herr_t H5S_mpio_create_large_type (hsize_t num_elements, - MPI_Aint stride_bytes, - MPI_Datatype old_type, - MPI_Datatype *new_type) +static herr_t +H5S__mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, + MPI_Datatype old_type, MPI_Datatype *new_type) { int num_big_types; /* num times the 2G datatype will be repeated */ int remaining_bytes; /* the number of bytes left that can be held in an int value */ @@ -1434,7 +1402,7 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements, MPI_Aint disp[2], old_extent; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Calculate how many Big MPI datatypes are needed to represent the buffer */ num_big_types = (int)(num_elements/bigio_count); @@ -1447,41 +1415,23 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements, * use type_hvector to create the type with the displacement provided */ if (0 == stride_bytes) { - if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count, - old_type, - &inner_type))) { + if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(bigio_count, old_type, &inner_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - } - } - else { - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector (bigio_count, - 1, - stride_bytes, - old_type, - &inner_type))) { + } /* end if */ + else + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(bigio_count, 1, stride_bytes, old_type, &inner_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) - } - } /* Create a contiguous datatype of the buffer (minus the remaining < 2GB part) * If a stride is present, use hvector type */ - if (0 == stride_bytes) { - if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types, - inner_type, - &outer_type))) { + if(0 == stride_bytes) { + if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(num_big_types, inner_type, &outer_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - } - } - else { - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector (num_big_types, - 1, - stride_bytes, - inner_type, - &outer_type))) { + } /* end if */ + else + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector(num_big_types, 1, stride_bytes, inner_type, &outer_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) - } - } MPI_Type_free(&inner_type); @@ -1489,23 +1439,13 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements, * use a struct datatype to encapsulate everything. */ if(remaining_bytes) { - if (stride_bytes == 0) { - if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous (remaining_bytes, - old_type, - &leftover_type))) { + if(stride_bytes == 0) { + if(MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(remaining_bytes, old_type, &leftover_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - } - } - else { - if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector - ((int)(num_elements - (hsize_t)num_big_types*bigio_count), - 1, - stride_bytes, - old_type, - &leftover_type))) { + } /* end if */ + else + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)(num_elements - (hsize_t)num_big_types * bigio_count), 1, stride_bytes, old_type, &leftover_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) - } - } /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, * so we're using the MPI-2 version even though we don't need the lb @@ -1522,28 +1462,25 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements, block_len[0] = 1; block_len[1] = 1; disp[0] = 0; - disp[1] = (old_extent+stride_bytes)*num_big_types*(MPI_Aint)bigio_count; + disp[1] = (old_extent + stride_bytes) * num_big_types * (MPI_Aint)bigio_count; - if(MPI_SUCCESS != (mpi_code = - MPI_Type_create_struct(2, block_len, disp, type, new_type))) { + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(2, block_len, disp, type, new_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code) - } MPI_Type_free(&outer_type); MPI_Type_free(&leftover_type); - } - else { + } /* end if */ + else /* There are no remaining bytes so just set the new type to * the outer type created */ *new_type = outer_type; - } if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_mpio_create_large_type */ +} /* end H5S__mpio_create_large_type() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Snone.c b/src/H5Snone.c index a8aaf7e..c867e67 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -18,166 +18,197 @@ * Purpose: "None" selection dataspace I/O functions. */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5Smodule.h" /* This source code file is part of the H5S module */ -#include "H5private.h" -#include "H5Eprivate.h" -#include "H5Iprivate.h" -#include "H5Spkg.h" -#include "H5VMprivate.h" -#include "H5Dprivate.h" +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5VMprivate.h" /* Vector functions */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ -/* Static function prototypes */ + +/********************/ +/* Local Prototypes */ +/********************/ /* Selection callbacks */ -static herr_t H5S_none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); -static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags, +static herr_t H5S__none_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); +static herr_t H5S__none_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); -static herr_t H5S_none_release(H5S_t *space); -static htri_t H5S_none_is_valid(const H5S_t *space); -static hssize_t H5S_none_serial_size(const H5S_t *space); -static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p); -static herr_t H5S_none_deserialize(H5S_t *space, uint32_t version, uint8_t flags, +static herr_t H5S__none_release(H5S_t *space); +static htri_t H5S__none_is_valid(const H5S_t *space); +static hssize_t H5S__none_serial_size(const H5S_t *space); +static herr_t H5S__none_serialize(const H5S_t *space, uint8_t **p); +static herr_t H5S__none_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); -static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); -static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off); +static herr_t H5S__none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); +static herr_t H5S__none_offset(const H5S_t *space, hsize_t *off); static int H5S__none_unlim_dim(const H5S_t *space); -static htri_t H5S_none_is_contiguous(const H5S_t *space); -static htri_t H5S_none_is_single(const H5S_t *space); -static htri_t H5S_none_is_regular(const H5S_t *space); -static herr_t H5S_none_adjust_u(H5S_t *space, const hsize_t *offset); -static herr_t H5S_none_project_scalar(const H5S_t *space, hsize_t *offset); -static herr_t H5S_none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); -static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); +static htri_t H5S__none_is_contiguous(const H5S_t *space); +static htri_t H5S__none_is_single(const H5S_t *space); +static htri_t H5S__none_is_regular(const H5S_t *space); +static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset); +static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); +static herr_t H5S__none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Selection iteration callbacks */ -static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); -static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); -static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter); -static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); -static herr_t H5S_none_iter_next_block(H5S_sel_iter_t *sel_iter); -static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter); +static herr_t H5S__none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); +static herr_t H5S__none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); +static hsize_t H5S__none_iter_nelmts(const H5S_sel_iter_t *iter); +static htri_t H5S__none_iter_has_next_block(const H5S_sel_iter_t *iter); +static herr_t H5S__none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S__none_iter_next_block(H5S_sel_iter_t *sel_iter); +static herr_t H5S__none_iter_release(H5S_sel_iter_t *sel_iter); + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*********************/ +/* Package Variables */ +/*********************/ /* Selection properties for "none" selections */ const H5S_select_class_t H5S_sel_none[1] = {{ H5S_SEL_NONE, /* Methods on selection */ - H5S_none_copy, - H5S_none_get_seq_list, - H5S_none_release, - H5S_none_is_valid, - H5S_none_serial_size, - H5S_none_serialize, - H5S_none_deserialize, - H5S_none_bounds, - H5S_none_offset, + H5S__none_copy, + H5S__none_get_seq_list, + H5S__none_release, + H5S__none_is_valid, + H5S__none_serial_size, + H5S__none_serialize, + H5S__none_deserialize, + H5S__none_bounds, + H5S__none_offset, H5S__none_unlim_dim, NULL, - H5S_none_is_contiguous, - H5S_none_is_single, - H5S_none_is_regular, - H5S_none_adjust_u, - H5S_none_project_scalar, - H5S_none_project_simple, - H5S_none_iter_init, + H5S__none_is_contiguous, + H5S__none_is_single, + H5S__none_is_regular, + H5S__none_adjust_u, + H5S__none_project_scalar, + H5S__none_project_simple, + H5S__none_iter_init, }}; + +/*******************/ +/* Local Variables */ +/*******************/ + /* Iteration properties for "none" selections */ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{ H5S_SEL_NONE, /* Methods on selection iterator */ - H5S_none_iter_coords, - H5S_none_iter_block, - H5S_none_iter_nelmts, - H5S_none_iter_has_next_block, - H5S_none_iter_next, - H5S_none_iter_next_block, - H5S_none_iter_release, + H5S__none_iter_coords, + H5S__none_iter_block, + H5S__none_iter_nelmts, + H5S__none_iter_has_next_block, + H5S__none_iter_next, + H5S__none_iter_next_block, + H5S__none_iter_release, }}; + /*------------------------------------------------------------------------- - * Function: H5S_none_iter_init + * Function: H5S__none_iter_init * * Purpose: Initializes iteration information for "none" selection. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space) +H5S__none_iter_init(H5S_sel_iter_t *iter, const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ - HDassert(space && H5S_SEL_NONE==H5S_GET_SELECT_TYPE(space)); + HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); HDassert(iter); /* Initialize type of selection iterator */ iter->type = H5S_sel_iter_none; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_none_iter_init() */ +} /* end H5S__none_iter_init() */ /*------------------------------------------------------------------------- - * Function: H5S_none_iter_coords + * Function: H5S__none_iter_coords * * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5S_none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *coords) +H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, + hsize_t H5_ATTR_UNUSED *coords) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); HDassert(coords); FUNC_LEAVE_NOAPI(FAIL) -} /* H5S_none_iter_coords() */ +} /* end H5S__none_iter_coords() */ /*------------------------------------------------------------------------- - * Function: H5S_none_iter_block + * Function: H5S__none_iter_block * * Purpose: Retrieve the current block of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Monday, June 2, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end) +H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, + hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); @@ -185,42 +216,40 @@ H5S_none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_U HDassert(end); FUNC_LEAVE_NOAPI(FAIL) -} /* H5S_none_iter_block() */ +} /* end H5S__none_iter_block() */ /*------------------------------------------------------------------------- - * Function: H5S_none_iter_nelmts + * Function: H5S__none_iter_nelmts * * Purpose: Return number of elements left to process in iterator * - * Return: non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t -H5S_none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) +H5S__none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); FUNC_LEAVE_NOAPI(0) -} /* H5S_none_iter_nelmts() */ +} /* end H5S__none_iter_nelmts() */ /*-------------------------------------------------------------------------- NAME - H5S_none_iter_has_next_block + H5S__none_iter_has_next_block PURPOSE Check if there is another block left in the current iterator USAGE - htri_t H5S_none_iter_has_next_block(iter) + htri_t H5S__none_iter_has_next_block(iter) const H5S_sel_iter_t *iter; IN: Pointer to selection iterator RETURNS Non-negative (TRUE/FALSE) on success/Negative on failure @@ -232,24 +261,24 @@ H5S_none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) +H5S__none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); FUNC_LEAVE_NOAPI(FAIL) -} /* H5S_none_iter_has_next_block() */ +} /* end H5S__none_iter_has_next_block() */ /*-------------------------------------------------------------------------- NAME - H5S_none_iter_next + H5S__none_iter_next PURPOSE Increment selection iterator USAGE - herr_t H5S_none_iter_next(iter, nelem) + herr_t H5S__none_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator size_t nelem; IN: Number of elements to advance by RETURNS @@ -262,25 +291,25 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem) +H5S__none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); - HDassert(nelem>0); + HDassert(nelem > 0); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_none_iter_next() */ +} /* end H5S__none_iter_next() */ /*-------------------------------------------------------------------------- NAME - H5S_none_iter_next_block + H5S__none_iter_next_block PURPOSE Increment selection iterator to next block USAGE - herr_t H5S_none_iter_next(iter) + herr_t H5S__none_iter_next(iter) H5S_sel_iter_t *iter; IN: Pointer to selection iterator RETURNS Non-negative on success/Negative on failure @@ -292,24 +321,24 @@ H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED ne REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter) +H5S__none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); FUNC_LEAVE_NOAPI(FAIL) -} /* H5S_none_iter_next_block() */ +} /* end H5S__none_iter_next_block() */ /*-------------------------------------------------------------------------- NAME - H5S_none_iter_release + H5S__none_iter_release PURPOSE Release "none" selection iterator information for a dataspace USAGE - herr_t H5S_none_iter_release(iter) + herr_t H5S__none_iter_release(iter) H5S_sel_iter_t *iter; IN: Pointer to selection iterator RETURNS Non-negative on success/Negative on failure @@ -321,24 +350,24 @@ H5S_none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter) +H5S__none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_none_iter_release() */ +} /* end H5S__none_iter_release() */ /*-------------------------------------------------------------------------- NAME - H5S_none_release + H5S__none_release PURPOSE Release none selection information for a dataspace USAGE - herr_t H5S_none_release(space) + herr_t H5S__none_release(space) H5S_t *space; IN: Pointer to dataspace RETURNS Non-negative on success/Negative on failure @@ -350,26 +379,27 @@ H5S_none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_release(H5S_t H5_ATTR_UNUSED * space) +H5S__none_release(H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_none_release() */ +} /* end H5S__none_release() */ /*-------------------------------------------------------------------------- NAME - H5S_none_copy + H5S__none_copy PURPOSE Copy a selection from one dataspace to another USAGE - herr_t H5S_none_copy(dst, src) + herr_t H5S__none_copy(dst, src, share_selection) H5S_t *dst; OUT: Pointer to the destination dataspace H5S_t *src; IN: Pointer to the source dataspace + hbool_t; IN: Whether to share the selection between the dataspaces RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -381,9 +411,10 @@ H5S_none_release(H5S_t H5_ATTR_UNUSED * space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSED share_selection) +H5S__none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, + hbool_t H5_ATTR_UNUSED share_selection) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(src); HDassert(dst); @@ -392,17 +423,17 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE dst->select.num_elem = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5S_none_copy() */ +} /* end H5S__none_copy() */ /*-------------------------------------------------------------------------- NAME - H5S_none_is_valid + H5S__none_is_valid PURPOSE Check whether the selection fits within the extent, with the current offset defined. USAGE - htri_t H5S_none_is_valid(space); + htri_t H5S__none_is_valid(space); H5S_t *space; IN: Dataspace pointer to query RETURNS TRUE if the selection fits within the extent, FALSE if it does not and @@ -416,24 +447,24 @@ H5S_none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) +H5S__none_is_valid(const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); FUNC_LEAVE_NOAPI(TRUE) -} /* end H5S_none_is_valid() */ +} /* end H5S__none_is_valid() */ /*-------------------------------------------------------------------------- NAME - H5S_none_serial_size + H5S__none_serial_size PURPOSE Determine the number of bytes needed to store the serialized "none" selection information. USAGE - hssize_t H5S_none_serial_size(space) + hssize_t H5S__none_serial_size(space) H5S_t *space; IN: Dataspace pointer to query RETURNS The number of bytes required on success, negative on an error. @@ -446,9 +477,9 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) +H5S__none_serial_size(const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); @@ -457,16 +488,16 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) * <length (4 bytes)> = 16 bytes */ FUNC_LEAVE_NOAPI(16) -} /* end H5S_none_serial_size() */ +} /* end H5S__none_serial_size() */ /*-------------------------------------------------------------------------- NAME - H5S_none_serialize + H5S__none_serialize PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_none_serialize(space, p) + herr_t H5S__none_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of @@ -482,11 +513,11 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_serialize(const H5S_t *space, uint8_t **p) +H5S__none_serialize(const H5S_t *space, uint8_t **p) { uint8_t *pp = (*p); /* Local pointer for decoding */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space); @@ -503,16 +534,16 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p) *p = pp; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_none_serialize() */ +} /* end H5S__none_serialize() */ /*-------------------------------------------------------------------------- NAME - H5S_none_deserialize + H5S__none_deserialize PURPOSE Deserialize the current selection from a user-provided buffer. USAGE - herr_t H5S_none_deserialize(space, version, flags, p) + herr_t H5S__none_deserialize(space, version, flags, p) H5S_t *space; IN/OUT: Dataspace pointer to place selection into uint32_t version IN: Selection version @@ -531,12 +562,12 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, - const uint8_t H5_ATTR_UNUSED **p) +H5S__none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, + uint8_t H5_ATTR_UNUSED flags, const uint8_t H5_ATTR_UNUSED **p) { herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(space); HDassert(p); @@ -548,16 +579,16 @@ H5S_none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_A done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_none_deserialize() */ +} /* end H5S__none_deserialize() */ /*-------------------------------------------------------------------------- NAME - H5S_none_bounds + H5S__none_bounds PURPOSE Gets the bounding box containing the selection. USAGE - herr_t H5S_none_bounds(space, start, end) + herr_t H5S__none_bounds(space, start, end) H5S_t *space; IN: Dataspace pointer of selection to query hsize_t *start; OUT: Starting coordinate of bounding box hsize_t *end; OUT: Opposite coordinate of bounding box @@ -577,25 +608,26 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start, hsize_t H5_ATTR_UNUSED *end) +H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start, + hsize_t H5_ATTR_UNUSED *end) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); HDassert(start); HDassert(end); FUNC_LEAVE_NOAPI(FAIL) -} /* H5Sget_none_bounds() */ +} /* end H5Sget_none_bounds() */ /*-------------------------------------------------------------------------- NAME - H5S_none_offset + H5S__none_offset PURPOSE Gets the linear offset of the first element for the selection. USAGE - herr_t H5S_none_offset(space, offset) + herr_t H5S__none_offset(space, offset) const H5S_t *space; IN: Dataspace pointer of selection to query hsize_t *offset; OUT: Linear offset of first element in selection RETURNS @@ -610,15 +642,15 @@ H5S_none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *start REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset) +H5S__none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); HDassert(offset); FUNC_LEAVE_NOAPI(FAIL) -} /* H5S_none_offset() */ +} /* end H5S__none_offset() */ /*-------------------------------------------------------------------------- @@ -651,11 +683,11 @@ H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) /*-------------------------------------------------------------------------- NAME - H5S_none_is_contiguous + H5S__none_is_contiguous PURPOSE Check if a "none" selection is contiguous within the dataspace extent. USAGE - htri_t H5S_none_is_contiguous(space) + htri_t H5S__none_is_contiguous(space) H5S_t *space; IN: Dataspace pointer to check RETURNS TRUE/FALSE/FAIL @@ -668,23 +700,23 @@ H5S__none_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space) +H5S__none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); FUNC_LEAVE_NOAPI(FALSE) -} /* H5S_none_is_contiguous() */ +} /* end H5S__none_is_contiguous() */ /*-------------------------------------------------------------------------- NAME - H5S_none_is_single + H5S__none_is_single PURPOSE Check if a "none" selection is a single block within the dataspace extent. USAGE - htri_t H5S_none_is_single(space) + htri_t H5S__none_is_single(space) H5S_t *space; IN: Dataspace pointer to check RETURNS TRUE/FALSE/FAIL @@ -697,23 +729,23 @@ H5S_none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_none_is_single(const H5S_t H5_ATTR_UNUSED *space) +H5S__none_is_single(const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); FUNC_LEAVE_NOAPI(FALSE) -} /* H5S_none_is_single() */ +} /* end H5S__none_is_single() */ /*-------------------------------------------------------------------------- NAME - H5S_none_is_regular + H5S__none_is_regular PURPOSE Check if a "none" selection is "regular" USAGE - htri_t H5S_none_is_regular(space) + htri_t H5S__none_is_regular(space) const H5S_t *space; IN: Dataspace pointer to check RETURNS TRUE/FALSE/FAIL @@ -727,15 +759,15 @@ H5S_none_is_single(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) +H5S__none_is_regular(const H5S_t H5_ATTR_UNUSED *space) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space); FUNC_LEAVE_NOAPI(TRUE) -} /* H5S_none_is_regular() */ +} /* end H5S__none_is_regular() */ /*-------------------------------------------------------------------------- @@ -744,7 +776,7 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) PURPOSE Adjust an "none" selection by subtracting an offset USAGE - herr_t H5S_none_adjust_u(space, offset) + herr_t H5S__none_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS @@ -757,24 +789,24 @@ H5S_none_is_regular(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset) +H5S__none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *offset) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space); HDassert(offset); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_none_adjust_u() */ +} /* end H5S__none_adjust_u() */ /*------------------------------------------------------------------------- - * Function: H5S_none_project_scalar + * Function: H5S__none_project_scalar * * Purpose: Projects a 'none' selection into a scalar dataspace * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -782,25 +814,25 @@ H5S_none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off *------------------------------------------------------------------------- */ static herr_t -H5S_none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset) +H5S__none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offset) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); HDassert(offset); FUNC_LEAVE_NOAPI(FAIL) -} /* H5S_none_project_scalar() */ +} /* end H5S__none_project_scalar() */ /*------------------------------------------------------------------------- - * Function: H5S_none_project_simple + * Function: H5S__none_project_simple * * Purpose: Projects an 'none' selection onto/into a simple dataspace * of a different rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -808,11 +840,12 @@ H5S_none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSE *------------------------------------------------------------------------- */ static herr_t -H5S_none_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset) +H5S__none_project_simple(const H5S_t H5_ATTR_UNUSED *base_space, + H5S_t *new_space, hsize_t H5_ATTR_UNUSED *offset) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(base_space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(base_space)); @@ -825,7 +858,7 @@ H5S_none_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offs done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_none_project_simple() */ +} /* end H5S__none_project_simple() */ /*-------------------------------------------------------------------------- @@ -867,7 +900,7 @@ H5S_select_none(H5S_t *space) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_none() */ +} /* end H5S_select_none() */ /*-------------------------------------------------------------------------- @@ -906,16 +939,16 @@ H5Sselect_none(hid_t spaceid) done: FUNC_LEAVE_API(ret_value) -} /* H5Sselect_none() */ +} /* end H5Sselect_none() */ /*-------------------------------------------------------------------------- NAME - H5S_none_get_seq_list + H5S__none_get_seq_list PURPOSE Create a list of offsets & lengths for a selection USAGE - herr_t H5S_none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len) + herr_t H5S__none_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len) H5S_t *space; IN: Dataspace containing selection to use. unsigned flags; IN: Flags for extra information about operation H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last @@ -941,11 +974,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter, +H5S__none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED flags, H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED maxseq, size_t H5_ATTR_UNUSED maxelem, size_t *nseq, size_t *nelem, hsize_t H5_ATTR_UNUSED *off, size_t H5_ATTR_UNUSED *len) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space); @@ -964,5 +997,5 @@ H5S_none_get_seq_list(const H5S_t H5_ATTR_UNUSED *space, unsigned H5_ATTR_UNUSED *nelem = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5S_none_get_seq_list() */ +} /* end H5S__none_get_seq_list() */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 9ad97dc..1fbfa35 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -26,8 +26,12 @@ #ifndef _H5Spkg_H #define _H5Spkg_H +/* Get package's private header */ #include "H5Sprivate.h" +/* Other private headers needed by this file */ +#include "H5Oprivate.h" /* Object headers */ + /* Flags to indicate special dataspace features are active */ #define H5S_VALID_MAX 0x01 #define H5S_VALID_PERM 0x02 @@ -77,6 +81,7 @@ struct H5S_extent_t { /* * Dataspace selection information */ + /* Node in point selection list (typedef'd in H5Sprivate.h) */ struct H5S_pnt_node_t { hsize_t *pnt; /* Pointer to a selected point */ @@ -88,9 +93,9 @@ typedef struct { H5S_pnt_node_t *head; /* Pointer to head of point list */ } H5S_pnt_list_t; -/* Information about new-style hyperslab spans */ +/* Information about hyperslab spans */ -/* Information a particular hyperslab span */ +/* Information a particular hyperslab span (typedef'd in H5Sprivate.h) */ struct H5S_hyper_span_t { hsize_t low, high; /* Low & high bounds of span */ hsize_t nelem; /* Number of elements in span (only needed during I/O) */ @@ -217,9 +222,11 @@ struct H5S_t { /* Selection iteration methods */ /* Method to retrieve the current coordinates of iterator for current selection */ -typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hsize_t *coords); +typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, + hsize_t *coords); /* Method to retrieve the current block of iterator for current selection */ -typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); +typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, + hsize_t *start, hsize_t *end); /* Method to determine number of elements left in iterator for current selection */ typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter); /* Method to determine if there are more blocks left in the current selection */ @@ -269,8 +276,8 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_point[1]; H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS]; /* Extent functions */ -H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent); -H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, +H5_DLL herr_t H5S__extent_release(H5S_extent_t *extent); +H5_DLL herr_t H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max); /* Operations on selections */ @@ -280,8 +287,8 @@ H5_DLL herr_t H5S__hyper_subtract(H5S_t *space, H5S_t *subtract_space); /* Testing functions */ #ifdef H5S_TESTING -H5_DLL htri_t H5S_select_shape_same_test(hid_t sid1, hid_t sid2); -H5_DLL htri_t H5S_get_rebuild_status_test(hid_t space_id); +H5_DLL htri_t H5S__select_shape_same_test(hid_t sid1, hid_t sid2); +H5_DLL htri_t H5S__get_rebuild_status_test(hid_t space_id); #endif /* H5S_TESTING */ #endif /*_H5Spkg_H*/ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index aea7d5c..11cf448 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -18,87 +18,124 @@ * Purpose: Point selection dataspace I/O functions. */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5Smodule.h" /* This source code file is part of the H5S module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* ID Functions */ -#include "H5MMprivate.h" /* Memory Management functions */ -#include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5VMprivate.h" /* Vector functions */ + + +/****************/ +/* Local Macros */ +/****************/ + -/* Static function prototypes */ +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ /* Selection callbacks */ -static herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); -static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, +static herr_t H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); +static herr_t H5S__point_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); -static herr_t H5S_point_release(H5S_t *space); -static htri_t H5S_point_is_valid(const H5S_t *space); -static hssize_t H5S_point_serial_size(const H5S_t *space); -static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p); -static herr_t H5S_point_deserialize(H5S_t *space, uint32_t version, uint8_t flags, +static herr_t H5S__point_release(H5S_t *space); +static htri_t H5S__point_is_valid(const H5S_t *space); +static hssize_t H5S__point_serial_size(const H5S_t *space); +static herr_t H5S__point_serialize(const H5S_t *space, uint8_t **p); +static herr_t H5S__point_deserialize(H5S_t *space, uint32_t version, uint8_t flags, const uint8_t **p); -static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); -static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off); +static herr_t H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); +static herr_t H5S__point_offset(const H5S_t *space, hsize_t *off); static int H5S__point_unlim_dim(const H5S_t *space); -static htri_t H5S_point_is_contiguous(const H5S_t *space); -static htri_t H5S_point_is_single(const H5S_t *space); -static htri_t H5S_point_is_regular(const H5S_t *space); -static herr_t H5S_point_adjust_u(H5S_t *space, const hsize_t *offset); -static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset); -static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); -static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); +static htri_t H5S__point_is_contiguous(const H5S_t *space); +static htri_t H5S__point_is_single(const H5S_t *space); +static htri_t H5S__point_is_regular(const H5S_t *space); +static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset); +static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset); +static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space, + hsize_t *offset); +static herr_t H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Selection iteration callbacks */ -static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); -static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); -static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter); -static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); -static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *sel_iter); -static herr_t H5S_point_iter_release(H5S_sel_iter_t *sel_iter); +static herr_t H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); +static herr_t H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, + hsize_t *end); +static hsize_t H5S__point_iter_nelmts(const H5S_sel_iter_t *iter); +static htri_t H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter); +static herr_t H5S__point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); +static herr_t H5S__point_iter_next_block(H5S_sel_iter_t *sel_iter); +static herr_t H5S__point_iter_release(H5S_sel_iter_t *sel_iter); + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*********************/ +/* Package Variables */ +/*********************/ /* Selection properties for point selections */ const H5S_select_class_t H5S_sel_point[1] = {{ H5S_SEL_POINTS, /* Methods on selection */ - H5S_point_copy, - H5S_point_get_seq_list, - H5S_point_release, - H5S_point_is_valid, - H5S_point_serial_size, - H5S_point_serialize, - H5S_point_deserialize, - H5S_point_bounds, - H5S_point_offset, + H5S__point_copy, + H5S__point_get_seq_list, + H5S__point_release, + H5S__point_is_valid, + H5S__point_serial_size, + H5S__point_serialize, + H5S__point_deserialize, + H5S__point_bounds, + H5S__point_offset, H5S__point_unlim_dim, NULL, - H5S_point_is_contiguous, - H5S_point_is_single, - H5S_point_is_regular, - H5S_point_adjust_u, - H5S_point_project_scalar, - H5S_point_project_simple, - H5S_point_iter_init, + H5S__point_is_contiguous, + H5S__point_is_single, + H5S__point_is_regular, + H5S__point_adjust_u, + H5S__point_project_scalar, + H5S__point_project_simple, + H5S__point_iter_init, }}; + +/*******************/ +/* Local Variables */ +/*******************/ + /* Iteration properties for point selections */ static const H5S_sel_iter_class_t H5S_sel_iter_point[1] = {{ H5S_SEL_POINTS, /* Methods on selection iterator */ - H5S_point_iter_coords, - H5S_point_iter_block, - H5S_point_iter_nelmts, - H5S_point_iter_has_next_block, - H5S_point_iter_next, - H5S_point_iter_next_block, - H5S_point_iter_release, + H5S__point_iter_coords, + H5S__point_iter_block, + H5S__point_iter_nelmts, + H5S__point_iter_has_next_block, + H5S__point_iter_next, + H5S__point_iter_next_block, + H5S__point_iter_release, }}; /* Declare a free list to manage the H5S_pnt_node_t struct */ @@ -107,93 +144,88 @@ H5FL_DEFINE_STATIC(H5S_pnt_node_t); /* Declare a free list to manage the H5S_pnt_list_t struct */ H5FL_DEFINE_STATIC(H5S_pnt_list_t); + /*------------------------------------------------------------------------- - * Function: H5S_point_iter_init + * Function: H5S__point_iter_init * * Purpose: Initializes iteration information for point selection. * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) +H5S__point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ - HDassert(space && H5S_SEL_POINTS==H5S_GET_SELECT_TYPE(space)); + HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); HDassert(iter); /* Initialize the number of points to iterate over */ - iter->elmt_left=space->select.num_elem; + iter->elmt_left = space->select.num_elem; /* Start at the head of the list of points */ iter->u.pnt.curr=space->select.sel_info.pnt_lst->head; /* Initialize type of selection iterator */ - iter->type=H5S_sel_iter_point; + iter->type = H5S_sel_iter_point; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_iter_init() */ +} /* end H5S__point_iter_init() */ /*------------------------------------------------------------------------- - * Function: H5S_point_iter_coords + * Function: H5S__point_iter_coords * * Purpose: Retrieve the current coordinates of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Tuesday, April 22, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) +H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); HDassert(coords); /* Copy the offset of the current point */ - HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); + HDmemcpy(coords, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_iter_coords() */ +} /* end H5S__point_iter_coords() */ /*------------------------------------------------------------------------- - * Function: H5S_point_iter_block + * Function: H5S__point_iter_block * * Purpose: Retrieve the current block of iterator for current * selection * - * Return: non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * * Programmer: Quincey Koziol * Monday, June 2, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) +H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); @@ -201,46 +233,44 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) HDassert(end); /* Copy the current point as a block */ - HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); - HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); + HDmemcpy(start, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank); + HDmemcpy(end, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_iter_block() */ +} /* end H5S__point_iter_block() */ /*------------------------------------------------------------------------- - * Function: H5S_point_iter_nelmts + * Function: H5S__point_iter_nelmts * * Purpose: Return number of elements left to process in iterator * - * Return: non-negative number of elements on success, zero on failure + * Return: Non-negative number of elements on success, zero on failure * * Programmer: Quincey Koziol * Tuesday, June 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t -H5S_point_iter_nelmts (const H5S_sel_iter_t *iter) +H5S__point_iter_nelmts(const H5S_sel_iter_t *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); FUNC_LEAVE_NOAPI(iter->elmt_left) -} /* H5S_point_iter_nelmts() */ +} /* end H5S__point_iter_nelmts() */ /*-------------------------------------------------------------------------- NAME - H5S_point_iter_has_next_block + H5S__point_iter_has_next_block PURPOSE Check if there is another block left in the current iterator USAGE - htri_t H5S_point_iter_has_next_block(iter) + htri_t H5S__point_iter_has_next_block(iter) const H5S_sel_iter_t *iter; IN: Pointer to selection iterator RETURNS Non-negative (TRUE/FALSE) on success/Negative on failure @@ -252,31 +282,31 @@ H5S_point_iter_nelmts (const H5S_sel_iter_t *iter) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter) +H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter) { - htri_t ret_value=TRUE; /* Return value */ + htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); /* Check if there is another point in the list */ - if(iter->u.pnt.curr->next==NULL) + if(iter->u.pnt.curr->next == NULL) HGOTO_DONE(FALSE); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_iter_has_next_block() */ +} /* end H5S__point_iter_has_next_block() */ /*-------------------------------------------------------------------------- NAME - H5S_point_iter_next + H5S__point_iter_next PURPOSE Increment selection iterator USAGE - herr_t H5S_point_iter_next(iter, nelem) + herr_t H5S__point_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator size_t nelem; IN: Number of elements to advance by RETURNS @@ -289,31 +319,31 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) +H5S__point_iter_next(H5S_sel_iter_t *iter, size_t nelem) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); - HDassert(nelem>0); + HDassert(nelem > 0); /* Increment the iterator */ - while(nelem>0) { - iter->u.pnt.curr=iter->u.pnt.curr->next; + while(nelem > 0) { + iter->u.pnt.curr = iter->u.pnt.curr->next; nelem--; } /* end while */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_iter_next() */ +} /* end H5S__point_iter_next() */ /*-------------------------------------------------------------------------- NAME - H5S_point_iter_next_block + H5S__point_iter_next_block PURPOSE Increment selection iterator to next block USAGE - herr_t H5S_point_iter_next_block(iter) + herr_t H5S__point_iter_next_block(iter) H5S_sel_iter_t *iter; IN: Pointer to selection iterator RETURNS Non-negative on success/Negative on failure @@ -325,27 +355,27 @@ H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_iter_next_block(H5S_sel_iter_t *iter) +H5S__point_iter_next_block(H5S_sel_iter_t *iter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); /* Increment the iterator */ - iter->u.pnt.curr=iter->u.pnt.curr->next; + iter->u.pnt.curr = iter->u.pnt.curr->next; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_iter_next_block() */ +} /* end H5S__point_iter_next_block() */ /*-------------------------------------------------------------------------- NAME - H5S_point_iter_release + H5S__point_iter_release PURPOSE Release point selection iterator information for a dataspace USAGE - herr_t H5S_point_iter_release(iter) + herr_t H5S__point_iter_release(iter) H5S_sel_iter_t *iter; IN: Pointer to selection iterator RETURNS Non-negative on success/Negative on failure @@ -357,24 +387,24 @@ H5S_point_iter_next_block(H5S_sel_iter_t *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter) +H5S__point_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED * iter) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(iter); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_iter_release() */ +} /* end H5S__point_iter_release() */ /*-------------------------------------------------------------------------- NAME - H5S_point_add + H5S__point_add PURPOSE Add a series of elements to a point selection USAGE - herr_t H5S_point_add(space, num_elem, coord) + herr_t H5S__point_add(space, num_elem, coord) H5S_t *space; IN: Dataspace of selection to modify size_t num_elem; IN: Number of elements in COORD array. const hsize_t *coord[]; IN: The location of each element selected @@ -388,14 +418,15 @@ H5S_point_iter_release (H5S_sel_iter_t H5_ATTR_UNUSED * iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) +H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) { H5S_pnt_node_t *top = NULL, *curr = NULL, *new_node = NULL; /* Point selection nodes */ unsigned u; /* Counter */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity checks */ HDassert(space); HDassert(num_elem > 0); HDassert(coord); @@ -469,16 +500,16 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_add() */ +} /* end H5S__point_add() */ /*-------------------------------------------------------------------------- NAME - H5S_point_release + H5S__point_release PURPOSE Release point selection information for a dataspace USAGE - herr_t H5S_point_release(space) + herr_t H5S__point_release(space) H5S_t *space; IN: Pointer to dataspace RETURNS Non-negative on success/Negative on failure @@ -490,7 +521,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_release (H5S_t *space) +H5S__point_release(H5S_t *space) { H5S_pnt_node_t *curr, *next; /* Point selection nodes */ @@ -515,7 +546,7 @@ H5S_point_release (H5S_t *space) space->select.num_elem = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_release() */ +} /* end H5S__point_release() */ /*-------------------------------------------------------------------------- @@ -539,10 +570,7 @@ H5S_point_release (H5S_t *space) array elements are iterated through when I/O is performed. Duplicate coordinates are not checked for. The selection operator, OP, determines how the new selection is to be combined with the existing selection for - the dataspace. Currently, only H5S_SELECT_SET is supported, which replaces - the existing selection with the one defined in this call. When operators - other than H5S_SELECT_SET are used to combine a new selection with an - existing selection, the selection ordering is reset to 'C' array ordering. + the dataspace. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -552,9 +580,9 @@ herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) { - herr_t ret_value = SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(space); @@ -573,7 +601,7 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information") /* Add points to selection */ - if(H5S_point_add(space, op, num_elem, coord) < 0) + if(H5S__point_add(space, op, num_elem, coord) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements") /* Set selection type */ @@ -581,18 +609,19 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_elements() */ +} /* end H5S_select_elements() */ /*-------------------------------------------------------------------------- NAME - H5S_point_copy + H5S__point_copy PURPOSE Copy a selection from one dataspace to another USAGE - herr_t H5S_point_copy(dst, src) + herr_t H5S__point_copy(dst, src, share_selection) H5S_t *dst; OUT: Pointer to the destination dataspace H5S_t *src; IN: Pointer to the source dataspace + hbool_t share_selection; IN: Whether to share the selection between the dataspaces RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -604,12 +633,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection) +H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selection) { H5S_pnt_node_t *curr, *new_node, *new_tail; /* Point information nodes */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(src); HDassert(dst); @@ -660,18 +689,18 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_point_copy() */ +} /* end H5S__point_copy() */ /*-------------------------------------------------------------------------- NAME - H5S_point_is_valid + H5S__point_is_valid PURPOSE Check whether the selection fits within the extent, with the current offset defined. USAGE - htri_t H5S_point_is_valid(space); - H5S_t *space; IN: Dataspace pointer to query + htri_t H5S__point_is_valid(space); + const H5S_t *space; IN: Dataspace pointer to query RETURNS TRUE if the selection fits within the extent, FALSE if it does not and Negative on an error. @@ -684,13 +713,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_point_is_valid (const H5S_t *space) +H5S__point_is_valid(const H5S_t *space) { H5S_pnt_node_t *curr; /* Point information nodes */ unsigned u; /* Counter */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); @@ -711,7 +740,7 @@ H5S_point_is_valid (const H5S_t *space) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_point_is_valid() */ +} /* end H5S__point_is_valid() */ /*-------------------------------------------------------------------------- @@ -750,18 +779,18 @@ H5Sget_select_elem_npoints(hid_t spaceid) done: FUNC_LEAVE_API(ret_value) -} /* H5Sget_select_elem_npoints() */ +} /* end H5Sget_select_elem_npoints() */ /*-------------------------------------------------------------------------- NAME - H5S_point_serial_size + H5S__point_serial_size PURPOSE Determine the number of bytes needed to store the serialized point selection information. USAGE - hssize_t H5S_point_serial_size(space) - H5S_t *space; IN: Dataspace pointer to query + hssize_t H5S__point_serial_size(space) + const H5S_t *space; IN: Dataspace pointer to query RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -773,11 +802,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_point_serial_size (const H5S_t *space) +H5S__point_serial_size(const H5S_t *space) { hssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); @@ -792,16 +821,16 @@ H5S_point_serial_size (const H5S_t *space) ret_value += (4 * space->extent.rank) * (hssize_t)H5S_GET_SELECT_NPOINTS(space); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_point_serial_size() */ +} /* end H5S__point_serial_size() */ /*-------------------------------------------------------------------------- NAME - H5S_point_serialize + H5S__point_serialize PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_point_serialize(space, p) + herr_t H5S__point_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of @@ -817,15 +846,15 @@ H5S_point_serial_size (const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_serialize (const H5S_t *space, uint8_t **p) +H5S__point_serialize(const H5S_t *space, uint8_t **p) { H5S_pnt_node_t *curr; /* Point information nodes */ uint8_t *pp = (*p); /* Local pointer for decoding */ - uint8_t *lenp; /* pointer to length location for later storage */ - uint32_t len=0; /* number of bytes used */ - unsigned u; /* local counting variable */ + uint8_t *lenp; /* Pointer to length location for later storage */ + uint32_t len = 0; /* Number of bytes used */ + unsigned u; /* Local counting variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space); @@ -841,23 +870,23 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) /* Encode number of dimensions */ UINT32ENCODE(pp, (uint32_t)space->extent.rank); - len+=4; + len += 4; /* Encode number of elements */ UINT32ENCODE(pp, (uint32_t)space->select.num_elem); - len+=4; + len += 4; /* Encode each point in selection */ - curr=space->select.sel_info.pnt_lst->head; - while(curr!=NULL) { + curr = space->select.sel_info.pnt_lst->head; + while(curr != NULL) { /* Add 4 bytes times the rank for each element selected */ - len+=4*space->extent.rank; + len += 4 * space->extent.rank; /* Encode each point */ - for(u=0; u<space->extent.rank; u++) + for(u = 0; u < space->extent.rank; u++) UINT32ENCODE(pp, (uint32_t)curr->pnt[u]); - curr=curr->next; + curr = curr->next; } /* end while */ /* Encode length */ @@ -867,16 +896,16 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) *p = pp; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_serialize() */ +} /* end H5S__point_serialize() */ /*-------------------------------------------------------------------------- NAME - H5S_point_deserialize + H5S__point_deserialize PURPOSE Deserialize the current selection from a user-provided buffer. USAGE - herr_t H5S_point_deserialize(space, p) + herr_t H5S__point_deserialize(space, p) H5S_t *space; IN/OUT: Dataspace pointer to place selection into uint32_t version IN: Selection version @@ -895,10 +924,9 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, +H5S__point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, const uint8_t **p) { - H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */ hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */ const uint8_t *pp = (*p); /* Local pointer for decoding */ size_t num_elem = 0; /* Number of elements in selection */ @@ -906,7 +934,7 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ unsigned i, j; /* local counting variables */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -928,7 +956,7 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ UINT32DECODE(pp, *tcoord); /* Select points */ - if(H5S_select_elements(space, op, num_elem, (const hsize_t *)coord) < 0) + if(H5S_select_elements(space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") /* Update decoding pointer */ @@ -940,17 +968,17 @@ done: H5MM_xfree(coord); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_deserialize() */ +} /* end H5S__point_deserialize() */ /*-------------------------------------------------------------------------- NAME - H5S_get_select_elem_pointlist + H5S__get_select_elem_pointlist PURPOSE Get the list of element points currently selected USAGE - herr_t H5S_get_select_elem_pointlist(space, hsize_t *buf) - H5S_t *space; IN: Dataspace pointer of selection to query + herr_t H5S__get_select_elem_pointlist(space, hsize_t *buf) + const H5S_t *space; IN: Dataspace pointer of selection to query hsize_t startpoint; IN: Element point to start with hsize_t numpoints; IN: Number of element points to get hsize_t *buf; OUT: List of element points selected @@ -973,12 +1001,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf) +H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, + hsize_t numpoints, hsize_t *buf) { H5S_pnt_node_t *node; /* Point node */ unsigned rank; /* Dataspace rank */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); HDassert(buf); @@ -1004,7 +1033,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint } /* end while */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_get_select_elem_pointlist() */ +} /* end H5S__get_select_elem_pointlist() */ /*-------------------------------------------------------------------------- @@ -1054,20 +1083,20 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection") - ret_value = H5S_get_select_elem_pointlist(space, startpoint, numpoints, buf); + ret_value = H5S__get_select_elem_pointlist(space, startpoint, numpoints, buf); done: FUNC_LEAVE_API(ret_value) -} /* H5Sget_select_elem_pointlist() */ +} /* end H5Sget_select_elem_pointlist() */ /*-------------------------------------------------------------------------- NAME - H5S_point_bounds + H5S__point_bounds PURPOSE Gets the bounding box containing the selection. USAGE - herr_t H5S_point_bounds(space, start, end) + herr_t H5S__point_bounds(space, start, end) H5S_t *space; IN: Dataspace pointer of selection to query hsize_t *start; OUT: Starting coordinate of bounding box hsize_t *end; OUT: Opposite coordinate of bounding box @@ -1088,14 +1117,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) +H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { H5S_pnt_node_t *node; /* Point node */ unsigned rank; /* Dataspace rank */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(space); @@ -1129,16 +1158,16 @@ H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_bounds() */ +} /* end H5S__point_bounds() */ /*-------------------------------------------------------------------------- NAME - H5S_point_offset + H5S__point_offset PURPOSE Gets the linear offset of the first element for the selection. USAGE - herr_t H5S_point_offset(space, offset) + herr_t H5S__point_offset(space, offset) const H5S_t *space; IN: Dataspace pointer of selection to query hsize_t *offset; OUT: Linear offset of first element in selection RETURNS @@ -1153,7 +1182,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_offset(const H5S_t *space, hsize_t *offset) +H5S__point_offset(const H5S_t *space, hsize_t *offset) { const hsize_t *pnt; /* Pointer to a selected point's coordinates */ const hssize_t *sel_offset; /* Pointer to the selection's offset */ @@ -1162,7 +1191,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset) int i; /* index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC HDassert(space); HDassert(offset); @@ -1193,7 +1222,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_offset() */ +} /* end H5S__point_offset() */ /*-------------------------------------------------------------------------- @@ -1227,11 +1256,11 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) /*-------------------------------------------------------------------------- NAME - H5S_point_is_contiguous + H5S__point_is_contiguous PURPOSE Check if a point selection is contiguous within the dataspace extent. USAGE - htri_t H5S_point_is_contiguous(space) + htri_t H5S__point_is_contiguous(space) H5S_t *space; IN: Dataspace pointer to check RETURNS TRUE/FALSE/FAIL @@ -1247,31 +1276,31 @@ H5S__point_unlim_dim(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_point_is_contiguous(const H5S_t *space) +H5S__point_is_contiguous(const H5S_t *space) { htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); /* One point is definitely contiguous */ - if(space->select.num_elem==1) - ret_value=TRUE; + if(space->select.num_elem == 1) + ret_value = TRUE; else /* More than one point might be contiguous, but it's complex to check and we don't need it right now */ - ret_value=FALSE; + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_is_contiguous() */ +} /* end H5S__point_is_contiguous() */ /*-------------------------------------------------------------------------- NAME - H5S_point_is_single + H5S__point_is_single PURPOSE Check if a point selection is single within the dataspace extent. USAGE - htri_t H5S_point_is_single(space) + htri_t H5S__point_is_single(space) H5S_t *space; IN: Dataspace pointer to check RETURNS TRUE/FALSE/FAIL @@ -1284,31 +1313,31 @@ H5S_point_is_contiguous(const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_point_is_single(const H5S_t *space) +H5S__point_is_single(const H5S_t *space) { htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); /* One point is definitely 'single' :-) */ - if(space->select.num_elem==1) - ret_value=TRUE; + if(space->select.num_elem == 1) + ret_value = TRUE; else - ret_value=FALSE; + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_is_single() */ +} /* end H5S__point_is_single() */ /*-------------------------------------------------------------------------- NAME - H5S_point_is_regular + H5S__point_is_regular PURPOSE Check if a point selection is "regular" USAGE - htri_t H5S_point_is_regular(space) + htri_t H5S__point_is_regular(space) const H5S_t *space; IN: Dataspace pointer to check RETURNS TRUE/FALSE/FAIL @@ -1324,32 +1353,32 @@ H5S_point_is_single(const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_point_is_regular(const H5S_t *space) +H5S__point_is_regular(const H5S_t *space) { htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(space); /* Only simple check for regular points for now... */ - if(space->select.num_elem==1) - ret_value=TRUE; + if(space->select.num_elem == 1) + ret_value = TRUE; else - ret_value=FALSE; + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_is_regular() */ +} /* end H5S__point_is_regular() */ /*-------------------------------------------------------------------------- NAME - H5S_point_adjust_u + H5S__point_adjust_u PURPOSE Adjust a "point" selection by subtracting an offset USAGE - herr_t H5S_point_adjust_u(space, offset) + herr_t H5S__point_adjust_u(space, offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hsize_t *offset; IN: Offset to subtract RETURNS @@ -1362,12 +1391,12 @@ H5S_point_is_regular(const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) +H5S__point_adjust_u(H5S_t *space, const hsize_t *offset) { H5S_pnt_node_t *node; /* Point node */ unsigned rank; /* Dataspace rank */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(space); HDassert(offset); @@ -1392,16 +1421,16 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) } /* end while */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_adjust_u() */ +} /* end H5S__point_adjust_u() */ /*------------------------------------------------------------------------- - * Function: H5S_point_project_scalar + * Function: H5S__point_project_scalar * * Purpose: Projects a single element point selection into a scalar * dataspace * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -1409,12 +1438,12 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) *------------------------------------------------------------------------- */ static herr_t -H5S_point_project_scalar(const H5S_t *space, hsize_t *offset) +H5S__point_project_scalar(const H5S_t *space, hsize_t *offset) { const H5S_pnt_node_t *node; /* Point node */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); @@ -1428,20 +1457,20 @@ H5S_point_project_scalar(const H5S_t *space, hsize_t *offset) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "point selection of one element has more than one node!") /* Calculate offset of selection in projected buffer */ - *offset = H5VM_array_offset(space->extent.rank, space->extent.size, node->pnt); + *offset = H5VM_array_offset(space->extent.rank, space->extent.size, node->pnt); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_project_scalar() */ +} /* end H5S__point_project_scalar() */ /*------------------------------------------------------------------------- - * Function: H5S_point_project_simple + * Function: H5S__point_project_simple * * Purpose: Projects a point selection onto/into a simple dataspace * of a different rank * - * Return: non-negative on success, negative on failure. + * Return: Non-negative on success, negative on failure. * * Programmer: Quincey Koziol * Sunday, July 18, 2010 @@ -1449,7 +1478,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset) +H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *offset) { const H5S_pnt_node_t *base_node; /* Point node in base space */ H5S_pnt_node_t *new_node; /* Point node in new space */ @@ -1457,7 +1486,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off unsigned rank_diff; /* Difference in ranks between spaces */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(base_space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(base_space)); @@ -1482,7 +1511,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off /* Calculate offset of selection in projected buffer */ HDmemset(block, 0, sizeof(block)); HDmemcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff); - *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block); + *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block); /* Iterate through base space's point nodes, copying the point information */ base_node = base_space->select.sel_info.pnt_lst->head; @@ -1559,7 +1588,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_project_simple() */ +} /* end H5S__point_project_simple() */ /*-------------------------------------------------------------------------- @@ -1620,16 +1649,16 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, done: FUNC_LEAVE_API(ret_value) -} /* H5Sselect_elements() */ +} /* end H5Sselect_elements() */ /*-------------------------------------------------------------------------- NAME - H5S_point_get_seq_list + H5S__point_get_seq_list PURPOSE Create a list of offsets & lengths for a selection USAGE - herr_t H5S_point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len) + herr_t H5S__point_get_seq_list(space,flags,iter,maxseq,maxelem,nseq,nelem,off,len) H5S_t *space; IN: Dataspace containing selection to use. unsigned flags; IN: Flags for extra information about operation H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last @@ -1655,14 +1684,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, +H5S__point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) { size_t io_left; /* The number of bytes left in the selection */ size_t start_io_left; /* The initial number of bytes left in the selection */ H5S_pnt_node_t *node; /* Point node */ - hsize_t dims[H5O_LAYOUT_NDIMS]; /* Total size of memory buf */ + hsize_t dims[H5S_MAX_RANK]; /* Total size of memory buf */ int ndims; /* Dimensionality of space*/ hsize_t acc; /* Coordinate accumulator */ hsize_t loc; /* Coordinate offset */ @@ -1670,7 +1699,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, int i; /* Local index variable */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(space); @@ -1758,5 +1787,5 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_point_get_seq_list() */ +} /* end H5S__point_get_seq_list() */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 32ac51a..24db889 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -17,9 +17,6 @@ #ifndef _H5Sprivate_H #define _H5Sprivate_H -/* Early typedefs to avoid circular dependencies */ -typedef struct H5S_t H5S_t; - /* Include package's public header */ #include "H5Spublic.h" @@ -30,7 +27,6 @@ typedef struct H5S_t H5S_t; #include "H5private.h" /* Generic Functions */ #include "H5Fprivate.h" /* Files */ #include "H5Gprivate.h" /* Groups */ -#include "H5Oprivate.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ @@ -68,14 +64,14 @@ typedef struct { /* Hyperslab selection iteration container */ typedef struct { /* Common fields for all hyperslab selections */ - hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */ + hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */ unsigned iter_rank; /* Rank of iterator information */ /* (This should always be the same as the dataspace - * rank, except for regular hyperslab selections in - * which there are contiguous regions in the lower - * dimensions which have been "flattened" out + * rank, except for regular hyperslab selections in + * which there are contiguous regions in the lower + * dimensions that have been "flattened") */ - hbool_t diminfo_valid; /* Whether the dimension information is valid */ + hbool_t diminfo_valid; /* Whether the dimension information is valid */ /* "Flattened" regular hyperslab selection fields */ H5S_hyper_dim_t diminfo[H5S_MAX_RANK]; /* "Flattened" regular selection information */ @@ -196,6 +192,12 @@ typedef struct H5S_sel_iter_op_t { #define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) #define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF)) +/* Forward declaration of structs used below */ +struct H5O_t; +struct H5O_loc_t; + +/* Early typedef to avoid circular dependencies */ +typedef struct H5S_t H5S_t; /* Operations on dataspaces */ H5_DLL H5S_t *H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max); @@ -207,7 +209,7 @@ H5_DLL hbool_t H5S_has_extent(const H5S_t *ds); H5_DLL int H5S_get_simple_extent_ndims(const H5S_t *ds); H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/, hsize_t max_dims[]/*out*/); -H5_DLL herr_t H5S_write(H5F_t *f, H5O_t *oh, unsigned update_flags, H5S_t *ds); +H5_DLL herr_t H5S_write(H5F_t *f, struct H5O_t *oh, unsigned update_flags, H5S_t *ds); H5_DLL herr_t H5S_append(H5F_t *f, struct H5O_t *oh, H5S_t *ds); H5_DLL H5S_t *H5S_read(const struct H5O_loc_t *loc); H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size); @@ -314,7 +316,7 @@ H5_DLL herr_t H5S_mpio_space_type(const H5S_t *space, size_t elmt_size, /* out: */ MPI_Datatype *new_type, int *count, hbool_t *is_derived_type, - hbool_t do_permute, + hbool_t do_permute, hsize_t **permute_map, hbool_t * is_permuted); #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Spublic.h b/src/H5Spublic.h index d7a5d29..b7129ca 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -79,23 +79,22 @@ typedef enum H5S_seloper_t { typedef enum { H5S_SEL_ERROR = -1, /* Error */ H5S_SEL_NONE = 0, /* Nothing selected */ - H5S_SEL_POINTS = 1, /* Sequence of points selected */ - H5S_SEL_HYPERSLABS = 2, /* "New-style" hyperslab selection defined */ + H5S_SEL_POINTS = 1, /* Points / elements selected */ + H5S_SEL_HYPERSLABS = 2, /* Hyperslab selected */ H5S_SEL_ALL = 3, /* Entire extent selected */ H5S_SEL_N /*THIS MUST BE LAST */ -}H5S_sel_type; +} H5S_sel_type; #ifdef __cplusplus extern "C" { #endif -/* Functions in H5S.c */ +/* Operations on dataspaces */ H5_DLL hid_t H5Screate(H5S_class_t type); H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[], - const hsize_t maxdims[]); + const hsize_t maxdims[]); H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank, - const hsize_t dims[], - const hsize_t max[]); + const hsize_t dims[], const hsize_t max[]); H5_DLL hid_t H5Scopy(hid_t space_id); H5_DLL herr_t H5Sclose(hid_t space_id); H5_DLL herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc); @@ -103,51 +102,47 @@ H5_DLL hid_t H5Sdecode(const void *buf); H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id); H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id); H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], - hsize_t maxdims[]); + hsize_t maxdims[]); H5_DLL htri_t H5Sis_simple(hid_t space_id); +H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id); +H5_DLL herr_t H5Sset_extent_none(hid_t space_id); +H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id); +H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2); + +/* Operations on dataspace selections */ +H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid); H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid); +H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); +H5_DLL htri_t H5Sselect_valid(hid_t spaceid); +H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], + hsize_t end[]); +H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset); +H5_DLL herr_t H5Sselect_all(hid_t spaceid); +H5_DLL herr_t H5Sselect_none(hid_t spaceid); +H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op, + size_t num_elem, const hsize_t *coord); +H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid); +H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, + hsize_t numpoints, hsize_t buf[/*numpoints*/]); H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, - const hsize_t start[], - const hsize_t _stride[], - const hsize_t count[], - const hsize_t _block[]); + const hsize_t start[], const hsize_t _stride[], const hsize_t count[], + const hsize_t _block[]); /* #define NEW_HYPERSLAB_API */ /* Note that these haven't been working for a while and were never * publicly released - QAK */ #ifdef NEW_HYPERSLAB_API H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, - const hsize_t start[], - const hsize_t _stride[], - const hsize_t count[], - const hsize_t _block[]); -H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op, - hid_t space2_id); -H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, - hid_t space2_id); + const hsize_t start[], const hsize_t _stride[], const hsize_t count[], + const hsize_t _block[]); +H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id); +H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id); #endif /* NEW_HYPERSLAB_API */ -H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op, - size_t num_elem, const hsize_t *coord); -H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id); -H5_DLL herr_t H5Sset_extent_none(hid_t space_id); -H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id); -H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2); -H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); -H5_DLL herr_t H5Sselect_all(hid_t spaceid); -H5_DLL herr_t H5Sselect_none(hid_t spaceid); -H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset); -H5_DLL htri_t H5Sselect_valid(hid_t spaceid); H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid); H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[], hsize_t block[]); H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid); -H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid); H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t buf[/*numblocks*/]); -H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, - hsize_t numpoints, hsize_t buf[/*numpoints*/]); -H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], - hsize_t end[]); -H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid); #ifdef __cplusplus } diff --git a/src/H5Sselect.c b/src/H5Sselect.c index dd656b1..4d7fc4f 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -17,9 +17,16 @@ * Purpose: Dataspace selection functions. */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5Smodule.h" /* This source code file is part of the H5S module */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ @@ -27,16 +34,40 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Spkg.h" /* Dataspaces */ -#include "H5VMprivate.h" /* Vector and array functions */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5VMprivate.h" /* Vector and array functions */ + + +/****************/ +/* Local Macros */ +/****************/ + + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ -/* Local functions */ #ifdef LATER static herr_t H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static htri_t H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter); static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter); #endif /* LATER */ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + /* Declare a free list to manage the H5S_sel_iter_t struct */ H5FL_DEFINE(H5S_sel_iter_t); @@ -47,6 +78,11 @@ H5FL_SEQ_EXTERN(size_t); H5FL_SEQ_EXTERN(hsize_t); +/*******************/ +/* Local Variables */ +/*******************/ + + /*-------------------------------------------------------------------------- NAME @@ -78,13 +114,56 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) HDassert(offset); /* Copy the offset over */ - HDmemcpy(space->select.offset, offset, sizeof(hssize_t)*space->extent.rank); + HDmemcpy(space->select.offset, offset, sizeof(hssize_t) * space->extent.rank); /* Indicate that the offset was changed */ space->select.offset_changed = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_select_offset() */ +} /* end H5S_select_offset() */ + + +/*-------------------------------------------------------------------------- + NAME + H5Soffset_simple + PURPOSE + Changes the offset of a selection within a simple dataspace extent + USAGE + herr_t H5Soffset_simple(space_id, offset) + hid_t space_id; IN: Dataspace object to reset + const hssize_t *offset; IN: Offset to position the selection at + RETURNS + Non-negative on success/Negative on failure + DESCRIPTION + This function creates an offset for the selection within an extent, allowing + the same shaped selection to be moved to different locations within a + dataspace without requiring it to be re-defined. +--------------------------------------------------------------------------*/ +herr_t +H5Soffset_simple(hid_t space_id, const hssize_t *offset) +{ + H5S_t *space; /* Dataspace to query */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*Hs", space_id, offset); + + /* Check args */ + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a dataspace") + if(space->extent.rank == 0 || (H5S_GET_EXTENT_TYPE(space) == H5S_SCALAR + || H5S_GET_EXTENT_TYPE(space) == H5S_NULL)) + HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace") + if(offset == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified") + + /* Set the selection offset */ + if(H5S_select_offset(space, offset) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Soffset_simple() */ /*-------------------------------------------------------------------------- @@ -139,9 +218,10 @@ done: PURPOSE Copy a selection from one dataspace to another USAGE - herr_t H5S_select_copy(dst, src) + herr_t H5S_select_copy(dst, src, share_selection) H5S_t *dst; OUT: Pointer to the destination dataspace H5S_t *src; IN: Pointer to the source dataspace + hbool_t; IN: Whether to share the selection between the dataspaces RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -177,7 +257,7 @@ H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_copy() */ +} /* end H5S_select_copy() */ /*------------------------------------------------------------------------- @@ -211,7 +291,7 @@ H5S_select_release(H5S_t *ds) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_select_release() */ +} /* end H5S_select_release() */ /*------------------------------------------------------------------------- @@ -278,10 +358,10 @@ H5S_select_serial_size(const H5S_t *space) HDassert(space); /* Call the selection type's serial_size function */ - ret_value=(*space->select.type->serial_size)(space); + ret_value = (*space->select.type->serial_size)(space); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_select_serial_size() */ +} /* end H5S_select_serial_size() */ /*-------------------------------------------------------------------------- @@ -311,7 +391,7 @@ H5S_select_serial_size(const H5S_t *space) herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -319,10 +399,10 @@ H5S_select_serialize(const H5S_t *space, uint8_t **p) HDassert(p); /* Call the selection type's serialize function */ - ret_value=(*space->select.type->serialize)(space,p); + ret_value = (*space->select.type->serialize)(space, p); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_select_serialize() */ +} /* end H5S_select_serialize() */ /*-------------------------------------------------------------------------- @@ -359,7 +439,7 @@ H5Sget_select_npoints(hid_t spaceid) done: FUNC_LEAVE_API(ret_value) -} /* H5Sget_select_npoints() */ +} /* H5Sget_select_npoints() */ /*-------------------------------------------------------------------------- @@ -382,7 +462,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hssize_t +H5_ATTR_PURE hssize_t H5S_get_select_npoints(const H5S_t *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -391,7 +471,7 @@ H5S_get_select_npoints(const H5S_t *space) HDassert(space); FUNC_LEAVE_NOAPI((hssize_t)space->select.num_elem) -} /* H5S_get_select_npoints() */ +} /* end H5S_get_select_npoints() */ /*-------------------------------------------------------------------------- @@ -413,8 +493,6 @@ H5S_get_select_npoints(const H5S_t *space) COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG - Christian Chilan 01/17/2007 - Changed the error return value from 0 to FAIL. --------------------------------------------------------------------------*/ htri_t H5Sselect_valid(hid_t spaceid) @@ -433,7 +511,7 @@ H5Sselect_valid(hid_t spaceid) done: FUNC_LEAVE_API(ret_value) -} /* H5Sselect_valid() */ +} /* end H5Sselect_valid() */ /*-------------------------------------------------------------------------- @@ -471,7 +549,7 @@ H5S_select_valid(const H5S_t *space) ret_value = (*space->select.type->is_valid)(space); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_valid() */ +} /* end H5S_select_valid() */ /*-------------------------------------------------------------------------- @@ -584,7 +662,7 @@ H5S_select_deserialize(H5S_t **space, const uint8_t **p) default: break; - } + } /* end switch */ if(ret_value < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection") @@ -599,7 +677,7 @@ done: HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_deserialize() */ +} /* end H5S_select_deserialize() */ /*-------------------------------------------------------------------------- @@ -651,7 +729,7 @@ H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]) done: FUNC_LEAVE_API(ret_value) -} /* H5Sget_select_bounds() */ +} /* end H5Sget_select_bounds() */ /*-------------------------------------------------------------------------- @@ -693,10 +771,10 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) HDassert(start); HDassert(end); - ret_value = (*space->select.type->bounds)(space,start,end); + ret_value = (*space->select.type->bounds)(space, start, end); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_get_select_bounds() */ +} /* end H5S_get_select_bounds() */ /*-------------------------------------------------------------------------- @@ -736,7 +814,7 @@ H5S_get_select_offset(const H5S_t *space, hsize_t *offset) ret_value = (*space->select.type->offset)(space, offset); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_get_select_offset() */ +} /* end H5S_get_select_offset() */ /*-------------------------------------------------------------------------- @@ -774,7 +852,7 @@ H5S_get_select_unlim_dim(const H5S_t *space) ret_value = (*space->select.type->unlim_dim)(space); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_get_select_unlim_dim() */ +} /* end H5S_get_select_unlim_dim() */ /*-------------------------------------------------------------------------- @@ -819,7 +897,7 @@ H5S_get_select_num_elem_non_unlim(const H5S_t *space, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_get_select_unlim_dim() */ +} /* end H5S_get_select_unlim_dim() */ /*-------------------------------------------------------------------------- @@ -856,7 +934,7 @@ H5S_select_is_contiguous(const H5S_t *space) ret_value = (*space->select.type->is_contiguous)(space); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_is_contiguous() */ +} /* end H5S_select_is_contiguous() */ /*-------------------------------------------------------------------------- @@ -893,7 +971,7 @@ H5S_select_is_single(const H5S_t *space) ret_value = (*space->select.type->is_single)(space); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_is_single() */ +} /* end H5S_select_is_single() */ /*-------------------------------------------------------------------------- @@ -930,7 +1008,7 @@ H5S_select_is_regular(const H5S_t *space) ret_value = (*space->select.type->is_regular)(space); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_is_regular() */ +} /* end H5S_select_is_regular() */ /*-------------------------------------------------------------------------- @@ -968,7 +1046,7 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) ret_value = (*space->select.type->adjust_u)(space, offset); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_adjust_u() */ +} /* end H5S_select_adjust_u() */ /*-------------------------------------------------------------------------- @@ -1007,7 +1085,7 @@ H5S_select_project_scalar(const H5S_t *space, hsize_t *offset) ret_value = (*space->select.type->project_scalar)(space, offset); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_project_scalar() */ +} /* end H5S_select_project_scalar() */ /*-------------------------------------------------------------------------- @@ -1048,7 +1126,7 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset) ret_value = (*space->select.type->project_simple)(space, new_space, offset); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_project_simple() */ +} /* end H5S_select_project_simple() */ /*-------------------------------------------------------------------------- @@ -1098,7 +1176,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s HDassert(sel_iter->type); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_iter_init() */ +} /* end H5S_select_iter_init() */ /*-------------------------------------------------------------------------- @@ -1135,10 +1213,10 @@ H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords) HDassert(coords); /* Call iter_coords routine for selection type */ - ret_value = (*sel_iter->type->iter_coords)(sel_iter,coords); + ret_value = (*sel_iter->type->iter_coords)(sel_iter, coords); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_iter_coords() */ +} /* end H5S_select_iter_coords() */ #ifdef LATER @@ -1170,7 +1248,7 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { herr_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(iter); @@ -1178,10 +1256,10 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) HDassert(end); /* Call iter_block routine for selection type */ - ret_value = (*iter->type->iter_block)(iter,start,end); + ret_value = (*iter->type->iter_block)(iter, start, end); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_iter_block() */ +} /* end H5S_select_iter_block() */ #endif /* LATER */ @@ -1219,7 +1297,7 @@ H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter) ret_value = (*sel_iter->type->iter_nelmts)(sel_iter); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_iter_nelmts() */ +} /* end H5S_select_iter_nelmts() */ #ifdef LATER @@ -1249,7 +1327,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) { herr_t ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ HDassert(iter); @@ -1258,7 +1336,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) ret_value = (*iter->type->iter_has_next_block)(iter); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_iter_has_next_block() */ +} /* end H5S_select_iter_has_next_block() */ #endif /* LATER */ @@ -1296,13 +1374,13 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) HDassert(nelem>0); /* Call iter_next routine for selection type */ - ret_value = (*iter->type->iter_next)(iter,nelem); + ret_value = (*iter->type->iter_next)(iter, nelem); /* Decrement the number of elements left in selection */ iter->elmt_left-=nelem; FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_iter_next() */ +} /* end H5S_select_iter_next() */ #ifdef LATER @@ -1343,7 +1421,7 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter) ret_value = (*iter->type->iter_next_block)(iter); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_iter_next_block() */ +} /* end H5S_select_iter_next_block() */ #endif /* LATER */ @@ -1381,7 +1459,7 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter) ret_value = (*sel_iter->type->iter_release)(sel_iter); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_iter_release() */ +} /* end H5S_select_iter_release() */ /*-------------------------------------------------------------------------- @@ -1421,7 +1499,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space, hsize_t *off = NULL; /* Array to store sequence offsets */ size_t *len = NULL; /* Array to store sequence lengths */ hssize_t nelmts; /* Number of elements in selection */ - hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */ + hsize_t space_size[H5S_MAX_RANK]; /* Dataspace size */ size_t max_elem; /* Maximum number of elements allowed in sequences */ size_t elmt_size; /* Datatype size */ unsigned ndims; /* Number of dimensions in dataspace */ @@ -1495,7 +1573,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space, /* Loop, while bytes left in sequence */ while(curr_len > 0 && user_ret == 0) { - hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */ + hsize_t coords[H5S_MAX_RANK]; /* Coordinates of element in dataspace */ hsize_t tmp_off; /* Temporary offset within sequence */ uint8_t *loc; /* Current element location in buffer */ int i; /* Local Index variable */ @@ -1558,7 +1636,7 @@ done: iter = H5FL_FREE(H5S_sel_iter_t, iter); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_select_iterate() */ +} /* end H5S_select_iterate() */ /*-------------------------------------------------------------------------- @@ -1594,7 +1672,7 @@ H5Sget_select_type(hid_t space_id) done: FUNC_LEAVE_API(ret_value) -} /* end H5Sget_select_type() */ +} /* end H5Sget_select_type() */ /*-------------------------------------------------------------------------- @@ -1616,7 +1694,7 @@ done: pattern, don't call it directly, use the appropriate macro defined in H5Sprivate.h. --------------------------------------------------------------------------*/ -H5S_sel_type +H5_ATTR_PURE H5S_sel_type H5S_get_select_type(const H5S_t *space) { H5S_sel_type ret_value = H5S_SEL_ERROR; /* Return value */ @@ -1627,10 +1705,10 @@ H5S_get_select_type(const H5S_t *space) HDassert(space); /* Set return value */ - ret_value=H5S_GET_SELECT_TYPE(space); + ret_value = H5S_GET_SELECT_TYPE(space); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_get_select_type() */ +} /* end H5S_get_select_type() */ /*-------------------------------------------------------------------------- @@ -1661,9 +1739,9 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) { H5S_sel_iter_t *iter_a = NULL; /* Selection a iteration info */ H5S_sel_iter_t *iter_b = NULL; /* Selection b iteration info */ - hbool_t iter_a_init = FALSE; /* Selection a iteration info has been initialized */ - hbool_t iter_b_init = FALSE; /* Selection b iteration info has been initialized */ - htri_t ret_value = TRUE; /* Return value */ + hbool_t iter_a_init = FALSE; /* Selection a iteration info has been initialized */ + hbool_t iter_b_init = FALSE; /* Selection b iteration info has been initialized */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1683,20 +1761,19 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) unsigned space_a_rank; /* Number of dimensions of dataspace A */ unsigned space_b_rank; /* Number of dimensions of dataspace B */ - /* need to be able to handle spaces of different rank: + /* Need to be able to handle spaces of different rank: * * To simplify logic, let space_a point to the element of the set - * {space1, space2} with the largest rank or space1 if the ranks + * {space1, space2} with the largest rank or space1 if the ranks * are identical. * * Similarly, let space_b point to the element of {space1, space2} * with the smallest rank, or space2 if they are identical. * - * Let: space_a_rank be the rank of space_a, + * Let: space_a_rank be the rank of space_a, * space_b_rank be the rank of space_b, - * delta_rank = space_a_rank - space_b_rank. * - * Set all this up below. + * Set all this up here. */ if(space1->extent.rank >= space2->extent.rank) { space_a = space1; @@ -1934,7 +2011,7 @@ done: iter_b = H5FL_FREE(H5S_sel_iter_t, iter_b); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_shape_same() */ +} /* end H5S_select_shape_same() */ /*-------------------------------------------------------------------------- @@ -1943,24 +2020,24 @@ done: PURPOSE Given a dataspace a of rank n with some selection, construct a new - dataspace b of rank m (m != n), with the selection in a being - topologically identical to that in b (as verified by + dataspace b of rank m (m != n), with the selection in a being + topologically identical to that in b (as verified by H5S_select_shape_same(). - This function exists, as some I/O code chokes on topologically - identical selections with different ranks. At least to begin + This function exists, as some I/O code chokes on topologically + identical selections with different ranks. At least to begin with, we will deal with the issue by constructing projections - of the memory dataspace with ranks equaling those of the file + of the memory dataspace with ranks equaling those of the file dataspace. - Note that if m > n, it is possible that the starting point in the - buffer associated with the memory dataspace will have to be + Note that if m > n, it is possible that the starting point in the + buffer associated with the memory dataspace will have to be adjusted to match the projected dataspace. If the buf parameter is not NULL, the function must return an adjusted buffer base address in *adj_buf_ptr. USAGE - htri_t H5S_select_construct_projection(base_space, + htri_t H5S_select_construct_projection(base_space, new_space_ptr, new_space_rank, buf, @@ -1969,30 +2046,30 @@ done: H5S_t ** new_space_ptr; OUT: Ptr to location in which to return the address of the projected space int new_space_rank; IN: Rank of the projected space. - const void * buf; IN: Base address of the buffer + const void * buf; IN: Base address of the buffer associated with the base space. May be NULL. void ** adj_buf_ptr; OUT: If buf != NULL, store the base - address of the section of buf + address of the section of buf that is described by *new_space_ptr in *adj_buf_ptr. - + RETURNS Non-negative on success/Negative on failure. DESCRIPTION - Construct a new dataspace and associated selection which is a - projection of the supplied dataspace and associated selection into + Construct a new dataspace and associated selection which is a + projection of the supplied dataspace and associated selection into the specified rank. Return it in *new_space_ptr. - If buf is supplied, computes the base address of the projected + If buf is supplied, computes the base address of the projected selection in buf, and stores the base address in *adj_buf_ptr. - + GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - The selection in the supplied base_space has thickness 1 in all + The selection in the supplied base_space has thickness 1 in all dimensions greater than new_space_rank. Note that here we count - dimensions from the fastest changing coordinate to the slowest + dimensions from the fastest changing coordinate to the slowest changing changing coordinate. EXAMPLES REVISION LOG @@ -2038,28 +2115,28 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, /* Create new scalar dataspace */ if(NULL == (new_space = H5S_create(H5S_SCALAR))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create scalar dataspace") - + /* No need to register the dataspace(i.e. get an ID) as * we will just be discarding it shortly. */ - /* Selection for the new space will be either all or + /* Selection for the new space will be either all or * none, depending on whether the base space has 0 or * 1 elements selected. * - * Observe that the base space can't have more than + * Observe that the base space can't have more than * one selected element, since its selection has the - * same shape as the file dataspace, and that data + * same shape as the file dataspace, and that data * space is scalar. */ if(1 == npoints) { /* Assuming that the selection in the base dataspace is not - * empty, we must compute the offset of the selected item in + * empty, we must compute the offset of the selected item in * the buffer associated with the base dataspace. * - * Since the new space rank is zero, we know that the - * the base space must have rank at least 1 -- and - * hence it is a simple dataspace. However, the + * Since the new space rank is zero, we know that the + * the base space must have rank at least 1 -- and + * hence it is a simple dataspace. However, the * selection, may be either point, hyperspace, or all. * */ @@ -2077,25 +2154,25 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, hsize_t new_space_dims[H5S_MAX_RANK]; /* Current dimensions for new dataspace */ hsize_t new_space_maxdims[H5S_MAX_RANK];/* Maximum dimensions for new dataspace */ unsigned rank_diff; /* Difference in ranks */ - + /* Set up the dimensions of the new, projected dataspace. * - * How we do this depends on whether we are projecting up into - * increased dimensions, or down into a reduced number of + * How we do this depends on whether we are projecting up into + * increased dimensions, or down into a reduced number of * dimensions. * - * If we are projecting up (the first half of the following - * if statement), we copy the dimensions of the base data - * space into the fastest changing dimensions of the new + * If we are projecting up (the first half of the following + * if statement), we copy the dimensions of the base data + * space into the fastest changing dimensions of the new * projected dataspace, and set the remaining dimensions to * one. * * If we are projecting down (the second half of the following - * if statement), we just copy the dimensions with the most + * if statement), we just copy the dimensions with the most * quickly changing dimensions into the dims for the projected * data set. * - * This works, because H5S_select_shape_same() will return + * This works, because H5S_select_shape_same() will return * true on selections of different rank iff: * * 1) the selection in the lower rank dataspace matches that @@ -2103,13 +2180,13 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, * the larger rank dataspace, and * * 2) the selection has thickness 1 in all ranks that appear - * only in the higher rank dataspace (i.e. those with + * only in the higher rank dataspace (i.e. those with * more slowly changing indicies). - */ + */ if(new_space_rank > base_space_rank) { hsize_t tmp_dim_size = 1; /* Temporary dimension value, for filling arrays */ - /* we must copy the dimensions of the base space into + /* we must copy the dimensions of the base space into * the fastest changing dimensions of the new space, * and set the remaining dimensions to 1 */ @@ -2120,7 +2197,7 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, HDmemcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank); } /* end if */ else { /* new_space_rank < base_space_rank */ - /* we must copy the fastest changing dimension of the + /* we must copy the fastest changing dimension of the * base space into the dimensions of the new space. */ rank_diff = base_space_rank - new_space_rank; @@ -2128,12 +2205,12 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, HDmemcpy(new_space_maxdims, &base_space_maxdims[rank_diff], sizeof(new_space_maxdims[0]) * new_space_rank); } /* end else */ - /* now have the new space rank and dimensions set up -- + /* now have the new space rank and dimensions set up -- * so we can create the new simple dataspace. */ if(NULL == (new_space = H5S_create_simple(new_space_rank, new_space_dims, new_space_maxdims))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") - + /* No need to register the dataspace(i.e. get an ID) as * we will just be discarding it shortly. */ @@ -2144,13 +2221,13 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, */ if(H5S_SELECT_PROJECT_SIMPLE(base_space, new_space, &projected_space_element_offset) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to project simple selection") - + /* If we get this far, we have created the new dataspace, and projected * the selection in the base dataspace into the new dataspace. * - * If the base dataspace is simple, check to see if the - * offset_changed flag on the base selection has been set -- if so, - * project the offset into the new dataspace and set the + * If the base dataspace is simple, check to see if the + * offset_changed flag on the base selection has been set -- if so, + * project the offset into the new dataspace and set the * offset_changed flag. */ if(H5S_GET_EXTENT_TYPE(base_space) == H5S_SIMPLE && base_space->select.offset_changed) { @@ -2182,12 +2259,12 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, * Since we can't do pointer arithmetic on void pointers, we first * cast buf to a pointer to byte -- i.e. uint8_t. * - * We then multiply the projected space element offset we - * calculated earlier by the supplied element size, add this - * value to the type cast buf pointer, cast the result back + * We then multiply the projected space element offset we + * calculated earlier by the supplied element size, add this + * value to the type cast buf pointer, cast the result back * to a pointer to void, and assign the result to *adj_buf_ptr. */ - *adj_buf_ptr = (const void *)(((const uint8_t *)buf) + + *adj_buf_ptr = (const void *)(((const uint8_t *)buf) + ((size_t)(projected_space_element_offset * element_size))); } /* end if */ else @@ -2202,7 +2279,7 @@ done: HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_construct_projection() */ +} /* end H5S_select_construct_projection() */ /*-------------------------------------------------------------------------- @@ -2233,7 +2310,7 @@ herr_t H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf) { H5S_sel_iter_t *iter = NULL; /* Selection iteration info */ - hbool_t iter_init = 0; /* Selection iteration info has been initialized */ + hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ hsize_t *off = NULL; /* Array to store sequence offsets */ size_t *len = NULL; /* Array to store sequence lengths */ hssize_t nelmts; /* Number of elements in selection */ @@ -2255,7 +2332,7 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b /* Initialize iterator */ if(H5S_select_iter_init(iter, space, fill_size) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") - iter_init = 1; /* Selection iteration info has been initialized */ + iter_init = TRUE; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(space)) < 0) @@ -2310,7 +2387,7 @@ done: iter = H5FL_FREE(H5S_sel_iter_t, iter); FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_fill() */ +} /* end H5S_select_fill() */ /*-------------------------------------------------------------------------- @@ -2337,7 +2414,7 @@ done: src_intersect_space within the selection of src_space as a selection within the selection of dst_space. The result is placed in the selection of new_space_ptr. - + GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -2361,7 +2438,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, /* Create new space, using dst extent. Start with "all" selection. */ if(NULL == (new_space = H5S_create(H5S_SIMPLE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace") - if(H5S_extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0) + if(H5S__extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy destination space extent") /* If the intersecting space is "all", the intersection must be equal to the @@ -2379,14 +2456,14 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, if(H5S_select_none(new_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") } /* end if */ - /* If any of the spaces use point selection, fall back to general algorithm - */ + /* If any of the spaces use point selection, fall back to general algorithm */ else if((src_intersect_space->select.type->type == H5S_SEL_POINTS) || (src_space->select.type->type == H5S_SEL_POINTS) || (dst_space->select.type->type == H5S_SEL_POINTS)) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported") else { HDassert(src_intersect_space->select.type->type == H5S_SEL_HYPERSLABS); + /* Intersecting space is hyperslab selection. Call the hyperslab * routine to project to another hyperslab selection. */ if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space) < 0) @@ -2403,7 +2480,7 @@ done: HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_project_intersection() */ +} /* end H5S_select_project_intersection() */ /*-------------------------------------------------------------------------- @@ -2425,7 +2502,7 @@ done: Removes any and all portions of space that are also present in subtract_space. In essence, performs an A_NOT_B operation with the two selections. - + GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -2493,5 +2570,5 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_subtract() */ +} /* end H5S_select_subtract() */ diff --git a/src/H5Stest.c b/src/H5Stest.c index a7bee2b..50f5fa9 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -17,23 +17,60 @@ * Purpose: Dataspace selection testing functions. */ +/****************/ +/* Module Setup */ +/****************/ + #include "H5Smodule.h" /* This source code file is part of the H5S module */ #define H5S_TESTING /*suppress warning about H5S testing funcs*/ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5Spkg.h" /* Dataspaces */ +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + /*-------------------------------------------------------------------------- NAME - H5S_select_shape_same_test + H5S__select_shape_same_test PURPOSE Determine if two dataspace selections are the same shape USAGE - htri_t H5S_select_shape_same_test(sid1, sid2) + htri_t H5S__select_shape_same_test(sid1, sid2) hid_t sid1; IN: 1st dataspace to compare hid_t sid2; IN: 2nd dataspace to compare RETURNS @@ -48,13 +85,13 @@ REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5S_select_shape_same_test(hid_t sid1, hid_t sid2) +H5S__select_shape_same_test(hid_t sid1, hid_t sid2) { H5S_t *space1; /* Pointer to 1st dataspace */ H5S_t *space2; /* Pointer to 2nd dataspace */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get dataspace structures */ if(NULL == (space1 = (H5S_t *)H5I_object_verify(sid1, H5I_DATASPACE))) @@ -68,16 +105,16 @@ H5S_select_shape_same_test(hid_t sid1, hid_t sid2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_select_shape_same_test() */ +} /* H5S__select_shape_same_test() */ /*-------------------------------------------------------------------------- NAME - H5S_get_rebuild_status_test + H5S__get_rebuild_status_test PURPOSE Determine the status of hyperslab rebuild USAGE - htri_t H5S_inquiry_rebuild_status(hid_t space_id) + htri_t H5S__get_rebuild_status_test(hid_t space_id) hid_t space_id; IN: dataspace id RETURNS Non-negative TRUE/FALSE on success, negative on failure @@ -90,12 +127,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5S_get_rebuild_status_test(hid_t space_id) +H5S__get_rebuild_status_test(hid_t space_id) { H5S_t *space; /* Pointer to 1st dataspace */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get dataspace structures */ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) @@ -105,5 +142,5 @@ H5S_get_rebuild_status_test(hid_t space_id) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_get_rebuild_status_test() */ +} /* H5S__get_rebuild_status_test() */ diff --git a/test/objcopy.c b/test/objcopy.c index eb4927f..4055781 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1167,7 +1167,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if((obj2_sid = H5Rget_region(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR /* Check if dataspaces are the same shape */ - if(H5S_select_shape_same_test(obj1_sid, obj2_sid) < 0) TEST_ERROR + if(H5S__select_shape_same_test(obj1_sid, obj2_sid) < 0) TEST_ERROR /* Close dataspaces */ if(H5Sclose(obj1_sid) < 0) TEST_ERROR @@ -2136,9 +2136,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) char src_fname[NAME_BUF_SIZE]; /* Name of source file */ char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */ H5F_libver_t low, high; /* File format bounds */ - H5F_libver_t low_src, high_src; /* Source file format bounds */ unsigned srcdset_fillversion; /* Fill version of source dataset */ - hbool_t valid_high = FALSE; /* TRUE if high bound is valid */ int i, j; /* Local index variables */ H5D_t *dsetp = NULL; /* Pointer to internal dset structure */ herr_t ret; /* Generic return value */ diff --git a/test/tselect.c b/test/tselect.c index bcc2a5b..9150b11 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -1888,9 +1888,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S__select_shape_same_test(small_cube_sid, file_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Read selection from disk */ ret = H5Dread(large_cube_dataset, @@ -1965,9 +1965,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S__select_shape_same_test(small_cube_sid, mem_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Read selection from disk */ @@ -2082,9 +2082,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, * memory slice through the cube selection and the * on disk full small cube selections as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S__select_shape_same_test(small_cube_sid, mem_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* write the slice from the in memory large cube to the on disk small cube */ @@ -2193,9 +2193,9 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, * on disk slice through the large cube selection * as having the same shape. */ - check = H5S_select_shape_same_test(small_cube_sid, + check = H5S__select_shape_same_test(small_cube_sid, file_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* write the cube from memory to the target slice of the disk cube */ @@ -2998,9 +2998,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(mem_small_cube_sid, + check = H5S__select_shape_same_test(mem_small_cube_sid, file_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* zero the buffer that we will be using for reading */ HDmemset(small_cube_buf_1, 0, sizeof(*small_cube_buf_1) * small_cube_size); @@ -3105,9 +3105,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_small_cube_sid, + check = H5S__select_shape_same_test(file_small_cube_sid, mem_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* zero out the in memory large cube */ @@ -3258,9 +3258,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_small_cube_sid, + check = H5S__select_shape_same_test(file_small_cube_sid, mem_large_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* write the slice from the in memory large cube to the @@ -3390,9 +3390,9 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(file_large_cube_sid, + check = H5S__select_shape_same_test(file_large_cube_sid, mem_small_cube_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* write the checker board selection of the in memory @@ -3525,13 +3525,13 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /**************************************************************** ** -** test_select_hyper_checker_board_dr(): Test H5S (dataspace) -** selection code with checkerboard source and target having +** test_select_hyper_checker_board_dr(): Test H5S (dataspace) +** selection code with checkerboard source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5S_shape_same in isolation, so now we try to do ** I/O. ** -** This is just an initial smoke check, so we will work +** This is just an initial smoke check, so we will work ** with a slice through a cube only. ** ****************************************************************/ @@ -5902,6 +5902,10 @@ test_select_hyper_union_random_5d(hid_t read_plist) /* Select hyperslab */ ret = H5Sselect_hyperslab(sid1, (i == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, NULL, count, NULL); CHECK(ret, FAIL, "H5Sselect_hyperslab"); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); + break; + } /* end if */ } /* end for */ /* Get the number of elements selected */ @@ -5920,14 +5924,18 @@ test_select_hyper_union_random_5d(hid_t read_plist) /* Read selection from disk */ ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,read_plist,rbuf); CHECK(ret, FAIL, "H5Dread"); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); + break; + } /* end if */ /* Compare data read with data written out */ tbuf=rbuf; ret = H5Diterate(wbuf,H5T_NATIVE_INT,sid1,test_select_hyper_iter2,&tbuf); - if(ret<0) { - TestErrPrintf("Random hyperslabs for seed %u failed!\n",seed); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); break; - } + } /* end if */ /* Set the read buffer back to all zeroes */ HDmemset(rbuf, 0, (size_t)SPACE6_DIM1); @@ -6585,7 +6593,7 @@ test_select_combine(void) hsize_t dims[SPACE7_RANK]={SPACE7_DIM1,SPACE7_DIM2}; /* Dimensions of dataspace */ H5S_sel_type sel_type; /* Selection type */ hssize_t nblocks; /* Number of hyperslab blocks */ - hsize_t blocks[128][2][SPACE7_RANK]; /* List of blocks */ + hsize_t blocks[16][2][SPACE7_RANK]; /* List of blocks */ herr_t error; /* Output message about test being performed */ @@ -8087,290 +8095,290 @@ test_shape_same(void) /* 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + check = H5S__select_shape_same_test(all_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(all_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(all_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(all_sid, scalar_none_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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + check = H5S__select_shape_same_test(none_sid,none_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(none_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(none_sid, scalar_none_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(none_sid, scalar_none_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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + check = H5S__select_shape_same_test(single_pt_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(single_pt_sid, scalar_all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid, scalar_all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(single_pt_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_pt_sid, scalar_none_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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + check = H5S__select_shape_same_test(mult_pt_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(mult_pt_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(mult_pt_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(mult_pt_sid, scalar_none_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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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 @@ -8394,8 +8402,8 @@ test_shape_same(void) } /* 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"); + 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"); @@ -8421,70 +8429,70 @@ test_shape_same(void) } /* 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"); + 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 scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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"); + 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 @@ -8508,8 +8516,8 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + 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"); @@ -8535,129 +8543,129 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + 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 scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_all_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_all_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_all_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare single "point" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(single_hyper_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_pt_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_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_hyper_pt_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,single_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_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_hyper_pt_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_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_hyper_pt_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_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_hyper_pt_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_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_hyper_pt_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_pt_sid, scalar_all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid, scalar_all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(single_hyper_pt_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(single_hyper_pt_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare regular, strided hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(regular_hyper_sid,regular_hyper_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,regular_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(regular_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_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(regular_hyper_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_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(regular_hyper_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Construct point selection which matches regular, strided hyperslab selection */ /* Create dataspace for point selection */ @@ -8674,8 +8682,8 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); @@ -8700,8 +8708,8 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); @@ -8720,70 +8728,70 @@ test_shape_same(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(regular_hyper_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(regular_hyper_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(regular_hyper_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare irregular hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(irreg_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_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(irreg_hyper_sid,all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,mult_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,single_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_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(irreg_hyper_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_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(irreg_hyper_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Construct hyperslab selection which matches irregular hyperslab selection */ /* Create dataspace for hyperslab selection */ @@ -8808,141 +8816,141 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid,tmp_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(irreg_hyper_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(irreg_hyper_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(irreg_hyper_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare scalar "all" dataspace with all selections created */ /* Compare against itself */ - check = H5S_select_shape_same_test(scalar_all_sid, scalar_all_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, scalar_all_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid = H5Scopy(scalar_all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S_select_shape_same_test(scalar_all_sid, tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_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(scalar_all_sid, all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check = H5S_select_shape_same_test(scalar_all_sid, none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check = H5S_select_shape_same_test(scalar_all_sid, single_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, single_pt_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check = H5S_select_shape_same_test(scalar_all_sid, mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_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(scalar_all_sid, single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_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(scalar_all_sid, single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_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(scalar_all_sid, single_hyper_pt_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_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(scalar_all_sid, regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, none_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, none_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against scalar "none" hyperslab selection */ - check = H5S_select_shape_same_test(scalar_all_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_all_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare scalar "none" dataspace with all selections created */ /* Compare against itself */ - check = H5S_select_shape_same_test(scalar_none_sid, scalar_none_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, scalar_none_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against copy of itself */ tmp_sid = H5Scopy(scalar_none_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S_select_shape_same_test(scalar_none_sid, tmp_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_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(scalar_none_sid, all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "none" selection */ - check = H5S_select_shape_same_test(scalar_none_sid, none_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, none_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against single point selection */ - check = H5S_select_shape_same_test(scalar_none_sid, single_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, single_pt_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against multiple point selection */ - check = H5S_select_shape_same_test(scalar_none_sid, mult_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_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(scalar_none_sid, single_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_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(scalar_none_sid, single_hyper_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_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(scalar_none_sid, single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_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(scalar_none_sid, regular_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, irreg_hyper_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, none_hyper_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, none_hyper_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ - check = H5S_select_shape_same_test(scalar_none_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(scalar_none_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -8974,27 +8982,27 @@ test_shape_same(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_1(): +** test_shape_same_dr__smoke_check_1(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** all of it. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select (10 X 10 X 1) hyper slabs in each, three with -** the slab parallel to the xy plane, three parallel to the +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select (10 X 10 X 1) hyper slabs in each, three with +** the slab parallel to the xy plane, three parallel to the ** xz plane, and three parallel to the yz plane. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when comparing -** the full 2 D space against any hyperslab parallel to the -** yz plane in the 3 D space, and FALSE when comparing the +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when comparing +** the full 2 D space against any hyperslab parallel to the +** yz plane in the 3 D space, and FALSE when comparing the ** full 2 D space against the other two hyper slabs. ** -** Also create two additional 3 D data spaces (10 X 10 X 10), -** and select a (10 X 10 X 2) hyper slab parallel to the yz -** axis in one of them, and two parallel (10 X 10 X 1) hyper -** slabs parallel to the yz axis in the other. -** H5S_select_shape_same() should return FALSE when comparing +** Also create two additional 3 D data spaces (10 X 10 X 10), +** and select a (10 X 10 X 2) hyper slab parallel to the yz +** axis in one of them, and two parallel (10 X 10 X 1) hyper +** slabs parallel to the yz axis in the other. +** H5S_select_shape_same() should return FALSE when comparing ** each to the 2 D selection. ** ****************************************************************/ @@ -9183,42 +9191,42 @@ test_shape_same_dr__smoke_check_1(void) /* setup is done -- run the tests: */ /* Compare against "xy" selection */ - check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "xz" selection */ - check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "yz" selection */ - check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_4_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_4_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -9265,9 +9273,9 @@ test_shape_same_dr__smoke_check_1(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_2(): +** test_shape_same_dr__smoke_check_2(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** a "checker board" hyper slab as follows: ** ** * * - - * * - - * * @@ -9281,27 +9289,27 @@ test_shape_same_dr__smoke_check_1(void) ** * * - - * * - - * * ** * * - - * * - - * * ** -** where asterisks indicate selected elements, and dashes +** where asterisks indicate selected elements, and dashes ** indicate unselected elements. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select similar (10 X 10 X 1) checker board hyper -** slabs in each, three with the slab parallel to the xy -** plane, three parallel to the xz plane, and three parallel +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select similar (10 X 10 X 1) checker board hyper +** slabs in each, three with the slab parallel to the xy +** plane, three parallel to the xz plane, and three parallel ** to the yz plane. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when comparing -** the 2 D space checker board selection against a checker -** board hyperslab parallel to the yz plane in the 3 D -** space, and FALSE when comparing the 2 D checkerboard -** selection against two hyper slabs parallel to the xy +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when comparing +** the 2 D space checker board selection against a checker +** board hyperslab parallel to the yz plane in the 3 D +** space, and FALSE when comparing the 2 D checkerboard +** selection against two hyper slabs parallel to the xy ** or xz planes. ** -** Also create an additional 3 D data spaces (10 X 10 X 10), -** and select a checker board parallel with the yz axis, -** save with some squares being on different planes. -** H5S_select_shape_same() should return FALSE when +** Also create an additional 3 D data spaces (10 X 10 X 10), +** and select a checker board parallel with the yz axis, +** save with some squares being on different planes. +** H5S_select_shape_same() should return FALSE when ** comparing this selection to the 2 D selection. ** ****************************************************************/ @@ -9584,7 +9592,7 @@ test_shape_same_dr__smoke_check_2(void) start[0] = 4; /* This test gets the right answer, but it fails the shape same - * test in an unexpected point. Bring this up with Quincey, as + * test in an unexpected point. Bring this up with Quincey, as * the oddness looks like it is not related to my code. * -- JRM */ @@ -9596,39 +9604,39 @@ test_shape_same_dr__smoke_check_2(void) /* setup is done -- run the tests: */ /* Compare against "xy" selection */ - check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "xz" selection */ - check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "yz" selection */ - check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_3_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -9673,9 +9681,9 @@ test_shape_same_dr__smoke_check_2(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_3(): +** test_shape_same_dr__smoke_check_3(): ** -** Create a square, 2 D data space (10 X 10), and select an +** Create a square, 2 D data space (10 X 10), and select an ** irregular hyper slab as follows: ** ** y @@ -9691,22 +9699,22 @@ test_shape_same_dr__smoke_check_2(void) ** 0 - - - - - - - - - - ** 0 1 2 3 4 5 6 7 8 9 x ** -** where asterisks indicate selected elements, and dashes +** where asterisks indicate selected elements, and dashes ** indicate unselected elements. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select similar irregular hyper slabs in each, three -** with the slab parallel to the xy plane, three parallel -** to the xz plane, and three parallel to the yz plane. -** Further, translate the irregular slab in 2/3rds of the +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select similar irregular hyper slabs in each, three +** with the slab parallel to the xy plane, three parallel +** to the xz plane, and three parallel to the yz plane. +** Further, translate the irregular slab in 2/3rds of the ** cases. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when -** comparing the 2 D irregular hyperslab selection -** against the irregular hyperslab selections parallel -** to the yz plane in the 3 D space, and FALSE when -** comparing it against the irregular hyper slabs +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when +** comparing the 2 D irregular hyperslab selection +** against the irregular hyperslab selections parallel +** to the yz plane in the 3 D space, and FALSE when +** comparing it against the irregular hyper slabs ** selections parallel to the xy or xz planes. ** ****************************************************************/ @@ -10119,36 +10127,36 @@ test_shape_same_dr__smoke_check_3(void) /* setup is done -- run the tests: */ /* Compare against "xy" selection */ - check = H5S_select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xy_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "xz" selection */ - check = H5S_select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_0_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_1_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_xz_slice_2_sid, small_square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Compare against "yz" selection */ - check = H5S_select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_0_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_1_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(small_cube_yz_slice_2_sid, small_square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -10190,9 +10198,9 @@ test_shape_same_dr__smoke_check_3(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_4(): +** test_shape_same_dr__smoke_check_4(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** the entire space. ** ** Similarly, create 3 D and 4 D data spaces: @@ -10213,7 +10221,7 @@ test_shape_same_dr__smoke_check_3(void) ** And select these entire spaces as well. ** ** Compare the 2 D space against all the other spaces -** with H5S_select_shape_same(). The (1 X 10 X 10) & +** with H5S_select_shape_same(). The (1 X 10 X 10) & ** (1 X 1 X 10 X 10) should return TRUE. All others ** should return FALSE. ** @@ -10331,39 +10339,39 @@ test_shape_same_dr__smoke_check_4(void) /* setup is done -- run the tests: */ - check = H5S_select_shape_same_test(three_d_space_0_sid, square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(three_d_space_0_sid, square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(three_d_space_1_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(three_d_space_1_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(three_d_space_2_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(three_d_space_2_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(three_d_space_3_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(three_d_space_3_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_0_sid, square_sid); - VERIFY(check, TRUE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_0_sid, square_sid); + VERIFY(check, TRUE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_1_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_1_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_2_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_2_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_3_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_3_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_4_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_4_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_5_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_5_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); - check = H5S_select_shape_same_test(four_d_space_6_sid, square_sid); - VERIFY(check, FALSE, "H5S_select_shape_same_test"); + check = H5S__select_shape_same_test(four_d_space_6_sid, square_sid); + VERIFY(check, FALSE, "H5S__select_shape_same_test"); /* Close dataspaces */ @@ -10410,12 +10418,12 @@ test_shape_same_dr__smoke_check_4(void) /**************************************************************** ** ** test_shape_same_dr__full_space_vs_slice(): Tests selection -** of a full n-cube data space vs an n-dimensional slice of -** of an m-cube (m > n) in a call to H5S_select_shape_same(). -** Note that this test does not require the n-cube and the +** of a full n-cube data space vs an n-dimensional slice of +** of an m-cube (m > n) in a call to H5S_select_shape_same(). +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional ** spaces. @@ -10452,16 +10460,16 @@ test_shape_same_dr__full_space_vs_slice(int test_num, HDassert( large_rank <= SS_DR_MAX_RANK ); HDassert( 0 <= offset ); HDassert( offset < large_rank ); - HDassert( edge_size > 0 ); - HDassert( edge_size <= 1000 ); + HDassert( edge_size > 0 ); + HDassert( edge_size <= 1000 ); - sprintf(test_desc_0, - "\tn-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tn-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n", small_rank, large_rank, offset, (int)dim_selected[0], @@ -10526,7 +10534,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num, /* setup is done -- run the test: */ - check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid); + check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); VERIFY(check, expected_result, "test_shape_same_dr__full_space_vs_slice"); @@ -10542,27 +10550,27 @@ test_shape_same_dr__full_space_vs_slice(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_full_space_vs_slice_tests(): +** test_shape_same_dr__run_full_space_vs_slice_tests(): ** ** Run the est_shape_same_dr__full_space_vs_slice() test ** over a variety of ranks and offsets. ** -** At present, we test H5S_select_shape_same() with +** At present, we test H5S_select_shape_same() with ** fully selected 1, 2, 3, and 4 cubes as one parameter, and ** 1, 2, 3, and 4 dimensional slices through a n-cube of rank -** no more than 5 (and at least the rank of the slice). -** We stop at rank 5, as Quincey suggested that it would be +** no more than 5 (and at least the rank of the slice). +** We stop at rank 5, as Quincey suggested that it would be ** sufficient. ** -** All the n-cubes will have lengths of the same size, so +** All the n-cubes will have lengths of the same size, so ** H5S_select_shape_same() should return true iff: ** -** 1) the rank for the fully selected n cube equals the +** 1) the rank for the fully selected n cube equals the ** number of dimensions selected in the slice through the ** m-cube (m >= n). ** ** 2) The dimensions selected in the slice through the m-cube -** are the dimesnions with the most quickly changing +** are the dimesnions with the most quickly changing ** indices. ** ****************************************************************/ @@ -10668,7 +10676,7 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) dim_selected, expected_result ); - + z++; } while((z < 2) && (large_rank >= 1)); @@ -10691,15 +10699,15 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) /**************************************************************** ** -** test_shape_same_dr__checkerboard(): Tests selection of a -** "checker board" subset of a full n-cube data space vs +** test_shape_same_dr__checkerboard(): Tests selection of a +** "checker board" subset of a full n-cube data space vs ** a "checker board" n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5S_select_shape_same(). ** -** Note that this test does not require the n-cube and the +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional ** spaces. @@ -10719,11 +10727,11 @@ test_shape_same_dr__checkerboard(int test_num, char test_desc_1[128]; int i; int dims_selected = 0; - hid_t n_cube_0_sid; /* the checker board selected - * hyper cube + hid_t n_cube_0_sid; /* the checker board selected + * hyper cube */ - hid_t n_cube_1_sid; /* the hyper cube in which a - * checkerboard slice is selected + hid_t n_cube_1_sid; /* the hyper cube in which a + * checkerboard slice is selected */ hsize_t dims[SS_DR_MAX_RANK]; hsize_t base_start[2]; @@ -10745,8 +10753,8 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( small_rank <= large_rank ); HDassert( large_rank <= SS_DR_MAX_RANK ); HDassert( 0 < checker_size ); - HDassert( checker_size <= edge_size ); - HDassert( edge_size <= 1000 ); + HDassert( checker_size <= edge_size ); + HDassert( edge_size <= 1000 ); HDassert( 0 <= offset ); HDassert( offset < (int)edge_size ); @@ -10757,13 +10765,13 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, - "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, (int)edge_size, (int)checker_size, @@ -10803,17 +10811,17 @@ test_shape_same_dr__checkerboard(int test_num, * * * - - * * - - * * * * * - - * * - - * * * - * In both cases, asterisks indicate selected elements, + * In both cases, asterisks indicate selected elements, * and dashes indicate unselected elements. * * 3-D and 4-D ascii art is somewhat painful, so I'll * leave those selections to your imagination. :-) * * Note, that since the edge_size and checker_size are - * parameters that are passed in, the selection need + * parameters that are passed in, the selection need * not look exactly like the selection shown above. - * At present, the function allows checker sizes that - * are not even divisors of the edge size -- thus + * At present, the function allows checker sizes that + * are not even divisors of the edge size -- thus * something like the following is also possible: * * * * * - - - * * * - @@ -10827,14 +10835,14 @@ test_shape_same_dr__checkerboard(int test_num, * * * * - - - * * * - * - - - * * * - - - * * - * As the above pattern can't be selected in one + * As the above pattern can't be selected in one * call to H5Sselect_hyperslab(), and since the * values in the start, stride, count, and block - * arrays will be repeated over all entries in + * arrays will be repeated over all entries in * the selected space case, and over all selected * dimensions in the selected hyperslab case, we - * compute these values first and store them in - * in the base_start, base_stride, base_count, + * compute these values first and store them in + * in the base_start, base_stride, base_count, * and base_block arrays. */ @@ -10844,9 +10852,9 @@ test_shape_same_dr__checkerboard(int test_num, base_stride[0] = 2 * checker_size; base_stride[1] = 2 * checker_size; - /* Note that the following computation depends on the C99 - * requirement that integer division discard any fraction - * (truncation towards zero) to function correctly. As we + /* Note that the following computation depends on the C99 + * requirement that integer division discard any fraction + * (truncation towards zero) to function correctly. As we * now require C99, this shouldn't be a problem, but noting * it may save us some pain if we are ever obliged to support * pre-C99 compilers again. @@ -10863,7 +10871,7 @@ test_shape_same_dr__checkerboard(int test_num, base_block[0] = checker_size; base_block[1] = checker_size; - /* now setup start, stride, count, and block arrays for + /* now setup start, stride, count, and block arrays for * the first call to H5Sselect_hyperslab(). */ for(i = 0; i < SS_DR_MAX_RANK; i++) { @@ -10877,10 +10885,10 @@ test_shape_same_dr__checkerboard(int test_num, start, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* if small_rank == 1, or if edge_size == checker_size, we + /* if small_rank == 1, or if edge_size == checker_size, we * are done, as either there is no added dimension in which * to place offset selected "checkers". - * + * * Otherwise, set up start, stride, count and block, and * make the additional selection. */ @@ -10900,7 +10908,7 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * - * Some how, it seems that selections can extend beyond the + * Some how, it seems that selections can extend beyond the * boundaries of the target data space -- hence the following * code to manually clip the selection back to the data space * proper. @@ -10923,8 +10931,8 @@ test_shape_same_dr__checkerboard(int test_num, /* Now select the checkerboard selection in the (possibly larger) n-cube. - * - * Since we have already calculated the base start, stride, count, + * + * Since we have already calculated the base start, stride, count, * and block, re-use the values in setting up start, stride, count, * and block. */ @@ -10968,10 +10976,10 @@ test_shape_same_dr__checkerboard(int test_num, start_ptr, stride_ptr, count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* As before, if the number of dimensions selected is less than or - * equal to 1, or if edge_size == checker_size, we are done, as - * either there is no added dimension in which to place offset selected - * "checkers", or the hyperslab is completely occupied by one + /* As before, if the number of dimensions selected is less than or + * equal to 1, or if edge_size == checker_size, we are done, as + * either there is no added dimension in which to place offset selected + * "checkers", or the hyperslab is completely occupied by one * "checker". * * Otherwise, set up start, stride, count and block, and @@ -11001,7 +11009,7 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * - * Again, it seems that selections can extend beyond the + * Again, it seems that selections can extend beyond the * boundaries of the target data space -- hence the following * code to manually clip the selection back to the data space * proper. @@ -11018,7 +11026,7 @@ test_shape_same_dr__checkerboard(int test_num, CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* setup is done -- run the test: */ - check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid); + check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); VERIFY(check, expected_result, "test_shape_same_dr__checkerboard"); @@ -11034,23 +11042,23 @@ test_shape_same_dr__checkerboard(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_checkerboard_tests(): +** test_shape_same_dr__run_checkerboard_tests(): ** -** In this set of tests, we test H5S_select_shape_same() -** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as -** one parameter, and 1, 2, 3, and 4 dimensional checkerboard -** slices through a n-cube of rank no more than 5 (and at -** least the rank of the slice). +** In this set of tests, we test H5S_select_shape_same() +** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as +** one parameter, and 1, 2, 3, and 4 dimensional checkerboard +** slices through a n-cube of rank no more than 5 (and at +** least the rank of the slice). ** -** All the n-cubes will have lengths of the same size, so +** All the n-cubes will have lengths of the same size, so ** H5S_select_shape_same() should return true iff: ** -** 1) the rank of the n cube equals the number of dimensions -** selected in the checker board slice through the m-cube +** 1) the rank of the n cube equals the number of dimensions +** selected in the checker board slice through the m-cube ** (m >= n). ** -** 2) The dimensions selected in the checkerboard slice -** through the m-cube are the dimensions with the most +** 2) The dimensions selected in the checkerboard slice +** through the m-cube are the dimensions with the most ** quickly changing indices. ** ****************************************************************/ @@ -11101,7 +11109,7 @@ test_shape_same_dr__run_checkerboard_tests(void) dim_selected[4] = FALSE; else dim_selected[4] = TRUE; - + /* compute the expected result: */ i = 0; @@ -11305,17 +11313,17 @@ test_shape_same_dr__run_checkerboard_tests(void) /**************************************************************** ** -** test_shape_same_dr__irregular(): +** test_shape_same_dr__irregular(): ** -** Tests selection of an "irregular" subset of a full +** Tests selection of an "irregular" subset of a full ** n-cube data space vs an identical "irregular" subset ** of an n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5S_select_shape_same(). ** -** Note that this test does not require the n-cube and the +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ****************************************************************/ static void @@ -11337,7 +11345,7 @@ test_shape_same_dr__irregular(int test_num, hid_t n_cube_0_sid; /* the hyper cube containing * an irregular selection */ - hid_t n_cube_1_sid; /* the hyper cube in which a + hid_t n_cube_1_sid; /* the hyper cube in which a * slice contains an irregular * selection. */ @@ -11373,7 +11381,7 @@ test_shape_same_dr__irregular(int test_num, hsize_t clip_block[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t *(starts[SS_DR_MAX_RANK]) = + hsize_t *(starts[SS_DR_MAX_RANK]) = {start_0, start_1, start_2, start_3, start_4}; hsize_t *(strides[SS_DR_MAX_RANK]) = {stride_0, stride_1, stride_2, stride_3, stride_4}; @@ -11396,8 +11404,8 @@ test_shape_same_dr__irregular(int test_num, HDassert( 0 < small_rank ); HDassert( small_rank <= large_rank ); HDassert( large_rank <= SS_DR_MAX_RANK ); - HDassert( 9 <= edge_size ); - HDassert( edge_size <= 1000 ); + HDassert( 9 <= edge_size ); + HDassert( edge_size <= 1000 ); HDassert( 0 <= slice_offset ); HDassert( slice_offset < edge_size ); HDassert( -2 <= pattern_offset ); @@ -11410,16 +11418,16 @@ test_shape_same_dr__irregular(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, - "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, - edge_size, + edge_size, slice_offset, pattern_offset, (int)dim_selected[0], (int)dim_selected[1], @@ -11438,11 +11446,11 @@ test_shape_same_dr__irregular(int test_num, CHECK(n_cube_0_sid, FAIL, "H5Screate_simple"); /* Select an "irregular" pattern in the small n-cube. This - * pattern can be though of a set of four 3 x 2 x 2 X 2 - * four dimensional prisims, each parallel to one of the - * axies and none of them intersecting with the other. + * pattern can be though of a set of four 3 x 2 x 2 X 2 + * four dimensional prisims, each parallel to one of the + * axies and none of them intersecting with the other. * - * In the lesser dimensional cases, this 4D pattern is + * In the lesser dimensional cases, this 4D pattern is * projected onto the lower dimensional space. * * In the 1-D case, the projection of the pattern looks @@ -11467,12 +11475,12 @@ test_shape_same_dr__irregular(int test_num, * 0 - - - - - - - - - - * 0 1 2 3 4 5 6 7 8 9 x * - * In both cases, asterisks indicate selected elements, + * In both cases, asterisks indicate selected elements, * and dashes indicate unselected elements. * * Note that is this case, since the edge size is fixed, - * the pattern does not change. However, we do use the - * displacement parameter to allow it to be moved around + * the pattern does not change. However, we do use the + * displacement parameter to allow it to be moved around * within the n-cube or hyper slab. */ @@ -11487,7 +11495,7 @@ test_shape_same_dr__irregular(int test_num, CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ - /* finally, clip the selection to ensure that it lies fully + /* finally, clip the selection to ensure that it lies fully * within the n-cube. */ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND, @@ -11526,8 +11534,8 @@ test_shape_same_dr__irregular(int test_num, /* Now select the irregular selection in the (possibly larger) n-cube. - * - * Basic idea is to project the pattern used in the smaller n-cube + * + * Basic idea is to project the pattern used in the smaller n-cube * onto the dimensions selected in the larger n-cube, with the displacement * specified. */ @@ -11564,7 +11572,7 @@ test_shape_same_dr__irregular(int test_num, /* setup is done -- run the test: */ - check = H5S_select_shape_same_test(n_cube_0_sid, n_cube_1_sid); + check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); VERIFY(check, expected_result, "test_shape_same_dr__checkerboard"); @@ -11580,25 +11588,25 @@ test_shape_same_dr__irregular(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_irregular_tests(): +** test_shape_same_dr__run_irregular_tests(): ** -** In this set of tests, we test H5S_select_shape_same() -** with an "irregular" subselection of 1, 2, 3, and 4 cubes as -** one parameter, and irregular subselections of 1, 2, 3, -** and 4 dimensional slices through a n-cube of rank no more -** than 5 (and at least the rank of the slice) as the other. -** Note that the "irregular" selection may be offset between +** In this set of tests, we test H5S_select_shape_same() +** with an "irregular" subselection of 1, 2, 3, and 4 cubes as +** one parameter, and irregular subselections of 1, 2, 3, +** and 4 dimensional slices through a n-cube of rank no more +** than 5 (and at least the rank of the slice) as the other. +** Note that the "irregular" selection may be offset between ** the n-cube and the slice. ** ** All the irregular selections will be identical (modulo rank) ** so H5S_select_shape_same() should return true iff: ** -** 1) the rank of the n cube equals the number of dimensions -** selected in the irregular slice through the m-cube +** 1) the rank of the n cube equals the number of dimensions +** selected in the irregular slice through the m-cube ** (m >= n). ** -** 2) The dimensions selected in the irregular slice -** through the m-cube are the dimensions with the most +** 2) The dimensions selected in the irregular slice +** through the m-cube are the dimensions with the most ** quickly changing indices. ** ****************************************************************/ @@ -11649,7 +11657,7 @@ test_shape_same_dr__run_irregular_tests(void) dim_selected[4] = FALSE; else dim_selected[4] = TRUE; - + /* compute the expected result: */ i = 0; @@ -11795,8 +11803,8 @@ test_shape_same_dr__run_irregular_tests(void) /**************************************************************** ** -** test_shape_same_dr(): Tests selections on dataspace with -** different ranks, to verify that "shape same" routine +** test_shape_same_dr(): Tests selections on dataspace with +** different ranks, to verify that "shape same" routine ** is now handling this case correctly. ** ****************************************************************/ @@ -11913,7 +11921,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg1); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg1); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ @@ -11922,7 +11930,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg1,sid_reg_ori1); + rebuild_check = H5S__select_shape_same_test(sid_reg1,sid_reg_ori1); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -11945,7 +11953,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg1); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg1); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ @@ -11992,7 +12000,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg2); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg2); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ @@ -12001,7 +12009,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg2,sid_reg_ori2); + rebuild_check = H5S__select_shape_same_test(sid_reg2,sid_reg_ori2); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12029,7 +12037,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg2); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg2); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ @@ -12081,7 +12089,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg3); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg3); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ @@ -12091,7 +12099,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg3,sid_reg_ori3); + rebuild_check = H5S__select_shape_same_test(sid_reg3,sid_reg_ori3); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12124,7 +12132,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg3); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg3); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ @@ -12184,7 +12192,7 @@ test_space_rebuild(void) rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg4); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg4); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ @@ -12193,7 +12201,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg4,sid_reg_ori4); + rebuild_check = H5S__select_shape_same_test(sid_reg4,sid_reg_ori4); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12237,7 +12245,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg4); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg4); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ @@ -12301,7 +12309,7 @@ test_space_rebuild(void) rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_reg5); + rebuild_stat = H5S__get_rebuild_status_test(sid_reg5); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ @@ -12310,7 +12318,7 @@ test_space_rebuild(void) } else { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S_select_shape_same_test(sid_reg5,sid_reg_ori5); + rebuild_check = H5S__select_shape_same_test(sid_reg5,sid_reg_ori5); CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); } @@ -12359,7 +12367,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_irreg5); + rebuild_stat = H5S__get_rebuild_status_test(sid_irreg5); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ @@ -12400,7 +12408,7 @@ test_space_rebuild(void) ret = H5Sselect_hyperslab(sid_spec,H5S_SELECT_SET,start5,stride5,count5,block5); CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_spec); + rebuild_stat = H5S__get_rebuild_status_test(sid_spec); /* In this case, rebuild_stat should be TRUE. */ if(!rebuild_stat){ ret = FAIL; @@ -12422,7 +12430,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = TRUE; - rebuild_stat = H5S_get_rebuild_status_test(sid_spec); + rebuild_stat = H5S__get_rebuild_status_test(sid_spec); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(rebuild_stat){ @@ -12445,7 +12453,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sselect_hyperslab"); rebuild_stat = FALSE; - rebuild_stat = H5S_get_rebuild_status_test(sid_spec); + rebuild_stat = H5S__get_rebuild_status_test(sid_spec); assert(rebuild_stat!=FAIL); /* In this case, rebuild_stat should be FALSE. */ if(!rebuild_stat){ @@ -12861,9 +12869,9 @@ test_select_bounds(void) /* Get bounds for 'none' selection */ H5E_BEGIN_TRY { ret = H5Sget_select_bounds(sid, low_bounds, high_bounds); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_select_bo unds"); - + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_select_bo unds"); + /* Set point selection */ coord[0][0] = 3; coord[0][1] = 3; coord[1][0] = 3; coord[1][1] = 96; @@ -13040,14 +13048,14 @@ test_hyper_regular(void) /* Query if 'all' selection is regular hyperslab (should fail) */ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); - } H5E_END_TRY; - VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); /* Set 'none' selection */ ret = H5Sselect_none(sid); @@ -13056,14 +13064,14 @@ test_hyper_regular(void) /* Query if 'none' selection is regular hyperslab (should fail) */ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); - } H5E_END_TRY; - VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); /* Set point selection */ coord[0][0] = 3; coord[0][1] = 3; coord[0][2] = 3; @@ -13076,14 +13084,14 @@ test_hyper_regular(void) /* Query if 'point' selection is regular hyperslab (should fail) */ H5E_BEGIN_TRY { is_regular = H5Sis_regular_hyperslab(sid); - } H5E_END_TRY; - VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(is_regular, FAIL, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); /* Set "regular" hyperslab selection */ start[0] = 2; start[1] = 2; start[2] = 2; @@ -13095,7 +13103,7 @@ test_hyper_regular(void) /* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */ is_regular = H5Sis_regular_hyperslab(sid); - VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); + VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); /* Retrieve the hyperslab parameters */ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); @@ -13121,13 +13129,13 @@ test_hyper_regular(void) /* Query if 'hyperslab' selection is regular hyperslab (should be FALSE) */ is_regular = H5Sis_regular_hyperslab(sid); - VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); + VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); /* Query regular hyperslab selection info (should fail) */ H5E_BEGIN_TRY { ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); - } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_regular_hyperslab"); /* 'XOR' in the point again, to remove it, which should make it regular again */ t_start[0] = 0; t_start[1] = 0; t_start[2] = 0; @@ -13137,7 +13145,7 @@ test_hyper_regular(void) /* Query if 'hyperslab' selection is regular hyperslab (should be TRUE) */ is_regular = H5Sis_regular_hyperslab(sid); - VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); + VERIFY(is_regular, TRUE, "H5Sis_regular_hyperslab"); /* Retrieve the hyperslab parameters */ ret = H5Sget_regular_hyperslab(sid, q_start, q_stride, q_count, q_block); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index eddbada..f5282bd 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -948,9 +948,9 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(tv_ptr->small_ds_slice_sid, + check = H5S__select_shape_same_test(tv_ptr->small_ds_slice_sid, tv_ptr->file_large_ds_sid_0); - VRFY((check == TRUE), "H5S_select_shape_same_test passed"); + VRFY((check == TRUE), "H5S__select_shape_same_test passed"); /* Read selection from disk */ @@ -1216,9 +1216,9 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0, + check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid); - VRFY((check == TRUE), "H5S_select_shape_same_test passed"); + VRFY((check == TRUE), "H5S__select_shape_same_test passed"); /* Read selection from disk */ @@ -1531,9 +1531,9 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * memory slice through the cube selection and the * on disk full square selections as having the same shape. */ - check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0, + check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid); - VRFY((check == TRUE), "H5S_select_shape_same_test passed."); + VRFY((check == TRUE), "H5S__select_shape_same_test passed."); /* write the slice from the in memory large data set to the @@ -1864,9 +1864,9 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) * on disk slice through the large data set selection * as having the same shape. */ - check = H5S_select_shape_same_test(tv_ptr->mem_small_ds_sid, + check = H5S__select_shape_same_test(tv_ptr->mem_small_ds_sid, tv_ptr->file_large_ds_sid_0); - VRFY((check == TRUE), "H5S_select_shape_same_test passed"); + VRFY((check == TRUE), "H5S__select_shape_same_test passed"); /* write the small data set slice from memory to the @@ -3149,9 +3149,9 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(tv_ptr->small_ds_slice_sid, + check = H5S__select_shape_same_test(tv_ptr->small_ds_slice_sid, tv_ptr->file_large_ds_sid_0); - VRFY((check == TRUE), "H5S_select_shape_same_test passed"); + VRFY((check == TRUE), "H5S__select_shape_same_test passed"); /* Read selection from disk */ @@ -3415,9 +3415,9 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_0, + check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid); - VRFY((check == TRUE), "H5S_select_shape_same_test passed"); + VRFY((check == TRUE), "H5S__select_shape_same_test passed"); /* Read selection from disk */ @@ -3800,9 +3800,9 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * large dataset and the checkerboard selection of the process * slice of the small data set as having the same shape. */ - check = H5S_select_shape_same_test(tv_ptr->file_small_ds_sid_1, + check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_1, tv_ptr->mem_large_ds_sid); - VRFY((check == TRUE), "H5S_select_shape_same_test passed."); + VRFY((check == TRUE), "H5S__select_shape_same_test passed."); /* write the checker board selection of the slice from the in @@ -4155,9 +4155,9 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) * on disk slice through the large data set selection * as having the same shape. */ - check = H5S_select_shape_same_test(tv_ptr->mem_small_ds_sid, + check = H5S__select_shape_same_test(tv_ptr->mem_small_ds_sid, tv_ptr->file_large_ds_sid_1); - VRFY((check == TRUE), "H5S_select_shape_same_test passed"); + VRFY((check == TRUE), "H5S__select_shape_same_test passed"); /* write the small data set slice from memory to the diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index 02d2cca..cc79af2 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -2334,9 +2334,9 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(mem_large_ds_sid, + check = H5S__select_shape_same_test(mem_large_ds_sid, file_small_ds_sid); - VRFY((check == TRUE), "H5S_select_shape_same_test passed (1)"); + VRFY((check == TRUE), "H5S__select_shape_same_test passed (1)"); ret = H5Dread(small_dataset, @@ -2455,9 +2455,9 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, /* verify that H5S_select_shape_same() reports the two * selections as having the same shape. */ - check = H5S_select_shape_same_test(mem_small_ds_sid, + check = H5S__select_shape_same_test(mem_small_ds_sid, file_large_ds_sid); - VRFY((check == TRUE), "H5S_select_shape_same_test passed (2)"); + VRFY((check == TRUE), "H5S__select_shape_same_test passed (2)"); ret = H5Dread(large_dataset, @@ -2622,31 +2622,27 @@ void lower_dim_size_comp_test(void) { /* const char *fcnName = "lower_dim_size_comp_test()"; */ - int chunk_edge_size = 0; - int use_collective_io = 1; - hid_t dset_type = H5T_NATIVE_UINT; + int chunk_edge_size = 0; + int use_collective_io; + #if 0 HDsleep(60); #endif - HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); - for ( use_collective_io = (hbool_t)0; - (int)use_collective_io <= 1; - (hbool_t)(use_collective_io++) ) { + HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); + for(use_collective_io = 0; use_collective_io <= 1; use_collective_io++) { chunk_edge_size = 0; lower_dim_size_comp_test__run_test(chunk_edge_size, (hbool_t)use_collective_io, - dset_type); - + H5T_NATIVE_UINT); chunk_edge_size = 5; lower_dim_size_comp_test__run_test(chunk_edge_size, (hbool_t)use_collective_io, - dset_type); - } + H5T_NATIVE_UINT); + } /* end for */ return; - } /* lower_dim_size_comp_test() */ |