summaryrefslogtreecommitdiffstats
path: root/src/H5Psimp.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-01-22 15:27:29 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-01-22 15:27:29 (GMT)
commitfdfb6dfd26410b931b4452f832b5a4aedec283e0 (patch)
tree052c551e3cb4f99b2c77af519dce3d3d6ae7429c /src/H5Psimp.c
parent851b17c87ad6f841efb5a5ba1b90b8c6636a2ffd (diff)
downloadhdf5-fdfb6dfd26410b931b4452f832b5a4aedec283e0.zip
hdf5-fdfb6dfd26410b931b4452f832b5a4aedec283e0.tar.gz
hdf5-fdfb6dfd26410b931b4452f832b5a4aedec283e0.tar.bz2
[svn-r163] Changes since 19980121
---------------------- ./Makefile.in Added more dependencies to .PHONY. ./src/H5D.c The write side of the I/O pipeline is implemented now too. Things are looking good for the prototype and it's just a matter of populating the library with the data type and data space conversion functions. ./src/H5Farray.c ./src/H5Fprivate.h ./test/istore.c Changed the order of the arguments for H5F_arr_read() and H5F_arr_write(). ./src/H5P.c ./src/H5Pprivate.h Changed the names of the arguments of H5P_find(). Fleshed out the mgath and fscat callback types. ./src/H5Psimp.c Added stubs for H5P_simp_mgath() and H5P_simp_fscat() that operate on the entire data space. Quincey, once you have the data space hyperslab stuff in place let me know and I'll finish the H5P_simp_*() functions to do partial I/O. Or you can take a look at it too if you like; there's some comments in there for you. ./src/H5V.c ./src/H5Vprivate.h Changed dimensionality arguments from `size_t' to `intn' to be consistent with the rest of the library and to get rid of warnings on 64-bit Irix.
Diffstat (limited to 'src/H5Psimp.c')
-rw-r--r--src/H5Psimp.c100
1 files changed, 85 insertions, 15 deletions
diff --git a/src/H5Psimp.c b/src/H5Psimp.c
index a5dd7ec..1cd46c4 100644
--- a/src/H5Psimp.c
+++ b/src/H5Psimp.c
@@ -124,7 +124,7 @@ H5P_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
/*
* Gather from file.
*/
- if (H5F_arr_read (f, layout, size, offset, offset, size, buf/*out*/)<0) {
+ if (H5F_arr_read (f, layout, size, size, offset, offset, buf/*out*/)<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_READERROR, 0, "read error");
}
@@ -175,7 +175,8 @@ H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
/*
* Quincey, this is where we look at the hyperslab spec of MEM_SPACE to
- * figure out how to scatter. For now we just assume that data points
+ * figure out how to scatter. You'll probably end up calling
+ * H5V_hyper_copy(), but for now we just assume that data points
* are copied directly from TCONV_BUF to BUF.
*/
HDmemcpy (buf, tconv_buf, nelmts*elmt_size);
@@ -186,9 +187,14 @@ H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
/*-------------------------------------------------------------------------
* Function: H5P_simp_mgath
*
- * Purpose: Gathers dataset elements from application memory and copies
- * them into the data type conversion buffer. NOT IMPLEMENTED
- * YET.
+ * Purpose: Gathers dataset elements from application memory BUF and
+ * copies them into the data type conversion buffer TCONV_BUF.
+ * Each element is ELMT_SIZE bytes and arranged in application
+ * memory according to MEM_SPACE. The elements selected from
+ * BUF by MEM_SPACE are numbered according to NUMBERING and the
+ * caller is requesting that at most NELMTS be gathered
+ * beginning with number START. The elements are packed into
+ * TCONV_BUF in order of their NUMBERING.
*
* Return: Success: Number of elements copied.
*
@@ -202,21 +208,47 @@ H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
*-------------------------------------------------------------------------
*/
size_t
-H5P_simp_mgath (void)
+H5P_simp_mgath (const void *buf, size_t elmt_size,
+ const H5P_t *mem_space, const H5P_number_t *numbering,
+ intn start, intn nelmts, void *tconv_buf/*out*/)
{
FUNC_ENTER (H5P_simp_mgath, 0);
- HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, 0,
- "not implemented yet");
+ /* Check args */
+ assert (buf);
+ assert (elmt_size>0);
+ assert (mem_space && H5P_SIMPLE==mem_space->type);
+ assert (numbering);
+ assert (nelmts>0);
+ assert (tconv_buf);
+
+ /*
+ * The prototype doesn't support strip mining.
+ */
+ assert (0==start);
+ assert (nelmts==H5P_get_npoints (mem_space));
+
+ /*
+ * Quincey, this is where we look at the hyperslab spec of MEM_SPACE to
+ * figure out how to gather. You'll probably end up calling
+ * H5V_hyper_copy(), but for now we just assume that data points are
+ * copied directly from BUF to TCONV_BUF.
+ */
+ HDmemcpy (tconv_buf, buf, nelmts*elmt_size);
- FUNC_LEAVE (0);
+ FUNC_LEAVE (nelmts);
}
/*-------------------------------------------------------------------------
* Function: H5P_simp_fscat
*
- * Purpose: Scatters dataset elements from the type conversion buffer to
- * the file. NOT IMPLEMENTED YET.
+ * Purpose: Scatters dataset elements from the type conversion buffer BUF
+ * to the file F where the data points are arranged according to
+ * the file data space FILE_SPACE and stored according to
+ * LAYOUT. Each element is ELMT_SIZE bytes and has a unique
+ * number according to NUMBERING. The caller is requesting that
+ * NELMTS elements are coppied beginning with element number
+ * START.
*
* Return: Success: SUCCEED
*
@@ -230,12 +262,50 @@ H5P_simp_mgath (void)
*-------------------------------------------------------------------------
*/
herr_t
-H5P_simp_fscat (void)
+H5P_simp_fscat (H5F_t *f, const struct H5O_layout_t *layout,
+ size_t elmt_size, const H5P_t *file_space,
+ const H5P_number_t *numbering, intn start, intn nelmts,
+ const void *buf)
{
+ size_t offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */
+ size_t size[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
+ intn i; /*counters */
+
FUNC_ENTER (H5P_simp_fscat, FAIL);
- HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL,
- "not implemented yet");
+ /* Check args */
+ assert (f);
+ assert (layout);
+ assert (elmt_size>0);
+ assert (file_space);
+ assert (numbering);
+ assert (nelmts>0);
+ assert (buf);
+
+ /*
+ * The prototype doesn't support strip mining.
+ */
+ assert (0==start);
+ assert (nelmts==H5P_get_npoints (file_space));
+
+ /*
+ * Quincey, this is where we look at FILE_SPACE to decide what the
+ * hyperslab is to read from disk. For now, since the H5P interface
+ * doesn't support hyperslabs, we'll assume the caller is asking for the
+ * entire array. --RPM
+ */
+ assert (nelmts == H5P_get_npoints (file_space));
+ for (i=0; i<layout->ndims; i++) offset[i] = 0;
+ i = H5P_get_dims (file_space, size);
+ assert (i+1 == layout->ndims);
+ size[i] = elmt_size;
+
+ /*
+ * Scatter to file.
+ */
+ if (H5F_arr_write (f, layout, size, size, offset, offset, buf/*out*/)<0) {
+ HRETURN_ERROR (H5E_DATASPACE, H5E_WRITEERROR, 0, "write error");
+ }
- FUNC_LEAVE (FAIL);
+ FUNC_LEAVE (SUCCEED);
}