mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
[svn-r1135] Expanded API for reading lists blocks/points to allow for just a portion of
the block/point-list to be read at a time.
This commit is contained in:
parent
af50eb6cbd
commit
fbef4e61ed
19
src/H5R.c
19
src/H5R.c
@ -331,6 +331,7 @@ H5R_dereference(H5D_t *dset, H5R_type_t ref_type, void *_ref)
|
||||
H5D_t *dataset; /* Pointer to dataset to open */
|
||||
H5G_entry_t ent; /* Symbol table entry */
|
||||
uint8_t *p; /* Pointer to OID to store */
|
||||
intn oid_type; /* type of object being dereferenced */
|
||||
hid_t ret_value = FAIL;
|
||||
|
||||
FUNC_ENTER(H5R_dereference, FAIL);
|
||||
@ -396,6 +397,15 @@ H5R_dereference(H5D_t *dset, H5R_type_t ref_type, void *_ref)
|
||||
} /* end switch */
|
||||
|
||||
/* Open the dataset object */
|
||||
oid_type=H5G_get_type(&ent);
|
||||
switch(oid_type) {
|
||||
case H5G_GROUP:
|
||||
break;
|
||||
|
||||
case H5G_TYPE:
|
||||
break;
|
||||
|
||||
case H5G_DATASET:
|
||||
if ((dataset=H5D_open_oid(&ent)) == NULL) {
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found");
|
||||
}
|
||||
@ -403,9 +413,16 @@ H5R_dereference(H5D_t *dset, H5R_type_t ref_type, void *_ref)
|
||||
/* Create an atom for the dataset */
|
||||
if ((ret_value = H5I_register(H5I_DATASET, dataset)) < 0) {
|
||||
H5D_close(dataset);
|
||||
HRETURN_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL,
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL,
|
||||
"can't register dataset");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, FAIL,
|
||||
"can't identify type of object referenced");
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
|
@ -333,7 +333,6 @@ __DLL__ herr_t H5S_register(H5S_sel_type cls, const H5S_fconv_t *fconv,
|
||||
__DLL__ hssize_t H5S_select_serial_size(const H5S_t *space);
|
||||
__DLL__ herr_t H5S_select_serialize(const H5S_t *space, uint8_t *buf);
|
||||
__DLL__ herr_t H5S_select_deserialize(H5S_t *space, const uint8_t *buf);
|
||||
__DLL__ herr_t H5S_get_select_bounds(H5S_t *space, hsize_t *start, hsize_t *end);
|
||||
|
||||
/* Point select functions */
|
||||
__DLL__ herr_t H5S_point_add(H5S_t *space, size_t num_elemn,
|
||||
|
@ -84,8 +84,8 @@ __DLL__ herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
|
||||
__DLL__ htri_t H5Sselect_valid(hid_t spaceid);
|
||||
__DLL__ hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
|
||||
__DLL__ hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
|
||||
__DLL__ herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t *buf);
|
||||
__DLL__ herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t *buf);
|
||||
__DLL__ herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t *buf);
|
||||
__DLL__ herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints, hsize_t *buf);
|
||||
__DLL__ herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -23,8 +23,9 @@ static intn interface_initialize_g = 0;
|
||||
|
||||
static hssize_t H5S_get_select_hyper_nblocks(H5S_t *space);
|
||||
static hssize_t H5S_get_select_elem_npoints(H5S_t *space);
|
||||
static herr_t H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t *buf);
|
||||
static herr_t H5S_get_select_elem_pointlist(H5S_t *space, hsize_t *buf);
|
||||
static herr_t H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblocks, hsize_t *buf);
|
||||
static herr_t H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf);
|
||||
static herr_t H5S_get_select_bounds(H5S_t *space, hsize_t *start, hsize_t *end);
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
@ -231,8 +232,8 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for overlapping blocks (remove when real block-merging algorithm
|
||||
* is in place?).
|
||||
* Check for overlapping hyperslab blocks in new selection (remove when
|
||||
* real block-merging algorithm is in place? -QAK).
|
||||
*/
|
||||
if(op==H5S_SELECT_SET && block!=NULL) {
|
||||
for(i=0; i<space->extent.u.simple.rank; i++) {
|
||||
@ -1278,6 +1279,8 @@ H5Sget_select_elem_npoints(hid_t spaceid)
|
||||
USAGE
|
||||
herr_t H5S_get_select_hyper_blocklist(space, hsize_t *buf)
|
||||
H5S_t *space; IN: Dataspace pointer of selection to query
|
||||
hsize_t startblock; IN: Hyperslab block to start with
|
||||
hsize_t numblocks; IN: Number of hyperslab blocks to get
|
||||
hsize_t *buf; OUT: List of hyperslab blocks selected
|
||||
RETURNS
|
||||
Non-negative on success, negative on failure
|
||||
@ -1295,7 +1298,7 @@ H5Sget_select_elem_npoints(hid_t spaceid)
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t *buf)
|
||||
H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblocks, hsize_t *buf)
|
||||
{
|
||||
H5S_hyper_node_t *node; /* Hyperslab node */
|
||||
intn rank; /* Dataspace rank */
|
||||
@ -1309,13 +1312,22 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t *buf)
|
||||
/* Get the dataspace extent rank */
|
||||
rank=space->extent.u.simple.rank;
|
||||
|
||||
/* Iterate through the node, copying each hyperslab's information */
|
||||
/* Get the head of the hyperslab list */
|
||||
node=space->select.sel_info.hslab.hyper_lst->head;
|
||||
while(node!=NULL) {
|
||||
|
||||
/* Get to the correct first node to give back to the user */
|
||||
while(node!=NULL && startblock>0) {
|
||||
startblock--;
|
||||
node=node->next;
|
||||
} /* end while */
|
||||
|
||||
/* Iterate through the node, copying each hyperslab's information */
|
||||
while(node!=NULL && numblocks>0) {
|
||||
HDmemcpy(buf,node->start,sizeof(hsize_t)*rank);
|
||||
buf+=rank;
|
||||
HDmemcpy(buf,node->end,sizeof(hsize_t)*rank);
|
||||
buf+=rank;
|
||||
numblocks--;
|
||||
node=node->next;
|
||||
} /* end while */
|
||||
|
||||
@ -1330,6 +1342,8 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t *buf)
|
||||
USAGE
|
||||
herr_t H5Sget_select_hyper_blocklist(dsid, hsize_t *buf)
|
||||
hid_t dsid; IN: Dataspace ID of selection to query
|
||||
hsize_t startblock; IN: Hyperslab block to start with
|
||||
hsize_t numblocks; IN: Number of hyperslab blocks to get
|
||||
hsize_t *buf; OUT: List of hyperslab blocks selected
|
||||
RETURNS
|
||||
Non-negative on success, negative on failure
|
||||
@ -1347,7 +1361,7 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t *buf)
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t
|
||||
H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t *buf)
|
||||
H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t *buf)
|
||||
{
|
||||
H5S_t *space = NULL; /* Dataspace to modify selection of */
|
||||
herr_t ret_value=FAIL; /* return value */
|
||||
@ -1364,7 +1378,7 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t *buf)
|
||||
if(space->select.type!=H5S_SEL_HYPERSLABS)
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection");
|
||||
|
||||
ret_value = H5S_get_select_hyper_blocklist(space,buf);
|
||||
ret_value = H5S_get_select_hyper_blocklist(space,startblock,numblocks,buf);
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
} /* H5Sget_select_hyper_blocklist() */
|
||||
@ -1377,6 +1391,8 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t *buf)
|
||||
USAGE
|
||||
herr_t H5S_get_select_elem_pointlist(space, hsize_t *buf)
|
||||
H5S_t *space; IN: Dataspace pointer of selection to query
|
||||
hsize_t startpoint; IN: Element point to start with
|
||||
hsize_t numpoints; IN: Number of element points to get
|
||||
hsize_t *buf; OUT: List of element points selected
|
||||
RETURNS
|
||||
Non-negative on success, negative on failure
|
||||
@ -1393,7 +1409,7 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t *buf)
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S_get_select_elem_pointlist(H5S_t *space, hsize_t *buf)
|
||||
H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf)
|
||||
{
|
||||
H5S_pnt_node_t *node; /* Point node */
|
||||
intn rank; /* Dataspace rank */
|
||||
@ -1407,11 +1423,21 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t *buf)
|
||||
/* Get the dataspace extent rank */
|
||||
rank=space->extent.u.simple.rank;
|
||||
|
||||
/* Get the head of the point list */
|
||||
node=space->select.sel_info.pnt_lst->head;
|
||||
|
||||
/* Iterate to the first point to return */
|
||||
while(node!=NULL && startpoint>0) {
|
||||
startpoint--;
|
||||
node=node->next;
|
||||
} /* end while */
|
||||
|
||||
/* Iterate through the node, copying each hyperslab's information */
|
||||
node=space->select.sel_info.pnt_lst->head;
|
||||
while(node!=NULL) {
|
||||
while(node!=NULL && numpoints>0) {
|
||||
HDmemcpy(buf,node->pnt,sizeof(hsize_t)*rank);
|
||||
buf+=rank;
|
||||
numpoints--;
|
||||
node=node->next;
|
||||
} /* end while */
|
||||
|
||||
@ -1426,6 +1452,8 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t *buf)
|
||||
USAGE
|
||||
herr_t H5Sget_select_elem_pointlist(dsid, hsize_t *buf)
|
||||
hid_t dsid; IN: Dataspace ID of selection to query
|
||||
hsize_t startpoint; IN: Element point to start with
|
||||
hsize_t numpoints; IN: Number of element points to get
|
||||
hsize_t *buf; OUT: List of element points selected
|
||||
RETURNS
|
||||
Non-negative on success, negative on failure
|
||||
@ -1442,7 +1470,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t *buf)
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t
|
||||
H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t *buf)
|
||||
H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints, hsize_t *buf)
|
||||
{
|
||||
H5S_t *space = NULL; /* Dataspace to modify selection of */
|
||||
herr_t ret_value=FAIL; /* return value */
|
||||
@ -1459,7 +1487,7 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t *buf)
|
||||
if(space->select.type!=H5S_SEL_POINTS)
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection");
|
||||
|
||||
ret_value = H5S_get_select_elem_pointlist(space,buf);
|
||||
ret_value = H5S_get_select_elem_pointlist(space,startpoint,numpoints,buf);
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
} /* H5Sget_select_elem_pointlist() */
|
||||
@ -1531,7 +1559,7 @@ H5S_get_select_bounds(H5S_t *space, hsize_t *start, hsize_t *end)
|
||||
}
|
||||
|
||||
FUNC_LEAVE (ret_value);
|
||||
} /* H5Sget_select_bounds() */
|
||||
} /* H5S_get_select_bounds() */
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
|
Loading…
Reference in New Issue
Block a user