summaryrefslogtreecommitdiffstats
path: root/src/H5Sall.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1998-07-15 21:23:25 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1998-07-15 21:23:25 (GMT)
commitc40c53d0af09a8453df6d1a46f37de593d23f0d0 (patch)
treeb28dc7838e2a7738402d7ebad9cff011abbca0cb /src/H5Sall.c
parent077d7c8c864c5452911117ee6b97c855487ff4cd (diff)
downloadhdf5-c40c53d0af09a8453df6d1a46f37de593d23f0d0.zip
hdf5-c40c53d0af09a8453df6d1a46f37de593d23f0d0.tar.gz
hdf5-c40c53d0af09a8453df6d1a46f37de593d23f0d0.tar.bz2
[svn-r512] Tracked down some problems with the number of dimensions used for point/element
selections and also fixed part of the problem with scalar dataspaces being written/read from the file.
Diffstat (limited to 'src/H5Sall.c')
-rw-r--r--src/H5Sall.c103
1 files changed, 57 insertions, 46 deletions
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 8af7a18..076e8ee 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -157,20 +157,23 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
}
- 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;
+ 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, layout->ndims*sizeof(*zero));
+ HDmemset (zero, 0, (space_ndims+1)*sizeof(*zero));
/*
* Gather from file.
@@ -240,20 +243,23 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
- 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;
+
+ 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, layout->ndims*sizeof(*zero));
+ HDmemset (zero, 0, (space_ndims+1)*sizeof(*zero));
/*
* Scatter to file.
@@ -322,20 +328,22 @@ H5S_all_mgath (const void *_buf, size_t elmt_size,
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to retrieve hyperslab parameters");
}
- HDmemset(mem_offset,0,sizeof(hssize_t)*space_ndims);
-
- if (H5S_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;
+ if(space_ndims>0) {
+ HDmemset(mem_offset,0,sizeof(hssize_t)*space_ndims);
+
+ if (H5S_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;
@@ -410,20 +418,23 @@ H5S_all_mscat (const void *_tconv_buf, size_t elmt_size,
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to retrieve hyperslab parameters");
}
- HDmemset(mem_offset,0,sizeof(hssize_t)*space_ndims);
-
- if (H5S_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;
+ if(space_ndims>0) {
+ HDmemset(mem_offset,0,sizeof(hssize_t)*space_ndims);
+
+ if (H5S_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;