diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-01-02 18:00:31 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-01-02 18:00:31 (GMT) |
commit | d99a7dfe7db5abe777c5e376c377885c2377ff59 (patch) | |
tree | 28ebf2ab1db3e7506f9c7031d947dece5a1d8ca9 /src/H5VLiod_attr.c | |
parent | 90f4424e0826b61449cf7a0a56c48f3c688f6d80 (diff) | |
download | hdf5-d99a7dfe7db5abe777c5e376c377885c2377ff59.zip hdf5-d99a7dfe7db5abe777c5e376c377885c2377ff59.tar.gz hdf5-d99a7dfe7db5abe777c5e376c377885c2377ff59.tar.bz2 |
[svn-r24605] - fix bug with point selections
- allow for H5S_ALL dataspace inputs
- allow use of scalar dataspaces
- update tests
Diffstat (limited to 'src/H5VLiod_attr.c')
-rw-r--r-- | src/H5VLiod_attr.c | 78 |
1 files changed, 61 insertions, 17 deletions
diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c index e39a8d0..99dfbf4 100644 --- a/src/H5VLiod_attr.c +++ b/src/H5VLiod_attr.c @@ -96,9 +96,19 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, /* Set the IOD array creation parameters */ array.cell_size = (uint32_t)H5Tget_size(input->type_id); array.num_dims = (uint32_t)H5Sget_simple_extent_ndims(input->space_id); - if(H5Sget_simple_extent_dims(input->space_id, current_dims, array_dims) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes"); - array.firstdim_max = array_dims[0]; + + /* Handle Scalar Dataspaces (set rank and current dims size to 1) */ + if(0 == array.num_dims) { + array.num_dims = 1; + array.firstdim_max = 1; + current_dims[0] = 1; + } + else { + if(H5Sget_simple_extent_dims(input->space_id, current_dims, array_dims) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes"); + array.firstdim_max = array_dims[0]; + } + array.current_dims = current_dims; array.chunk_dims = NULL; @@ -491,14 +501,31 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, if((ndims = H5Sget_simple_extent_ndims(space_id)) < 0) HGOTO_ERROR2(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion"); - hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + /* handle scalar dataspace */ + if(0 == ndims) { + ndims = 1; - /* generate the descriptor */ - if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0) - HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t)); + + num_descriptors = 1; + hslabs.start[0] = 0; + hslabs.count[0] = 1; + hslabs.block[0] = 1; + hslabs.stride[0] = 1; + } + else { + hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + + /* generate the descriptor */ + if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + } /* set the file descriptor */ file_desc = hslabs; @@ -678,14 +705,31 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, if((ndims = H5Sget_simple_extent_ndims(space_id)) < 0) HGOTO_ERROR2(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataspace dimesnsion"); - hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); - hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + /* handle scalar dataspace */ + if(0 == ndims) { + ndims = 1; + + hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t)); + hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t)); - /* generate the descriptor */ - if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0) - HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + num_descriptors = 1; + hslabs.start[0] = 0; + hslabs.count[0] = 1; + hslabs.block[0] = 1; + hslabs.stride[0] = 1; + } + else { + hslabs.start = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.stride = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.block = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + hslabs.count = (iod_size_t *)malloc(sizeof(iod_size_t) * ndims); + + /* generate the descriptor */ + if(H5VL_iod_get_file_desc(space_id, &num_descriptors, &hslabs) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to generate IOD file descriptor from dataspace selection"); + } /* set the file descriptor */ file_desc = hslabs; |