diff options
-rw-r--r-- | src/H5A.c | 4 | ||||
-rw-r--r-- | src/H5Osdspace.c | 91 | ||||
-rw-r--r-- | src/H5S.c | 183 | ||||
-rw-r--r-- | src/H5Sall.c | 4 | ||||
-rw-r--r-- | src/H5Shyper.c | 115 | ||||
-rw-r--r-- | src/H5Smpio.c | 6 | ||||
-rw-r--r-- | src/H5Spkg.h | 18 | ||||
-rw-r--r-- | src/H5Spoint.c | 26 | ||||
-rw-r--r-- | src/H5Sprivate.h | 2 | ||||
-rw-r--r-- | src/H5Sselect.c | 40 |
10 files changed, 194 insertions, 295 deletions
@@ -1520,10 +1520,6 @@ H5A_copy(const H5A_t *old_attr) HDmemcpy(new_attr->data,old_attr->data,old_attr->data_size); } /* end if */ -#ifndef LATER - /* Copy the share info? */ -#endif - /* Set the return value */ ret_value=new_attr; diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index d558d33..35f00cc 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -124,8 +124,8 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "wrong version number in data space message"); /* Get rank */ - sdim->u.simple.rank = *p++; - if (sdim->u.simple.rank>H5S_MAX_RANK) + sdim->rank = *p++; + if (sdim->rank>H5S_MAX_RANK) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "simple data space dimensionality is too large"); /* Get dataspace flags for later */ @@ -136,7 +136,7 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_ sdim->type = *p++; else { /* Set the dataspace type to be simple or scalar as appropriate */ - if(sdim->u.simple.rank>0) + if(sdim->rank>0) sdim->type = H5S_SIMPLE; else sdim->type = H5S_SCALAR; @@ -147,33 +147,25 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p, H5O_shared_ p += 4; /*reserved*/ - if (sdim->u.simple.rank > 0) { - if (NULL==(sdim->u.simple.size=H5FL_ARR_MALLOC(hsize_t,sdim->u.simple.rank))) + if (sdim->rank > 0) { + if (NULL==(sdim->size=H5FL_ARR_MALLOC(hsize_t,sdim->rank))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - for (i = 0; i < sdim->u.simple.rank; i++) - H5F_DECODE_LENGTH (f, p, sdim->u.simple.size[i]); + for (i = 0; i < sdim->rank; i++) + H5F_DECODE_LENGTH (f, p, sdim->size[i]); if (flags & H5S_VALID_MAX) { - if (NULL==(sdim->u.simple.max=H5FL_ARR_MALLOC(hsize_t,sdim->u.simple.rank))) + if (NULL==(sdim->max=H5FL_ARR_MALLOC(hsize_t,sdim->rank))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - for (i = 0; i < sdim->u.simple.rank; i++) - H5F_DECODE_LENGTH (f, p, sdim->u.simple.max[i]); + for (i = 0; i < sdim->rank; i++) + H5F_DECODE_LENGTH (f, p, sdim->max[i]); } -#ifdef LATER - if (flags & H5S_VALID_PERM) { - if (NULL==(sdim->u.simple.perm=H5FL_ARR_MALLOC(hsize_t,sdim->u.simple.rank))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - for (i = 0; i < sdim->u.simple.rank; i++) - H5F_DECODE_LENGTH (f, p, sdim->u.simple.perm[i]); - } -#endif /* LATER */ } /* Compute the number of elements in the extent */ if(sdim->type == H5S_NULL) sdim->nelem = 0; else { - for(i=0, sdim->nelem=1; i<sdim->u.simple.rank; i++) - sdim->nelem*=sdim->u.simple.size[i]; + for(i=0, sdim->nelem=1; i<sdim->rank; i++) + sdim->nelem*=sdim->size[i]; } } @@ -237,19 +229,15 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg) assert(sdim); /* set flags */ - if (sdim->u.simple.max) + if (sdim->max) flags |= H5S_VALID_MAX; -#ifdef LATER - if (sdim->u.simple.perm) - flags |= H5S_VALID_PERM; -#endif /* encode */ if(sdim->type!=H5S_NULL) *p++ = H5O_SDSPACE_VERSION; else *p++ = H5O_SDSPACE_VERSION_2; - *p++ = sdim->u.simple.rank; + *p++ = sdim->rank; *p++ = flags; if(sdim->type!=H5S_NULL) *p++ = 0; /*reserved*/ @@ -260,19 +248,13 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg) *p++ = 0; /*reserved*/ *p++ = 0; /*reserved*/ - if (sdim->u.simple.rank > 0) { - for (u = 0; u < sdim->u.simple.rank; u++) - H5F_ENCODE_LENGTH (f, p, sdim->u.simple.size[u]); + if (sdim->rank > 0) { + for (u = 0; u < sdim->rank; u++) + H5F_ENCODE_LENGTH (f, p, sdim->size[u]); if (flags & H5S_VALID_MAX) { - for (u = 0; u < sdim->u.simple.rank; u++) - H5F_ENCODE_LENGTH (f, p, sdim->u.simple.max[u]); + for (u = 0; u < sdim->rank; u++) + H5F_ENCODE_LENGTH (f, p, sdim->max[u]); } -#ifdef LATER - if (flags & H5S_VALID_PERM) { - for (u = 0; u < sdim->u.simple.rank; u++) - H5F_ENCODE_LENGTH (f, p, sdim->u.simple.perm[u]); - } -#endif } done: @@ -360,15 +342,10 @@ H5O_sdspace_size(H5F_t *f, const void *mesg) FUNC_ENTER_NOAPI(H5O_sdspace_size, 0); /* add in the dimension sizes */ - ret_value += space->u.simple.rank * H5F_SIZEOF_SIZE (f); + ret_value += space->rank * H5F_SIZEOF_SIZE (f); /* add in the space for the maximum dimensions, if they are present */ - ret_value += space->u.simple.max ? space->u.simple.rank * H5F_SIZEOF_SIZE (f) : 0; - -#ifdef LATER - /* add in the space for the dimension permutations, if they are present */ - ret_value += space->u.simple.perm ? space->u.simple.rank * 4 : 0; -#endif + ret_value += space->max ? space->rank * H5F_SIZEOF_SIZE (f) : 0; done: FUNC_LEAVE_NOAPI(ret_value); @@ -472,38 +449,28 @@ H5O_sdspace_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *mesg, HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Rank:", - (unsigned long) (sdim->u.simple.rank)); + (unsigned long) (sdim->rank)); - if(sdim->u.simple.rank>0) { + if(sdim->rank>0) { HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); - for (u = 0; u < sdim->u.simple.rank; u++) - HDfprintf (stream, "%s%Hu", u?", ":"", sdim->u.simple.size[u]); + for (u = 0; u < sdim->rank; u++) + HDfprintf (stream, "%s%Hu", u?", ":"", sdim->size[u]); HDfprintf (stream, "}\n"); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:"); - if (sdim->u.simple.max) { + if (sdim->max) { HDfprintf (stream, "{"); - for (u = 0; u < sdim->u.simple.rank; u++) { - if (H5S_UNLIMITED==sdim->u.simple.max[u]) { + for (u = 0; u < sdim->rank; u++) { + if (H5S_UNLIMITED==sdim->max[u]) { HDfprintf (stream, "%sINF", u?", ":""); } else { - HDfprintf (stream, "%s%Hu", u?", ":"", sdim->u.simple.max[u]); + HDfprintf (stream, "%s%Hu", u?", ":"", sdim->max[u]); } } HDfprintf (stream, "}\n"); } else { HDfprintf (stream, "CONSTANT\n"); } - -#ifdef LATER - if (sdim->u.simple.perm) { - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Perm:"); - for (u = 0; u < sdim->u.simple.rank; u++) { - HDfprintf (stream, "%s%lu", u?", ":"", - (unsigned long) (sdim->u.simple.perm[u])); - } - } -#endif } /* end if */ done: @@ -28,7 +28,6 @@ static H5S_t * H5S_create(H5S_class_t type); static herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max); static htri_t H5S_is_simple(const H5S_t *sdim); -static herr_t H5S_release_simple(H5S_simple_t *simple); /* Interface initialization */ #define PABLO_MASK H5S_mask @@ -301,8 +300,10 @@ H5S_create(H5S_class_t type) FUNC_ENTER_NOAPI(H5S_create, NULL); /* Create a new data space */ - if((ret_value = H5FL_CALLOC(H5S_t))!=NULL) { + if((ret_value = H5FL_MALLOC(H5S_t))!=NULL) { ret_value->extent.type = type; + ret_value->extent.rank = 0; + ret_value->extent.size = ret_value->extent.max = NULL; switch(type) { case H5S_SCALAR: @@ -317,8 +318,12 @@ H5S_create(H5S_class_t type) break; } /* end switch */ + /* Start with "all" selection */ if(H5S_select_all(ret_value,0)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); + + /* Reset common selection info pointer */ + ret_value->select.sel_info.hslab=NULL; } /* end if */ done: @@ -397,29 +402,13 @@ H5S_extent_release(H5S_extent_t *extent) assert(extent); - /* release extent */ - switch (extent->type) { - case H5S_NO_CLASS: - /*nothing needed */ - break; - - case H5S_NULL: - case H5S_SCALAR: - /*nothing needed */ - break; - - case H5S_SIMPLE: - ret_value=H5S_release_simple(&(extent->u.simple)); - break; - - case H5S_COMPLEX: - /* nothing yet */ - break; - - default: - assert("unknown dataspace (extent) type" && 0); - break; - } + /* Release extent */ + if(extent->type==H5S_SIMPLE) { + if(extent->size) + H5FL_ARR_FREE(hsize_t,extent->size); + if(extent->max) + H5FL_ARR_FREE(hsize_t,extent->max); + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value); @@ -501,41 +490,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5S_release_simple - * - * Purpose: Releases all memory associated with a simple data space. - * (but doesn't free the simple space itself) - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Friday, April 17, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5S_release_simple(H5S_simple_t *simple) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_release_simple); - - assert(simple); - - if(simple->size) - H5FL_ARR_FREE(hsize_t,simple->size); - if(simple->max) - H5FL_ARR_FREE(hsize_t,simple->max); -#ifdef LATER - if(simple->perm) - H5FL_ARR_FREE(hsize_t,simple->perm); -#endif /* LATER */ - - FUNC_LEAVE_NOAPI(SUCCEED); -} - - -/*------------------------------------------------------------------------- * Function: H5Scopy * * Purpose: Copies a dataspace. @@ -647,30 +601,30 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src) /* Copy the regular fields */ dst->type=src->type; dst->nelem=src->nelem; - dst->u.simple.rank=src->u.simple.rank; + dst->rank=src->rank; switch (src->type) { case H5S_NULL: case H5S_SCALAR: - dst->u.simple.size=NULL; - dst->u.simple.max=NULL; + dst->size=NULL; + dst->max=NULL; break; case H5S_SIMPLE: - if (src->u.simple.size) { - dst->u.simple.size = H5FL_ARR_MALLOC(hsize_t,src->u.simple.rank); - for (u = 0; u < src->u.simple.rank; u++) - dst->u.simple.size[u] = src->u.simple.size[u]; + if (src->size) { + dst->size = H5FL_ARR_MALLOC(hsize_t,src->rank); + for (u = 0; u < src->rank; u++) + dst->size[u] = src->size[u]; } else - dst->u.simple.size=NULL; - if (src->u.simple.max) { - dst->u.simple.max = H5FL_ARR_MALLOC(hsize_t,src->u.simple.rank); - for (u = 0; u < src->u.simple.rank; u++) - dst->u.simple.max[u] = src->u.simple.max[u]; + dst->size=NULL; + if (src->max) { + dst->max = H5FL_ARR_MALLOC(hsize_t,src->rank); + for (u = 0; u < src->rank; u++) + dst->max[u] = src->max[u]; } else - dst->u.simple.max=NULL; + dst->max=NULL; break; case H5S_COMPLEX: @@ -719,11 +673,6 @@ H5S_copy(const H5S_t *src, hbool_t share_selection) if (NULL==(dst = H5FL_MALLOC(H5S_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); -#ifdef LATER - /* Copy the field in the struct */ - *dst = *src; -#endif /* LATER */ - /* Copy the source dataspace's extent */ if (H5S_extent_copy(&(dst->extent),&(src->extent))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent"); @@ -858,19 +807,19 @@ H5S_get_npoints_max(const H5S_t *ds) break; case H5S_SIMPLE: - if (ds->extent.u.simple.max) { - for (ret_value=1, u=0; u<ds->extent.u.simple.rank; u++) { - if (H5S_UNLIMITED==ds->extent.u.simple.max[u]) { + if (ds->extent.max) { + for (ret_value=1, u=0; u<ds->extent.rank; u++) { + if (H5S_UNLIMITED==ds->extent.max[u]) { ret_value = HSIZET_MAX; break; } else - ret_value *= ds->extent.u.simple.max[u]; + ret_value *= ds->extent.max[u]; } } else { - for (ret_value=1, u=0; u<ds->extent.u.simple.rank; u++) - ret_value *= ds->extent.u.simple.size[u]; + for (ret_value=1, u=0; u<ds->extent.rank; u++) + ret_value *= ds->extent.size[u]; } break; @@ -958,7 +907,7 @@ H5S_get_simple_extent_ndims(const H5S_t *ds) case H5S_NULL: case H5S_SCALAR: case H5S_SIMPLE: - ret_value = ds->extent.u.simple.rank; + ret_value = ds->extent.rank; break; case H5S_COMPLEX: @@ -1052,15 +1001,15 @@ H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) break; case H5S_SIMPLE: - ret_value = ds->extent.u.simple.rank; + ret_value = ds->extent.rank; for (i=0; i<ret_value; i++) { if (dims) - dims[i] = ds->extent.u.simple.size[i]; + dims[i] = ds->extent.size[i]; if (max_dims) { - if (ds->extent.u.simple.max) - max_dims[i] = ds->extent.u.simple.max[i]; + if (ds->extent.max) + max_dims[i] = ds->extent.max[i]; else - max_dims[i] = ds->extent.u.simple.size[i]; + max_dims[i] = ds->extent.size[i]; } } break; @@ -1394,27 +1343,28 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, if (rank == 0) { /* scalar variable */ space->extent.type = H5S_SCALAR; space->extent.nelem = 1; - space->extent.u.simple.rank = 0; /* set to scalar rank */ + space->extent.rank = 0; /* set to scalar rank */ } else { hsize_t nelem; /* Number of elements in extent */ unsigned u; /* Local index variable */ space->extent.type = H5S_SIMPLE; - /* Set the rank and copy the dims */ - space->extent.u.simple.rank = rank; - space->extent.u.simple.size = H5FL_ARR_MALLOC(hsize_t,rank); - HDmemcpy(space->extent.u.simple.size, dims, sizeof(hsize_t) * rank); + /* Set the rank and allocate space for the dims */ + space->extent.rank = rank; + space->extent.size = H5FL_ARR_MALLOC(hsize_t,rank); - /* Compute the number of elements in the extent */ - for(u=0, nelem=1; u<space->extent.u.simple.rank; u++) - nelem*=space->extent.u.simple.size[u]; + /* Copy the dimensions & compute the number of elements in the extent */ + for(u=0, nelem=1; u<space->extent.rank; u++) { + space->extent.size[u]=dims[u]; + nelem*=dims[u]; + } /* end for */ space->extent.nelem = nelem; /* Copy the maximum dimensions if specified */ if(max!=NULL) { - space->extent.u.simple.max = H5FL_ARR_MALLOC(hsize_t,rank); - HDmemcpy(space->extent.u.simple.max, max, sizeof(hsize_t) * rank); + space->extent.max = H5FL_ARR_MALLOC(hsize_t,rank); + HDmemcpy(space->extent.max, max, sizeof(hsize_t) * rank); } /* end if */ } @@ -1626,11 +1576,11 @@ H5S_extend (H5S_t *space, const hsize_t *size) assert (size); /* Check through all the dimensions to see if modifying the dataspace is allowed */ - for (u=0; u<space->extent.u.simple.rank; u++) { - if (space->extent.u.simple.size[u]<size[u]) { - if (space->extent.u.simple.max && - H5S_UNLIMITED!=space->extent.u.simple.max[u] && - space->extent.u.simple.max[u]<size[u]) + for (u=0; u<space->extent.rank; u++) { + if (space->extent.size[u]<size[u]) { + if (space->extent.max && + H5S_UNLIMITED!=space->extent.max[u] && + space->extent.max[u]<size[u]) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "dimension cannot be increased"); ret_value++; } @@ -1641,11 +1591,11 @@ H5S_extend (H5S_t *space, const hsize_t *size) hsize_t nelem; /* Number of elements in extent */ /* Change the dataspace size & re-compute the number of elements in the extent */ - for (u=0, nelem=1; u<space->extent.u.simple.rank; u++) { - if (space->extent.u.simple.size[u]<size[u]) - space->extent.u.simple.size[u] = size[u]; + for (u=0, nelem=1; u<space->extent.rank; u++) { + if (space->extent.size[u]<size[u]) + space->extent.size[u] = size[u]; - nelem*=space->extent.u.simple.size[u]; + nelem*=space->extent.size[u]; } space->extent.nelem = nelem; @@ -1918,7 +1868,7 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset) /* Check args */ if (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); - if (space->extent.u.simple.rank==0 || (H5S_GET_EXTENT_TYPE(space)==H5S_SCALAR + if (space->extent.rank==0 || (H5S_GET_EXTENT_TYPE(space)==H5S_SCALAR || H5S_GET_EXTENT_TYPE(space)==H5S_NULL)) HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace"); if (offset == NULL) @@ -1961,10 +1911,9 @@ H5S_set_extent( H5S_t *space, const hsize_t *size ) assert( size); /* Verify that the dimensions being changed are allowed to change */ - for ( u = 0; u < space->extent.u.simple.rank; u++ ) { - if ( space->extent.u.simple.max && - H5S_UNLIMITED != space->extent.u.simple.max[u] && - space->extent.u.simple.max[u]!=size[u] ) + for ( u = 0; u < space->extent.rank; u++ ) { + if ( space->extent.max && H5S_UNLIMITED != space->extent.max[u] && + space->extent.max[u]!=size[u] ) HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,"dimension cannot be modified"); ret_value++; } /* end for */ @@ -2007,9 +1956,9 @@ H5S_set_extent_real( H5S_t *space, const hsize_t *size ) assert(size); /* Change the dataspace size & re-compute the number of elements in the extent */ - for (u=0, nelem=1; u < space->extent.u.simple.rank; u++ ) { - space->extent.u.simple.size[u] = size[u]; - nelem*=space->extent.u.simple.size[u]; + for (u=0, nelem=1; u < space->extent.rank; u++ ) { + space->extent.size[u] = size[u]; + nelem*=space->extent.size[u]; } /* end for */ space->extent.nelem = nelem; diff --git a/src/H5Sall.c b/src/H5Sall.c index 1058e07..8b53cb9 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -623,12 +623,12 @@ H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) assert(end); /* Get the dataspace extent rank */ - rank=space->extent.u.simple.rank; + rank=space->extent.rank; /* Just copy over the complete extent */ for(i=0; i<rank; i++) { start[i]=0; - H5_ASSIGN_OVERFLOW(end[i],space->extent.u.simple.size[i]-1,hsize_t,hssize_t); + H5_ASSIGN_OVERFLOW(end[i],space->extent.size[i]-1,hsize_t,hssize_t); } /* end for */ done: diff --git a/src/H5Shyper.c b/src/H5Shyper.c index a3e6f35..809474b 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -205,8 +205,8 @@ H5S_hyper_print_diminfo(FILE *f, const H5S_t *space) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_diminfo); - H5S_hyper_print_diminfo_helper(f,"opt_diminfo",space->extent.u.simple.rank,space->select.sel_info.hslab->opt_diminfo); - H5S_hyper_print_diminfo_helper(f,"app_diminfo",space->extent.u.simple.rank,space->select.sel_info.hslab->app_diminfo); + H5S_hyper_print_diminfo_helper(f,"opt_diminfo",space->extent.rank,space->select.sel_info.hslab->opt_diminfo); + H5S_hyper_print_diminfo_helper(f,"app_diminfo",space->extent.rank,space->select.sel_info.hslab->app_diminfo); FUNC_LEAVE_NOAPI(SUCCEED); } @@ -253,7 +253,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) iter->u.hyp.iter_rank=0; /* Get the rank of the dataspace */ - rank=space->extent.u.simple.rank; + rank=space->extent.rank; /* Set the temporary pointer to the dimension information */ tdiminfo=space->select.sel_info.hslab->opt_diminfo; @@ -266,7 +266,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) unsigned cont_dim=0; /* # of contiguous dimensions */ /* Set the temporary pointer to the dataspace extent's dimension sizes */ - mem_size=space->extent.u.simple.size; + mem_size=space->extent.size; /* * For a regular hyperslab to be contiguous up to some dimension, it @@ -1457,9 +1457,6 @@ H5S_hyper_cmp_spans (H5S_hyper_span_info_t *span_info1, H5S_hyper_span_info_t *s } /* end else */ } /* end else */ -#ifdef LATER -done: -#endif /* LATER */ FUNC_LEAVE_NOAPI(ret_value); } /* H5S_hyper_cmp_spans() */ @@ -1719,27 +1716,27 @@ H5S_hyper_is_valid (const H5S_t *space) hssize_t end; /* The high bound of a region in a dimension */ /* Check each dimension */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { /* if block or count is zero, then can skip the test since */ /* no data point is chosen */ if (diminfo[u].count && diminfo[u].block) { /* Bounds check the start point in this dimension */ if((diminfo[u].start+space->select.offset[u])<0 || - (diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.u.simple.size[u]) + (diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.size[u]) HGOTO_DONE(FALSE) /* Compute the largest location in this dimension */ end=diminfo[u].start+diminfo[u].stride*(diminfo[u].count-1)+(diminfo[u].block-1)+space->select.offset[u]; /* Bounds check the end point in this dimension */ - if(end<0 || end>=(hssize_t)space->extent.u.simple.size[u]) + if(end<0 || end>=(hssize_t)space->extent.size[u]) HGOTO_DONE(FALSE) } /* end if */ } /* end for */ } /* end if */ else { /* Call the recursive routine to validate the span tree */ - ret_value=H5S_hyper_is_valid_helper(space->select.sel_info.hslab->span_lst,space->select.offset,space->extent.u.simple.size,(hsize_t)0); + ret_value=H5S_hyper_is_valid_helper(space->select.sel_info.hslab->span_lst,space->select.offset,space->extent.size,(hsize_t)0); } /* end else */ done: @@ -1825,7 +1822,7 @@ H5S_get_select_hyper_nblocks(H5S_t *space) /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid) { /* Check each dimension */ - for(ret_value=1,u=0; u<space->extent.u.simple.rank; u++) + for(ret_value=1,u=0; u<space->extent.rank; u++) ret_value*=space->select.sel_info.hslab->app_diminfo[u].count; } /* end if */ else @@ -1913,14 +1910,14 @@ H5S_hyper_serial_size (const H5S_t *space) /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid) { /* Check each dimension */ - for(block_count=1,u=0; u<space->extent.u.simple.rank; u++) + for(block_count=1,u=0; u<space->extent.rank; u++) block_count*=space->select.sel_info.hslab->opt_diminfo[u].count; - ret_value+=8*block_count*space->extent.u.simple.rank; + ret_value+=8*block_count*space->extent.rank; } /* end if */ else { /* Spin through hyperslab spans, adding 8 * rank bytes for each block */ block_count=H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst); - ret_value+=8*space->extent.u.simple.rank*block_count; + ret_value+=8*space->extent.rank*block_count; } /* end else */ done: @@ -2056,13 +2053,13 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf) buf+=4; /* skip over space for length */ /* Encode number of dimensions */ - UINT32ENCODE(buf, (uint32_t)space->extent.u.simple.rank); + UINT32ENCODE(buf, (uint32_t)space->extent.rank); len+=4; /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid) { /* Set some convienence values */ - ndims=space->extent.u.simple.rank; + ndims=space->extent.rank; fast_dim=ndims-1; diminfo=space->select.sel_info.hslab->opt_diminfo; @@ -2152,8 +2149,8 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf) /* Add 8 bytes times the rank for each hyperslab selected */ H5_CHECK_OVERFLOW(block_count,hssize_t,hsize_t); - H5_CHECK_OVERFLOW((8*space->extent.u.simple.rank*(hsize_t)block_count),hsize_t,size_t); - len+=(size_t)(8*space->extent.u.simple.rank*block_count); + H5_CHECK_OVERFLOW((8*space->extent.rank*(hsize_t)block_count),hsize_t,size_t); + len+=(size_t)(8*space->extent.rank*block_count); /* Encode each hyperslab in selection */ H5S_hyper_serialize_helper(space->select.sel_info.hslab->span_lst,start,end,(hsize_t)0,&buf); @@ -2213,7 +2210,7 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf) /* Deserialize slabs to select */ buf+=16; /* Skip over selection header */ UINT32DECODE(buf,rank); /* decode the rank of the point selection */ - if(rank!=space->extent.u.simple.rank) + if(rank!=space->extent.rank) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace"); UINT32DECODE(buf,num_elem); /* decode the number of points */ @@ -2405,7 +2402,7 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startbloc /* Check for a "regular" hyperslab selection */ if(space->select.sel_info.hslab->diminfo_valid) { /* Set some convienence values */ - ndims=space->extent.u.simple.rank; + ndims=space->extent.rank; fast_dim=ndims-1; /* Check which set of dimension information to use */ @@ -2667,7 +2664,7 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) assert(end); /* Set the start and end arrays up */ - rank=space->extent.u.simple.rank; + rank=space->extent.rank; for(i=0; i<rank; i++) { start[i]=HSSIZET_MAX; end[i]=HSSIZET_MIN; @@ -2750,12 +2747,12 @@ H5S_hyper_is_contiguous(const H5S_t *space) small_contiguous=FALSE; /* assume false initially */ /* Check for a "large contigous" block */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { if(diminfo[u].count>1) { large_contiguous=FALSE; break; } /* end if */ - if(u>0 && diminfo[u].block!=space->extent.u.simple.size[u]) { + if(u>0 && diminfo[u].block!=space->extent.size[u]) { large_contiguous=FALSE; break; } /* end if */ @@ -2764,12 +2761,12 @@ H5S_hyper_is_contiguous(const H5S_t *space) /* If we didn't find a large contiguous block, check for a small one */ if(large_contiguous==FALSE) { small_contiguous=TRUE; - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { if(diminfo[u].count>1) { small_contiguous=FALSE; break; } /* end if */ - if(u<(space->extent.u.simple.rank-1) && diminfo[u].block!=1) { + if(u<(space->extent.rank-1) && diminfo[u].block!=1) { small_contiguous=FALSE; break; } /* end if */ @@ -2818,7 +2815,7 @@ H5S_hyper_is_contiguous(const H5S_t *space) } /* end if */ else { /* If this span doesn't cover the entire dimension, then this selection isn't contiguous */ - if(((span->high-span->low)+1)!=(hssize_t)space->extent.u.simple.size[u]) { + if(((span->high-span->low)+1)!=(hssize_t)space->extent.size[u]) { large_contiguous=FALSE; break; } /* end if */ @@ -2856,7 +2853,7 @@ H5S_hyper_is_contiguous(const H5S_t *space) } /* end if */ else { /* If this span doesn't cover the entire dimension, then this selection isn't contiguous */ - if(u<(space->extent.u.simple.rank-1) && ((span->high-span->low)+1)!=1) { + if(u<(space->extent.rank-1) && ((span->high-span->low)+1)!=1) { small_contiguous=FALSE; break; } /* end if */ @@ -2922,7 +2919,7 @@ H5S_hyper_is_single(const H5S_t *space) ret_value=TRUE; /* assume true and reset if the dimensions don't match */ /* Check for a single block */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { if(space->select.sel_info.hslab->opt_diminfo[u].count>1) { ret_value=FALSE; break; @@ -3512,11 +3509,11 @@ H5S_hyper_convert(H5S_t *space) unsigned u; /* Local index variable */ /* Fill in temporary information for the dimensions */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { tmp_start[u]=0; tmp_stride[u]=1; tmp_count[u]=1; - tmp_block[u]=space->extent.u.simple.size[u]; + tmp_block[u]=space->extent.size[u]; } /* end for */ /* Convert to hyperslab selection */ @@ -3645,7 +3642,7 @@ H5S_hyper_intersect (H5S_t *space1, H5S_t *space2) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree"); /* Check that the dataspaces are both the same rank */ - if(space1->extent.u.simple.rank!=space2->extent.u.simple.rank) + if(space1->extent.rank!=space2->extent.rank) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "dataspace ranks don't match"); /* Perform the span-by-span intersection check */ @@ -3872,7 +3869,7 @@ H5S_hyper_adjust(H5S_t *space, const hssize_t *offset) /* Subtract the offset from the "regular" coordinates, if they exist */ if(space->select.sel_info.hslab->diminfo_valid) { - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u]; assert(space->select.sel_info.hslab->opt_diminfo[u].start>=0); } /* end for */ @@ -3987,7 +3984,7 @@ H5S_hyper_move(H5S_t *space, const hssize_t *offset) /* Move to the offset with the "regular" coordinates, if they exist */ if(space->select.sel_info.hslab->diminfo_valid) { - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { space->select.sel_info.hslab->opt_diminfo[u].start=offset[u]; assert(space->select.sel_info.hslab->opt_diminfo[u].start>=0); } /* end for */ @@ -4041,7 +4038,7 @@ H5S_hyper_normalize_offset(H5S_t *space) /* (Technically, this check shouldn't be in the "hyperslab" routines...) */ if(H5S_GET_SELECT_TYPE(space)!=H5S_SEL_ALL) { /* Invert the selection offset */ - for(u=0; u<space->extent.u.simple.rank; u++) + for(u=0; u<space->extent.rank; u++) space->select.offset[u] =- space->select.offset[u]; /* Call the existing 'adjust' routine */ @@ -4049,7 +4046,7 @@ H5S_hyper_normalize_offset(H5S_t *space) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab normalization"); /* Zero out the selection offset */ - for(u=0; u<space->extent.u.simple.rank; u++) + for(u=0; u<space->extent.rank; u++) space->select.offset[u] = 0; } /* end if */ @@ -5291,7 +5288,7 @@ H5S_hyper_rebuild (H5S_t *space) app_diminfo=space->select.sel_info.hslab->app_diminfo; while(span!=NULL) { /* Sanity check */ - assert(curr_dim<space->extent.u.simple.rank); + assert(curr_dim<space->extent.rank); /* Recover the optimized dimension information */ app_diminfo[curr_dim].start = diminfo[curr_dim].start = span->low; @@ -5351,7 +5348,7 @@ H5S_hyper_generate_spans(H5S_t *space) assert(H5S_GET_SELECT_TYPE(space)==H5S_SEL_HYPERSLABS); /* Get the diminfo */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { tmp_start[u]=space->select.sel_info.hslab->opt_diminfo[u].start; tmp_stride[u]=space->select.sel_info.hslab->opt_diminfo[u].stride; tmp_count[u]=space->select.sel_info.hslab->opt_diminfo[u].count; @@ -5408,7 +5405,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, assert(block); /* Generate span tree for new hyperslab information */ - if((new_spans=H5S_hyper_make_spans(space->extent.u.simple.rank,start,stride,count,block))==NULL) + if((new_spans=H5S_hyper_make_spans(space->extent.rank,start,stride,count,block))==NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information"); /* Generate list of blocks to add/remove based on selection operation */ @@ -5650,13 +5647,13 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* * Check for overlapping hyperslab blocks in new selection. */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { if(count[u]>1 && stride[u]<block[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap"); } /* end for */ /* Optimize hyperslab parameters to merge contiguous blocks, etc. */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { /* contiguous hyperslabs have the block size equal to the stride */ if(stride[u]==block[u]) { opt_count[u]=1; @@ -5725,11 +5722,11 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */ /* Fill in temporary information for the dimensions */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { tmp_start[u]=0; tmp_stride[u]=1; tmp_count[u]=1; - tmp_block[u]=space->extent.u.simple.size[u]; + tmp_block[u]=space->extent.size[u]; } /* end for */ /* Convert to hyperslab selection */ @@ -5773,7 +5770,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* Save the diminfo */ space->select.num_elem=1; - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { space->select.sel_info.hslab->app_diminfo[u].start = start[u]; space->select.sel_info.hslab->app_diminfo[u].stride = stride[u]; space->select.sel_info.hslab->app_diminfo[u].count = count[u]; @@ -5869,7 +5866,7 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[], HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); if(stride!=NULL) { /* Check for 0-sized strides */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { if(stride[u]==0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value"); } /* end for */ @@ -6124,7 +6121,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, assert(block); /* Generate span tree for new hyperslab information */ - if((new_spans=H5S_hyper_make_spans(space->extent.u.simple.rank,start,stride,count,block))==NULL) + if((new_spans=H5S_hyper_make_spans(space->extent.rank,start,stride,count,block))==NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information"); /* Copy the original dataspace */ @@ -6206,13 +6203,13 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* * Check for overlapping hyperslab blocks in new selection. */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { if(count[u]>1 && stride[u]<block[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap"); } /* end for */ /* Optimize hyperslab parameters to merge contiguous blocks, etc. */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { /* contiguous hyperslabs have the block size equal to the stride */ if(stride[u]==block[u]) { opt_count[u]=1; @@ -6281,11 +6278,11 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */ /* Fill in temporary information for the dimensions */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { tmp_start[u]=0; tmp_stride[u]=1; tmp_count[u]=1; - tmp_block[u]=space->extent.u.simple.size[u]; + tmp_block[u]=space->extent.size[u]; } /* end for */ /* Convert to hyperslab selection */ @@ -6330,7 +6327,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* Save the diminfo */ space->select.num_elem=1; - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { space->select.sel_info.hslab->app_diminfo[u].start = start[u]; space->select.sel_info.hslab->app_diminfo[u].stride = stride[u]; space->select.sel_info.hslab->app_diminfo[u].count = count[u]; @@ -6428,7 +6425,7 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[], unsigned u; /* Local index variable */ /* Check for 0-sized strides */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { if(stride[u]==0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value"); } /* end for */ @@ -6616,7 +6613,7 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); /* Check that both dataspaces have the same rank */ - if(space1->extent.u.simple.rank!=space2->extent.u.simple.rank) + if(space1->extent.rank!=space2->extent.rank) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank"); /* Check that both dataspaces have hyperslab selections */ @@ -6741,7 +6738,7 @@ H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); /* Check that both dataspaces have the same rank */ - if(space1->extent.u.simple.rank!=space2->extent.u.simple.rank) + if(space1->extent.rank!=space2->extent.rank) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank"); /* Check that both dataspaces have hyperslab selections */ @@ -6826,7 +6823,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter, assert(len); /* Set the rank of the fastest changing dimension */ - ndims=space->extent.u.simple.rank; + ndims=space->extent.rank; fast_dim=(ndims-1); /* Get the pointers to the current span info and span nodes */ @@ -6844,7 +6841,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter, /* Compute the cumulative size of dataspace dimensions */ for(i=fast_dim, acc=elem_size; i>=0; i--) { slab[i]=acc; - acc*=space->extent.u.simple.size[i]; + acc*=space->extent.size[i]; } /* end for */ /* Set the offset of the first element iterated on */ @@ -7275,7 +7272,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, tdiminfo=iter->u.hyp.diminfo; /* Check if this is a "flattened" regular hyperslab selection */ - if(iter->u.hyp.iter_rank!=0 && iter->u.hyp.iter_rank<space->extent.u.simple.rank) { + if(iter->u.hyp.iter_rank!=0 && iter->u.hyp.iter_rank<space->extent.rank) { /* Set the aliases for a few important dimension ranks */ ndims=iter->u.hyp.iter_rank; fast_dim=ndims-1; @@ -7288,14 +7285,14 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, } /* end if */ else { /* Set the aliases for a few important dimension ranks */ - ndims=space->extent.u.simple.rank; + ndims=space->extent.rank; fast_dim=ndims-1; /* Set the local copy of the selection offset */ sel_off=space->select.offset; /* Set up the pointer to the size of the memory space */ - mem_size=space->extent.u.simple.size; + mem_size=space->extent.size; } /* end else */ /* initialize row sizes for each dimension */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index a58103d..468d297 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -248,7 +248,7 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, /* make a local copy of the dimension info so we can operate with them */ /* Check if this is a "flattened" regular hyperslab selection */ - if(sel_iter.u.hyp.iter_rank!=0 && sel_iter.u.hyp.iter_rank<space->extent.u.simple.rank) { + if(sel_iter.u.hyp.iter_rank!=0 && sel_iter.u.hyp.iter_rank<space->extent.rank) { /* Flattened selection */ rank=sel_iter.u.hyp.iter_rank; assert (rank >= 0 && rank<=H5S_MAX_RANK); /* within array bounds */ @@ -282,7 +282,7 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, } /* end if */ else { /* Non-flattened selection */ - rank = space->extent.u.simple.rank; + rank = space->extent.rank; assert (rank >= 0 && rank<=H5S_MAX_RANK); /* within array bounds */ if (0==rank) goto empty; @@ -295,7 +295,7 @@ H5S_mpio_hyper_type( const H5S_t *space, size_t elmt_size, d[i].strid = diminfo[i].stride; d[i].block = diminfo[i].block; d[i].count = diminfo[i].count; - d[i].xtent = space->extent.u.simple.size[i]; + d[i].xtent = space->extent.size[i]; #ifdef H5Smpi_DEBUG HDfprintf(stderr, "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", FUNC, d[i].start, d[i].strid, d[i].count, d[i].block, d[i].xtent ); diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 72f9fd6..82bfec2 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -42,23 +42,14 @@ /* * Dataspace extent information */ -/* Simple extent container */ -typedef struct H5S_simple_t { - unsigned rank; /* Number of dimensions */ - hsize_t *size; /* Current size of the dimensions */ - hsize_t *max; /* Maximum size of the dimensions */ -#ifdef LATER - hsize_t *perm; /* Dimension permutation array */ -#endif /* LATER */ -} H5S_simple_t; - /* Extent container */ typedef struct { H5S_class_t type; /* Type of extent */ hsize_t nelem; /* Number of elements in extent */ - union { - H5S_simple_t simple; /* Simple dimensionality information */ - } u; + + unsigned rank; /* Number of dimensions */ + hsize_t *size; /* Current size of the dimensions */ + hsize_t *max; /* Maximum size of the dimensions */ } H5S_extent_t; /* @@ -227,7 +218,6 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_none[1]; H5_DLLVAR const H5S_select_class_t H5S_sel_point[1]; /* Extent functions */ -H5_DLL herr_t H5S_close_simple(H5S_simple_t *simple); H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent); H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src); diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 87dd0e2..dc42f11 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -407,11 +407,11 @@ H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t * if((new_node = H5FL_MALLOC(H5S_pnt_node_t))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); - if((new_node->pnt = H5MM_malloc(space->extent.u.simple.rank*sizeof(hssize_t)))==NULL) + if((new_node->pnt = H5MM_malloc(space->extent.rank*sizeof(hssize_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); /* Copy over the coordinates */ - HDmemcpy(new_node->pnt,coord+(i*space->extent.u.simple.rank),(space->extent.u.simple.rank*sizeof(hssize_t))); + HDmemcpy(new_node->pnt,coord+(i*space->extent.rank),(space->extent.rank*sizeof(hssize_t))); /* Link into list */ new_node->next=NULL; @@ -612,9 +612,9 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection) /* Create each point */ if((new_node=H5FL_MALLOC(H5S_pnt_node_t))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); - if((new_node->pnt = H5MM_malloc(src->extent.u.simple.rank*sizeof(hssize_t)))==NULL) + if((new_node->pnt = H5MM_malloc(src->extent.rank*sizeof(hssize_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); - HDmemcpy(new_node->pnt,curr->pnt,(src->extent.u.simple.rank*sizeof(hssize_t))); + HDmemcpy(new_node->pnt,curr->pnt,(src->extent.rank*sizeof(hssize_t))); new_node->next=NULL; /* Keep the order the same when copying */ @@ -668,10 +668,10 @@ H5S_point_is_valid (const H5S_t *space) curr=space->select.sel_info.pnt_lst->head; while(curr!=NULL) { /* Check each dimension */ - for(u=0; u<space->extent.u.simple.rank; u++) { + for(u=0; u<space->extent.rank; u++) { /* Check if an offset has been defined */ /* Bounds check the selected point + offset against the extent */ - if(((curr->pnt[u]+space->select.offset[u])>(hssize_t)space->extent.u.simple.size[u]) + if(((curr->pnt[u]+space->select.offset[u])>(hssize_t)space->extent.size[u]) || ((curr->pnt[u]+space->select.offset[u])<0)) { ret_value=FALSE; break; @@ -764,7 +764,7 @@ H5S_point_serial_size (const H5S_t *space) curr=space->select.sel_info.pnt_lst->head; while(curr!=NULL) { /* Add 4 bytes times the rank for each element selected */ - ret_value+=4*space->extent.u.simple.rank; + ret_value+=4*space->extent.rank; curr=curr->next; } /* end while */ @@ -813,7 +813,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf) buf+=4; /* skip over space for length */ /* Encode number of dimensions */ - UINT32ENCODE(buf, (uint32_t)space->extent.u.simple.rank); + UINT32ENCODE(buf, (uint32_t)space->extent.rank); len+=4; /* Encode number of elements */ @@ -824,10 +824,10 @@ H5S_point_serialize (const H5S_t *space, uint8_t *buf) curr=space->select.sel_info.pnt_lst->head; while(curr!=NULL) { /* Add 4 bytes times the rank for each element selected */ - len+=4*space->extent.u.simple.rank; + len+=4*space->extent.rank; /* Encode each point */ - for(u=0; u<space->extent.u.simple.rank; u++) + for(u=0; u<space->extent.rank; u++) UINT32ENCODE(buf, (uint32_t)curr->pnt[u]); curr=curr->next; @@ -879,7 +879,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf) /* Deserialize points to select */ buf+=16; /* Skip over selection header */ UINT32DECODE(buf,rank); /* decode the rank of the point selection */ - if(rank!=space->extent.u.simple.rank) + if(rank!=space->extent.rank) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace"); UINT32DECODE(buf,num_elem); /* decode the number of points */ @@ -946,7 +946,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint assert(buf); /* Get the dataspace extent rank */ - rank=space->extent.u.simple.rank; + rank=space->extent.rank; /* Get the head of the point list */ node=space->select.sel_info.pnt_lst->head; @@ -1063,7 +1063,7 @@ H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) assert(end); /* Get the dataspace extent rank */ - rank=space->extent.u.simple.rank; + rank=space->extent.rank; /* Set the start and end arrays up */ for(i=0; i<rank; i++) { diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 9e6d4b4..5dbb467 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -155,7 +155,7 @@ typedef struct H5S_conv_t { /* If the module using this macro is allowed access to the private variables, access them directly */ #ifdef H5S_PACKAGE #define H5S_GET_EXTENT_TYPE(S) ((S)->extent.type) -#define H5S_GET_EXTENT_NDIMS(S) ((S)->extent.u.simple.rank) +#define H5S_GET_EXTENT_NDIMS(S) ((S)->extent.rank) #define H5S_GET_EXTENT_NPOINTS(S) ((S)->extent.nelem) #define H5S_GET_SELECT_NPOINTS(S) ((S)->select.num_elem) #define H5S_GET_SELECT_TYPE(S) ((S)->select.type->type) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 4d7091a..d46e8df 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -82,11 +82,11 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) /* Check args */ assert(space); - assert(space->extent.u.simple.rank); + assert(space->extent.rank); assert(offset); /* Copy the offset over */ - HDmemcpy(space->select.offset,offset,sizeof(hssize_t)*space->extent.u.simple.rank); + HDmemcpy(space->select.offset,offset,sizeof(hssize_t)*space->extent.rank); done: FUNC_LEAVE_NOAPI(ret_value); @@ -749,11 +749,11 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s /* Initialize common information */ /* Save the dataspace's rank */ - sel_iter->rank=space->extent.u.simple.rank; + sel_iter->rank=space->extent.rank; if(sel_iter->rank>0) { /* Point to the dataspace dimensions */ - sel_iter->dims=space->extent.u.simple.size; + sel_iter->dims=space->extent.size; } /* end if */ else sel_iter->dims = NULL; @@ -1128,12 +1128,12 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); /* Get the rank of the dataspace */ - ndims=space->extent.u.simple.rank; + ndims=space->extent.rank; if (ndims > 0){ /* Copy the size of the space */ - assert(space->extent.u.simple.size); - HDmemcpy(space_size, space->extent.u.simple.size, ndims*sizeof(hsize_t)); + assert(space->extent.size); + HDmemcpy(space_size, space->extent.size, ndims*sizeof(hsize_t)); } space_size[ndims]=elmt_size; @@ -1308,7 +1308,7 @@ HDfprintf(stderr,"%s: Entering\n",FUNC); assert(space2); /* Check for different dimensionality */ - if (space1->extent.u.simple.rank!=space2->extent.u.simple.rank) + if (space1->extent.rank!=space2->extent.rank) HGOTO_DONE(FALSE); #ifdef QAK @@ -1339,7 +1339,7 @@ HDfprintf(stderr,"%s: Check 2.0\n",FUNC); HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality"); /* Check that the sizes are the same */ - for (u=0; u<space1->extent.u.simple.rank; u++) + for (u=0; u<space1->extent.rank; u++) if(dims1[u]!=dims2[u]) HGOTO_DONE(FALSE); } /* end if */ @@ -1356,7 +1356,7 @@ HDfprintf(stderr,"%s: Check 3.0\n",FUNC); HDfprintf(stderr,"%s: Check 4.0\n",FUNC); #endif /* QAK */ /* Check that the shapes are the same */ - for (u=0; u<space1->extent.u.simple.rank; u++) { + for (u=0; u<space1->extent.rank; u++) { if(space1->select.sel_info.hslab->opt_diminfo[u].stride!=space2->select.sel_info.hslab->opt_diminfo[u].stride) HGOTO_DONE(FALSE); if(space1->select.sel_info.hslab->opt_diminfo[u].count!=space2->select.sel_info.hslab->opt_diminfo[u].count) @@ -1417,11 +1417,11 @@ else { #ifdef QAK { HDfprintf(stderr,"%s: iter1 start={",FUNC); - for(u=0; u<space1->extent.u.simple.rank; u++) - HDfprintf(stderr,"%Hd%s",start1[u],(u<(space1->extent.u.simple.rank-1) ? ", " : "}\n")); + for(u=0; u<space1->extent.rank; u++) + HDfprintf(stderr,"%Hd%s",start1[u],(u<(space1->extent.rank-1) ? ", " : "}\n")); HDfprintf(stderr,"%s: iter1 end={",FUNC); - for(u=0; u<space1->extent.u.simple.rank; u++) - HDfprintf(stderr,"%Hd%s",end1[u],(u<(space1->extent.u.simple.rank-1) ? ", " : "}\n")); + for(u=0; u<space1->extent.rank; u++) + HDfprintf(stderr,"%Hd%s",end1[u],(u<(space1->extent.rank-1) ? ", " : "}\n")); } #endif /* QAK */ if(H5S_SELECT_ITER_BLOCK(&iter2,start2,end2)<0) @@ -1429,18 +1429,18 @@ else { #ifdef QAK { HDfprintf(stderr,"%s: iter2 start={",FUNC); - for(u=0; u<space1->extent.u.simple.rank; u++) - HDfprintf(stderr,"%Hd%s",start2[u],(u<(space1->extent.u.simple.rank-1) ? ", " : "}\n")); + for(u=0; u<space1->extent.rank; u++) + HDfprintf(stderr,"%Hd%s",start2[u],(u<(space1->extent.rank-1) ? ", " : "}\n")); HDfprintf(stderr,"%s: iter2 end={",FUNC); - for(u=0; u<space1->extent.u.simple.rank; u++) - HDfprintf(stderr,"%Hd%s",end2[u],(u<(space1->extent.u.simple.rank-1) ? ", " : "}\n")); + for(u=0; u<space1->extent.rank; u++) + HDfprintf(stderr,"%Hd%s",end2[u],(u<(space1->extent.rank-1) ? ", " : "}\n")); } #endif /* QAK */ /* The first block only compares the sizes and sets the relative offsets for later blocks */ if(first_block) { /* If the block sizes from each selection doesn't match, get out */ - for (u=0; u<space1->extent.u.simple.rank; u++) { + for (u=0; u<space1->extent.rank; u++) { if((end1[u]-start1[u])!=(end2[u]-start2[u])) HGOTO_DONE(FALSE); @@ -1454,7 +1454,7 @@ else { } /* end if */ else { /* Check over the blocks for each selection */ - for (u=0; u<space1->extent.u.simple.rank; u++) { + for (u=0; u<space1->extent.rank; u++) { /* Check if the blocks are in the same relative location */ if((start1[u]-off1[u])!=(start2[u]-off2[u])) HGOTO_DONE(FALSE); |