diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-10-02 13:31:24 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-10-02 13:31:24 (GMT) |
commit | 58ee080e72f4aa1e10bc7c3fcf5f6499aaad18e7 (patch) | |
tree | 7f0022dabb2c9a053b2d3c09a56fbd2c52544643 | |
parent | 849d36019d929c409c50cce08842354139dca2f8 (diff) | |
download | hdf5-58ee080e72f4aa1e10bc7c3fcf5f6499aaad18e7.zip hdf5-58ee080e72f4aa1e10bc7c3fcf5f6499aaad18e7.tar.gz hdf5-58ee080e72f4aa1e10bc7c3fcf5f6499aaad18e7.tar.bz2 |
[svn-r734] Changes since 19981001
----------------------
./src/H5D.c
./src/H5Fistore.c
./src/H5Fprivate.h
Fixed a couple things for parallel hdf5 that I broke with the
last checkin.
./src/H5Ofill.c
If no fill value is specified it isn't added to the object
header.
./tools/h5ls.c
Added a line-feed after `Unknown object' is printed.
./tools/h5tools.c
Fixed printing of scalar values. Need to still track down a
failed assertion when H5Sselect_hyperslab() is called with a
zero size....
-rw-r--r-- | src/H5D.c | 6 | ||||
-rw-r--r-- | src/H5Distore.c | 8 | ||||
-rw-r--r-- | src/H5Fistore.c | 8 | ||||
-rw-r--r-- | src/H5Fprivate.h | 3 | ||||
-rw-r--r-- | src/H5Ofill.c | 11 | ||||
-rw-r--r-- | tools/h5ls.c | 2 | ||||
-rw-r--r-- | tools/h5tools.c | 69 |
7 files changed, 62 insertions, 45 deletions
@@ -960,7 +960,8 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to convert fill value to dataset type"); } - if (H5O_modify(&(new_dset->ent), H5O_FILL, 0, H5O_FLAG_CONSTANT, + if (new_dset->create_parms->fill.buf && + H5O_modify(&(new_dset->ent), H5O_FILL, 0, H5O_FLAG_CONSTANT, &(new_dset->create_parms->fill))<0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to update fill value header message"); @@ -2224,7 +2225,8 @@ H5D_allocate (H5D_t *dataset, const H5D_xfer_t *xfer) if (H5F_istore_allocate(dataset->ent.file, (layout), space_dim, xfer->split_ratios, - &(dataset->create_parms->pline))<0) { + &(dataset->create_parms->pline), + &(dataset->create_parms->fill))<0) { HRETURN(FAIL); } break; diff --git a/src/H5Distore.c b/src/H5Distore.c index ebfb004..8c9dd1b 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1625,7 +1625,7 @@ H5F_istore_read(H5F_t *f, const H5D_xfer_t *xfer, const H5O_layout_t *layout, l.dim[i] = layout->dim[i]; l.addr = udata.addr; tmp_xfer.xfer_mode = H5D_XFER_DFLT; - if (H5F_arr_read(f, &tmp_xfer, &l, pline, NULL/*no efl*/, + if (H5F_arr_read(f, &tmp_xfer, &l, pline, fill, NULL/*no efl*/, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)==FAIL){ HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, @@ -1802,7 +1802,7 @@ H5F_istore_write(H5F_t *f, const H5D_xfer_t *xfer, const H5O_layout_t *layout, l.dim[i] = layout->dim[i]; l.addr = udata.addr; tmp_xfer.xfer_mode = H5D_XFER_DFLT; - if (H5F_arr_write(f, &tmp_xfer, &l, pline, NULL/*no efl*/, + if (H5F_arr_write(f, &tmp_xfer, &l, pline, fill, NULL/*no efl*/, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)==FAIL){ HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, @@ -2080,7 +2080,7 @@ H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout, herr_t H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout, const hsize_t *space_dim, const double split_ratios[], - const H5O_pline_t *pline) + const H5O_pline_t *pline, const H5O_fill_t *fill) { intn i, carry; @@ -2140,7 +2140,7 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout, * chunk. */ if (NULL==(chunk=H5F_istore_lock (f, layout, split_ratios, pline, - chunk_offset, FALSE, + fill, chunk_offset, FALSE, &idx_hint))) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); diff --git a/src/H5Fistore.c b/src/H5Fistore.c index ebfb004..8c9dd1b 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -1625,7 +1625,7 @@ H5F_istore_read(H5F_t *f, const H5D_xfer_t *xfer, const H5O_layout_t *layout, l.dim[i] = layout->dim[i]; l.addr = udata.addr; tmp_xfer.xfer_mode = H5D_XFER_DFLT; - if (H5F_arr_read(f, &tmp_xfer, &l, pline, NULL/*no efl*/, + if (H5F_arr_read(f, &tmp_xfer, &l, pline, fill, NULL/*no efl*/, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)==FAIL){ HRETURN_ERROR (H5E_IO, H5E_READERROR, FAIL, @@ -1802,7 +1802,7 @@ H5F_istore_write(H5F_t *f, const H5D_xfer_t *xfer, const H5O_layout_t *layout, l.dim[i] = layout->dim[i]; l.addr = udata.addr; tmp_xfer.xfer_mode = H5D_XFER_DFLT; - if (H5F_arr_write(f, &tmp_xfer, &l, pline, NULL/*no efl*/, + if (H5F_arr_write(f, &tmp_xfer, &l, pline, fill, NULL/*no efl*/, sub_size, size_m, sub_offset_m, offset_wrt_chunk, buf)==FAIL){ HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, @@ -2080,7 +2080,7 @@ H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout, herr_t H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout, const hsize_t *space_dim, const double split_ratios[], - const H5O_pline_t *pline) + const H5O_pline_t *pline, const H5O_fill_t *fill) { intn i, carry; @@ -2140,7 +2140,7 @@ H5F_istore_allocate (H5F_t *f, const H5O_layout_t *layout, * chunk. */ if (NULL==(chunk=H5F_istore_lock (f, layout, split_ratios, pline, - chunk_offset, FALSE, + fill, chunk_offset, FALSE, &idx_hint))) { HRETURN_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index ca787f7..7f25090 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -569,7 +569,8 @@ herr_t H5F_istore_allocate (H5F_t *f, const struct H5O_layout_t *layout, const hsize_t *space_dim, const double split_ratios[], - const struct H5O_pline_t *pline); + const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill); /* Functions that operate on contiguous storage wrt boot block */ herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 1328307..29e5914 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -75,11 +75,14 @@ H5O_fill_decode(H5F_t *f, const uint8 *p, H5O_shared_t *sh) "memory allocation failed for fill value message"); } UINT32DECODE(p, mesg->size); - if (NULL==(mesg->buf=H5MM_malloc(mesg->size))) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for fill value"); + if (mesg->size>0) { + if (NULL==(mesg->buf=H5MM_malloc(mesg->size))) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed for fill value"); + } + HDmemcpy(mesg->buf, p, mesg->size); } - HDmemcpy(mesg->buf, p, mesg->size); + ret_value = (void*)mesg; done: diff --git a/tools/h5ls.c b/tools/h5ls.c index a328eb8..39124b8 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -354,7 +354,7 @@ list (hid_t group, const char *name, void __unused__ *cd) puts("**NOT FOUND**"); return 0; } else if (sb.type<0 || sb.type>=H5G_NTYPES) { - printf("Unknown type=%d", sb.type); + printf("Unknown type(%d)\n", sb.type); return 0; } if (dispatch_g[sb.type].name) fputs(dispatch_g[sb.type].name, stdout); diff --git a/tools/h5tools.c b/tools/h5tools.c index d3cc110..b4411de 100644 --- a/tools/h5tools.c +++ b/tools/h5tools.c @@ -56,30 +56,35 @@ h5dump_prefix(char *s/*out*/, const h5dump_t *info, hsize_t elmtno, int ndims, hsize_t n, i; char temp[1024]; - /* - * Calculate the number of elements represented by a unit change in a - * certain index position. - */ - for (i=ndims-1, p_prod[ndims-1]=1; i>0; --i) { - p_prod[i-1] = (max_idx[i]-min_idx[i]) * p_prod[i]; - } + if (ndims>0) { + /* + * Calculate the number of elements represented by a unit change in a + * certain index position. + */ + for (i=ndims-1, p_prod[ndims-1]=1; i>0; --i) { + p_prod[i-1] = (max_idx[i]-min_idx[i]) * p_prod[i]; + } - /* - * Calculate the index values from the element number. - */ - for (i=0, n=elmtno; i<(hsize_t)ndims; i++) { - p_idx[i] = n / p_prod[i] + min_idx[i]; - n %= p_prod[i]; - } + /* + * Calculate the index values from the element number. + */ + for (i=0, n=elmtno; i<(hsize_t)ndims; i++) { + p_idx[i] = n / p_prod[i] + min_idx[i]; + n %= p_prod[i]; + } - /* - * Print the index values. - */ - *temp = '\0'; - for (i=0; i<(hsize_t)ndims; i++) { - if (i) strcat(temp, OPT(info->idx_sep, ",")); - sprintf(temp+strlen(temp), OPT(info->idx_n_fmt, "%lu"), - (unsigned long)p_idx[i]); + /* + * Print the index values. + */ + *temp = '\0'; + for (i=0; i<(hsize_t)ndims; i++) { + if (i) strcat(temp, OPT(info->idx_sep, ",")); + sprintf(temp+strlen(temp), OPT(info->idx_n_fmt, "%lu"), + (unsigned long)p_idx[i]); + } + } else { + /* Scalar */ + sprintf(temp, OPT(info->idx_n_fmt, "%lu"), (unsigned long)0); } /* @@ -397,16 +402,22 @@ h5dump_simple(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type) for (elmtno=0; elmtno<p_nelmts; elmtno+=hs_nelmts) { /* Calculate the hyperslab size */ - for (i=0, hs_nelmts=1; i<(hsize_t)ndims; i++) { - hs_size[i] = MIN(sm_size[i], p_max_idx[i]-hs_offset[i]); - hs_nelmts *= hs_size[i]; + if (ndims>0) { + for (i=0, hs_nelmts=1; i<(hsize_t)ndims; i++) { + hs_size[i] = MIN(sm_size[i], p_max_idx[i]-hs_offset[i]); + hs_nelmts *= hs_size[i]; + } + H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, + hs_size, NULL); + H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, + &hs_nelmts, NULL); + } else { + H5Sselect_all(f_space); + H5Sselect_all(sm_space); + hs_nelmts = 1; } /* Read the data */ - H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, - hs_size, NULL); - H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, - &hs_nelmts, NULL); if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf)<0) { return -1; } |