summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert Kim Yates <rkyates@llnl.gov>1998-08-17 15:20:56 (GMT)
committerRobert Kim Yates <rkyates@llnl.gov>1998-08-17 15:20:56 (GMT)
commita1e8ce1d81cbb8b6029c1bb972fcc527cd179f0d (patch)
tree88a5b2a2942c309949011084b019596f7929d0e2 /src
parent8ed18c9e73733939216251e1d154b18e7d34bad3 (diff)
downloadhdf5-a1e8ce1d81cbb8b6029c1bb972fcc527cd179f0d.zip
hdf5-a1e8ce1d81cbb8b6029c1bb972fcc527cd179f0d.tar.gz
hdf5-a1e8ce1d81cbb8b6029c1bb972fcc527cd179f0d.tar.bz2
[svn-r599] Added code to convert HDF dataspace selections to MPI datatypes.
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c39
-rw-r--r--src/H5Flow.c53
-rw-r--r--src/H5Omtime.c2
-rw-r--r--src/H5Shyper.c158
-rw-r--r--src/H5Sselect.c32
5 files changed, 197 insertions, 87 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 21373fa..b96b900 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -27,6 +27,7 @@ static char RcsId[] = "@(#)$Revision$";
#include <H5MMprivate.h> /* Memory management */
#include <H5Oprivate.h> /* Object headers */
#include <H5Pprivate.h> /* Property lists */
+#include <H5Sprivate.h> /* Dataspace functions rky 980813 */
#include <H5Zprivate.h> /* Data filters */
#ifdef QAK
@@ -1339,6 +1340,25 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
"unable to convert from file to memory data space");
}
+<<<<<<< H5D.c
+#ifdef QAK
+ printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+
+#ifdef HAVE_PARALLEL
+ /* rky 980813 This is a temporary KLUGE.
+ * The sconv functions should be set by H5S_find,
+ * or we should use a different way to call the MPI-IO
+ * mem-and-file-dataspace-xfer functions
+ * (the latter in case the arguments to sconv_funcs
+ * turn out to be inappropriate for MPI-IO). */
+ if (dataset->ent.file->shared->access_parms->driver == H5F_LOW_MPIO) {
+ sconv_func.read = H5S_mpio_spaces_read;
+ }
+#endif /*HAVE_PARALLEL*/
+
+=======
+>>>>>>> 1.113
/*
* If there is no type conversion then try reading directly into the
@@ -1674,7 +1694,26 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, FAIL,
"unable to convert from memory to file data space");
}
+<<<<<<< H5D.c
+#ifdef QAK
+ printf("%s: check 1.0\n",FUNC);
+#endif /* QAK */
+
+#ifdef HAVE_PARALLEL
+ /* rky 980813 This is a temporary KLUGE.
+ * The sconv functions should be set by H5S_find,
+ * or we should use a different way to call the MPI-IO
+ * mem-and-file-dataspace-xfer functions
+ * (the latter in case the arguments to sconv_funcs
+ * turn out to be inappropriate for MPI-IO). */
+ if (dataset->ent.file->shared->access_parms->driver == H5F_LOW_MPIO) {
+ sconv_func.write = H5S_mpio_spaces_write;
+ }
+#endif /*HAVE_PARALLEL*/
+
+=======
+>>>>>>> 1.113
/*
* If there is no type conversion then try writing directly from
* application buffer to file.
diff --git a/src/H5Flow.c b/src/H5Flow.c
index f929e44..5ddc299 100644
--- a/src/H5Flow.c
+++ b/src/H5Flow.c
@@ -269,6 +269,11 @@ H5F_low_read(H5F_low_t *lf, const H5F_access_t *access_parms,
* June 2, 1998 Albert Cheng
* Added xfer_mode argument
*
+ * rky 980816
+ * Accommodate fancy MPI compound datatype writes.
+ * Also, parallel writes now abort if writing beyond eof
+ * (rather than just printing an error message
+ * and continuing, as they used to).
*-------------------------------------------------------------------------
*/
herr_t
@@ -279,19 +284,40 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
herr_t ret_value = FAIL;
haddr_t tmp_addr;
+#ifdef HAVE_PARALLEL
+ int use_types;
+#endif
+
FUNC_ENTER(H5F_low_write, FAIL);
assert(lf && lf->type);
assert(addr && addr_defined(addr));
assert(buf);
- /* Extend the file eof marker if we write past it */
- tmp_addr = *addr;
- H5F_addr_inc(&tmp_addr, (hsize_t)size);
- if (H5F_addr_gt(&tmp_addr, &(lf->eof))) {
- fprintf(stderr, "H5F: extending file w/o allocation\n");
- lf->eof = tmp_addr;
- }
+ /* check for writing past the end of file marker */
+#ifdef HAVE_PARALLEL
+ if (H5F_LOW_MPIO==access_parms->driver
+ && access_parms->u.mpio.use_types) {
+ /* In the case of fancy use of MPI datatypes, the addr and size
+ * parameters have a very peculiar interpretation.
+ * It is logically possible, but quite complex, to calculate
+ * the physical offset that the last byte to be written will have
+ * (assuming the write doesn't fail partway thru, which it may).
+ * Instead, we fix up the eof _after_ the write
+ * (I really don't know if that's OK or not... rky 980816) */
+ use_types = access_parms->u.mpio.use_types; /* check after write */
+ } else {
+#endif /* HAVE_PARALLEL */
+ /* writing a simple block of bytes; can check for writing beyond eof */
+ tmp_addr = *addr;
+ H5F_addr_inc(&tmp_addr, (hsize_t)size);
+ if (H5F_addr_gt(&tmp_addr, &(lf->eof))) {
+ fprintf(stderr, "H5F: extending file w/o allocation\n");
+ lf->eof = tmp_addr;
+ }
+#ifdef HAVE_PARALLEL
+ } /* end else */
+#endif /* HAVE_PARALLEL */
/* Write the data */
if (lf->type->write) {
@@ -303,6 +329,19 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "no write method");
}
+#ifdef HAVE_PARALLEL
+ /* fix up eof for MPI use_type writes */
+ if (H5F_LOW_MPIO==access_parms->driver && use_types) {
+ /* set logical eof to current physical eof
+ * (ephemeral though it may be...) */
+ MPI_Offset size;
+ if (MPI_SUCCESS != MPI_File_get_size(lf->u.mpio.f,&size)) {
+ HRETURN_ERROR(H5E_IO, H5E_MPI, NULL, "couldn't get file size" );
+ }
+ lf->eof.offset = size;
+ }
+#endif
+
FUNC_LEAVE(ret_value);
}
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index ae85abb..5601550 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -189,7 +189,7 @@ H5O_mtime_encode(H5F_t __unused__ *f, uint8 *p, const void *_mesg)
/* encode */
tm = gmtime(mesg);
- sprintf(p, "%04d%02d%02d%02d%02d%02d",
+ sprintf((char*)p, "%04d%02d%02d%02d%02d%02d",
1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 52b8c5f..7797ad7 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -443,7 +443,7 @@ H5S_hyper_fread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info)
/* Get a sorted list (in the next dimension down) of the regions which */
/* overlap the current index in this dim */
if((regions=H5S_hyper_get_regions(&num_regions,dim,
- fhyper_info->space->select.sel_info.hyper_lst->count,
+ fhyper_info->space->select.sel_info.hyper.hyper_lst->count,
fhyper_info->lo_bounds, fhyper_info->hi_bounds,
fhyper_info->iter->hyp.pos,fhyper_info->space->select.offset))!=NULL) {
@@ -629,8 +629,8 @@ H5S_hyper_fgath (H5F_t *f, const struct H5O_layout_t *layout,
this is the correct place to change the order of the array iterations)
*/
for(i=0; i<file_space->extent.u.simple.rank; i++) {
- lo_bounds[i]=file_space->select.sel_info.hyper_lst->lo_bounds[i];
- hi_bounds[i]=file_space->select.sel_info.hyper_lst->hi_bounds[i];
+ lo_bounds[i]=file_space->select.sel_info.hyper.hyper_lst->lo_bounds[i];
+ hi_bounds[i]=file_space->select.sel_info.hyper.hyper_lst->hi_bounds[i];
} /* end for */
/* Initialize parameter block for recursive calls */
@@ -702,7 +702,7 @@ H5S_hyper_fwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info)
/* Get a sorted list (in the next dimension down) of the regions which */
/* overlap the current index in this dim */
if((regions=H5S_hyper_get_regions(&num_regions,dim,
- fhyper_info->space->select.sel_info.hyper_lst->count,
+ fhyper_info->space->select.sel_info.hyper.hyper_lst->count,
fhyper_info->lo_bounds, fhyper_info->hi_bounds,
fhyper_info->iter->hyp.pos,fhyper_info->space->select.offset))!=NULL) {
@@ -861,8 +861,8 @@ H5S_hyper_fscat (H5F_t *f, const struct H5O_layout_t *layout,
* correct place to change the order of the array iterations)
*/
for(i=0; i<file_space->extent.u.simple.rank; i++) {
- lo_bounds[i]=file_space->select.sel_info.hyper_lst->lo_bounds[i];
- hi_bounds[i]=file_space->select.sel_info.hyper_lst->hi_bounds[i];
+ lo_bounds[i]=file_space->select.sel_info.hyper.hyper_lst->lo_bounds[i];
+ hi_bounds[i]=file_space->select.sel_info.hyper.hyper_lst->hi_bounds[i];
} /* end for */
/* Initialize parameter block for recursive calls */
@@ -933,7 +933,7 @@ H5S_hyper_mread (intn dim, H5S_hyper_fhyper_info_t *fhyper_info)
/* Get a sorted list (in the next dimension down) of the regions which */
/* overlap the current index in this dim */
if((regions=H5S_hyper_get_regions(&num_regions,dim,
- fhyper_info->space->select.sel_info.hyper_lst->count,
+ fhyper_info->space->select.sel_info.hyper.hyper_lst->count,
fhyper_info->lo_bounds, fhyper_info->hi_bounds,
fhyper_info->iter->hyp.pos,fhyper_info->space->select.offset))!=NULL) {
@@ -1127,12 +1127,12 @@ H5S_hyper_mgath (const void *_buf, size_t elmt_size,
printf("%s: check 3.0\n",FUNC);
#endif /* QAK */
for(i=0; i<mem_space->extent.u.simple.rank; i++) {
- lo_bounds[i]=mem_space->select.sel_info.hyper_lst->lo_bounds[i];
- hi_bounds[i]=mem_space->select.sel_info.hyper_lst->hi_bounds[i];
+ lo_bounds[i]=mem_space->select.sel_info.hyper.hyper_lst->lo_bounds[i];
+ hi_bounds[i]=mem_space->select.sel_info.hyper.hyper_lst->hi_bounds[i];
#ifdef QAK
printf("%s: check 3.1, lo[%d]=%p, hi[%d]=%p\n",
FUNC,i,lo_bounds[i],i,hi_bounds[i]);
- for(j=0; j<(int)mem_space->select.sel_info.hyper_lst->count; j++)
+ for(j=0; j<(int)mem_space->select.sel_info.hyper.hyper_lst->count; j++)
printf("%s: check 3.2, lo[%d][%d]=%d, hi[%d][%d]=%d\n",
FUNC, i, j, (int)lo_bounds[i][j].bound, i, j,
(int)hi_bounds[i][j].bound);
@@ -1207,7 +1207,7 @@ H5S_hyper_mwrite (intn dim, H5S_hyper_fhyper_info_t *fhyper_info)
/* Get a sorted list (in the next dimension down) of the regions which */
/* overlap the current index in this dim */
if((regions=H5S_hyper_get_regions(&num_regions,dim,
- fhyper_info->space->select.sel_info.hyper_lst->count,
+ fhyper_info->space->select.sel_info.hyper.hyper_lst->count,
fhyper_info->lo_bounds, fhyper_info->hi_bounds,
fhyper_info->iter->hyp.pos,fhyper_info->space->select.offset))!=NULL) {
@@ -1382,8 +1382,8 @@ H5S_hyper_mscat (const void *_tconv_buf, size_t elmt_size,
* correct place to change the order of the array iterations)
*/
for(i=0; i<mem_space->extent.u.simple.rank; i++) {
- lo_bounds[i]=mem_space->select.sel_info.hyper_lst->lo_bounds[i];
- hi_bounds[i]=mem_space->select.sel_info.hyper_lst->hi_bounds[i];
+ lo_bounds[i]=mem_space->select.sel_info.hyper.hyper_lst->lo_bounds[i];
+ hi_bounds[i]=mem_space->select.sel_info.hyper.hyper_lst->hi_bounds[i];
} /* end for */
/* Initialize parameter block for recursive calls */
@@ -1547,26 +1547,26 @@ H5S_hyper_add (H5S_t *space, const hssize_t *start, const hsize_t *size)
#ifdef QAK
printf("%s: check 3.0, lo_bounds=%p, hi_bounds=%p\n",
- FUNC, space->select.sel_info.hyper_lst->lo_bounds,
- space->select.sel_info.hyper_lst->hi_bounds);
+ FUNC, space->select.sel_info.hyper.hyper_lst->lo_bounds,
+ space->select.sel_info.hyper.hyper_lst->hi_bounds);
#endif /* QAK */
/* Increase size of boundary arrays for dataspace's selection */
for(i=0; i<space->extent.u.simple.rank; i++) {
#ifdef QAK
printf("%s: check 3.1, i=%d\n",FUNC,(int)i);
#endif /* QAK */
- tmp=space->select.sel_info.hyper_lst->lo_bounds[i];
- if((space->select.sel_info.hyper_lst->lo_bounds[i]=H5MM_realloc(tmp,sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper_lst->count+1)))==NULL) {
- space->select.sel_info.hyper_lst->lo_bounds[i]=tmp;
+ tmp=space->select.sel_info.hyper.hyper_lst->lo_bounds[i];
+ if((space->select.sel_info.hyper.hyper_lst->lo_bounds[i]=H5MM_realloc(tmp,sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper.hyper_lst->count+1)))==NULL) {
+ space->select.sel_info.hyper.hyper_lst->lo_bounds[i]=tmp;
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate hyperslab lo boundary array");
} /* end if */
#ifdef QAK
printf("%s: check 3.2, i=%d\n",FUNC,(int)i);
#endif /* QAK */
- tmp=space->select.sel_info.hyper_lst->hi_bounds[i];
- if((space->select.sel_info.hyper_lst->hi_bounds[i]=H5MM_realloc(tmp,sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper_lst->count+1)))==NULL) {
- space->select.sel_info.hyper_lst->hi_bounds[i]=tmp;
+ tmp=space->select.sel_info.hyper.hyper_lst->hi_bounds[i];
+ if((space->select.sel_info.hyper.hyper_lst->hi_bounds[i]=H5MM_realloc(tmp,sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper.hyper_lst->count+1)))==NULL) {
+ space->select.sel_info.hyper.hyper_lst->hi_bounds[i]=tmp;
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate hyperslab hi boundary array");
} /* end if */
@@ -1578,13 +1578,13 @@ H5S_hyper_add (H5S_t *space, const hssize_t *start, const hsize_t *size)
intn j;
for(i=0; i<space->extent.u.simple.rank; i++) {
- for(j=0; j<(int)space->select.sel_info.hyper_lst->count; j++) {
+ for(j=0; j<(int)space->select.sel_info.hyper.hyper_lst->count; j++) {
printf("%s: lo_bound[%d][%d]=%d(%p), "
"hi_bound[%d][%d]=%d(%p)\n",FUNC,
- i,j,(int)space->select.sel_info.hyper_lst->lo_bounds[i][j].bound,
- space->select.sel_info.hyper_lst->lo_bounds[i][j].node,
- i,j,(int)space->select.sel_info.hyper_lst->hi_bounds[i][j].bound,
- space->select.sel_info.hyper_lst->hi_bounds[i][j].node);
+ i,j,(int)space->select.sel_info.hyper.hyper_lst->lo_bounds[i][j].bound,
+ space->select.sel_info.hyper.hyper_lst->lo_bounds[i][j].node,
+ i,j,(int)space->select.sel_info.hyper.hyper_lst->hi_bounds[i][j].bound,
+ space->select.sel_info.hyper.hyper_lst->hi_bounds[i][j].node);
}
}
}
@@ -1592,29 +1592,29 @@ H5S_hyper_add (H5S_t *space, const hssize_t *start, const hsize_t *size)
/* Insert each boundary of the hyperslab into the sorted lists of bounds */
for(i=0; i<space->extent.u.simple.rank; i++) {
/* Check if this is the first hyperslab inserted */
- if(space->select.sel_info.hyper_lst->count==0) {
+ if(space->select.sel_info.hyper.hyper_lst->count==0) {
#ifdef QAK
printf("%s: check 4.1, start[%d]=%d, end[%d]=%d\n",
FUNC, i, (int)slab->start[i],i,(int)slab->end[i]);
- printf("%s: check 4.1, hyper_lst->count=%d\n",
- FUNC,(int)space->select.sel_info.hyper_lst->count);
+ printf("%s: check 4.1,.hyper.hyper_lst->count=%d\n",
+ FUNC,(int)space->select.sel_info.hyper.hyper_lst->count);
#endif /* QAK */
- space->select.sel_info.hyper_lst->lo_bounds[i][0].bound=slab->start[i];
- space->select.sel_info.hyper_lst->lo_bounds[i][0].node=slab;
- space->select.sel_info.hyper_lst->hi_bounds[i][0].bound=slab->end[i];
- space->select.sel_info.hyper_lst->hi_bounds[i][0].node=slab;
+ space->select.sel_info.hyper.hyper_lst->lo_bounds[i][0].bound=slab->start[i];
+ space->select.sel_info.hyper.hyper_lst->lo_bounds[i][0].node=slab;
+ space->select.sel_info.hyper.hyper_lst->hi_bounds[i][0].bound=slab->end[i];
+ space->select.sel_info.hyper.hyper_lst->hi_bounds[i][0].node=slab;
} /* end if */
else {
#ifdef QAK
printf("%s: check 4.3, start[%d]=%d, end[%d]=%d\n",
FUNC,i,(int)slab->start[i],i,(int)slab->end[i]);
- printf("%s: check 4.3, hyper_lst->count=%d\n",
- FUNC,(int)space->select.sel_info.hyper_lst->count);
+ printf("%s: check 4.3,.hyper.hyper_lst->count=%d\n",
+ FUNC,(int)space->select.sel_info.hyper.hyper_lst->count);
#endif /* QAK */
/* Take care of the low boundary first */
/* Find the location to insert in front of */
- if((bound_loc=H5S_hyper_bsearch(slab->start[i],space->select.sel_info.hyper_lst->lo_bounds[i],
- space->select.sel_info.hyper_lst->count))<0)
+ if((bound_loc=H5S_hyper_bsearch(slab->start[i],space->select.sel_info.hyper.hyper_lst->lo_bounds[i],
+ space->select.sel_info.hyper.hyper_lst->count))<0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't find location to insert hyperslab boundary");
@@ -1622,29 +1622,29 @@ H5S_hyper_add (H5S_t *space, const hssize_t *start, const hsize_t *size)
printf("%s: check 4.5, bound_loc=%d\n",FUNC,(int)bound_loc);
#endif /* QAK */
/* Check if we need to move boundary elements */
- if(bound_loc!=(intn)space->select.sel_info.hyper_lst->count) {
- HDmemmove(&space->select.sel_info.hyper_lst->lo_bounds[i][bound_loc+1],
- &space->select.sel_info.hyper_lst->lo_bounds[i][bound_loc],
- sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper_lst->count-bound_loc));
+ if(bound_loc!=(intn)space->select.sel_info.hyper.hyper_lst->count) {
+ HDmemmove(&space->select.sel_info.hyper.hyper_lst->lo_bounds[i][bound_loc+1],
+ &space->select.sel_info.hyper.hyper_lst->lo_bounds[i][bound_loc],
+ sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper.hyper_lst->count-bound_loc));
} /* end if */
- space->select.sel_info.hyper_lst->lo_bounds[i][bound_loc].bound=slab->start[i];
- space->select.sel_info.hyper_lst->lo_bounds[i][bound_loc].node=slab;
+ space->select.sel_info.hyper.hyper_lst->lo_bounds[i][bound_loc].bound=slab->start[i];
+ space->select.sel_info.hyper.hyper_lst->lo_bounds[i][bound_loc].node=slab;
/* Take care of the high boundary next */
/* Find the location to insert in front of */
- if((bound_loc=H5S_hyper_bsearch(slab->end[i],space->select.sel_info.hyper_lst->hi_bounds[i],
- space->select.sel_info.hyper_lst->count))<0)
+ if((bound_loc=H5S_hyper_bsearch(slab->end[i],space->select.sel_info.hyper.hyper_lst->hi_bounds[i],
+ space->select.sel_info.hyper.hyper_lst->count))<0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't find location to insert hyperslab boundary");
/* Check if we need to move boundary elements */
- if(bound_loc!=(intn)space->select.sel_info.hyper_lst->count) {
- HDmemmove(&space->select.sel_info.hyper_lst->hi_bounds[i][bound_loc+1],
- &space->select.sel_info.hyper_lst->hi_bounds[i][bound_loc],
- sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper_lst->count-bound_loc));
+ if(bound_loc!=(intn)space->select.sel_info.hyper.hyper_lst->count) {
+ HDmemmove(&space->select.sel_info.hyper.hyper_lst->hi_bounds[i][bound_loc+1],
+ &space->select.sel_info.hyper.hyper_lst->hi_bounds[i][bound_loc],
+ sizeof(H5S_hyper_bound_t)*(space->select.sel_info.hyper.hyper_lst->count-bound_loc));
} /* end if */
- space->select.sel_info.hyper_lst->hi_bounds[i][bound_loc].bound=slab->end[i];
- space->select.sel_info.hyper_lst->hi_bounds[i][bound_loc].node=slab;
+ space->select.sel_info.hyper.hyper_lst->hi_bounds[i][bound_loc].bound=slab->end[i];
+ space->select.sel_info.hyper.hyper_lst->hi_bounds[i][bound_loc].node=slab;
} /* end else */
} /* end for */
#ifdef QAK
@@ -1652,11 +1652,11 @@ H5S_hyper_add (H5S_t *space, const hssize_t *start, const hsize_t *size)
#endif /* QAK */
/* Increment the number of bounds in the array */
- space->select.sel_info.hyper_lst->count++;
+ space->select.sel_info.hyper.hyper_lst->count++;
/* Prepend on list of hyperslabs for this selection */
- slab->next=space->select.sel_info.hyper_lst->head;
- space->select.sel_info.hyper_lst->head=slab;
+ slab->next=space->select.sel_info.hyper.hyper_lst->head;
+ space->select.sel_info.hyper.hyper_lst->head=slab;
/* Increment the number of elements in the hyperslab selection */
space->select.num_elem+=elem_count;
@@ -1666,11 +1666,11 @@ H5S_hyper_add (H5S_t *space, const hssize_t *start, const hsize_t *size)
intn j;
for(i=0; i<space->extent.u.simple.rank; i++) {
- for(j=0; j<(int)space->select.sel_info.hyper_lst->count; j++) {
+ for(j=0; j<(int)space->select.sel_info.hyper.hyper_lst->count; j++) {
printf("%s: lo_bound[%d][%d]=%d, hi_bound[%d][%d]=%d\n",
FUNC,i,j,
- (int)space->select.sel_info.hyper_lst->lo_bounds[i][j].bound,i,j,
- (int)space->select.sel_info.hyper_lst->hi_bounds[i][j].bound);
+ (int)space->select.sel_info.hyper.hyper_lst->lo_bounds[i][j].bound,i,j,
+ (int)space->select.sel_info.hyper.hyper_lst->hi_bounds[i][j].bound);
}
}
}
@@ -1714,16 +1714,19 @@ H5S_hyper_release (H5S_t *space)
/* Reset the number of points selected */
space->select.num_elem=0;
+ /* Release the per-dimension selection info */
+ H5MM_xfree(space->select.sel_info.hyper.diminfo);
+
/* Release hi and lo boundary information */
for(i=0; i<space->extent.u.simple.rank; i++) {
- H5MM_xfree(space->select.sel_info.hyper_lst->lo_bounds[i]);
- H5MM_xfree(space->select.sel_info.hyper_lst->hi_bounds[i]);
+ H5MM_xfree(space->select.sel_info.hyper.hyper_lst->lo_bounds[i]);
+ H5MM_xfree(space->select.sel_info.hyper.hyper_lst->hi_bounds[i]);
} /* end for */
- H5MM_xfree(space->select.sel_info.hyper_lst->lo_bounds);
- H5MM_xfree(space->select.sel_info.hyper_lst->hi_bounds);
+ H5MM_xfree(space->select.sel_info.hyper.hyper_lst->lo_bounds);
+ H5MM_xfree(space->select.sel_info.hyper.hyper_lst->hi_bounds);
/* Release list of selected regions */
- curr=space->select.sel_info.hyper_lst->head;
+ curr=space->select.sel_info.hyper.hyper_lst->head;
while(curr!=NULL) {
next=curr->next;
H5MM_xfree(curr->start);
@@ -1733,8 +1736,8 @@ H5S_hyper_release (H5S_t *space)
} /* end while */
/* Release hyperslab selection node itself */
- H5MM_xfree(space->select.sel_info.hyper_lst);
- space->select.sel_info.hyper_lst=NULL;
+ H5MM_xfree(space->select.sel_info.hyper.hyper_lst);
+ space->select.sel_info.hyper.hyper_lst=NULL;
#ifdef QAK
printf("%s: check 2.0\n",FUNC);
@@ -1858,6 +1861,7 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src)
{
H5S_hyper_list_t *new_hyper; /* New hyperslab selection */
H5S_hyper_node_t *curr, *new, *new_head; /* Hyperslab information nodes */
+ H5S_hyper_dim_t *new_diminfo; /* New per-dimension info array[rank] */
intn i; /* Counters */
size_t u; /* Counters */
herr_t ret_value=SUCCEED; /* return value */
@@ -1870,16 +1874,30 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src)
#ifdef QAK
printf("%s: check 3.0\n", FUNC);
#endif /* QAK */
+ /* Create the per-dimension selection info */
+ if((new_diminfo = H5MM_malloc(sizeof(H5S_hyper_dim_t *)*src->extent.u.simple.rank))==NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "can't allocate per-dimension array");
+
+ /* Copy the per-dimension selection info */
+ for(i=0; i<src->extent.u.simple.rank; i++) {
+ new_diminfo[i].start = src->select.sel_info.hyper.diminfo[i].start;
+ new_diminfo[i].stride = src->select.sel_info.hyper.diminfo[i].stride;
+ new_diminfo[i].count = src->select.sel_info.hyper.diminfo[i].count;
+ new_diminfo[i].block = src->select.sel_info.hyper.diminfo[i].block;
+ } /* end for */
+ dst->select.sel_info.hyper.diminfo = new_diminfo;
+
/* Create the new hyperslab information node */
if((new_hyper = H5MM_malloc(sizeof(H5S_hyper_list_t)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate point node");
/* Copy the basic hyperslab selection information */
- *new_hyper=*(src->select.sel_info.hyper_lst);
+ *new_hyper=*(src->select.sel_info.hyper.hyper_lst);
/* Attach the hyperslab information to the destination dataspace */
- dst->select.sel_info.hyper_lst=new_hyper;
+ dst->select.sel_info.hyper.hyper_lst=new_hyper;
#ifdef QAK
printf("%s: check 4.0\n", FUNC);
@@ -1892,10 +1910,10 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate point node");
for(i=0; i<src->extent.u.simple.rank; i++) {
- if((new_hyper->lo_bounds[i] = H5MM_malloc(sizeof(H5S_hyper_bound_t)*src->select.sel_info.hyper_lst->count))==NULL)
+ if((new_hyper->lo_bounds[i] = H5MM_malloc(sizeof(H5S_hyper_bound_t)*src->select.sel_info.hyper.hyper_lst->count))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate point node");
- if((new_hyper->hi_bounds[i] = H5MM_malloc(sizeof(H5S_hyper_bound_t)*src->select.sel_info.hyper_lst->count))==NULL)
+ if((new_hyper->hi_bounds[i] = H5MM_malloc(sizeof(H5S_hyper_bound_t)*src->select.sel_info.hyper.hyper_lst->count))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate point node");
} /* end for */
@@ -1904,7 +1922,7 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src)
printf("%s: check 5.0\n", FUNC);
#endif /* QAK */
/* Copy the hyperslab selection nodes, adding them to the lo & hi bound arrays also */
- curr=src->select.sel_info.hyper_lst->head;
+ curr=src->select.sel_info.hyper.hyper_lst->head;
new_head=NULL;
u=0;
while(curr!=NULL) {
@@ -1993,7 +2011,7 @@ H5S_hyper_select_valid (const H5S_t *space)
assert(space);
/* Check each point to determine whether selection+offset is within extent */
- curr=space->select.sel_info.hyper_lst->head;
+ curr=space->select.sel_info.hyper.hyper_lst->head;
while(curr!=NULL && ret_value==TRUE) {
/* Check each dimension */
for(i=0; i<space->extent.u.simple.rank; i++) {
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index d3e67b9..77c2461 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -240,10 +240,11 @@ H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op,
*block=NULL; /* Block size array */
hssize_t slab[H5O_LAYOUT_NDIMS]; /* Location of the block to add for strided selections */
size_t slice[H5O_LAYOUT_NDIMS]; /* Size of preceding dimension's slice */
- uintn acc; /* Accumulator for building slices */
- uintn contig; /* whether selection is contiguous or not */
- int i,j; /* Counters */
- herr_t ret_value=FAIL; /* return value */
+ uintn acc; /* Accumulator for building slices */
+ uintn contig; /* whether selection is contiguous or not */
+ int i,j; /* Counters */
+ H5S_hyper_dim_t *diminfo; /* per-dimension info for the selection */
+ herr_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5Sselect_hyperslab, FAIL);
H5TRACE6("e","iSs*[a0]Hs*[a0]h*[a0]h*[a0]h",space_id,op,start,_stride,
@@ -280,12 +281,25 @@ H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op,
if((block = H5MM_malloc(sizeof(hssize_t)*space->extent.u.simple.rank))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
- "can't allocate stride vector");
+ "can't allocate block vector");
H5V_array_fill(block,&fill,sizeof(hssize_t),space->extent.u.simple.rank);
} else {
block=(hsize_t *)_block;
} /* end else */
+ /* Copy all the per-dimension selection info into the space descriptor */
+ if((diminfo = H5MM_malloc(sizeof(H5S_hyper_dim_t)*space->extent.u.simple.rank))==NULL) {
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
+ "can't allocate per-dimension vector");
+ } /* end if */
+ for(i=0; i<space->extent.u.simple.rank; i++) {
+ diminfo[i].start = start[i];
+ diminfo[i].stride = stride[i];
+ diminfo[i].count = count[i];
+ diminfo[i].block = block[i];
+ } /* end for */
+ space->select.sel_info.hyper.diminfo = diminfo;
+
/*
* Check for overlapping blocks (remove when real block-merging algorithm
* is in place).
@@ -326,17 +340,17 @@ H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t op,
#endif /* QAK */
/* Allocate space for the hyperslab selection information if necessary */
if(space->select.type!=H5S_SEL_HYPERSLABS ||
- space->select.sel_info.hyper_lst==NULL) {
- if((space->select.sel_info.hyper_lst =
+ space->select.sel_info.hyper.hyper_lst==NULL) {
+ if((space->select.sel_info.hyper.hyper_lst =
H5MM_calloc(sizeof(H5S_hyper_list_t)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate hyperslab information");
- if((space->select.sel_info.hyper_lst->lo_bounds =
+ if((space->select.sel_info.hyper.hyper_lst->lo_bounds =
H5MM_calloc(space->extent.u.simple.rank*
sizeof(H5S_hyper_bound_t *)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"can't allocate hyperslab lo bound information");
- if((space->select.sel_info.hyper_lst->hi_bounds =
+ if((space->select.sel_info.hyper.hyper_lst->hi_bounds =
H5MM_calloc(space->extent.u.simple.rank*
sizeof(H5S_hyper_bound_t *)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,