[svn-r4586] Purpose:

Code speedups, etc.
Description:
    Bring in new algorithms and data structures for dealing with hyperslabs.

    This speeds up the hyperslab I/O for non-regular hyperslabs by a huge
    amount.

    Currently, the new API functions are ifdef'ed out, pending discussion
    and consensus approval.
Platforms tested:
    FreeBSD 4.4 (hawkwind)
This commit is contained in:
Quincey Koziol 2001-11-02 15:31:35 -05:00
parent e9d955be61
commit 1cd9eb7e0d
12 changed files with 5652 additions and 3014 deletions

View File

@ -2098,7 +2098,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#endif
#ifdef QAK
printf("%s: check 1.0, nelmts=%d\n",FUNC,(int)nelmts);
printf("%s: check 1.0, nelmts=%d, H5S_get_select_npoints(file_space)=%d\n",FUNC,(int)nelmts,(int)H5S_get_select_npoints(file_space));
#endif /* QAK */
/*
* Locate the type conversion function and data space conversion
@ -2222,29 +2222,32 @@ printf("%s: check 1.2, \n",FUNC);
}
#endif
/*
* This is the general case. Figure out the strip mine size.
* This is the general case.
*/
if ((sconv->f->init)(file_space, &file_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize file selection information");
}
if ((sconv->m->init)(mem_space, &mem_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
if ((sconv->m->init)(mem_space, &bkg_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize background selection information");
}
/* Compute element sizes and other parameters */
src_type_size = H5T_get_size(dataset->type);
dst_type_size = H5T_get_size(mem_type);
target_size = H5P_peek_size_t(dxpl_id,H5D_XFER_MAX_TEMP_BUF_NAME);
#ifdef QAK
printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size);
printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_elem_out=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size,(int)min_elem_out);
#endif /* QAK */
request_nelmts = target_size / MAX(src_type_size, dst_type_size);
/* Figure out the strip mine size. */
if ((sconv->f->init)(file_space, src_type_size, &file_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize file selection information");
}
if ((sconv->m->init)(mem_space, dst_type_size, &mem_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
if ((sconv->m->init)(mem_space, dst_type_size, &bkg_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize background selection information");
}
#ifdef QAK
printf("%s: check 3.0, request_nelmts=%d\n",FUNC,(int)request_nelmts);
#endif
@ -2731,21 +2734,10 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
}
#endif
/*
* This is the general case. Figure out the strip mine size.
* This is the general case.
*/
if ((sconv->f->init)(file_space, &file_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize file selection information");
}
if ((sconv->m->init)(mem_space, &mem_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
if ((sconv->f->init)(file_space, &bkg_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
/* Compute element sizes and other parameters */
src_type_size = H5T_get_size(mem_type);
dst_type_size = H5T_get_size(dataset->type);
target_size = H5P_peek_size_t(dxpl_id,H5D_XFER_MAX_TEMP_BUF_NAME);
@ -2753,7 +2745,6 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size);
#endif /* QAK */
request_nelmts = target_size / MAX (src_type_size, dst_type_size);
#ifdef QAK
printf("%s: check 3.0, request_nelmts=%d, tpath->cdata.need_bkg=%d\n",FUNC,(int)request_nelmts,(int)tpath->cdata.need_bkg);
#endif
@ -2762,6 +2753,20 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
"temporary buffer max size is too small");
}
/* Figure out the strip mine size. */
if ((sconv->f->init)(file_space, dst_type_size, &file_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize file selection information");
}
if ((sconv->m->init)(mem_space, src_type_size, &mem_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
if ((sconv->f->init)(file_space, dst_type_size, &bkg_iter)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize memory selection information");
}
/*
* Get a temporary buffer for type conversion unless the app has already
* supplied one through the xfer properties. Instead of allocating a
@ -2827,6 +2832,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed");
}
#ifdef QAK
#ifdef QAK
{
int i;
@ -2841,6 +2847,7 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUN
printf("\n");
}
}
#endif /* QAK */
printf("%s: check 6.0, tconv_buf=%p, *tconv_buf=%p\n",FUNC,tconv_buf,*(char **)tconv_buf);
#endif

View File

@ -137,11 +137,15 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = {
/* Datatype conversion errors */
{H5E_CANTCONVERT, "Can't convert datatypes"},
/* Dataspace errors */
{H5E_CANTCLIP, "Can't clip hyperslab region"},
{H5E_CANTCOUNT, "Can't count elements"},
/* Property list errors */
{H5E_CANTGET, "Can't get value"},
{H5E_CANTSET, "Can't set value"},
/* Datatype conversion errors */
/* Parallel I/O errors */
{H5E_MPI, "Some MPI function failed"}
};

View File

@ -177,6 +177,10 @@ typedef enum H5E_minor_t {
/* Datatype conversion errors */
H5E_CANTCONVERT, /*Can't convert datatypes */
/* Dataspace errors */
H5E_CANTCLIP, /*Can't clip hyperslab region */
H5E_CANTCOUNT, /*Can't count elements */
/* Property list errors */
H5E_CANTGET, /*Can't get value */
H5E_CANTSET, /*Can't set value */

View File

@ -1505,7 +1505,7 @@ printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.fi
/* No maximum number of elements, use the PQ information */
else {
#ifdef H5FL_DEBUG
printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head->list->name,(int)H5FL_arr_gc_head->list->u.queue.allocated);
printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.first->list->name,(int)H5FL_arr_gc_head.first->list->u.queue.allocated);
#endif /* H5FL_DEBUG */
/* Check if the list has allocations outstanding */
if(H5FL_arr_gc_head.first->list->u.queue.allocated>0) {

View File

@ -87,7 +87,7 @@ H5S_init_interface(void)
/* Register space conversion functions */
if (H5S_register(H5S_SEL_POINTS, H5S_POINT_FCONV, H5S_POINT_MCONV)<0 ||
H5S_register(H5S_SEL_ALL, H5S_ALL_FCONV, H5S_ALL_MCONV) <0 ||
H5S_register(H5S_SEL_HYPERSLABS, H5S_HYPER_FCONV, H5S_HYPER_MCONV)<0) {
H5S_register(H5S_SEL_HYPERSLABS, H5S_HYPER_FCONV, H5S_HYPER_MCONV) <0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to register one or more conversion functions");
}

View File

@ -22,7 +22,7 @@
#define INTERFACE_INIT NULL
static int interface_initialize_g = 0;
static herr_t H5S_all_init (const H5S_t *space, H5S_sel_iter_t *iter);
static herr_t H5S_all_init (const H5S_t *space, size_t elmt_size, H5S_sel_iter_t *iter);
static hsize_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
hsize_t max);
static hsize_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
@ -80,7 +80,7 @@ const H5S_mconv_t H5S_ALL_MCONV[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
H5S_all_init (const H5S_t *space, H5S_sel_iter_t *sel_iter)
H5S_all_init (const H5S_t *space, size_t UNUSED elmt_size, H5S_sel_iter_t *sel_iter)
{
FUNC_ENTER (H5S_all_init, FAIL);
@ -392,8 +392,8 @@ H5S_all_read(H5F_t *f, const H5O_layout_t *layout, const H5O_pline_t *pline,
const H5S_t *mem_space, hid_t dxpl_id, void *_buf/*out*/,
hbool_t *must_convert/*out*/)
{
H5S_hyper_span_t *file_span=NULL,*mem_span=NULL; /* Hyperslab span node */
char *buf=(char*)_buf; /* Get pointer to buffer */
H5S_hyper_node_t *file_node=NULL,*mem_node=NULL; /* Hyperslab node */
hsize_t mem_size,file_size;
hssize_t file_off,mem_off;
hssize_t count; /* Regular hyperslab count */
@ -433,9 +433,24 @@ printf("%s: check 1.0\n",FUNC);
goto fall_through;
} /* end if */
else {
if(mem_space->select.sel_info.hslab.hyper_lst->count>1)
goto fall_through;
mem_node=mem_space->select.sel_info.hslab.hyper_lst->head;
/* Get the pointer to the hyperslab spans to check */
mem_span=mem_space->select.sel_info.hslab.span_lst->head;
/* Spin through the spans, checking for more than one span in each dimension */
while(mem_span!=NULL) {
/* If there are more than one span in the dimension, we can't use this routine */
if(mem_span->next!=NULL)
goto fall_through;
/* Advance to the next span, if it's available */
if(mem_span->down==NULL)
break;
else
mem_span=mem_span->down->head;
} /* end while */
/* Get the pointer to the hyperslab spans to use */
mem_span=mem_space->select.sel_info.hslab.span_lst->head;
} /* end else */
} /* end if */
else
@ -454,9 +469,24 @@ printf("%s: check 1.0\n",FUNC);
goto fall_through;
} /* end if */
else {
if(file_space->select.sel_info.hslab.hyper_lst->count>1)
goto fall_through;
file_node=file_space->select.sel_info.hslab.hyper_lst->head;
/* Get the pointer to the hyperslab spans to check */
file_span=file_space->select.sel_info.hslab.span_lst->head;
/* Spin through the spans, checking for more than one span in each dimension */
while(file_span!=NULL) {
/* If there are more than one span in the dimension, we can't use this routine */
if(file_span->next!=NULL)
goto fall_through;
/* Advance to the next span, if it's available */
if(file_span->down==NULL)
break;
else
file_span=file_span->down->head;
} /* end while */
/* Get the pointer to the hyperslab spans to use */
file_span=file_space->select.sel_info.hslab.span_lst->head;
} /* end else */
} /* end if */
else
@ -472,8 +502,9 @@ printf("%s: check 1.0\n",FUNC);
mem_off=mem_space->select.sel_info.hslab.diminfo[u].start;
} /* end if */
else {
mem_size=(mem_node->end[u]-mem_node->start[u])+1;
mem_off=mem_node->start[u];
mem_size=(mem_span->high-mem_span->low)+1;
mem_off=mem_span->low;
mem_span=mem_span->down->head;
} /* end else */
} /* end if */
else {
@ -488,8 +519,9 @@ printf("%s: check 1.0\n",FUNC);
file_off=file_space->select.sel_info.hslab.diminfo[u].start;
} /* end if */
else {
file_size=(file_node->end[u]-file_node->start[u])+1;
file_off=file_node->start[u];
file_size=(file_span->high-file_span->low)+1;
file_off=file_span->low;
file_span=file_span->down->head;
} /* end else */
} /* end if */
else {
@ -628,8 +660,8 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
const H5S_t *mem_space, hid_t dxpl_id, const void *_buf,
hbool_t *must_convert/*out*/)
{
H5S_hyper_span_t *file_span=NULL,*mem_span=NULL; /* Hyperslab span node */
const char *buf=(const char*)_buf; /* Get pointer to buffer */
H5S_hyper_node_t *file_node=NULL,*mem_node=NULL; /* Hyperslab node */
hsize_t mem_size,file_size;
hssize_t file_off,mem_off;
hssize_t count; /* Regular hyperslab count */
@ -666,9 +698,24 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
goto fall_through;
} /* end if */
else {
if(mem_space->select.sel_info.hslab.hyper_lst->count>1)
goto fall_through;
mem_node=mem_space->select.sel_info.hslab.hyper_lst->head;
/* Get the pointer to the hyperslab spans to check */
mem_span=mem_space->select.sel_info.hslab.span_lst->head;
/* Spin through the spans, checking for more than one span in each dimension */
while(mem_span!=NULL) {
/* If there are more than one span in the dimension, we can't use this routine */
if(mem_span->next!=NULL)
goto fall_through;
/* Advance to the next span, if it's available */
if(mem_span->down==NULL)
break;
else
mem_span=mem_span->down->head;
} /* end while */
/* Get the pointer to the hyperslab spans to use */
mem_span=mem_space->select.sel_info.hslab.span_lst->head;
} /* end else */
} /* end if */
else
@ -687,9 +734,24 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
goto fall_through;
} /* end if */
else {
if(file_space->select.sel_info.hslab.hyper_lst->count>1)
goto fall_through;
file_node=file_space->select.sel_info.hslab.hyper_lst->head;
/* Get the pointer to the hyperslab spans to check */
file_span=file_space->select.sel_info.hslab.span_lst->head;
/* Spin through the spans, checking for more than one span in each dimension */
while(file_span!=NULL) {
/* If there are more than one span in the dimension, we can't use this routine */
if(file_span->next!=NULL)
goto fall_through;
/* Advance to the next span, if it's available */
if(file_span->down==NULL)
break;
else
file_span=file_span->down->head;
} /* end while */
/* Get the pointer to the hyperslab spans to use */
file_span=file_space->select.sel_info.hslab.span_lst->head;
} /* end else */
} /* end if */
else
@ -705,8 +767,9 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
mem_off=mem_space->select.sel_info.hslab.diminfo[u].start;
} /* end if */
else {
mem_size=(mem_node->end[u]-mem_node->start[u])+1;
mem_off=mem_node->start[u];
mem_size=(mem_span->high-mem_span->low)+1;
mem_off=mem_span->low;
mem_span=mem_span->down->head;
} /* end else */
} /* end if */
else {
@ -721,8 +784,9 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
file_off=file_space->select.sel_info.hslab.diminfo[u].start;
} /* end if */
else {
file_size=(file_node->end[u]-file_node->start[u])+1;
file_off=file_node->start[u];
file_size=(file_span->high-file_span->low)+1;
file_off=file_span->low;
file_span=file_span->down->head;
} /* end else */
} /* end if */
else {

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2001 NCSA
* All rights reserved.
* Copyright (C) 2000 NCSA
* All rights reserved.
*
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Thursday, September 28, 2000
@ -16,7 +16,7 @@
#ifndef _H5Spkg_H
#define _H5Spkg_H
#include "H5Sprivate.h"
#include <H5Sprivate.h>
/*
* Dataspace extent information
@ -53,41 +53,23 @@ typedef struct {
H5S_pnt_node_t *head; /* Pointer to head of point list */
} H5S_pnt_list_t;
/* Node in hyperslab selection list */
typedef struct H5S_hyper_node_tag {
hssize_t *start; /* Pointer to a corner of a hyperslab closest to the origin */
hssize_t *end; /* Pointer to a corner of a hyperslab furthest from the origin */
struct {
unsigned cached; /* Flag to indicate that the block is cached (during I/O only) */
size_t size; /* Size of cached block (in elements) */
unsigned rleft; /* Read elements left to access in block */
unsigned wleft; /* Write elements left to access in block */
uint8_t *block; /* Pointer into buffer for cache */
uint8_t *rpos; /* Pointer to current read location within block */
uint8_t *wpos; /* Pointer to current write location within block */
} cinfo;
struct H5S_hyper_node_tag *next; /* pointer to next hyperslab in list */
} H5S_hyper_node_t;
/* Information about new-style hyperslab spans */
/* Region in dimension */
typedef struct H5S_hyper_region_tag {
hssize_t start; /* The low bound of a region in a dimension */
hssize_t end; /* The high bound of a region in a dimension */
H5S_hyper_node_t *node; /* pointer to the node the region is in */
} H5S_hyper_region_t;
/* Information a particular hyperslab span */
struct H5S_hyper_span_t {
hssize_t low, high; /* Low & high bounds of span */
hsize_t nelem; /* Number of elements in span (only needed during I/O) */
hsize_t pstride; /* Pseudo-stride from start of previous span (only used during I/O) */
struct H5S_hyper_span_info_t *down; /* Pointer to list of spans in next dimension down */
struct H5S_hyper_span_t *next; /* Pointer to next span in list */
};
/* Information about hyperslab boundary and pointer to hyperslab node */
typedef struct {
hssize_t bound; /* Location of boundary */
H5S_hyper_node_t *node; /* Boundary's node */
} H5S_hyper_bound_t;
/* Information about hyperslab list */
typedef struct {
size_t count; /* Number of nodes in list */
H5S_hyper_node_t *head; /* Pointer to head of hyperslab list */
H5S_hyper_bound_t **lo_bounds; /* Lower (closest to the origin) bound array for each dimension */
} H5S_hyper_list_t;
/* Information about a list of hyperslab spans */
struct H5S_hyper_span_info_t {
unsigned count; /* Ref. count of number of spans which share this span */
struct H5S_hyper_span_info_t *scratch; /* Scratch pointer (used during copies & as mark during precomputes for I/O) */
struct H5S_hyper_span_t *head; /* Pointer to list of spans in next dimension down */
};
/* Information about one dimension in a hyperslab selection */
typedef struct {
@ -97,7 +79,7 @@ typedef struct {
hsize_t block;
} H5S_hyper_dim_t;
/* Information about hyperslab selection */
/* Information about new-style hyperslab selection */
typedef struct {
H5S_hyper_dim_t *diminfo; /* ->[rank] of per-dim selection info */
/* diminfo only points to one array, which holds the information
@ -106,12 +88,12 @@ typedef struct {
* restriction to H5S_SELECT_SET is removed. */
H5S_hyper_dim_t *app_diminfo;/* ->[rank] of per-dim selection info */
/* 'diminfo' points to a [potentially] optimized version of the user's
* hyperslab information. 'app_diminfo' points to the actual parameters
* that the application used for setting the hyperslab selection. These
* are only used for re-gurgitating the original values used to set the
* hyperslab to the application when it queries the hyperslab selection
* information. */
H5S_hyper_list_t *hyper_lst; /* List of selected hyperslabs (order is not important) */
* hyperslab information. 'app_diminfo' points to the actual parameters
* that the application used for setting the hyperslab selection. These
* are only used for re-gurgitating the original values used to set the
* hyperslab to the application when it queries the hyperslab selection
* information. */
H5S_hyper_span_info_t *span_lst; /* List of hyperslab span information */
} H5S_hyper_sel_t;
/* Selection information container */
@ -122,7 +104,7 @@ typedef struct {
hsize_t num_elem; /* Number of elements in selection */
union {
H5S_pnt_list_t *pnt_lst; /* List of selected points (order is important) */
H5S_hyper_sel_t hslab; /* Info about hyperslab selections */
H5S_hyper_sel_t hslab; /* Info about new-style hyperslab selections */
} sel_info;
} H5S_select_t;
@ -181,20 +163,13 @@ __DLL__ herr_t H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space,
__DLL__ herr_t H5S_hyper_release(H5S_t *space);
__DLL__ herr_t H5S_hyper_sel_iter_release(H5S_sel_iter_t *sel_iter);
__DLL__ hsize_t H5S_hyper_npoints(const H5S_t *space);
__DLL__ int H5S_hyper_compare_regions(const void *r1, const void *r2);
__DLL__ int H5S_hyper_compare_bounds(const void *r1, const void *r2);
__DLL__ herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src);
__DLL__ htri_t H5S_hyper_select_valid(const H5S_t *space);
__DLL__ int H5S_hyper_bound_comp(const void *_b1, const void *_b2);
__DLL__ herr_t H5S_hyper_node_add(H5S_hyper_node_t **head, int endflag,
unsigned rank, const hssize_t *start,
const hsize_t *size);
__DLL__ herr_t H5S_hyper_clip(H5S_t *space, H5S_hyper_node_t *nodes,
H5S_hyper_node_t **uniq,
H5S_hyper_node_t **overlap);
__DLL__ hssize_t H5S_hyper_select_serial_size(const H5S_t *space);
__DLL__ herr_t H5S_hyper_select_serialize(const H5S_t *space, uint8_t *buf);
__DLL__ herr_t H5S_hyper_select_deserialize(H5S_t *space, const uint8_t *buf);
__DLL__ hssize_t H5S_hyper_span_nblocks(H5S_hyper_span_info_t *spans);
__DLL__ herr_t H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hssize_t start[], hssize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf);
__DLL__ herr_t H5S_hyper_bounds(H5S_t *space, hsize_t *start, hsize_t *end);
__DLL__ htri_t H5S_hyper_select_contiguous(const H5S_t *space);
__DLL__ herr_t H5S_hyper_select_iterate(void *buf, hid_t type_id, H5S_t *space,

View File

@ -23,7 +23,7 @@
#define INTERFACE_INIT NULL
static int interface_initialize_g = 0;
static herr_t H5S_point_init (const H5S_t *space, H5S_sel_iter_t *iter);
static herr_t H5S_point_init (const H5S_t *space, size_t elmt_size, H5S_sel_iter_t *iter);
static hsize_t H5S_point_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
hsize_t max);
static hsize_t H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout,
@ -83,7 +83,7 @@ const H5S_mconv_t H5S_POINT_MCONV[1] = {{
*-------------------------------------------------------------------------
*/
static herr_t
H5S_point_init (const H5S_t *space, H5S_sel_iter_t *sel_iter)
H5S_point_init (const H5S_t *space, size_t UNUSED elmt_size, H5S_sel_iter_t *sel_iter)
{
FUNC_ENTER (H5S_point_init, FAIL);

View File

@ -33,15 +33,17 @@
/* Forward references of common typedefs */
typedef struct H5S_t H5S_t;
typedef struct H5S_pnt_node_t H5S_pnt_node_t;
typedef struct H5S_hyper_span_t H5S_hyper_span_t;
typedef struct H5S_hyper_span_info_t H5S_hyper_span_info_t;
/* Enumerated type for the type of selection */
typedef enum {
H5S_SEL_ERROR = -1, /* Error */
H5S_SEL_NONE = 0, /* Nothing selected */
H5S_SEL_POINTS = 1, /* Sequence of points selected */
H5S_SEL_HYPERSLABS = 2, /* Hyperslab selection defined */
H5S_SEL_ALL = 3, /* Entire extent selected */
H5S_SEL_N = 4 /*THIS MUST BE LAST */
H5S_SEL_ERROR = -1, /* Error */
H5S_SEL_NONE = 0, /* Nothing selected */
H5S_SEL_POINTS = 1, /* Sequence of points selected */
H5S_SEL_HYPERSLABS = 2, /* "New-style" hyperslab selection defined */
H5S_SEL_ALL = 3, /* Entire extent selected */
H5S_SEL_N = 4 /*THIS MUST BE LAST */
}H5S_sel_type;
/* Point selection iteration container */
@ -50,9 +52,12 @@ typedef struct {
H5S_pnt_node_t *curr; /* Pointer to next node to output */
} H5S_point_iter_t;
/* Hyperslab selection iteration container */
/* New Hyperslab selection iteration container */
typedef struct {
hsize_t elmt_left; /* Number of elements left to iterate over */
H5S_hyper_span_info_t *spans; /* Pointer to copy of the span tree */
H5S_hyper_span_t **span; /* Array of pointers to span nodes */
hssize_t *off; /* Offset in span node */
hssize_t *pos; /* Position to start iterating at */
} H5S_hyper_iter_t;
@ -65,7 +70,7 @@ typedef struct {
/* Selection iteration container */
typedef union {
H5S_point_iter_t pnt; /* Point selection iteration information */
H5S_hyper_iter_t hyp; /* Hyperslab selection iteration information */
H5S_hyper_iter_t hyp; /* New Hyperslab selection iteration information */
H5S_all_iter_t all; /* "All" selection iteration information */
} H5S_sel_iter_t;
@ -81,7 +86,7 @@ typedef struct H5S_fconv_t {
H5S_sel_type type;
/* Initialize file element numbering information */
herr_t (*init)(const H5S_t *space, H5S_sel_iter_t *iter);
herr_t (*init)(const H5S_t *space, size_t elmt_size, H5S_sel_iter_t *iter);
/* Determine optimal number of elements to transfer */
hsize_t (*avail)(const H5S_t *file_space, const H5S_sel_iter_t *file_iter,
@ -110,7 +115,7 @@ typedef struct H5S_mconv_t {
H5S_sel_type type;
/* Initialize memory element numbering information */
herr_t (*init)(const H5S_t *space, H5S_sel_iter_t *iter);
herr_t (*init)(const H5S_t *space, size_t elmt_size, H5S_sel_iter_t *iter);
/* Gather elements from app buffer to type conversion buffer */
hsize_t (*gath)(const void *buf, size_t elmt_size,
@ -207,11 +212,6 @@ __DLL__ H5S_t *H5S_read(struct H5G_entry_t *ent);
__DLL__ int H5S_cmp(const H5S_t *ds1, const H5S_t *ds2);
__DLL__ htri_t H5S_is_simple(const H5S_t *sdim);
__DLL__ unsigned H5S_nelem(const H5S_t *space);
__DLL__ herr_t H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op,
const hssize_t start[],
const hsize_t _stride[],
const hsize_t count[],
const hsize_t _block[]);
__DLL__ int H5S_get_hyperslab(const H5S_t *ds, hssize_t offset[]/*out*/,
hsize_t size[]/*out*/, hsize_t stride[]/*out*/);
__DLL__ herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src);

View File

@ -40,7 +40,34 @@ typedef enum H5S_seloper_t {
H5S_SELECT_NOOP = -1, /* error */
H5S_SELECT_SET = 0, /* Select "set" operation */
H5S_SELECT_OR, /* Binary "or" operation for hyperslabs
* (add new selection to existing selection)
* (add new selection to existing selection)
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A or B: CCCCCCCCCCCCCCCC
*/
H5S_SELECT_AND, /* Binary "and" operation for hyperslabs
* (only leave overlapped regions in selection)
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A and B: CCCC
*/
H5S_SELECT_XOR, /* Binary "xor" operation for hyperslabs
* (only leave non-overlapped regions in selection)
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A xor B: CCCCCC CCCCCC
*/
H5S_SELECT_NOTB, /* Binary "not" operation for hyperslabs
* (only leave non-overlapped regions in original selection)
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A not B: CCCCCC
*/
H5S_SELECT_NOTA, /* Binary "not" operation for hyperslabs
* (only leave non-overlapped regions in new selection)
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* B not A: CCCCCC
*/
H5S_SELECT_APPEND, /* Append elements to end of point selection */
H5S_SELECT_PREPEND, /* Prepend elements to beginning of point selection */
@ -72,6 +99,17 @@ __DLL__ herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
const hsize_t _stride[],
const hsize_t count[],
const hsize_t _block[]);
#ifdef NEW_HYPERSLAB_API
__DLL__ hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
const hssize_t start[],
const hsize_t _stride[],
const hsize_t count[],
const hsize_t _block[]);
__DLL__ herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
hid_t space2_id);
__DLL__ hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
hid_t space2_id);
#endif /* OLD_WAY */
__DLL__ herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
size_t num_elemn,
const hssize_t **coord);

View File

@ -235,25 +235,25 @@ H5S_get_select_npoints (const H5S_t *space)
assert(space);
switch(space->select.type) {
case H5S_SEL_POINTS: /* Sequence of points selected */
ret_value=H5S_point_npoints(space);
break;
case H5S_SEL_POINTS: /* Sequence of points selected */
ret_value=H5S_point_npoints(space);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
ret_value=H5S_hyper_npoints(space);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
ret_value=H5S_hyper_npoints(space);
break;
case H5S_SEL_ALL: /* Entire extent selected */
ret_value=H5S_all_npoints(space);
break;
case H5S_SEL_ALL: /* Entire extent selected */
ret_value=H5S_all_npoints(space);
break;
case H5S_SEL_NONE: /* Nothing selected */
ret_value=0;
break;
case H5S_SEL_NONE: /* Nothing selected */
ret_value=0;
break;
case H5S_SEL_ERROR:
case H5S_SEL_N:
break;
case H5S_SEL_ERROR:
case H5S_SEL_N:
break;
}
FUNC_LEAVE (ret_value);
@ -379,22 +379,22 @@ H5S_select_valid (const H5S_t *space)
assert(space);
switch(space->select.type) {
case H5S_SEL_POINTS: /* Sequence of points selected */
ret_value=H5S_point_select_valid(space);
break;
case H5S_SEL_POINTS: /* Sequence of points selected */
ret_value=H5S_point_select_valid(space);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
ret_value=H5S_hyper_select_valid(space);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
ret_value=H5S_hyper_select_valid(space);
break;
case H5S_SEL_ALL: /* Entire extent selected */
case H5S_SEL_NONE: /* Nothing selected */
ret_value=TRUE;
break;
case H5S_SEL_ALL: /* Entire extent selected */
case H5S_SEL_NONE: /* Nothing selected */
ret_value=TRUE;
break;
case H5S_SEL_ERROR:
case H5S_SEL_N:
break;
case H5S_SEL_ERROR:
case H5S_SEL_N:
break;
}
FUNC_LEAVE (ret_value);
@ -430,26 +430,27 @@ H5S_select_serial_size (const H5S_t *space)
assert(space);
switch(space->select.type) {
case H5S_SEL_POINTS: /* Sequence of points selected */
ret_value=H5S_point_select_serial_size(space);
break;
case H5S_SEL_POINTS: /* Sequence of points selected */
ret_value=H5S_point_select_serial_size(space);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
ret_value=H5S_hyper_select_serial_size(space);
break;
case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */
ret_value=H5S_hyper_select_serial_size(space);
break;
case H5S_SEL_ALL: /* Entire extent selected */
case H5S_SEL_NONE: /* Nothing selected */
ret_value=16; /* replace with real function call at some point */
break;
case H5S_SEL_ALL: /* Entire extent selected */
case H5S_SEL_NONE: /* Nothing selected */
ret_value=16; /* replace with real function call at some point */
break;
case H5S_SEL_ERROR:
case H5S_SEL_N:
break;
case H5S_SEL_ERROR:
case H5S_SEL_N:
break;
}
FUNC_LEAVE (ret_value);
} /* H5S_select_serial_size() */
/*--------------------------------------------------------------------------
NAME
@ -569,6 +570,7 @@ H5S_select_deserialize (H5S_t *space, const uint8_t *buf)
FUNC_LEAVE (ret_value);
} /* H5S_select_deserialize() */
/*--------------------------------------------------------------------------
NAME
@ -599,23 +601,16 @@ H5S_get_select_hyper_nblocks(H5S_t *space)
/* Check for a "regular" hyperslab selection */
if(space->select.sel_info.hslab.diminfo != NULL) {
#ifdef QAK
{
H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab.diminfo;
for(u=0; u<space->extent.u.simple.rank; u++)
printf("%s: (%u) start=%d, stride=%d, count=%d, block=%d\n",FUNC,u,(int)diminfo[u].start,(int)diminfo[u].stride,(int)diminfo[u].count,(int)diminfo[u].block);
}
#endif /*QAK */
/* Check each dimension */
for(ret_value=1,u=0; u<space->extent.u.simple.rank; u++)
ret_value*=space->select.sel_info.hslab.app_diminfo[u].count;
} /* end if */
else
ret_value = (hssize_t)space->select.sel_info.hslab.hyper_lst->count;
else
ret_value = H5S_hyper_span_nblocks(space->select.sel_info.hslab.span_lst);
FUNC_LEAVE (ret_value);
} /* H5Sget_select_hyper_nblocks() */
} /* H5S_get_select_hyper_nblocks() */
/*--------------------------------------------------------------------------
NAME
@ -655,6 +650,7 @@ H5Sget_select_hyper_nblocks(hid_t spaceid)
FUNC_LEAVE (ret_value);
} /* H5Sget_select_hyper_nblocks() */
/*--------------------------------------------------------------------------
NAME
@ -686,6 +682,7 @@ H5S_get_select_elem_npoints(H5S_t *space)
FUNC_LEAVE (ret_value);
} /* H5Sget_select_elem_npoints() */
/*--------------------------------------------------------------------------
NAME
@ -725,6 +722,7 @@ H5Sget_select_elem_npoints(hid_t spaceid)
FUNC_LEAVE (ret_value);
} /* H5Sget_select_elem_npoints() */
/*--------------------------------------------------------------------------
NAME
@ -732,7 +730,7 @@ H5Sget_select_elem_npoints(hid_t spaceid)
PURPOSE
Get the list of hyperslab blocks currently selected
USAGE
herr_t H5S_get_select_hyper_blocklist(space, hsize_t *buf)
herr_t H5S_get_select_hyper_blocklist(space, startblock, numblocks, 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
@ -743,7 +741,7 @@ H5Sget_select_elem_npoints(hid_t spaceid)
Puts a list of the hyperslab blocks into the user's buffer. The blocks
start with the 'startblock'th block in the list of blocks and put
'numblocks' number of blocks into the user's buffer (or until the end of
the list of blocks, whichever happen first)
the list of blocks, whichever happens first)
The block coordinates have the same dimensionality (rank) as the
dataspace they are located within. The list of blocks is formatted as
follows: <"start" coordinate> immediately followed by <"opposite" corner
@ -762,9 +760,9 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numbloc
H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
hssize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
hssize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
hssize_t temp_off; /* Offset in a given dimension */
H5S_hyper_node_t *node; /* Hyperslab node */
int rank; /* Dataspace rank */
int i; /* Counter */
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
int temp_dim; /* Temporary rank holder */
@ -777,9 +775,6 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numbloc
assert(space);
assert(buf);
/* Get the dataspace extent rank */
rank=space->extent.u.simple.rank;
/* Check for a "regular" hyperslab selection */
if(space->select.sel_info.hslab.diminfo != NULL) {
/* Set some convienence values */
@ -859,35 +854,18 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numbloc
/* Re-compute offset array */
for(i=0; i<ndims; i++) {
temp_off=diminfo[i].start
+diminfo[i].stride*(diminfo[i].count-tmp_count[i]);
temp_off=diminfo[i].start+diminfo[i].stride*(diminfo[i].count-tmp_count[i]);
offset[i]=temp_off;
} /* end for */
} /* end while */
} /* end if */
else {
/* Get the head of the hyperslab list */
node=space->select.sel_info.hslab.hyper_lst->head;
/* 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 */
ret_value=H5S_hyper_span_blocklist(space->select.sel_info.hslab.span_lst,start,end,(hsize_t)0,&startblock,&numblocks,&buf);
} /* end else */
FUNC_LEAVE (ret_value);
} /* H5Sget_select_hyper_blocklist() */
} /* H5S_get_select_hyper_blocklist() */
/*--------------------------------------------------------------------------
NAME
@ -895,7 +873,7 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numbloc
PURPOSE
Get the list of hyperslab blocks currently selected
USAGE
herr_t H5Sget_select_hyper_blocklist(dsid, hsize_t *buf)
herr_t H5Sget_select_hyper_blocklist(dsid, startblock, numblocks, 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
@ -938,10 +916,15 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numbloc
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,startblock,numblocks,buf);
/* Go get the correct number of blocks */
if(numblocks>0)
ret_value = H5S_get_select_hyper_blocklist(space,startblock,numblocks,buf);
else
ret_value=SUCCEED; /* Successfully got 0 blocks... */
FUNC_LEAVE (ret_value);
} /* H5Sget_select_hyper_blocklist() */
/*--------------------------------------------------------------------------
NAME
@ -1006,6 +989,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint
FUNC_LEAVE (ret_value);
} /* H5Sget_select_elem_pointlist() */
/*--------------------------------------------------------------------------
NAME
@ -1059,6 +1043,7 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoint
FUNC_LEAVE (ret_value);
} /* H5Sget_select_elem_pointlist() */
/*--------------------------------------------------------------------------
NAME
@ -1100,7 +1085,7 @@ H5S_get_select_bounds(H5S_t *space, hsize_t *start, hsize_t *end)
assert(start);
assert(end);
/* Set all the start and end arrays up */
/* Set the start and end arrays up */
rank=space->extent.u.simple.rank;
for(i=0; i<rank; i++) {
start[i]=UINT_MAX;
@ -1128,6 +1113,7 @@ H5S_get_select_bounds(H5S_t *space, hsize_t *start, hsize_t *end)
FUNC_LEAVE (ret_value);
} /* H5S_get_select_bounds() */
/*--------------------------------------------------------------------------
NAME
@ -1177,6 +1163,7 @@ H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end)
FUNC_LEAVE (ret_value);
} /* H5Sget_select_bounds() */
/*--------------------------------------------------------------------------
NAME