diff options
-rw-r--r-- | src/H5Dio.c | 24 | ||||
-rw-r--r-- | src/H5Sall.c | 23 | ||||
-rw-r--r-- | src/H5Shyper.c | 40 | ||||
-rw-r--r-- | src/H5Snone.c | 8 | ||||
-rw-r--r-- | src/H5Spkg.h | 22 | ||||
-rw-r--r-- | src/H5Spoint.c | 16 | ||||
-rw-r--r-- | src/H5Sprivate.h | 12 | ||||
-rw-r--r-- | src/H5Sselect.c | 41 |
8 files changed, 91 insertions, 95 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c index b64d844..1833452 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -1171,7 +1171,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 || dataset->layout.type==H5D_COMPACT); n = H5S_select_fgath(dataset->ent.file, &(dataset->layout), - &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), src_type_size, file_space, + &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), file_space, &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf/*out*/); #ifdef H5S_DEBUG @@ -1186,7 +1186,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif - n = H5S_select_mgath(buf, dst_type_size, mem_space, &bkg_iter, + n = H5S_select_mgath(buf, mem_space, &bkg_iter, smine_nelmts, dxpl_cache, bkg_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].bkg_timer), &timer); @@ -1209,7 +1209,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif - status = H5S_select_mscat(tconv_buf, dst_type_size, mem_space, + status = H5S_select_mscat(tconv_buf, mem_space, &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].scat_timer), &timer); @@ -1395,7 +1395,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif - n = H5S_select_mgath(buf, src_type_size, mem_space, &mem_iter, + n = H5S_select_mgath(buf, mem_space, &mem_iter, smine_nelmts, dxpl_cache, tconv_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[0].gath_timer), &timer); @@ -1410,7 +1410,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 H5_timer_begin(&timer); #endif n = H5S_select_fgath(dataset->ent.file, &(dataset->layout), - &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space, + &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), file_space, &bkg_iter, smine_nelmts, dxpl_cache, dxpl_id, bkg_buf/*out*/); #ifdef H5S_DEBUG @@ -1435,7 +1435,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5 H5_timer_begin(&timer); #endif status = H5S_select_fscat(dataset->ent.file, &(dataset->layout), - &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), dst_type_size, file_space, &file_iter, + &dataset->dcpl_cache, (H5D_storage_t *)&(dataset->efl), file_space, &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf); #ifdef H5S_DEBUG @@ -1685,7 +1685,7 @@ UNUSED assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 || dataset->layout.type==H5D_COMPACT); n = H5S_select_fgath(dataset->ent.file, &(dataset->layout), - &dataset->dcpl_cache, &store, src_type_size, chunk_info->fspace, + &dataset->dcpl_cache, &store, chunk_info->fspace, &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf/*out*/); #ifdef H5S_DEBUG @@ -1700,7 +1700,7 @@ UNUSED #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif - n = H5S_select_mgath(buf, dst_type_size, chunk_info->mspace, &bkg_iter, + n = H5S_select_mgath(buf, chunk_info->mspace, &bkg_iter, smine_nelmts, dxpl_cache, bkg_buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].bkg_timer), &timer); @@ -1724,7 +1724,7 @@ UNUSED #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif - status = H5S_select_mscat(tconv_buf, dst_type_size, chunk_info->mspace, + status = H5S_select_mscat(tconv_buf, chunk_info->mspace, &mem_iter, smine_nelmts, dxpl_cache, buf/*out*/); #ifdef H5S_DEBUG H5_timer_end(&(sconv->stats[1].scat_timer), &timer); @@ -2037,7 +2037,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, #ifdef H5S_DEBUG H5_timer_begin(&timer); #endif - n = H5S_select_mgath(buf, src_type_size, chunk_info->mspace, &mem_iter, + n = H5S_select_mgath(buf, chunk_info->mspace, &mem_iter, smine_nelmts, dxpl_cache, tconv_buf/*out*/); #ifdef H5S_DEBUG @@ -2053,7 +2053,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5_timer_begin(&timer); #endif n = H5S_select_fgath(dataset->ent.file, &(dataset->layout), - &dataset->dcpl_cache, &store, dst_type_size, chunk_info->fspace, + &dataset->dcpl_cache, &store, chunk_info->fspace, &bkg_iter, smine_nelmts, dxpl_cache, dxpl_id, bkg_buf/*out*/); #ifdef H5S_DEBUG @@ -2079,7 +2079,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, H5_timer_begin(&timer); #endif status = H5S_select_fscat(dataset->ent.file, &(dataset->layout), - &dataset->dcpl_cache, &store, dst_type_size, chunk_info->fspace, + &dataset->dcpl_cache, &store, chunk_info->fspace, &file_iter, smine_nelmts, dxpl_cache, dxpl_id, tconv_buf); #ifdef H5S_DEBUG diff --git a/src/H5Sall.c b/src/H5Sall.c index 6f5152d..edff4ba 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -60,7 +60,7 @@ static herr_t H5S_all_iter_release(H5S_sel_iter_t *sel_iter); *------------------------------------------------------------------------- */ herr_t -H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space, size_t UNUSED elmt_size) +H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space) { herr_t ret_value=SUCCEED; /* Return value */ @@ -74,7 +74,8 @@ H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space, size_t UNUSED elmt_ iter->elmt_left=H5S_get_simple_extent_npoints(space); /* Start at the upper left location */ - iter->u.all.offset=0; + iter->u.all.elmt_offset=0; + iter->u.all.byte_offset=0; /* Initialize methods for selection iterator */ iter->iter_coords=H5S_all_iter_coords; @@ -117,7 +118,7 @@ H5S_all_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords) assert (coords); /* Calculate the coordinates for the current iterator offset */ - if(H5V_array_calc(iter->u.all.offset,iter->rank,iter->dims,coords)<0) + if(H5V_array_calc(iter->u.all.elmt_offset,iter->rank,iter->dims,coords)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve coordinates"); done: @@ -249,7 +250,8 @@ H5S_all_iter_next(H5S_sel_iter_t *iter, size_t nelem) assert (nelem>0); /* Increment the iterator */ - iter->u.all.offset+=nelem; + iter->u.all.elmt_offset+=nelem; + iter->u.all.byte_offset+=(nelem*iter->elmt_size); FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_all_iter_next() */ @@ -779,12 +781,11 @@ done: PURPOSE Create a list of offsets & lengths for a selection USAGE - herr_t H5S_all_get_seq_list(space,flags,iter,elem_size,maxseq,maxbytes,nseq,nbytes,off,len) + herr_t H5S_all_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 position of interest in selection. - size_t elem_size; IN: Size of an element size_t maxseq; IN: Maximum number of sequences to generate size_t maxelem; IN: Maximum number of elements to include in the generated sequences @@ -807,7 +808,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_iter_t *iter, - size_t elem_size, size_t UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem, + size_t UNUSED maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) { size_t elem_used; /* The number of elements used */ @@ -818,7 +819,6 @@ H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_i /* Check args */ assert(space); assert(iter); - assert(elem_size>0); assert(maxseq>0); assert(maxelem>0); assert(nseq); @@ -831,8 +831,8 @@ H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_i elem_used=MIN(maxelem,(size_t)iter->elmt_left); /* Compute the offset in the dataset */ - off[0]=iter->u.all.offset*elem_size; - len[0]=elem_used*elem_size; + off[0]=iter->u.all.byte_offset; + len[0]=elem_used*iter->elmt_size; /* Should only need one sequence for 'all' selections */ *nseq=1; @@ -842,7 +842,8 @@ H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_i /* Update the iterator */ iter->elmt_left-=elem_used; - iter->u.all.offset+=elem_used; + iter->u.all.elmt_offset+=elem_used; + iter->u.all.byte_offset+=len[0]; done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 77d18f7..22c1541 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -176,7 +176,7 @@ H5S_hyper_print_diminfo(FILE *f, const H5S_t *space) *------------------------------------------------------------------------- */ herr_t -H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size) +H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ H5S_hyper_span_info_t *spans; /* Pointer to hyperslab span info node */ @@ -222,7 +222,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size) /* Don't flatten adjacent elements into contiguous block if the * element size is 0. This is for the H5S_select_shape_same() code. */ - if(elmt_size>0) { + if(iter->elmt_size>0) { /* Check for any "contiguous" blocks that can be flattened */ for(u=rank-1; u>0; u--) { if(tdiminfo[u].count==1 && tdiminfo[u].block==mem_size[u]) @@ -316,7 +316,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size) iter->u.hyp.spans=H5S_hyper_copy_span(space->select.sel_info.hslab.span_lst); /* Set the nelem & pstride values according to the element size */ - H5S_hyper_span_precompute(iter->u.hyp.spans,elmt_size); + H5S_hyper_span_precompute(iter->u.hyp.spans,iter->elmt_size); /* Initialize the starting span_info's and spans */ spans=iter->u.hyp.spans; @@ -6669,11 +6669,10 @@ done: PURPOSE Create a list of offsets & lengths for a selection USAGE - herr_t H5S_select_hyper_get_file_list_gen(space,iter,maxseq,nseq,off,len) + herr_t H5S_select_hyper_get_file_list_gen(space,iter,maxseq,maxelem,nseq,nelem,off,len) H5S_t *space; IN: Dataspace containing selection to use. H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last position of interest in selection. - size_t elem_size; IN: Size of an element size_t maxseq; IN: Maximum number of sequences to generate size_t maxelem; IN: Maximum number of elements to include in the generated sequences @@ -6696,7 +6695,7 @@ done: --------------------------------------------------------------------------*/ static herr_t H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter, - size_t elem_size, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, + size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) { H5S_hyper_span_t *curr_span; /* Current hyperslab span node */ @@ -6713,6 +6712,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter, size_t start_io_bytes_left; /* Initial number of bytes left to process */ size_t io_used; /* Number of elements processed */ size_t curr_seq=0; /* Number of sequence/offsets stored in the arrays */ + size_t elem_size; /* Size of each element iterating over */ int ndims; /* Number of dimensions of dataset */ int fast_dim; /* Rank of the fastest changing dimension for the dataspace */ int curr_dim; /* Current dimension being operated on */ @@ -6723,7 +6723,6 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter, /* Check args */ assert(space); assert(iter); - assert(elem_size>0); assert(maxseq>0); assert(maxelem>0); assert(nseq); @@ -6740,6 +6739,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter, abs_arr=iter->u.hyp.off; off_arr=space->select.offset; ispan=iter->u.hyp.span; + elem_size=iter->elmt_size; /* Set the amount of elements to perform I/O on, etc. */ H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t); @@ -7102,11 +7102,10 @@ partial_done: /* Yes, goto's are evil, so sue me... :-) */ PURPOSE Create a list of offsets & lengths for a selection USAGE - herr_t H5S_select_hyper_get_file_list_opt(space,iter,maxseq,nseq,off,len) + herr_t H5S_select_hyper_get_file_list_opt(space,iter,maxseq,maxelem,nseq,nelem,off,len) H5S_t *space; IN: Dataspace containing selection to use. H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last position of interest in selection. - size_t elem_size; IN: Size of an element size_t maxseq; IN: Maximum number of sequences to generate size_t maxelem; IN: Maximum number of elements to include in the generated sequences @@ -7129,7 +7128,7 @@ partial_done: /* Yes, goto's are evil, so sue me... :-) */ --------------------------------------------------------------------------*/ static herr_t H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, - size_t elmt_size, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, + size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) { hsize_t *mem_size; /* Size of the source buffer */ @@ -7163,13 +7162,13 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, size_t nelmts; /* Starting number of elements */ size_t io_left; /* The number of elements left in I/O operation */ size_t start_io_left; /* The initial number of elements left in I/O operation */ + size_t elem_size; /* Size of each element iterating over */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_opt); /* Check args */ assert(space); assert(iter); - assert(elmt_size>0); assert(maxseq>0); assert(maxelem>0); assert(nseq); @@ -7205,7 +7204,8 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, } /* end else */ /* initialize row sizes for each dimension */ - for(i=(ndims-1),acc=elmt_size; i>=0; i--) { + elem_size=iter->elmt_size; + for(i=(ndims-1),acc=elem_size; i>=0; i--) { slab[i]=acc; acc*=mem_size[i]; } /* end for */ @@ -7236,7 +7236,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, /* Add a new sequence */ off[curr_seq]=loc; - H5_ASSIGN_OVERFLOW(len[curr_seq],actual_elem*elmt_size,hsize_t,size_t); + H5_ASSIGN_OVERFLOW(len[curr_seq],actual_elem*elem_size,hsize_t,size_t); /* Increment sequence count */ curr_seq++; @@ -7287,7 +7287,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, H5_ASSIGN_OVERFLOW(actual_elem,tdiminfo[fast_dim].block,hsize_t,size_t); /* Set the number of actual bytes */ - actual_bytes=actual_elem*elmt_size; + actual_bytes=actual_elem*elem_size; /* Set local copies of information for the fastest changing dimension */ fast_dim_start=tdiminfo[fast_dim].start; @@ -7532,7 +7532,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, /* Handle any leftover, partial blocks in this row */ if(io_left>0 && curr_seq<maxseq) { actual_elem=io_left; - actual_bytes=actual_elem*elmt_size; + actual_bytes=actual_elem*elem_size; /* Store the sequence information */ off[curr_seq]=loc; @@ -7579,12 +7579,11 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, PURPOSE Create a list of offsets & lengths for a selection USAGE - herr_t H5S_hyper_get_seq_list(space,flags,iter,elem_size,maxseq,maxbytes,nseq,nbytes,off,len) + herr_t H5S_hyper_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 position of interest in selection. - size_t elem_size; IN: Size of an element size_t maxseq; IN: Maximum number of sequences to generate size_t maxelem; IN: Maximum number of elements to include in the generated sequences @@ -7607,7 +7606,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, --------------------------------------------------------------------------*/ herr_t H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t *iter, - size_t elem_size, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, + size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) { herr_t ret_value; /* return value */ @@ -7617,7 +7616,6 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t /* Check args */ assert(space); assert(iter); - assert(elem_size>0); assert(maxseq>0); assert(maxelem>0); assert(nseq); @@ -7628,10 +7626,10 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t /* Check for the special case of just one H5Sselect_hyperslab call made */ if(space->select.sel_info.hslab.diminfo_valid) /* Use optimized call to generate sequence list */ - ret_value=H5S_hyper_get_seq_list_opt(space,iter,elem_size,maxseq,maxelem,nseq,nelem,off,len); + ret_value=H5S_hyper_get_seq_list_opt(space,iter,maxseq,maxelem,nseq,nelem,off,len); else /* Call the general sequence generator routine */ - ret_value=H5S_hyper_get_seq_list_gen(space,iter,elem_size,maxseq,maxelem,nseq,nelem,off,len); + ret_value=H5S_hyper_get_seq_list_gen(space,iter,maxseq,maxelem,nseq,nelem,off,len); done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Snone.c b/src/H5Snone.c index 28622c1..1e6a1d5 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -61,7 +61,7 @@ static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter); *------------------------------------------------------------------------- */ herr_t -H5S_none_iter_init (H5S_sel_iter_t *iter, const H5S_t UNUSED *space, size_t UNUSED elmt_size) +H5S_none_iter_init (H5S_sel_iter_t *iter, const H5S_t UNUSED *space) { herr_t ret_value=SUCCEED; /* Return value */ @@ -733,12 +733,11 @@ done: PURPOSE Create a list of offsets & lengths for a selection USAGE - herr_t H5S_all_get_seq_list(space,flags,iter,elem_size,maxseq,maxbytes,nseq,nbytes,off,len) + herr_t H5S_all_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 position of interest in selection. - size_t elem_size; IN: Size of an element size_t maxseq; IN: Maximum number of sequences to generate size_t maxelem; IN: Maximum number of elements to include in the generated sequences @@ -761,7 +760,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5S_none_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_iter_t UNUSED *iter, - size_t UNUSED elem_size, size_t UNUSED maxseq, size_t UNUSED maxelem, size_t *nseq, size_t *nelem, + size_t UNUSED maxseq, size_t UNUSED maxelem, size_t *nseq, size_t *nelem, hsize_t UNUSED *off, size_t UNUSED *len) { herr_t ret_value=SUCCEED; /* Return value */ @@ -771,7 +770,6 @@ H5S_none_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_ /* Check args */ assert(space); assert(iter); - assert(elem_size>0); assert(maxseq>0); assert(maxelem>0); assert(nseq); diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 3053dd8..31f23ea 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -103,7 +103,7 @@ typedef struct { hbool_t diminfo_valid; /* Whether the dataset has valid diminfo */ H5S_hyper_dim_t opt_diminfo[H5S_MAX_RANK]; /* per-dim selection info */ H5S_hyper_dim_t app_diminfo[H5S_MAX_RANK]; /* per-dim selection info */ - /* 'diminfo' points to a [potentially] optimized version of the user's + /* 'opt_diminfo' points to a [potentially] optimized version of the user's * hyperslab information. 'app_diminfo' points to the actual parameters * that the application used for setting the hyperslab selection. These * are only used for re-gurgitating the original values used to set the @@ -115,7 +115,7 @@ typedef struct { /* Selection information methods */ /* Method to retrieve a list of offset/length sequences for selection */ typedef herr_t (*H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags, - H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes, + H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); /* Method to compute number of elements in current selection */ typedef hsize_t (*H5S_sel_get_npoints_func_t)(const H5S_t *space); @@ -136,7 +136,7 @@ typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space); /* Method to determine if current selection is "regular" */ typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space); /* Method to initialize iterator for current selection */ -typedef herr_t (*H5S_sel_iter_init_func_t)(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_size); +typedef herr_t (*H5S_sel_iter_init_func_t)(H5S_sel_iter_t *sel_iter, const H5S_t *space); /* Selection information object */ typedef struct { @@ -175,7 +175,7 @@ H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); /* Operations on selections */ /* Point selection iterator functions */ -H5_DLL herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size); +H5_DLL herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Point selection functions */ H5_DLL herr_t H5S_point_release(H5S_t *space); @@ -190,11 +190,11 @@ H5_DLL htri_t H5S_point_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_point_is_single(const H5S_t *space); H5_DLL htri_t H5S_point_is_regular(const H5S_t *space); H5_DLL herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, - H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes, + H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); /* "All" selection iterator functions */ -H5_DLL herr_t H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size); +H5_DLL herr_t H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* "All" selection functions */ H5_DLL herr_t H5S_all_release(H5S_t *space); @@ -208,11 +208,11 @@ H5_DLL htri_t H5S_all_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_all_is_single(const H5S_t *space); H5_DLL htri_t H5S_all_is_regular(const H5S_t *space); H5_DLL herr_t H5S_all_get_seq_list(const H5S_t *space, unsigned flags, - H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes, + H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); /* Hyperslab selection iterator functions */ -H5_DLL herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size); +H5_DLL herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Hyperslab selection functions */ H5_DLL herr_t H5S_hyper_release(H5S_t *space); @@ -227,11 +227,11 @@ H5_DLL htri_t H5S_hyper_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_hyper_is_single(const H5S_t *space); H5_DLL htri_t H5S_hyper_is_regular(const H5S_t *space); H5_DLL herr_t H5S_hyper_get_seq_list(const H5S_t *space, unsigned flags, - H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes, + H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); /* "None" selection iterator functions */ -H5_DLL herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size); +H5_DLL herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* "None" selection functions */ H5_DLL herr_t H5S_none_release(H5S_t *space); @@ -245,7 +245,7 @@ H5_DLL htri_t H5S_none_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_none_is_single(const H5S_t *space); H5_DLL htri_t H5S_none_is_regular(const H5S_t *space); H5_DLL herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags, - H5S_sel_iter_t *iter, size_t elem_size, size_t maxseq, size_t maxbytes, + H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Spoint.c b/src/H5Spoint.c index b9e0b8a..fa26f99 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -68,7 +68,7 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t); *------------------------------------------------------------------------- */ herr_t -H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t UNUSED elmt_size) +H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) { herr_t ret_value=SUCCEED; /* Return value */ @@ -1307,12 +1307,11 @@ done: PURPOSE Create a list of offsets & lengths for a selection USAGE - herr_t H5S_point_get_seq_list(space,flags,iter,elem_size,maxseq,maxbytes,nseq,nbytes,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 position of interest in selection. - size_t elem_size; IN: Size of an element size_t maxseq; IN: Maximum number of sequences to generate size_t maxelem; IN: Maximum number of elements to include in the generated sequences @@ -1335,7 +1334,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, - size_t elem_size, size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, + 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 */ @@ -1354,7 +1353,6 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, /* Check args */ assert(space); assert(iter); - assert(elem_size>0); assert(maxseq>0); assert(maxelem>0); assert(nseq); @@ -1376,7 +1374,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, curr_seq=0; while(node!=NULL) { /* Compute the offset of each selected point in the buffer */ - for(i=ndims-1,acc=elem_size,loc=0; i>=0; i--) { + for(i=ndims-1,acc=iter->elmt_size,loc=0; i>=0; i--) { loc+=(node->pnt[i]+space->select.offset[i])*acc; acc*=dims[i]; } /* end for */ @@ -1391,12 +1389,12 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, /* (Unlikely, but possible) */ if(loc==(off[curr_seq-1]+len[curr_seq-1])) { /* Extend the previous sequence */ - len[curr_seq-1]+=elem_size; + len[curr_seq-1]+=iter->elmt_size; } /* end if */ else { /* Add a new sequence */ off[curr_seq]=loc; - len[curr_seq]=elem_size; + len[curr_seq]=iter->elmt_size; /* Increment sequence count */ curr_seq++; @@ -1405,7 +1403,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, else { /* Add a new sequence */ off[curr_seq]=loc; - len[curr_seq]=elem_size; + len[curr_seq]=iter->elmt_size; /* Increment sequence count */ curr_seq++; diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index d350738..c3dc4e2 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -80,7 +80,8 @@ typedef struct { /* "All" selection iteration container */ typedef struct { - hsize_t offset; /* Next element to output */ + hsize_t elmt_offset; /* Next element to output */ + hsize_t byte_offset; /* Next byte to output */ } H5S_all_iter_t; typedef struct H5S_sel_iter_t H5S_sel_iter_t; @@ -106,6 +107,7 @@ struct H5S_sel_iter_t { unsigned rank; /* Rank of dataspace the selection iterator is operating on */ hsize_t *dims; /* Dimensions of dataspace the selection is operating on */ hsize_t elmt_left; /* Number of elements left to iterate over */ + size_t elmt_size; /* Size of elements to iterate over */ /* Information specific to each type of iterator */ union { @@ -201,17 +203,17 @@ H5_DLL herr_t H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5_DLL herr_t H5S_select_fill(void *fill, size_t fill_size, const H5S_t *space, void *buf); H5_DLL herr_t H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, - const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, size_t elmt_size, + const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, const H5S_t *file_space, H5S_sel_iter_t *file_iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const void *_buf); H5_DLL hsize_t H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, - const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, size_t elmt_size, + const H5D_dcpl_cache_t *dcpl_cache, const union H5D_storage_t *store, const H5S_t *file_space, H5S_sel_iter_t *file_iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, void *buf); -H5_DLL herr_t H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, +H5_DLL herr_t H5S_select_mscat (const void *_tscat_buf, const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, void *_buf/*out*/); -H5_DLL hsize_t H5S_select_mgath (const void *_buf, size_t elmt_size, +H5_DLL hsize_t H5S_select_mgath (const void *_buf, const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, void *_tgath_buf/*out*/); H5_DLL herr_t H5S_select_read(H5F_t *f, const struct H5O_layout_t *layout, diff --git a/src/H5Sselect.c b/src/H5Sselect.c index e48ee93..27c560a 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -567,8 +567,11 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s else sel_iter->dims = NULL; + /* Save the element size */ + sel_iter->elmt_size=elmt_size; + /* Call initialization routine for selection type */ - ret_value= (*space->select.iter_init)(sel_iter, space, elmt_size); + ret_value= (*space->select.iter_init)(sel_iter, space); done: FUNC_LEAVE_NOAPI(ret_value); @@ -927,7 +930,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t /* Loop, while elements left in selection */ while(max_elem>0 && user_ret==0) { /* Get the sequences of bytes */ - if((*space->select.get_seq_list)(space,0,&iter,elmt_size,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1335,7 +1338,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) /* Loop, while elements left in selection */ while(max_elem>0) { /* Get the sequences of bytes */ - if((*space->select.get_seq_list)(space,0,&iter,fill_size,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop over sequences */ @@ -1388,7 +1391,7 @@ done: herr_t H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, - size_t elmt_size, const H5S_t *space, H5S_sel_iter_t *iter, + const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const void *_buf) { @@ -1411,7 +1414,6 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, /* Check args */ assert (f); assert (layout); - assert (elmt_size>0); assert (store); assert (space); assert (iter); @@ -1437,12 +1439,12 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,elmt_size,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Reset the current sequence information */ mem_curr_seq=dset_curr_seq=0; - orig_mem_len=mem_len=nelem*elmt_size; + orig_mem_len=mem_len=nelem*iter->elmt_size; mem_off=0; /* Write sequence list out */ @@ -1493,7 +1495,7 @@ done: hsize_t H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_cache, const H5D_storage_t *store, - size_t elmt_size, const H5S_t *space, H5S_sel_iter_t *iter, + const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, void *_buf/*out*/) { @@ -1516,7 +1518,6 @@ H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, /* Check args */ assert (f); assert (layout); - assert (elmt_size>0); assert (store); assert (space); assert (iter); @@ -1541,12 +1542,12 @@ H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,elmt_size,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Reset the current sequence information */ mem_curr_seq=dset_curr_seq=0; - orig_mem_len=mem_len=nelem*elmt_size; + orig_mem_len=mem_len=nelem*iter->elmt_size; mem_off=0; /* Read sequence list in */ @@ -1589,7 +1590,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, +H5S_select_mscat (const void *_tscat_buf, const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, void *_buf/*out*/) { @@ -1610,7 +1611,6 @@ H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, /* Check args */ assert (tscat_buf); - assert (elmt_size>0); assert (space); assert (iter); assert (nelmts>0); @@ -1634,7 +1634,7 @@ H5S_select_mscat (const void *_tscat_buf, size_t elmt_size, const H5S_t *space, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,0,iter,elmt_size,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1683,7 +1683,7 @@ done: *------------------------------------------------------------------------- */ hsize_t -H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, +H5S_select_mgath (const void *_buf, const H5S_t *space, H5S_sel_iter_t *iter, hsize_t nelmts, const H5D_dxpl_cache_t *dxpl_cache, void *_tgath_buf/*out*/) { @@ -1704,7 +1704,6 @@ H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, /* Check args */ assert (buf); - assert (elmt_size>0); assert (space); assert (iter); assert (nelmts>0); @@ -1728,7 +1727,7 @@ H5S_select_mgath (const void *_buf, size_t elmt_size, const H5S_t *space, /* Loop until all elements are written */ while(maxelem>0) { /* Get list of sequences for selection to write */ - if((*space->select.get_seq_list)(space,0,iter,elmt_size,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) + if((*space->select.get_seq_list)(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1854,7 +1853,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc /* Check if more file sequences are needed */ if(curr_file_seq>=file_nseq) { /* Get sequences for file selection */ - if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,elmt_size,dxpl_cache->vec_size,maxelem,&file_nseq,&file_nelem,file_off,file_len)<0) + if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,maxelem,&file_nseq,&file_nelem,file_off,file_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -1864,7 +1863,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc /* Check if more memory sequences are needed */ if(curr_mem_seq>=mem_nseq) { /* Get sequences for memory selection */ - if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,elmt_size,dxpl_cache->vec_size,maxelem,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) + if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,dxpl_cache->vec_size,maxelem,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -2032,7 +2031,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca #endif /* QAK */ if(curr_file_seq>=file_nseq) { /* Get sequences for file selection */ - if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,elmt_size,dxpl_cache->vec_size,maxelem,&file_nseq,&file_nelem,file_off,file_len)<0) + if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,maxelem,&file_nseq,&file_nelem,file_off,file_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ @@ -2051,7 +2050,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca /* Check if more memory sequences are needed */ if(curr_mem_seq>=mem_nseq) { /* Get sequences for memory selection */ - if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,elmt_size,dxpl_cache->vec_size,maxelem,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) + if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,dxpl_cache->vec_size,maxelem,&mem_nseq,&mem_nelem,mem_off,mem_len)<0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ |