summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-06-14 20:11:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-06-14 20:11:19 (GMT)
commit4d9cce57b4827b0e94f50f9488a87d3f9b5166fc (patch)
treed95a82bac819d5880de1b80c22e505aac477e28b
parente67b8f86ecd8e730055f10d3ab885d27cd032082 (diff)
downloadhdf5-4d9cce57b4827b0e94f50f9488a87d3f9b5166fc.zip
hdf5-4d9cce57b4827b0e94f50f9488a87d3f9b5166fc.tar.gz
hdf5-4d9cce57b4827b0e94f50f9488a87d3f9b5166fc.tar.bz2
[svn-r4002] Purpose:
Bug fix/code improvement. Description: 'all' selections were (ab)using the array reading code and required that the internal data transfer buffer size be big enough to hold the an entire slab of the data, which was confusing and limiting for users. Solution: Changed 'all' selections to use sequence reading code instead of array reading code. Platforms tested: FreeBSD 4.3 (hawkwind)
-rw-r--r--src/H5D.c36
-rw-r--r--src/H5Sall.c261
-rw-r--r--src/H5Shyper.c8
-rw-r--r--src/H5Spoint.c5
-rw-r--r--src/H5Sprivate.h4
5 files changed, 72 insertions, 242 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 8aef16f..07da5b7 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1589,7 +1589,6 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
size_t dst_type_size; /*size of destination type*/
hsize_t target_size; /*desired buffer size */
hsize_t request_nelmts; /*requested strip mine */
- size_t min_elem_out=1; /*Minimum # of elements to output*/
H5T_bkg_t need_bkg; /*type of background buf*/
H5S_t *free_this_space=NULL; /*data space to free */
hbool_t must_convert; /*have to xfer the slow way*/
@@ -1775,15 +1774,15 @@ printf("%s: check 1.2, \n",FUNC);
/*
* This is the general case. Figure out the strip mine size.
*/
- if ((sconv->f->init)(&(dataset->layout), file_space, &file_iter, &min_elem_out)<0) {
+ if ((sconv->f->init)(&(dataset->layout), file_space, &file_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize file selection information");
}
- if ((sconv->m->init)(&(dataset->layout), mem_space, &mem_iter, &min_elem_out)<0) {
+ if ((sconv->m->init)(&(dataset->layout), mem_space, &mem_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
- if ((sconv->m->init)(&(dataset->layout), mem_space, &bkg_iter, &min_elem_out)<0) {
+ if ((sconv->m->init)(&(dataset->layout), mem_space, &bkg_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize background selection information");
}
@@ -1792,12 +1791,10 @@ printf("%s: check 1.2, \n",FUNC);
dst_type_size = H5T_get_size(mem_type);
target_size = xfer_parms->buf_size;
#ifdef QAK
-printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_elem_out=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size,(int)min_elem_out);
+printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size);
#endif /* QAK */
request_nelmts = target_size / MAX(src_type_size, dst_type_size);
- /* Adjust to the min. # of elements to output */
- request_nelmts = (request_nelmts/min_elem_out)*min_elem_out;
#ifdef QAK
printf("%s: check 3.0, request_nelmts=%d\n",FUNC,(int)request_nelmts);
#endif
@@ -2040,7 +2037,6 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
size_t dst_type_size; /*size of destination type*/
hsize_t target_size; /*desired buffer size */
hsize_t request_nelmts; /*requested strip mine */
- size_t min_elem_out=1; /*Minimum # of elements to output*/
H5T_bkg_t need_bkg; /*type of background buf*/
H5S_t *free_this_space=NULL; /*data space to free */
hbool_t must_convert; /*have to xfer the slow way*/
@@ -2160,7 +2156,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
}
}
#ifdef QAK
- printf("%s: after H5T_find, tpath=%p, tpath->name=%s\n",FUNC,tpath,tpath->name);
+ printf("%s: check 0.6, after H5T_find, tpath=%p, tpath->name=%s\n",FUNC,tpath,tpath->name);
#endif /* QAK */
if (NULL==(sconv=H5S_find(mem_space, file_space))) {
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
@@ -2188,6 +2184,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
* If there is no type conversion then try writing directly from
* application buffer to file.
*/
+#ifdef QAK
+ printf("%s: check 0.7, H5T_IS_NOOP(path)=%d, sconv->write=%p\n", FUNC,
+ (int)H5T_IS_NOOP(tpath), sconv->write);
+#endif /* QAK */
if (H5T_IS_NOOP(tpath) && sconv->write) {
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
@@ -2251,15 +2251,15 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/*
* This is the general case. Figure out the strip mine size.
*/
- if ((sconv->f->init)(&(dataset->layout), file_space, &file_iter, &min_elem_out)<0) {
+ if ((sconv->f->init)(&(dataset->layout), file_space, &file_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize file selection information");
}
- if ((sconv->m->init)(&(dataset->layout), mem_space, &mem_iter, &min_elem_out)<0) {
+ if ((sconv->m->init)(&(dataset->layout), mem_space, &mem_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
- if ((sconv->f->init)(&(dataset->layout), file_space, &bkg_iter, &min_elem_out)<0) {
+ if ((sconv->f->init)(&(dataset->layout), file_space, &bkg_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
@@ -2267,18 +2267,18 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
src_type_size = H5T_get_size(mem_type);
dst_type_size = H5T_get_size(dataset->type);
target_size = xfer_parms->buf_size;
+#ifdef QAK
+printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size);
+#endif /* QAK */
request_nelmts = target_size / MAX (src_type_size, dst_type_size);
- /* Adjust to the min. # of elements to output */
- request_nelmts = (request_nelmts/min_elem_out)*min_elem_out;
+#ifdef QAK
+ printf("%s: check 3.0, request_nelmts=%d, tpath->cdata.need_bkg=%d\n",FUNC,(int)request_nelmts,(int)tpath->cdata.need_bkg);
+#endif
if (request_nelmts<=0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"temporary buffer max size is too small");
}
-
-#ifdef QAK
- printf("%s: check 3.0, request_nelmts=%d, tpath->cdata.need_bkg=%d\n",FUNC,(int)request_nelmts,(int)tpath->cdata.need_bkg);
-#endif
/*
* Get a temporary buffer for type conversion unless the app has already
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 36e4e46..80abaea 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -23,7 +23,7 @@
static intn interface_initialize_g = 0;
static herr_t H5S_all_init (const struct H5O_layout_t *layout,
- const H5S_t *space, H5S_sel_iter_t *iter, size_t *min_elem_out);
+ const H5S_t *space, H5S_sel_iter_t *iter);
static hsize_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
hsize_t max);
static hsize_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
@@ -65,6 +65,7 @@ const H5S_mconv_t H5S_ALL_MCONV[1] = {{
H5S_all_mscat, /*scatter */
}};
+
/*-------------------------------------------------------------------------
* Function: H5S_all_init
*
@@ -81,13 +82,8 @@ const H5S_mconv_t H5S_ALL_MCONV[1] = {{
*/
static herr_t
H5S_all_init (const struct H5O_layout_t UNUSED *layout,
- const H5S_t *space, H5S_sel_iter_t *sel_iter, size_t *min_elem_out)
+ const H5S_t *space, H5S_sel_iter_t *sel_iter)
{
- hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- intn space_ndims; /*dimensionality of space*/
- hsize_t acc; /*accumulator */
- intn i; /*counters */
-
FUNC_ENTER (H5S_all_init, FAIL);
/* Check args */
@@ -101,21 +97,9 @@ H5S_all_init (const struct H5O_layout_t UNUSED *layout,
/* Start at the upper left location */
sel_iter->all.offset=0;
- /* Get the dimensions of the space, to set the min. # of elements */
- if ((space_ndims=H5S_get_simple_extent_dims (space, hsize, NULL))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
- "unable to retrieve hyperslab parameters");
- }
-
- /* Adjust the slowest varying dimension to account for strip mining */
- for (i=1, acc=1; i<space_ndims; i++)
- acc *= hsize[i];
-
- /* Set the minimum # of elements to output */
- *min_elem_out=acc;
-
FUNC_LEAVE (SUCCEED);
}
+
/*-------------------------------------------------------------------------
* Function: H5S_all_favail
@@ -134,36 +118,20 @@ H5S_all_init (const struct H5O_layout_t UNUSED *layout,
*-------------------------------------------------------------------------
*/
static hsize_t
-H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, hsize_t max)
+H5S_all_favail (const H5S_t UNUSED *space, const H5S_sel_iter_t *sel_iter, hsize_t max)
{
- hsize_t nelmts;
- int m_ndims; /* file dimensionality */
- hsize_t size[H5O_LAYOUT_NDIMS]; /*size of selected hyperslab */
- hsize_t acc;
- int i;
-
FUNC_ENTER (H5S_all_favail, 0);
/* Check args */
assert (space && H5S_SEL_ALL==space->select.type);
assert (sel_iter);
- /*
- * The stripmine size is such that only the slowest varying dimension can
- * be split up. We choose the largest possible strip mine size which is
- * not larger than the desired size.
- */
- m_ndims = H5S_get_simple_extent_dims (space, size, NULL);
- for (i=m_ndims-1, acc=1; i>0; --i)
- acc *= size[i];
- nelmts = (max/acc) * acc;
- if (nelmts<=0) {
- HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, 0,
- "strip mine buffer is too small");
- }
-
- FUNC_LEAVE (MIN(sel_iter->all.elmt_left,nelmts));
+#ifdef QAK
+ printf("%s: sel_iter->all.elmt_left=%u, max=%u\n",FUNC,(unsigned)sel_iter->all.elmt_left,(unsigned)max);
+#endif /* QAK */
+ FUNC_LEAVE (MIN(sel_iter->all.elmt_left,max));
} /* H5S_all_favail() */
+
/*-------------------------------------------------------------------------
* Function: H5S_all_fgath
@@ -197,15 +165,10 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_fill_t *fill, const struct H5O_efl_t *efl,
size_t elmt_size, const H5S_t *file_space,
H5S_sel_iter_t *file_iter, hsize_t nelmts, hid_t dxpl_id,
- void *_buf/*out*/)
+ void *buf/*out*/)
{
- hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/
- hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */
- uint8_t *buf=(uint8_t*)_buf; /*for pointer arithmetic*/
- hsize_t acc; /*accumulator */
- intn space_ndims; /*dimensionality of space*/
- intn i; /*counters */
+ hsize_t actual_bytes; /* The actual number of bytes to read */
+ hsize_t buf_off; /* Dataset offset for copying memory */
FUNC_ENTER (H5S_all_fgath, 0);
@@ -218,40 +181,15 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
assert (nelmts>0);
assert (buf);
- /*
- * Get hyperslab information to determine what elements are being
- * selected (there might eventually be other selection methods too).
- * We only support hyperslabs with unit sample because there's no way to
- * currently pass sample information into H5F_arr_read() much less
- * H5F_istore_read().
- */
- if ((space_ndims=H5S_get_simple_extent_dims (file_space, hsize, NULL))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
- "unable to retrieve hyperslab parameters");
- }
-
- if(space_ndims>0) {
- HDmemset(file_offset,0,sizeof(hssize_t)*space_ndims);
-
- /* Adjust the slowest varying dimension to take care of strip mining */
- for (i=1, acc=1; i<space_ndims; i++)
- acc *= hsize[i];
- assert (0==file_iter->all.offset % acc);
- assert (0==nelmts % acc);
- file_offset[0] += file_iter->all.offset / acc;
- hsize[0] = nelmts / acc;
- } /* end if */
-
- /* The fastest varying dimension is for the data point itself */
- file_offset[space_ndims] = 0;
- hsize[space_ndims] = elmt_size;
- HDmemset (zero, 0, (space_ndims+1)*sizeof(*zero));
+ /* Set the offset in the dataset and the number of bytes to read */
+ buf_off=file_iter->all.offset*elmt_size;
+ actual_bytes=elmt_size*nelmts;
/*
- * Gather from file.
+ * Read piece from file.
*/
- if (H5F_arr_read(f, dxpl_id, layout, pline, fill, efl, hsize, hsize,
- zero, file_offset, buf/*out*/)<0) {
+ if (H5F_seq_read(f, dxpl_id, layout, pline, fill, efl, file_space,
+ elmt_size, actual_bytes, buf_off, buf/*out*/)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error");
}
@@ -261,6 +199,7 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
FUNC_LEAVE (nelmts);
} /* H5S_all_fgath() */
+
/*-------------------------------------------------------------------------
* Function: H5S_all_fscat
@@ -287,15 +226,10 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const struct H5O_fill_t *fill,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, H5S_sel_iter_t *file_iter,
- hsize_t nelmts, hid_t dxpl_id, const void *_buf)
+ hsize_t nelmts, hid_t dxpl_id, const void *buf)
{
- hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */
- hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero vector */
- const uint8_t *buf=(const uint8_t*)_buf; /*for pointer arithmetic*/
- hsize_t acc; /*accumulator */
- intn space_ndims; /*space dimensionality */
- intn i; /*counters */
+ hsize_t actual_bytes; /* The actual number of bytes to write */
+ hsize_t buf_off; /* Dataset offset for copying memory */
FUNC_ENTER (H5S_all_fscat, FAIL);
@@ -308,37 +242,16 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
assert (nelmts>0);
assert (buf);
- /*
- * Get information to determine what elements are being selected.
- */
- if ((space_ndims=H5S_get_simple_extent_dims (file_space, hsize, NULL))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
- "unable to retrieve hyperslab parameters");
- }
-
- if(space_ndims>0) {
- HDmemset(file_offset,0,sizeof(hssize_t)*space_ndims);
-
- /* Adjust the slowest varying dimension to account for strip mining */
- for (i=1, acc=1; i<space_ndims; i++)
- acc *= hsize[i];
- assert (0==file_iter->all.offset % acc);
- assert (0==nelmts % acc);
- file_offset[0] += file_iter->all.offset / acc;
- hsize[0] = nelmts / acc;
- } /* end if */
-
- /* The fastest varying dimension is for the data point itself */
- file_offset[space_ndims] = 0;
- hsize[space_ndims] = elmt_size;
- HDmemset (zero, 0, (space_ndims+1)*sizeof(*zero));
+ /* Set the offset in the dataset and the number of bytes to write */
+ buf_off=file_iter->all.offset*elmt_size;
+ actual_bytes=elmt_size*nelmts;
/*
- * Scatter to file.
+ * Write piece from file.
*/
- if (H5F_arr_write (f, dxpl_id, layout, pline, fill, efl, hsize, hsize,
- zero, file_offset, buf)<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error");
+ if (H5F_seq_write(f, dxpl_id, layout, pline, fill, efl, file_space,
+ elmt_size, actual_bytes, buf_off, buf/*out*/)<0) {
+ HRETURN_ERROR(H5E_DATASPACE, H5E_WRITEERROR, 0, "write error");
}
/* Advance iterator */
@@ -347,6 +260,7 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
FUNC_LEAVE (SUCCEED);
} /* H5S_all_fscat() */
+
/*-------------------------------------------------------------------------
* Function: H5S_all_mgath
@@ -371,17 +285,10 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
static hsize_t
H5S_all_mgath (const void *_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
- hsize_t nelmts, void *_tconv_buf/*out*/)
+ hsize_t nelmts, void *tconv_buf/*out*/)
{
- hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /*slab offset in app buf*/
- hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
- hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */
const uint8_t *buf=(const uint8_t*)_buf; /* Get local copies for address arithmetic */
- uint8_t *tconv_buf=(uint8_t*)_tconv_buf;
- hsize_t acc; /*accumulator */
- intn space_ndims; /*dimensionality of space*/
- intn i; /*counters */
+ size_t actual_bytes; /* The actual number of bytes to read */
FUNC_ENTER (H5S_all_mgath, 0);
@@ -393,45 +300,12 @@ H5S_all_mgath (const void *_buf, size_t elmt_size,
assert (nelmts>0);
assert (tconv_buf);
- /*
- * Retrieve information to determine what elements are being selected.
- */
- if ((space_ndims=H5S_get_simple_extent_dims (mem_space, hsize, NULL))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
- "unable to retrieve hyperslab parameters");
- }
- if(space_ndims>0) {
- HDmemset(mem_offset,0,sizeof(hssize_t)*space_ndims);
-
- if (H5S_get_simple_extent_dims (mem_space, mem_size, NULL)<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
- "unable to retrieve data space dimensions");
- }
-
- /* Adjust the slowest varying dimension to account for strip mining */
- for (i=1, acc=1; i<space_ndims; i++)
- acc *= hsize[i];
- assert (0==mem_iter->all.offset % acc);
- assert (0==nelmts % acc);
- mem_offset[0] += mem_iter->all.offset / acc;
- hsize[0] = nelmts / acc;
- } /* end if */
-
- /* The fastest varying dimension is for the data point itself */
- mem_offset[space_ndims] = 0;
- mem_size[space_ndims] = elmt_size;
- hsize[space_ndims] = elmt_size;
- HDmemset (zero, 0, (space_ndims+1)*sizeof(*zero));
+ /* Set the offset in the dataset and the number of bytes to read */
+ buf += mem_iter->all.offset*elmt_size;
+ actual_bytes=elmt_size*nelmts;
- /*
- * Scatter from conversion buffer to application memory.
- */
- H5_CHECK_OVERFLOW(space_ndims+1,intn,uintn);
- if (H5V_hyper_copy ((uintn)(space_ndims+1), hsize, hsize, zero, tconv_buf,
- mem_size, mem_offset, buf)<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
- "unable to scatter data to memory");
- }
+ /* "read" in the bytes from the source (buf) to the destination (tconv_buf) */
+ HDmemcpy(tconv_buf,buf,actual_bytes);
/* Advance iterator */
mem_iter->all.elmt_left-=nelmts;
@@ -440,6 +314,7 @@ H5S_all_mgath (const void *_buf, size_t elmt_size,
FUNC_LEAVE (nelmts);
} /* H5S_all_mgath() */
+
/*-------------------------------------------------------------------------
* Function: H5S_all_mscat
*
@@ -458,19 +333,12 @@ H5S_all_mgath (const void *_buf, size_t elmt_size,
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_all_mscat (const void *_tconv_buf, size_t elmt_size,
+H5S_all_mscat (const void *tconv_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
hsize_t nelmts, void *_buf/*out*/)
{
- hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /*slab offset in app buf*/
- hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
- hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
- hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */
- uint8_t *buf=(uint8_t*)_buf; /* Get local copies for address arithmetic */
- const uint8_t *tconv_buf=(const uint8_t *)_tconv_buf;
- hsize_t acc; /*accumulator */
- intn space_ndims; /*dimensionality of space*/
- intn i; /*counters */
+ uint8_t *buf=(uint8_t *)_buf;
+ size_t actual_bytes; /* The actual number of bytes to write */
FUNC_ENTER (H5S_all_mscat, FAIL);
@@ -482,47 +350,12 @@ H5S_all_mscat (const void *_tconv_buf, size_t elmt_size,
assert (nelmts>0);
assert (buf);
- /*
- * Retrieve information to determine what elements are being selected.
- */
- if ((space_ndims=H5S_get_simple_extent_dims (mem_space, hsize, NULL))<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
- "unable to retrieve hyperslab parameters");
- }
-
- if(space_ndims>0) {
- HDmemset(mem_offset,0,sizeof(hssize_t)*space_ndims);
-
- if (H5S_get_simple_extent_dims (mem_space, mem_size, NULL)<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
- "unable to retrieve data space dimensions");
- }
-
- /* Adjust the slowest varying dimension to take care of strip mining */
- for (i=1, acc=1; i<space_ndims; i++) {
- acc *= hsize[i];
- }
- assert (0==mem_iter->all.offset % acc);
- assert (0==nelmts % acc);
- mem_offset[0] += mem_iter->all.offset / acc;
- hsize[0] = nelmts / acc;
- } /* end if */
-
- /* The fastest varying dimension is for the data point itself */
- mem_offset[space_ndims] = 0;
- mem_size[space_ndims] = elmt_size;
- hsize[space_ndims] = elmt_size;
- HDmemset (zero, 0, (space_ndims+1)*sizeof(*zero));
+ /* Set the offset in the dataset and the number of bytes to write */
+ buf += mem_iter->all.offset*elmt_size;
+ actual_bytes=elmt_size*nelmts;
- /*
- * Scatter from conversion buffer to application memory.
- */
- H5_CHECK_OVERFLOW(space_ndims+1,intn,uintn);
- if (H5V_hyper_copy ((uintn)(space_ndims+1), hsize, mem_size, mem_offset, buf,
- hsize, zero, tconv_buf)<0) {
- HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
- "unable to scatter data to memory");
- }
+ /* "write" the bytes from the source (tconv_buf) to the destination (buf) */
+ HDmemcpy(buf,tconv_buf,actual_bytes);
/* Advance iterator */
mem_iter->all.elmt_left-=nelmts;
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 4eb1de6..8e0fd0d 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -77,7 +77,7 @@ static hsize_t H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout
const H5S_t *file_space, H5S_sel_iter_t *file_iter,
hsize_t nelmts, hid_t dxpl_id, const void *_buf);
static herr_t H5S_hyper_init (const struct H5O_layout_t *layout,
- const H5S_t *space, H5S_sel_iter_t *iter, size_t *min_elem_out);
+ const H5S_t *space, H5S_sel_iter_t *iter);
static hsize_t H5S_hyper_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
hsize_t max);
static hsize_t H5S_hyper_fgath (H5F_t *f, const struct H5O_layout_t *layout,
@@ -173,8 +173,7 @@ H5FL_BLK_DEFINE_STATIC(hyper_block);
*/
static herr_t
H5S_hyper_init (const struct H5O_layout_t UNUSED *layout,
- const H5S_t *space, H5S_sel_iter_t *sel_iter,
- size_t UNUSED *min_elem_out)
+ const H5S_t *space, H5S_sel_iter_t *sel_iter)
{
FUNC_ENTER (H5S_hyper_init, FAIL);
@@ -5408,7 +5407,6 @@ H5S_hyper_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t
{
H5S_hyper_iter_info_t iter_info; /* Block of parameters to pass into recursive calls */
H5S_sel_iter_t iter; /* selection iteration info*/
- size_t min_elem_out=1; /* Minimum # of elements to output*/
herr_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5S_hyper_select_iterate, FAIL);
@@ -5419,7 +5417,7 @@ H5S_hyper_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t
assert(H5I_DATATYPE == H5I_get_type(type_id));
/* Initialize the selection iterator */
- if (H5S_hyper_init(NULL, space, &iter, &min_elem_out)<0) {
+ if (H5S_hyper_init(NULL, space, &iter)<0) {
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to initialize selection information");
}
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 89ad281..072a5b7 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -24,7 +24,7 @@
static intn interface_initialize_g = 0;
static herr_t H5S_point_init (const struct H5O_layout_t *layout,
- const H5S_t *space, H5S_sel_iter_t *iter, size_t *min_elem_out);
+ const H5S_t *space, H5S_sel_iter_t *iter);
static hsize_t H5S_point_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
hsize_t max);
static hsize_t H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout,
@@ -87,8 +87,7 @@ const H5S_mconv_t H5S_POINT_MCONV[1] = {{
*/
static herr_t
H5S_point_init (const struct H5O_layout_t UNUSED *layout,
- const H5S_t *space, H5S_sel_iter_t *sel_iter,
- size_t UNUSED *min_elem_out)
+ const H5S_t *space, H5S_sel_iter_t *sel_iter)
{
FUNC_ENTER (H5S_point_init, FAIL);
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index f315b77..1415229 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -82,7 +82,7 @@ typedef struct H5S_fconv_t {
/* Initialize file element numbering information */
herr_t (*init)(const struct H5O_layout_t *layout, const H5S_t *space,
- H5S_sel_iter_t *iter, size_t *min_elem_out);
+ H5S_sel_iter_t *iter);
/* Determine optimal number of elements to transfer */
hsize_t (*avail)(const H5S_t *file_space, const H5S_sel_iter_t *file_iter,
@@ -112,7 +112,7 @@ typedef struct H5S_mconv_t {
/* Initialize memory element numbering information */
herr_t (*init)(const struct H5O_layout_t *layout, const H5S_t *space,
- H5S_sel_iter_t *iter, size_t *min_elem_out);
+ H5S_sel_iter_t *iter);
/* Gather elements from app buffer to type conversion buffer */
hsize_t (*gath)(const void *buf, size_t elmt_size,