mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-01 16:28:09 +08:00
[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.
This commit is contained in:
parent
851b17c87a
commit
fdfb6dfd26
@ -57,7 +57,9 @@ SUBDIRS=src test
|
|||||||
# make used in combination with gcc will maintain dependency
|
# make used in combination with gcc will maintain dependency
|
||||||
# information automatically.
|
# information automatically.
|
||||||
#
|
#
|
||||||
.PHONY: test
|
.PHONY: all lib progs test install uninstall dep depend clean mostlyclean \
|
||||||
|
distclean maintainer-clean
|
||||||
|
|
||||||
all lib progs test install uninstall TAGS dep depend:
|
all lib progs test install uninstall TAGS dep depend:
|
||||||
@@SETX@; for d in $(SUBDIRS); do \
|
@@SETX@; for d in $(SUBDIRS); do \
|
||||||
(cd $$d && $(MAKE) $@) || exit 1; \
|
(cd $$d && $(MAKE) $@) || exit 1; \
|
||||||
|
176
src/H5D.c
176
src/H5D.c
@ -235,9 +235,9 @@ H5Dcreate(hid_t file_id, const char *name, hid_t type_id, hid_t space_id,
|
|||||||
hid_t
|
hid_t
|
||||||
H5Dopen(hid_t file_id, const char *name)
|
H5Dopen(hid_t file_id, const char *name)
|
||||||
{
|
{
|
||||||
H5F_t *file = NULL; /*file holding the dataset */
|
H5F_t *file = NULL; /*file holding the dataset */
|
||||||
H5D_t *dataset = NULL; /*the dataset */
|
H5D_t *dataset = NULL; /*the dataset */
|
||||||
hid_t ret_value = FAIL;
|
hid_t ret_value = FAIL;
|
||||||
|
|
||||||
FUNC_ENTER(H5Dopen, FAIL);
|
FUNC_ENTER(H5Dopen, FAIL);
|
||||||
H5ECLEAR;
|
H5ECLEAR;
|
||||||
@ -250,10 +250,12 @@ H5Dopen(hid_t file_id, const char *name)
|
|||||||
if (!name || !*name) {
|
if (!name || !*name) {
|
||||||
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name");
|
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the dataset */
|
/* Find the dataset */
|
||||||
if (NULL == (dataset = H5D_open(file, name))) {
|
if (NULL == (dataset = H5D_open(file, name))) {
|
||||||
HRETURN_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "dataset not found");
|
HRETURN_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "dataset not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create an atom for the dataset */
|
/* Create an atom for the dataset */
|
||||||
if ((ret_value = H5Aregister_atom(H5_DATASET, dataset)) < 0) {
|
if ((ret_value = H5Aregister_atom(H5_DATASET, dataset)) < 0) {
|
||||||
H5D_close(dataset);
|
H5D_close(dataset);
|
||||||
@ -262,7 +264,7 @@ H5Dopen(hid_t file_id, const char *name)
|
|||||||
}
|
}
|
||||||
FUNC_LEAVE(ret_value);
|
FUNC_LEAVE(ret_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* Function: H5Dclose
|
* Function: H5Dclose
|
||||||
*
|
*
|
||||||
@ -395,14 +397,15 @@ H5Dread(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
|
|||||||
if (!buf) {
|
if (!buf) {
|
||||||
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer");
|
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read raw data */
|
/* read raw data */
|
||||||
if (H5D_read(dataset, mem_type, mem_space, file_space, xfer_parms,
|
if (H5D_read(dataset, mem_type, mem_space, file_space, xfer_parms,
|
||||||
buf /*out */ ) < 0) {
|
buf/*out*/) < 0) {
|
||||||
HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data");
|
HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data");
|
||||||
}
|
}
|
||||||
FUNC_LEAVE(SUCCEED);
|
FUNC_LEAVE(SUCCEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* Function: H5Dwrite
|
* Function: H5Dwrite
|
||||||
*
|
*
|
||||||
@ -484,6 +487,7 @@ H5Dwrite(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
|
|||||||
if (!buf) {
|
if (!buf) {
|
||||||
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer");
|
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write raw data */
|
/* write raw data */
|
||||||
if (H5D_write(dataset, mem_type, mem_space, file_space, xfer_parms,
|
if (H5D_write(dataset, mem_type, mem_space, file_space, xfer_parms,
|
||||||
buf) < 0) {
|
buf) < 0) {
|
||||||
@ -491,7 +495,7 @@ H5Dwrite(hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id,
|
|||||||
}
|
}
|
||||||
FUNC_LEAVE(SUCCEED);
|
FUNC_LEAVE(SUCCEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* Function: H5D_find_name
|
* Function: H5D_find_name
|
||||||
*
|
*
|
||||||
@ -517,7 +521,7 @@ H5D_find_name(hid_t file_id, group_t UNUSED, const char *name)
|
|||||||
{
|
{
|
||||||
return H5Dopen(file_id, name);
|
return H5Dopen(file_id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* Function: H5D_create
|
* Function: H5D_create
|
||||||
*
|
*
|
||||||
@ -544,7 +548,7 @@ H5D_find_name(hid_t file_id, group_t UNUSED, const char *name)
|
|||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
H5D_t *
|
H5D_t *
|
||||||
H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
|
H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
|
||||||
const H5D_create_t *create_parms)
|
const H5D_create_t *create_parms)
|
||||||
{
|
{
|
||||||
@ -582,6 +586,7 @@ H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
|
|||||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||||
"can't update type or space header messages");
|
"can't update type or space header messages");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Total raw data size */
|
/* Total raw data size */
|
||||||
nbytes = H5T_get_size(type) * H5P_get_npoints(space);
|
nbytes = H5T_get_size(type) * H5P_get_npoints(space);
|
||||||
new_dset->layout.type = new_dset->create_parms.layout;
|
new_dset->layout.type = new_dset->create_parms.layout;
|
||||||
@ -620,10 +625,12 @@ H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
|
|||||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||||
"unable to initialize storage");
|
"unable to initialize storage");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Give the dataset a name */
|
/* Give the dataset a name */
|
||||||
if (H5G_insert(name, &(new_dset->ent)) < 0) {
|
if (H5G_insert(name, &(new_dset->ent)) < 0) {
|
||||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to name dataset");
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to name dataset");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Success */
|
/* Success */
|
||||||
ret_value = new_dset;
|
ret_value = new_dset;
|
||||||
|
|
||||||
@ -641,7 +648,7 @@ H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
|
|||||||
}
|
}
|
||||||
FUNC_LEAVE(ret_value);
|
FUNC_LEAVE(ret_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* Function: H5D_open
|
* Function: H5D_open
|
||||||
*
|
*
|
||||||
@ -664,9 +671,9 @@ H5D_create(H5F_t *f, const char *name, const H5T_t *type, const H5P_t *space,
|
|||||||
H5D_t *
|
H5D_t *
|
||||||
H5D_open(H5F_t *f, const char *name)
|
H5D_open(H5F_t *f, const char *name)
|
||||||
{
|
{
|
||||||
H5D_t *dataset = NULL; /*the dataset which was found */
|
H5D_t *dataset = NULL; /*the dataset which was found */
|
||||||
H5D_t *ret_value = NULL; /*return value */
|
H5D_t *ret_value = NULL; /*return value */
|
||||||
intn i;
|
intn i;
|
||||||
|
|
||||||
FUNC_ENTER(H5D_open, NULL);
|
FUNC_ENTER(H5D_open, NULL);
|
||||||
|
|
||||||
@ -686,10 +693,10 @@ H5D_open(H5F_t *f, const char *name)
|
|||||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open");
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open");
|
||||||
}
|
}
|
||||||
/* Get the type and space */
|
/* Get the type and space */
|
||||||
if (NULL == (dataset->type = H5O_read(&(dataset->ent), H5O_DTYPE, 0, NULL)) ||
|
if (NULL==(dataset->type=H5O_read(&(dataset->ent), H5O_DTYPE, 0, NULL)) ||
|
||||||
NULL == (dataset->space = H5P_read(f, &(dataset->ent)))) {
|
NULL==(dataset->space=H5P_read(f, &(dataset->ent)))) {
|
||||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||||
"can't load type of space info from dataset header");
|
"unable to load type or space info from dataset header");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Get the raw data layout info. It's actually stored in two locations:
|
* Get the raw data layout info. It's actually stored in two locations:
|
||||||
@ -697,7 +704,7 @@ H5D_open(H5F_t *f, const char *name)
|
|||||||
* values are copied to the dataset create template so the user can query
|
* values are copied to the dataset create template so the user can query
|
||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
if (H5O_read(&(dataset->ent), H5O_LAYOUT, 0, &(dataset->layout)) < 0) {
|
if (NULL==H5O_read(&(dataset->ent), H5O_LAYOUT, 0, &(dataset->layout))) {
|
||||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
|
||||||
"unable to read data layout message");
|
"unable to read data layout message");
|
||||||
}
|
}
|
||||||
@ -741,7 +748,7 @@ H5D_open(H5F_t *f, const char *name)
|
|||||||
}
|
}
|
||||||
FUNC_LEAVE(ret_value);
|
FUNC_LEAVE(ret_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* Function: H5D_close
|
* Function: H5D_close
|
||||||
*
|
*
|
||||||
@ -774,9 +781,6 @@ H5D_close(H5D_t *dataset)
|
|||||||
/* check args */
|
/* check args */
|
||||||
assert(dataset && dataset->ent.file);
|
assert(dataset && dataset->ent.file);
|
||||||
|
|
||||||
/* Close the dataset object */
|
|
||||||
H5O_close(&(dataset->ent));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Release dataset type and space - there isn't much we can do if one of
|
* Release dataset type and space - there isn't much we can do if one of
|
||||||
* these fails, so we just continue.
|
* these fails, so we just continue.
|
||||||
@ -784,6 +788,9 @@ H5D_close(H5D_t *dataset)
|
|||||||
free_failed = (H5T_close(dataset->type) < 0 ||
|
free_failed = (H5T_close(dataset->type) < 0 ||
|
||||||
H5P_close(dataset->space) < 0);
|
H5P_close(dataset->space) < 0);
|
||||||
|
|
||||||
|
/* Close the dataset object */
|
||||||
|
H5O_close(&(dataset->ent));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free memory. Before freeing the memory set the file pointer to NULL.
|
* Free memory. Before freeing the memory set the file pointer to NULL.
|
||||||
* We always check for a null file pointer in other H5D functions to be
|
* We always check for a null file pointer in other H5D functions to be
|
||||||
@ -823,13 +830,13 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
const H5P_t *file_space, const H5D_xfer_t *xfer_parms,
|
const H5P_t *file_space, const H5D_xfer_t *xfer_parms,
|
||||||
void *buf/*out*/)
|
void *buf/*out*/)
|
||||||
{
|
{
|
||||||
size_t nelmts, src_size, dst_size;
|
size_t nelmts ; /*number of elements */
|
||||||
herr_t ret_value = FAIL;
|
|
||||||
uint8 *tconv_buf = NULL; /*data type conv buffer */
|
uint8 *tconv_buf = NULL; /*data type conv buffer */
|
||||||
H5T_conv_t tconv_func = NULL; /*conversion function */
|
H5T_conv_t tconv_func = NULL; /*conversion function */
|
||||||
hid_t src_id = -1, dst_id = -1;/*temporary type atoms */
|
hid_t src_id = -1, dst_id = -1;/*temporary type atoms */
|
||||||
const H5P_conv_t *sconv_func = NULL; /*space conversion funcs*/
|
const H5P_conv_t *sconv_func = NULL; /*space conversion funcs*/
|
||||||
H5P_number_t numbering; /*element numbering info*/
|
H5P_number_t numbering; /*element numbering info*/
|
||||||
|
herr_t ret_value = FAIL;
|
||||||
|
|
||||||
FUNC_ENTER(H5D_read, FAIL);
|
FUNC_ENTER(H5D_read, FAIL);
|
||||||
|
|
||||||
@ -840,6 +847,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
assert(buf);
|
assert(buf);
|
||||||
if (!file_space) file_space = dataset->space;
|
if (!file_space) file_space = dataset->space;
|
||||||
if (!mem_space) mem_space = file_space;
|
if (!mem_space) mem_space = file_space;
|
||||||
|
assert (H5P_get_npoints (mem_space)==H5P_get_npoints (file_space));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert data types to atoms because the conversion functions are
|
* Convert data types to atoms because the conversion functions are
|
||||||
@ -852,16 +860,16 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Locate the type conversion function, data space conversion, and set up
|
* Locate the type conversion function and data space conversion
|
||||||
* the element numbering information.
|
* functions, and set up the element numbering information.
|
||||||
*/
|
*/
|
||||||
if (NULL == (tconv_func = H5T_find(dataset->type, mem_type))) {
|
if (NULL == (tconv_func = H5T_find(dataset->type, mem_type))) {
|
||||||
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
||||||
"unable to convert between src and dest data types");
|
"unable to convert between src and dest data types");
|
||||||
}
|
}
|
||||||
if (NULL==(sconv_func=H5P_find (file_space, mem_space))) {
|
if (NULL==(sconv_func=H5P_find (mem_space, file_space))) {
|
||||||
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
||||||
"unable to convert between src and dest data spaces");
|
"unable to convert from file to memory data space");
|
||||||
}
|
}
|
||||||
if (sconv_func->init &&
|
if (sconv_func->init &&
|
||||||
(sconv_func->init)(&(dataset->layout), mem_space, file_space,
|
(sconv_func->init)(&(dataset->layout), mem_space, file_space,
|
||||||
@ -875,15 +883,17 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
/*
|
/*
|
||||||
* Compute the size of the request and allocate scratch buffers.
|
* Compute the size of the request and allocate scratch buffers.
|
||||||
*/
|
*/
|
||||||
|
nelmts = H5P_get_npoints(mem_space);
|
||||||
#ifndef LATER
|
#ifndef LATER
|
||||||
/*
|
/*
|
||||||
* Note: this prototype version allocates a buffer large enough to
|
* Note: this prototype version allocates a buffer large enough to
|
||||||
* satisfy the entire request; strip mining is not implemented.
|
* satisfy the entire request; strip mining is not implemented.
|
||||||
*/
|
*/
|
||||||
nelmts = H5P_get_npoints(dataset->space);
|
{
|
||||||
src_size = nelmts * H5T_get_size(dataset->type);
|
size_t src_size = nelmts * H5T_get_size(dataset->type);
|
||||||
dst_size = nelmts * H5T_get_size(mem_type);
|
size_t dst_size = nelmts * H5T_get_size(mem_type);
|
||||||
tconv_buf = H5MM_xmalloc(MAX(src_size, dst_size));
|
tconv_buf = H5MM_xmalloc(MAX(src_size, dst_size));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -892,7 +902,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
if ((sconv_func->fgath)(dataset->ent.file, &(dataset->layout),
|
if ((sconv_func->fgath)(dataset->ent.file, &(dataset->layout),
|
||||||
H5T_get_size (dataset->type), file_space,
|
H5T_get_size (dataset->type), file_space,
|
||||||
&numbering, 0, nelmts,
|
&numbering, 0, nelmts,
|
||||||
tconv_buf/*out*/)<0) {
|
tconv_buf/*out*/)!=nelmts) {
|
||||||
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "gather failed");
|
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "gather failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,15 +952,13 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
const H5P_t *file_space, const H5D_xfer_t *xfer_parms,
|
const H5P_t *file_space, const H5D_xfer_t *xfer_parms,
|
||||||
const void *buf)
|
const void *buf)
|
||||||
{
|
{
|
||||||
size_t nelmts, src_size, dst_size;
|
size_t nelmts;
|
||||||
size_t offset[H5O_LAYOUT_NDIMS];
|
uint8 *tconv_buf = NULL; /*data type conv buffer */
|
||||||
size_t size[H5O_LAYOUT_NDIMS];
|
H5T_conv_t tconv_func = NULL; /*conversion function */
|
||||||
size_t zero[H5O_LAYOUT_NDIMS];
|
hid_t src_id = -1, dst_id = -1;/*temporary type atoms */
|
||||||
intn i;
|
const H5P_conv_t *sconv_func = NULL; /*space conversion funcs*/
|
||||||
herr_t ret_value = FAIL;
|
H5P_number_t numbering; /*element numbering info*/
|
||||||
uint8 *tconv_buf = NULL; /*data type conversion buffer */
|
herr_t ret_value = FAIL;
|
||||||
H5T_conv_t tconv_func = NULL; /*data type conversion function */
|
|
||||||
hid_t src_id = -1, dst_id = -1; /*temporary type atoms */
|
|
||||||
|
|
||||||
FUNC_ENTER(H5D_write, FAIL);
|
FUNC_ENTER(H5D_write, FAIL);
|
||||||
|
|
||||||
@ -959,17 +967,9 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
assert(mem_type);
|
assert(mem_type);
|
||||||
assert(xfer_parms);
|
assert(xfer_parms);
|
||||||
assert(buf);
|
assert(buf);
|
||||||
|
if (!file_space) file_space = dataset->space;
|
||||||
if (H5D_CONTIGUOUS != dataset->create_parms.layout) {
|
if (!mem_space) mem_space = file_space;
|
||||||
HRETURN_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
assert (H5P_get_npoints (mem_space)==H5P_get_npoints (file_space));
|
||||||
"layout is not supported yet");
|
|
||||||
}
|
|
||||||
if ((mem_space && H5P_cmp(mem_space, dataset->space)) ||
|
|
||||||
(file_space && H5P_cmp(file_space, dataset->space))) {
|
|
||||||
HRETURN_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
|
||||||
"space conversion not supported yet");
|
|
||||||
}
|
|
||||||
assert (!mem_space || H5P_SIMPLE==mem_space->type);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert data types to atoms because the conversion functions are
|
* Convert data types to atoms because the conversion functions are
|
||||||
@ -982,31 +982,50 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute the size of the request and allocate scratch buffers.
|
* Locate the type conversion function and data space conversion
|
||||||
*/
|
* functions, and set up the element numbering information.
|
||||||
#ifndef LATER
|
|
||||||
/*
|
|
||||||
* Note: This prototype version allocates a buffer large enough to
|
|
||||||
* satisfy the entire request; strip mining is not implemented.
|
|
||||||
*/
|
|
||||||
nelmts = H5P_get_npoints(dataset->space);
|
|
||||||
src_size = nelmts * H5T_get_size(mem_type);
|
|
||||||
dst_size = nelmts * H5T_get_size(dataset->type);
|
|
||||||
tconv_buf = H5MM_xmalloc(MAX(src_size, dst_size));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Locate the type conversion function.
|
|
||||||
*/
|
*/
|
||||||
if (NULL == (tconv_func = H5T_find(mem_type, dataset->type))) {
|
if (NULL == (tconv_func = H5T_find(mem_type, dataset->type))) {
|
||||||
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
||||||
"unable to convert between src and dest data types");
|
"unable to convert between src and dest data types");
|
||||||
}
|
}
|
||||||
|
if (NULL==(sconv_func=H5P_find (mem_space, file_space))) {
|
||||||
|
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
|
||||||
|
"unable to convert from memory to file data space");
|
||||||
|
}
|
||||||
|
if (sconv_func->init &&
|
||||||
|
(sconv_func->init)(&(dataset->layout), mem_space, file_space,
|
||||||
|
&numbering/*out*/)<=0) {
|
||||||
|
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
|
||||||
|
"unable to initialize element numbering information");
|
||||||
|
} else {
|
||||||
|
HDmemset (&numbering, 0, sizeof numbering);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute the size of the request and allocate scratch buffers.
|
||||||
|
*/
|
||||||
|
nelmts = H5P_get_npoints(dataset->space);
|
||||||
|
#ifndef LATER
|
||||||
|
/*
|
||||||
|
* Note: This prototype version allocates a buffer large enough to
|
||||||
|
* satisfy the entire request; strip mining is not implemented.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
size_t src_size = nelmts * H5T_get_size(mem_type);
|
||||||
|
size_t dst_size = nelmts * H5T_get_size(dataset->type);
|
||||||
|
tconv_buf = H5MM_xmalloc(MAX(src_size, dst_size));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gather data into the data type conversion buffer.
|
* Gather data into the data type conversion buffer.
|
||||||
*/
|
*/
|
||||||
HDmemcpy(tconv_buf, buf, src_size);
|
if ((sconv_func->mgath)(buf, H5T_get_size (mem_type), mem_space,
|
||||||
|
&numbering, 0, nelmts, tconv_buf/*out*/)!=nelmts) {
|
||||||
|
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "gather failed");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform data type conversion.
|
* Perform data type conversion.
|
||||||
@ -1019,23 +1038,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5P_t *mem_space,
|
|||||||
/*
|
/*
|
||||||
* Scatter the data out to the file.
|
* Scatter the data out to the file.
|
||||||
*/
|
*/
|
||||||
#ifndef LATER
|
if ((sconv_func->fscat)(dataset->ent.file, &(dataset->layout),
|
||||||
/*
|
H5T_get_size (dataset->type), file_space,
|
||||||
* Note: We only support complete writes currently. That si, the
|
&numbering, 0, nelmts, tconv_buf)<0) {
|
||||||
* hyperslab must begin at zero in memory and on disk and the size
|
HGOTO_ERROR (H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed");
|
||||||
* of the hyperslab must be the same as the array on disk.
|
|
||||||
*/
|
|
||||||
for (i = 0; i < dataset->layout.ndims; i++) {
|
|
||||||
zero[i] = 0;
|
|
||||||
offset[i] = 0;
|
|
||||||
}
|
|
||||||
i = H5P_get_dims (dataset->space, size);
|
|
||||||
assert (i+1==dataset->layout.ndims);
|
|
||||||
size[i] = H5T_get_size (dataset->type);
|
|
||||||
#endif
|
|
||||||
if (H5F_arr_write(dataset->ent.file, &(dataset->layout), size, offset,
|
|
||||||
zero, size, tconv_buf) < 0) {
|
|
||||||
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write failed");
|
|
||||||
}
|
}
|
||||||
ret_value = SUCCEED;
|
ret_value = SUCCEED;
|
||||||
|
|
||||||
|
@ -112,13 +112,13 @@ H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/)
|
|||||||
*/
|
*/
|
||||||
herr_t
|
herr_t
|
||||||
H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
|
H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
|
||||||
const size_t _hslab_size[], const size_t file_offset[],
|
const size_t _hslab_size[], const size_t mem_size[],
|
||||||
const size_t mem_offset[], const size_t mem_size[],
|
const size_t mem_offset[], const size_t file_offset[],
|
||||||
void *_buf/*out*/)
|
void *_buf/*out*/)
|
||||||
{
|
{
|
||||||
uint8 *buf = (uint8 *)_buf; /*cast for arithmetic */
|
uint8 *buf = (uint8 *)_buf; /*cast for arithmetic */
|
||||||
size_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
|
intn file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
|
||||||
size_t mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
|
intn mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
|
||||||
size_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
|
size_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
|
||||||
size_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
|
size_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
|
||||||
size_t mem_start, file_start; /*byte offsets to start */
|
size_t mem_start, file_start; /*byte offsets to start */
|
||||||
@ -247,13 +247,13 @@ H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
|
|||||||
*/
|
*/
|
||||||
herr_t
|
herr_t
|
||||||
H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
|
H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
|
||||||
const size_t _hslab_size[], const size_t file_offset[],
|
const size_t _hslab_size[], const size_t mem_size[],
|
||||||
const size_t mem_offset[], const size_t mem_size[],
|
const size_t mem_offset[], const size_t file_offset[],
|
||||||
const void *_buf)
|
const void *_buf)
|
||||||
{
|
{
|
||||||
const uint8 *buf = (const uint8 *)_buf; /*cast for arithmetic */
|
const uint8 *buf = (const uint8 *)_buf; /*cast for arithmetic */
|
||||||
size_t file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
|
intn file_stride[H5O_LAYOUT_NDIMS]; /*strides through file */
|
||||||
size_t mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
|
intn mem_stride[H5O_LAYOUT_NDIMS]; /*strides through memory*/
|
||||||
size_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
|
size_t hslab_size[H5O_LAYOUT_NDIMS]; /*hyperslab size */
|
||||||
size_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
|
size_t idx[H5O_LAYOUT_NDIMS]; /*multi-dim counter */
|
||||||
size_t mem_start, file_start; /*byte offsets to start */
|
size_t mem_start, file_start; /*byte offsets to start */
|
||||||
|
@ -408,12 +408,12 @@ herr_t H5F_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
|
|||||||
/* Functions that operate on array storage */
|
/* Functions that operate on array storage */
|
||||||
herr_t H5F_arr_create(H5F_t *f, struct H5O_layout_t *layout /*in,out */ );
|
herr_t H5F_arr_create(H5F_t *f, struct H5O_layout_t *layout /*in,out */ );
|
||||||
herr_t H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
|
herr_t H5F_arr_read (H5F_t *f, const struct H5O_layout_t *layout,
|
||||||
const size_t _hslab_size[], const size_t file_offset[],
|
const size_t _hslab_size[], const size_t mem_size[],
|
||||||
const size_t mem_offset[], const size_t mem_size[],
|
const size_t mem_offset[], const size_t file_offset[],
|
||||||
void *_buf/*out*/);
|
void *_buf/*out*/);
|
||||||
herr_t H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
|
herr_t H5F_arr_write (H5F_t *f, const struct H5O_layout_t *layout,
|
||||||
const size_t _hslab_size[], const size_t file_offset[],
|
const size_t _hslab_size[], const size_t mem_size[],
|
||||||
const size_t mem_offset[], const size_t mem_size[],
|
const size_t mem_offset[], const size_t file_offset[],
|
||||||
const void *_buf);
|
const void *_buf);
|
||||||
|
|
||||||
/* Functions that operate on indexed storage */
|
/* Functions that operate on indexed storage */
|
||||||
|
15
src/H5P.c
15
src/H5P.c
@ -896,9 +896,10 @@ H5Pset_space(hid_t sid, intn rank, const size_t *dims)
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* Function: H5P_find
|
* Function: H5P_find
|
||||||
*
|
*
|
||||||
* Purpose: Given source and destination data spaces (SRC and DST) this
|
* Purpose: Given two data spaces (MEM_SPACE and FILE_SPACE) this
|
||||||
* function locates the data space conversion functions and
|
* function locates the data space conversion functions and
|
||||||
* initializes CONV to point to them.
|
* initializes CONV to point to them. The CONV contains
|
||||||
|
* function pointers for converting in either direction.
|
||||||
*
|
*
|
||||||
* Return: Success: Pointer to a data space conversion callback
|
* Return: Success: Pointer to a data space conversion callback
|
||||||
* list.
|
* list.
|
||||||
@ -913,7 +914,7 @@ H5Pset_space(hid_t sid, intn rank, const size_t *dims)
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
const H5P_conv_t *
|
const H5P_conv_t *
|
||||||
H5P_find (const H5P_t *src, const H5P_t *dst)
|
H5P_find (const H5P_t *mem_space, const H5P_t *file_space)
|
||||||
{
|
{
|
||||||
static H5P_conv_t _conv;
|
static H5P_conv_t _conv;
|
||||||
static const H5P_conv_t *conv = NULL;
|
static const H5P_conv_t *conv = NULL;
|
||||||
@ -921,16 +922,16 @@ H5P_find (const H5P_t *src, const H5P_t *dst)
|
|||||||
FUNC_ENTER (H5P_find, NULL);
|
FUNC_ENTER (H5P_find, NULL);
|
||||||
|
|
||||||
/* Check args */
|
/* Check args */
|
||||||
assert (src && H5P_SIMPLE==src->type);
|
assert (mem_space && H5P_SIMPLE==mem_space->type);
|
||||||
assert (dst && H5P_SIMPLE==dst->type);
|
assert (file_space && H5P_SIMPLE==file_space->type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can't do conversion if the source and destination select a
|
* We can't do conversion if the source and destination select a
|
||||||
* different number of data points.
|
* different number of data points.
|
||||||
*/
|
*/
|
||||||
if (H5P_get_npoints (src) != H5P_get_npoints (dst)) {
|
if (H5P_get_npoints (mem_space) != H5P_get_npoints (file_space)) {
|
||||||
HRETURN_ERROR (H5E_DATASPACE, H5E_BADRANGE, NULL,
|
HRETURN_ERROR (H5E_DATASPACE, H5E_BADRANGE, NULL,
|
||||||
"src and dest data spaces are different sizes");
|
"memory and file data spaces are different sizes");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -72,10 +72,15 @@ typedef struct H5P_tconv_t {
|
|||||||
intn start, intn nelmts, void *buf/*out*/);
|
intn start, intn nelmts, void *buf/*out*/);
|
||||||
|
|
||||||
/* Gather elements from app buffer to type conversion buffer */
|
/* Gather elements from app buffer to type conversion buffer */
|
||||||
size_t (*mgath)(void /*fill out later*/);
|
size_t (*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*/);
|
||||||
|
|
||||||
/* Scatter elements from type conversion buffer to disk */
|
/* Scatter elements from type conversion buffer to disk */
|
||||||
herr_t (*fscat)(void /*fill out later*/);
|
herr_t (*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 *tconv_buf);
|
||||||
} H5P_conv_t;
|
} H5P_conv_t;
|
||||||
|
|
||||||
H5P_t *H5P_copy (const H5P_t *src);
|
H5P_t *H5P_copy (const H5P_t *src);
|
||||||
@ -88,7 +93,7 @@ H5P_t *H5P_read (H5F_t *f, H5G_entry_t *ent);
|
|||||||
intn H5P_cmp (const H5P_t *ds1, const H5P_t *ds2);
|
intn H5P_cmp (const H5P_t *ds1, const H5P_t *ds2);
|
||||||
hbool_t H5P_is_simple (const H5P_t *sdim);
|
hbool_t H5P_is_simple (const H5P_t *sdim);
|
||||||
uintn H5P_nelem (const H5P_t *space);
|
uintn H5P_nelem (const H5P_t *space);
|
||||||
const H5P_conv_t *H5P_find (const H5P_t *src, const H5P_t *dst);
|
const H5P_conv_t *H5P_find (const H5P_t *mem_space, const H5P_t *file_space);
|
||||||
|
|
||||||
/* Conversion functions for simple data spaces */
|
/* Conversion functions for simple data spaces */
|
||||||
size_t H5P_simp_init (const struct H5O_layout_t *layout,
|
size_t H5P_simp_init (const struct H5O_layout_t *layout,
|
||||||
@ -101,7 +106,12 @@ size_t H5P_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
|
|||||||
herr_t H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
|
herr_t H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
|
||||||
const H5P_t *mem_space, const H5P_number_t *numbering,
|
const H5P_t *mem_space, const H5P_number_t *numbering,
|
||||||
intn start, intn nelmts, void *buf/*out*/);
|
intn start, intn nelmts, void *buf/*out*/);
|
||||||
size_t H5P_simp_mgath (void);
|
size_t H5P_simp_mgath (const void *buf, size_t elmt_size,
|
||||||
herr_t H5P_simp_fscat (void);
|
const H5P_t *mem_space, const H5P_number_t *numbering,
|
||||||
|
intn start, intn nelmts, void *tconv_buf/*out*/);
|
||||||
|
herr_t 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 *tconv_buf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
100
src/H5Psimp.c
100
src/H5Psimp.c
@ -124,7 +124,7 @@ H5P_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout,
|
|||||||
/*
|
/*
|
||||||
* Gather from file.
|
* 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");
|
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
|
* 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.
|
* are copied directly from TCONV_BUF to BUF.
|
||||||
*/
|
*/
|
||||||
HDmemcpy (buf, tconv_buf, nelmts*elmt_size);
|
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
|
* Function: H5P_simp_mgath
|
||||||
*
|
*
|
||||||
* Purpose: Gathers dataset elements from application memory and copies
|
* Purpose: Gathers dataset elements from application memory BUF and
|
||||||
* them into the data type conversion buffer. NOT IMPLEMENTED
|
* copies them into the data type conversion buffer TCONV_BUF.
|
||||||
* YET.
|
* 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.
|
* Return: Success: Number of elements copied.
|
||||||
*
|
*
|
||||||
@ -202,21 +208,47 @@ H5P_simp_mscat (const void *tconv_buf, size_t elmt_size,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
size_t
|
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);
|
FUNC_ENTER (H5P_simp_mgath, 0);
|
||||||
|
|
||||||
HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, 0,
|
/* Check args */
|
||||||
"not implemented yet");
|
assert (buf);
|
||||||
|
assert (elmt_size>0);
|
||||||
|
assert (mem_space && H5P_SIMPLE==mem_space->type);
|
||||||
|
assert (numbering);
|
||||||
|
assert (nelmts>0);
|
||||||
|
assert (tconv_buf);
|
||||||
|
|
||||||
FUNC_LEAVE (0);
|
/*
|
||||||
|
* 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 (nelmts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* Function: H5P_simp_fscat
|
* Function: H5P_simp_fscat
|
||||||
*
|
*
|
||||||
* Purpose: Scatters dataset elements from the type conversion buffer to
|
* Purpose: Scatters dataset elements from the type conversion buffer BUF
|
||||||
* the file. NOT IMPLEMENTED YET.
|
* 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
|
* Return: Success: SUCCEED
|
||||||
*
|
*
|
||||||
@ -230,12 +262,50 @@ H5P_simp_mgath (void)
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
herr_t
|
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);
|
FUNC_ENTER (H5P_simp_fscat, FAIL);
|
||||||
|
|
||||||
HRETURN_ERROR (H5E_DATASPACE, H5E_UNSUPPORTED, FAIL,
|
/* Check args */
|
||||||
"not implemented yet");
|
assert (f);
|
||||||
|
assert (layout);
|
||||||
|
assert (elmt_size>0);
|
||||||
|
assert (file_space);
|
||||||
|
assert (numbering);
|
||||||
|
assert (nelmts>0);
|
||||||
|
assert (buf);
|
||||||
|
|
||||||
FUNC_LEAVE (FAIL);
|
/*
|
||||||
|
* 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 (SUCCEED);
|
||||||
}
|
}
|
||||||
|
22
src/H5V.c
22
src/H5V.c
@ -40,7 +40,7 @@ static hbool_t interface_initialize_g = TRUE;
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
herr_t
|
herr_t
|
||||||
H5V_stride_optimize1(size_t *np, size_t *elmt_size, size_t *size,
|
H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
|
||||||
intn *stride1)
|
intn *stride1)
|
||||||
{
|
{
|
||||||
FUNC_ENTER(H5V_stride_optimize1, FAIL);
|
FUNC_ENTER(H5V_stride_optimize1, FAIL);
|
||||||
@ -87,7 +87,7 @@ H5V_stride_optimize1(size_t *np, size_t *elmt_size, size_t *size,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
herr_t
|
herr_t
|
||||||
H5V_stride_optimize2(size_t *np, size_t *elmt_size, size_t *size,
|
H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
|
||||||
intn *stride1, intn *stride2)
|
intn *stride1, intn *stride2)
|
||||||
{
|
{
|
||||||
FUNC_ENTER(H5V_stride_optimize2, FAIL);
|
FUNC_ENTER(H5V_stride_optimize2, FAIL);
|
||||||
@ -143,7 +143,7 @@ H5V_stride_optimize2(size_t *np, size_t *elmt_size, size_t *size,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
H5V_hyper_stride(size_t n, const size_t *size,
|
H5V_hyper_stride(intn n, const size_t *size,
|
||||||
const size_t *total_size, const size_t *offset,
|
const size_t *total_size, const size_t *offset,
|
||||||
intn *stride/*out*/)
|
intn *stride/*out*/)
|
||||||
{
|
{
|
||||||
@ -196,7 +196,7 @@ H5V_hyper_stride(size_t n, const size_t *size,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
hbool_t
|
hbool_t
|
||||||
H5V_hyper_eq(size_t n,
|
H5V_hyper_eq(intn n,
|
||||||
const size_t *offset1, const size_t *size1,
|
const size_t *offset1, const size_t *size1,
|
||||||
const size_t *offset2, const size_t *size2)
|
const size_t *offset2, const size_t *size2)
|
||||||
{
|
{
|
||||||
@ -238,7 +238,7 @@ H5V_hyper_eq(size_t n,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
hbool_t
|
hbool_t
|
||||||
H5V_hyper_disjointp(size_t n,
|
H5V_hyper_disjointp(intn n,
|
||||||
const size_t *offset1, const size_t *size1,
|
const size_t *offset1, const size_t *size1,
|
||||||
const size_t *offset2, const size_t *size2)
|
const size_t *offset2, const size_t *size2)
|
||||||
{
|
{
|
||||||
@ -282,7 +282,7 @@ H5V_hyper_disjointp(size_t n,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
herr_t
|
herr_t
|
||||||
H5V_hyper_fill(size_t n, const size_t *_size,
|
H5V_hyper_fill(intn n, const size_t *_size,
|
||||||
const size_t *total_size, const size_t *offset, void *_dst,
|
const size_t *total_size, const size_t *offset, void *_dst,
|
||||||
uint8 fill_value)
|
uint8 fill_value)
|
||||||
{
|
{
|
||||||
@ -358,7 +358,7 @@ H5V_hyper_fill(size_t n, const size_t *_size,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
herr_t
|
herr_t
|
||||||
H5V_hyper_copy(size_t n, const size_t *_size,
|
H5V_hyper_copy(intn n, const size_t *_size,
|
||||||
|
|
||||||
/*destination*/
|
/*destination*/
|
||||||
const size_t *dst_size, const size_t *dst_offset,
|
const size_t *dst_size, const size_t *dst_offset,
|
||||||
@ -433,7 +433,7 @@ H5V_hyper_copy(size_t n, const size_t *_size,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
herr_t
|
herr_t
|
||||||
H5V_stride_fill(size_t n, size_t elmt_size, const size_t *size,
|
H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
|
||||||
const intn *stride, void *_dst, uint8 fill_value)
|
const intn *stride, void *_dst, uint8 fill_value)
|
||||||
{
|
{
|
||||||
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic */
|
uint8 *dst = (uint8 *) _dst; /*cast for ptr arithmetic */
|
||||||
@ -489,7 +489,7 @@ H5V_stride_fill(size_t n, size_t elmt_size, const size_t *size,
|
|||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
herr_t
|
herr_t
|
||||||
H5V_stride_copy(size_t n, size_t elmt_size, const size_t *size,
|
H5V_stride_copy(intn n, size_t elmt_size, const size_t *size,
|
||||||
const intn *dst_stride, void *_dst,
|
const intn *dst_stride, void *_dst,
|
||||||
const intn *src_stride, const void *_src)
|
const intn *src_stride, const void *_src)
|
||||||
{
|
{
|
||||||
@ -545,11 +545,11 @@ herr_t
|
|||||||
H5V_stride_copy2(size_t nelmts, size_t elmt_size,
|
H5V_stride_copy2(size_t nelmts, size_t elmt_size,
|
||||||
|
|
||||||
/* destination */
|
/* destination */
|
||||||
size_t dst_n, const size_t *dst_size, const intn *dst_stride,
|
intn dst_n, const size_t *dst_size, const intn *dst_stride,
|
||||||
void *_dst,
|
void *_dst,
|
||||||
|
|
||||||
/* source */
|
/* source */
|
||||||
size_t src_n, const size_t *src_size, const intn *src_stride,
|
intn src_n, const size_t *src_size, const intn *src_stride,
|
||||||
const void *_src)
|
const void *_src)
|
||||||
{
|
{
|
||||||
uint8 *dst = (uint8 *) _dst;
|
uint8 *dst = (uint8 *) _dst;
|
||||||
|
@ -28,31 +28,31 @@
|
|||||||
/* A null pointer is equivalent to a zero vector */
|
/* A null pointer is equivalent to a zero vector */
|
||||||
#define H5V_ZERO NULL
|
#define H5V_ZERO NULL
|
||||||
|
|
||||||
size_t H5V_hyper_stride(size_t n, const size_t *size, const size_t *total_size,
|
size_t H5V_hyper_stride(intn n, const size_t *size, const size_t *total_size,
|
||||||
const size_t *offset, intn *stride);
|
const size_t *offset, intn *stride);
|
||||||
hbool_t H5V_hyper_disjointp(size_t n, const size_t *offset1,
|
hbool_t H5V_hyper_disjointp(intn n, const size_t *offset1,
|
||||||
const size_t *size1, const size_t *offset2,
|
const size_t *size1, const size_t *offset2,
|
||||||
const size_t *size2);
|
const size_t *size2);
|
||||||
hbool_t H5V_hyper_eq(size_t n, const size_t *offset1, const size_t *size1,
|
hbool_t H5V_hyper_eq(intn n, const size_t *offset1, const size_t *size1,
|
||||||
const size_t *offset2, const size_t *size2);
|
const size_t *offset2, const size_t *size2);
|
||||||
herr_t H5V_hyper_fill(size_t n, const size_t *total_size, const size_t *offset,
|
herr_t H5V_hyper_fill(intn n, const size_t *total_size, const size_t *offset,
|
||||||
const size_t *size, void *buf, uint8 val);
|
const size_t *size, void *buf, uint8 val);
|
||||||
herr_t H5V_hyper_copy(size_t n, const size_t *size,
|
herr_t H5V_hyper_copy(intn n, const size_t *size,
|
||||||
const size_t *dst_total_size, const size_t *dst_offset,
|
const size_t *dst_total_size, const size_t *dst_offset,
|
||||||
void *_dst, const size_t *src_total_size,
|
void *_dst, const size_t *src_total_size,
|
||||||
const size_t *src_offset, const void *_src);
|
const size_t *src_offset, const void *_src);
|
||||||
herr_t H5V_stride_fill(size_t n, size_t elmt_size, const size_t *size,
|
herr_t H5V_stride_fill(intn n, size_t elmt_size, const size_t *size,
|
||||||
const intn *stride, void *_dst, uint8 fill_value);
|
const intn *stride, void *_dst, uint8 fill_value);
|
||||||
herr_t H5V_stride_copy(size_t n, size_t elmt_size, const size_t *_size,
|
herr_t H5V_stride_copy(intn n, size_t elmt_size, const size_t *_size,
|
||||||
const intn *dst_stride, void *_dst,
|
const intn *dst_stride, void *_dst,
|
||||||
const intn *src_stride, const void *_src);
|
const intn *src_stride, const void *_src);
|
||||||
herr_t H5V_stride_copy2(size_t nelmts, size_t elmt_size, size_t dst_n,
|
herr_t H5V_stride_copy2(size_t nelmts, size_t elmt_size, intn dst_n,
|
||||||
const size_t *dst_size, const intn *dst_stride,
|
const size_t *dst_size, const intn *dst_stride,
|
||||||
void *_dst, size_t src_n, const size_t *src_size,
|
void *_dst, intn src_n, const size_t *src_size,
|
||||||
const intn *src_stride, const void *_src);
|
const intn *src_stride, const void *_src);
|
||||||
herr_t H5V_stride_optimize1(size_t *np, size_t *elmt_size, size_t *size,
|
herr_t H5V_stride_optimize1(intn *np, size_t *elmt_size, size_t *size,
|
||||||
intn *stride1);
|
intn *stride1);
|
||||||
herr_t H5V_stride_optimize2(size_t *np, size_t *elmt_size, size_t *size,
|
herr_t H5V_stride_optimize2(intn *np, size_t *elmt_size, size_t *size,
|
||||||
intn *stride1, intn *stride2);
|
intn *stride1, intn *stride2);
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ new_object(H5F_t *f, const char *name, size_t ndims, H5G_entry_t *ent/*out*/)
|
|||||||
layout.dim[i] = 2;
|
layout.dim[i] = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
H5F_arr_create(f, &layout /*in,out */ );
|
H5F_arr_create(f, &layout/*in,out*/);
|
||||||
if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, &layout) < 0) {
|
if (H5O_modify(ent, H5O_LAYOUT, H5O_NEW_MESG, 0, &layout) < 0) {
|
||||||
printf("*FAILED*\n");
|
printf("*FAILED*\n");
|
||||||
if (!isatty(1)) {
|
if (!isatty(1)) {
|
||||||
@ -314,7 +314,7 @@ test_extend(H5F_t *f, const char *prefix,
|
|||||||
memset(buf, 128 + ctr, nelmts);
|
memset(buf, 128 + ctr, nelmts);
|
||||||
|
|
||||||
/* Write to disk */
|
/* Write to disk */
|
||||||
if (H5F_arr_write(f, &layout, size, offset, zero, size, buf) < 0) {
|
if (H5F_arr_write(f, &layout, size, size, zero, offset, buf) < 0) {
|
||||||
puts("*FAILED*");
|
puts("*FAILED*");
|
||||||
if (!isatty(1)) {
|
if (!isatty(1)) {
|
||||||
AT();
|
AT();
|
||||||
@ -324,7 +324,7 @@ test_extend(H5F_t *f, const char *prefix,
|
|||||||
}
|
}
|
||||||
/* Read from disk */
|
/* Read from disk */
|
||||||
memset(check, 0xff, nelmts);
|
memset(check, 0xff, nelmts);
|
||||||
if (H5F_arr_read(f, &layout, size, offset, zero, size, check) < 0) {
|
if (H5F_arr_read(f, &layout, size, size, zero, offset, check) < 0) {
|
||||||
puts("*FAILED*");
|
puts("*FAILED*");
|
||||||
if (!isatty(1)) {
|
if (!isatty(1)) {
|
||||||
AT();
|
AT();
|
||||||
@ -357,7 +357,7 @@ test_extend(H5F_t *f, const char *prefix,
|
|||||||
|
|
||||||
/* Now read the entire array back out and check it */
|
/* Now read the entire array back out and check it */
|
||||||
memset(buf, 0xff, nx * ny * nz);
|
memset(buf, 0xff, nx * ny * nz);
|
||||||
if (H5F_arr_read(f, &layout, whole_size, zero, zero, whole_size, buf)<0) {
|
if (H5F_arr_read(f, &layout, whole_size, whole_size, zero, zero, buf)<0) {
|
||||||
puts("*FAILED*");
|
puts("*FAILED*");
|
||||||
if (!isatty(1)) {
|
if (!isatty(1)) {
|
||||||
AT();
|
AT();
|
||||||
@ -476,7 +476,7 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
|
|||||||
memset(buf, 128 + ctr, nx * ny * nz);
|
memset(buf, 128 + ctr, nx * ny * nz);
|
||||||
|
|
||||||
/* write to disk */
|
/* write to disk */
|
||||||
if (H5F_arr_write(f, &layout, size, offset, zero, size, buf) < 0) {
|
if (H5F_arr_write(f, &layout, size, size, zero, offset, buf) < 0) {
|
||||||
puts("*FAILED*");
|
puts("*FAILED*");
|
||||||
if (!isatty(1)) {
|
if (!isatty(1)) {
|
||||||
AT();
|
AT();
|
||||||
|
Loading…
Reference in New Issue
Block a user