summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Dcontig.c46
-rw-r--r--src/H5Dseq.c16
-rw-r--r--src/H5Fcontig.c46
-rw-r--r--src/H5Fprivate.h4
-rw-r--r--src/H5Fseq.c16
-rw-r--r--src/H5Shyper.c492
6 files changed, 352 insertions, 268 deletions
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index fa01acd..a93e410 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -60,23 +60,32 @@ H5F_contig_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxp
if(f->shared->lf->feature_flags&H5FD_FEAT_DATA_SIEVE) {
/* Try reading from the data sieve buffer */
if(f->shared->sieve_buf) {
+ haddr_t sieve_start, sieve_end; /* Start & end locations of sieve buffer */
+ haddr_t contig_end; /* End locations of block to write */
+ hsize_t sieve_size; /* size of sieve buffer */
+
+ /* Stash local copies of these value */
+ sieve_start=f->shared->sieve_loc;
+ sieve_size=f->shared->sieve_size;
+ sieve_end=sieve_start+sieve_size;
+ contig_end=addr+size-1;
+
/* If entire read is within the sieve buffer, read it from the buffer */
- if((addr>=f->shared->sieve_loc && addr<(f->shared->sieve_loc+f->shared->sieve_size))
- && ((addr+size-1)>=f->shared->sieve_loc && (addr+size-1)<(f->shared->sieve_loc+f->shared->sieve_size))) {
+ if(addr>=sieve_start && contig_end<sieve_end) {
/* Grab the data out of the buffer */
- HDmemcpy(buf,f->shared->sieve_buf+(addr-f->shared->sieve_loc),size);
+ HDmemcpy(buf,f->shared->sieve_buf+(addr-sieve_start),size);
} /* end if */
/* Entire request is not within this data sieve buffer */
else {
/* Check if we can actually hold the I/O request in the sieve buffer */
if(size>f->shared->sieve_buf_size) {
/* Check for any overlap with the current sieve buffer */
- if((f->shared->sieve_loc>=addr && f->shared->sieve_loc<(addr+size))
- || ((f->shared->sieve_loc+f->shared->sieve_size-1)>=addr && (f->shared->sieve_loc+f->shared->sieve_size-1)<(addr+size))) {
+ if((sieve_start>=addr && sieve_start<(contig_end+1))
+ || ((sieve_end-1)>=addr && (sieve_end-1)<(contig_end+1))) {
/* Flush the sieve buffer, if it's dirty */
if(f->shared->sieve_dirty) {
/* Write to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
+ if (H5F_block_write(f, H5FD_MEM_DRAW, sieve_start, sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
@@ -97,7 +106,7 @@ H5F_contig_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxp
/* Flush the sieve buffer if it's dirty */
if(f->shared->sieve_dirty) {
/* Write to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
+ if (H5F_block_write(f, H5FD_MEM_DRAW, sieve_start, sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
@@ -213,11 +222,20 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size,
if(f->shared->lf->feature_flags&H5FD_FEAT_DATA_SIEVE) {
/* Try writing to the data sieve buffer */
if(f->shared->sieve_buf) {
+ haddr_t sieve_start, sieve_end; /* Start & end locations of sieve buffer */
+ haddr_t contig_end; /* End locations of block to write */
+ hsize_t sieve_size; /* size of sieve buffer */
+
+ /* Stash local copies of these value */
+ sieve_start=f->shared->sieve_loc;
+ sieve_size=f->shared->sieve_size;
+ sieve_end=sieve_start+sieve_size;
+ contig_end=addr+size-1;
+
/* If entire write is within the sieve buffer, write it to the buffer */
- if((addr>=f->shared->sieve_loc && addr<(f->shared->sieve_loc+f->shared->sieve_size))
- && ((addr+size-1)>=f->shared->sieve_loc && (addr+size-1)<(f->shared->sieve_loc+f->shared->sieve_size))) {
+ if(addr>=sieve_start && contig_end<sieve_end) {
/* Grab the data out of the buffer */
- HDmemcpy(f->shared->sieve_buf+(addr-f->shared->sieve_loc),buf,size);
+ HDmemcpy(f->shared->sieve_buf+(addr-sieve_start),buf,size);
/* Set sieve buffer dirty flag */
f->shared->sieve_dirty=1;
@@ -228,12 +246,12 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size,
/* Check if we can actually hold the I/O request in the sieve buffer */
if(size>f->shared->sieve_buf_size) {
/* Check for any overlap with the current sieve buffer */
- if((f->shared->sieve_loc>=addr && f->shared->sieve_loc<(addr+size))
- || ((f->shared->sieve_loc+f->shared->sieve_size-1)>=addr && (f->shared->sieve_loc+f->shared->sieve_size-1)<(addr+size))) {
+ if((sieve_start>=addr && sieve_start<(contig_end+1))
+ || ((sieve_end-1)>=addr && (sieve_end-1)<(contig_end+1))) {
/* Flush the sieve buffer, if it's dirty */
if(f->shared->sieve_dirty) {
/* Write to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
+ if (H5F_block_write(f, H5FD_MEM_DRAW, sieve_start, sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
@@ -258,7 +276,7 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size,
/* Flush the sieve buffer if it's dirty */
if(f->shared->sieve_dirty) {
/* Write to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
+ if (H5F_block_write(f, H5FD_MEM_DRAW, sieve_start, sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
diff --git a/src/H5Dseq.c b/src/H5Dseq.c
index 4181823..007a7fa 100644
--- a/src/H5Dseq.c
+++ b/src/H5Dseq.c
@@ -42,7 +42,7 @@ static intn interface_initialize_g = 0;
* in memory. The data is read from file F and the array's size and
* storage information is in LAYOUT. External files are described
* according to the external file list, EFL. The sequence offset is
- * FILE_OFFSET in the file and MEM_OFFSET in memory (offsets are
+ * FILE_OFFSET in the file (offsets are
* in terms of bytes) and the size of the hyperslab is SEQ_LEN. The
* total size of the file array is implied in the LAYOUT argument.
*
@@ -59,8 +59,7 @@ herr_t
H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const H5O_fill_t *fill,
const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size,
- hsize_t seq_len, hssize_t mem_offset, hssize_t file_offset,
- void *_buf/*out*/)
+ hsize_t seq_len, hssize_t file_offset, void *_buf/*out*/)
{
uint8_t *buf = (uint8_t*)_buf; /*cast for arithmetic */
hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */
@@ -120,7 +119,6 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
addr = layout->addr;
}
addr += file_offset;
- buf += mem_offset;
/*
* Now begin to walk through the array, copying data from disk to
@@ -194,7 +192,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
if(count<10) {
printf("%s: elmt_size=%d, addr=%d, seq_len=%d\n",FUNC,(int)elmt_size,(int)addr,(int)seq_len);
- printf("%s: file_offset=%d, mem_offset=%d\n",FUNC,(int)file_offset,(int)mem_offset);
+ printf("%s: file_offset=%d\n",FUNC,(int)file_offset);
count++;
}
}
@@ -271,7 +269,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
* in memory. The data is written to file F and the array's size and
* storage information is in LAYOUT. External files are described
* according to the external file list, EFL. The sequence offset is
- * FILE_OFFSET in the file and MEM_OFFSET in memory (offsets are
+ * FILE_OFFSET in the file (offsets are
* in terms of bytes) and the size of the hyperslab is SEQ_LEN. The
* total size of the file array is implied in the LAYOUT argument.
*
@@ -288,8 +286,7 @@ herr_t
H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const H5O_fill_t *fill,
const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size,
- hsize_t seq_len, hssize_t mem_offset, hssize_t file_offset,
- const void *_buf)
+ hsize_t seq_len, hssize_t file_offset, const void *_buf)
{
const uint8_t *buf = (const uint8_t*)_buf; /*cast for arithmetic */
hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */
@@ -349,7 +346,6 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
addr = layout->addr;
}
addr += file_offset;
- buf += mem_offset;
/*
* Now begin to walk through the array, copying data from disk to
@@ -417,7 +413,7 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
if(count<10) {
printf("%s: elmt_size=%d, addr=%d, seq_len=%lu\n",FUNC,(int)elmt_size,(int)addr,(unsigned long)seq_len);
- printf("%s: file_offset=%d, mem_offset=%d\n",FUNC,(int)file_offset,(int)mem_offset);
+ printf("%s: file_offset=%d\n",FUNC,(int)file_offset);
count++;
}
}
diff --git a/src/H5Fcontig.c b/src/H5Fcontig.c
index fa01acd..a93e410 100644
--- a/src/H5Fcontig.c
+++ b/src/H5Fcontig.c
@@ -60,23 +60,32 @@ H5F_contig_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxp
if(f->shared->lf->feature_flags&H5FD_FEAT_DATA_SIEVE) {
/* Try reading from the data sieve buffer */
if(f->shared->sieve_buf) {
+ haddr_t sieve_start, sieve_end; /* Start & end locations of sieve buffer */
+ haddr_t contig_end; /* End locations of block to write */
+ hsize_t sieve_size; /* size of sieve buffer */
+
+ /* Stash local copies of these value */
+ sieve_start=f->shared->sieve_loc;
+ sieve_size=f->shared->sieve_size;
+ sieve_end=sieve_start+sieve_size;
+ contig_end=addr+size-1;
+
/* If entire read is within the sieve buffer, read it from the buffer */
- if((addr>=f->shared->sieve_loc && addr<(f->shared->sieve_loc+f->shared->sieve_size))
- && ((addr+size-1)>=f->shared->sieve_loc && (addr+size-1)<(f->shared->sieve_loc+f->shared->sieve_size))) {
+ if(addr>=sieve_start && contig_end<sieve_end) {
/* Grab the data out of the buffer */
- HDmemcpy(buf,f->shared->sieve_buf+(addr-f->shared->sieve_loc),size);
+ HDmemcpy(buf,f->shared->sieve_buf+(addr-sieve_start),size);
} /* end if */
/* Entire request is not within this data sieve buffer */
else {
/* Check if we can actually hold the I/O request in the sieve buffer */
if(size>f->shared->sieve_buf_size) {
/* Check for any overlap with the current sieve buffer */
- if((f->shared->sieve_loc>=addr && f->shared->sieve_loc<(addr+size))
- || ((f->shared->sieve_loc+f->shared->sieve_size-1)>=addr && (f->shared->sieve_loc+f->shared->sieve_size-1)<(addr+size))) {
+ if((sieve_start>=addr && sieve_start<(contig_end+1))
+ || ((sieve_end-1)>=addr && (sieve_end-1)<(contig_end+1))) {
/* Flush the sieve buffer, if it's dirty */
if(f->shared->sieve_dirty) {
/* Write to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
+ if (H5F_block_write(f, H5FD_MEM_DRAW, sieve_start, sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
@@ -97,7 +106,7 @@ H5F_contig_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxp
/* Flush the sieve buffer if it's dirty */
if(f->shared->sieve_dirty) {
/* Write to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
+ if (H5F_block_write(f, H5FD_MEM_DRAW, sieve_start, sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
@@ -213,11 +222,20 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size,
if(f->shared->lf->feature_flags&H5FD_FEAT_DATA_SIEVE) {
/* Try writing to the data sieve buffer */
if(f->shared->sieve_buf) {
+ haddr_t sieve_start, sieve_end; /* Start & end locations of sieve buffer */
+ haddr_t contig_end; /* End locations of block to write */
+ hsize_t sieve_size; /* size of sieve buffer */
+
+ /* Stash local copies of these value */
+ sieve_start=f->shared->sieve_loc;
+ sieve_size=f->shared->sieve_size;
+ sieve_end=sieve_start+sieve_size;
+ contig_end=addr+size-1;
+
/* If entire write is within the sieve buffer, write it to the buffer */
- if((addr>=f->shared->sieve_loc && addr<(f->shared->sieve_loc+f->shared->sieve_size))
- && ((addr+size-1)>=f->shared->sieve_loc && (addr+size-1)<(f->shared->sieve_loc+f->shared->sieve_size))) {
+ if(addr>=sieve_start && contig_end<sieve_end) {
/* Grab the data out of the buffer */
- HDmemcpy(f->shared->sieve_buf+(addr-f->shared->sieve_loc),buf,size);
+ HDmemcpy(f->shared->sieve_buf+(addr-sieve_start),buf,size);
/* Set sieve buffer dirty flag */
f->shared->sieve_dirty=1;
@@ -228,12 +246,12 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size,
/* Check if we can actually hold the I/O request in the sieve buffer */
if(size>f->shared->sieve_buf_size) {
/* Check for any overlap with the current sieve buffer */
- if((f->shared->sieve_loc>=addr && f->shared->sieve_loc<(addr+size))
- || ((f->shared->sieve_loc+f->shared->sieve_size-1)>=addr && (f->shared->sieve_loc+f->shared->sieve_size-1)<(addr+size))) {
+ if((sieve_start>=addr && sieve_start<(contig_end+1))
+ || ((sieve_end-1)>=addr && (sieve_end-1)<(contig_end+1))) {
/* Flush the sieve buffer, if it's dirty */
if(f->shared->sieve_dirty) {
/* Write to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
+ if (H5F_block_write(f, H5FD_MEM_DRAW, sieve_start, sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
@@ -258,7 +276,7 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size,
/* Flush the sieve buffer if it's dirty */
if(f->shared->sieve_dirty) {
/* Write to file */
- if (H5F_block_write(f, H5FD_MEM_DRAW, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
+ if (H5F_block_write(f, H5FD_MEM_DRAW, sieve_start, sieve_size, dxpl_id, f->shared->sieve_buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index da19bd6..b9e5876 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -342,12 +342,12 @@ __DLL__ herr_t H5F_seq_read(H5F_t *f, hid_t dxpl_id,
const struct H5O_layout_t *layout, const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill, const struct H5O_efl_t *efl,
const struct H5S_t *file_space, size_t elmt_size, hsize_t seq_len,
- hssize_t mem_offset, hssize_t file_offset, void *_buf/*out*/);
+ hssize_t file_offset, void *_buf/*out*/);
__DLL__ herr_t H5F_seq_write (H5F_t *f, hid_t dxpl_id,
const struct H5O_layout_t *layout, const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill, const struct H5O_efl_t *efl,
const struct H5S_t *file_space, size_t elmt_size, hsize_t seq_len,
- hssize_t mem_offset, hssize_t file_offset, const void *_buf);
+ hssize_t file_offset, const void *_buf);
/* Functions that operate on indexed storage */
diff --git a/src/H5Fseq.c b/src/H5Fseq.c
index 4181823..007a7fa 100644
--- a/src/H5Fseq.c
+++ b/src/H5Fseq.c
@@ -42,7 +42,7 @@ static intn interface_initialize_g = 0;
* in memory. The data is read from file F and the array's size and
* storage information is in LAYOUT. External files are described
* according to the external file list, EFL. The sequence offset is
- * FILE_OFFSET in the file and MEM_OFFSET in memory (offsets are
+ * FILE_OFFSET in the file (offsets are
* in terms of bytes) and the size of the hyperslab is SEQ_LEN. The
* total size of the file array is implied in the LAYOUT argument.
*
@@ -59,8 +59,7 @@ herr_t
H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const H5O_fill_t *fill,
const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size,
- hsize_t seq_len, hssize_t mem_offset, hssize_t file_offset,
- void *_buf/*out*/)
+ hsize_t seq_len, hssize_t file_offset, void *_buf/*out*/)
{
uint8_t *buf = (uint8_t*)_buf; /*cast for arithmetic */
hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */
@@ -120,7 +119,6 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
addr = layout->addr;
}
addr += file_offset;
- buf += mem_offset;
/*
* Now begin to walk through the array, copying data from disk to
@@ -194,7 +192,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
if(count<10) {
printf("%s: elmt_size=%d, addr=%d, seq_len=%d\n",FUNC,(int)elmt_size,(int)addr,(int)seq_len);
- printf("%s: file_offset=%d, mem_offset=%d\n",FUNC,(int)file_offset,(int)mem_offset);
+ printf("%s: file_offset=%d\n",FUNC,(int)file_offset);
count++;
}
}
@@ -271,7 +269,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
* in memory. The data is written to file F and the array's size and
* storage information is in LAYOUT. External files are described
* according to the external file list, EFL. The sequence offset is
- * FILE_OFFSET in the file and MEM_OFFSET in memory (offsets are
+ * FILE_OFFSET in the file (offsets are
* in terms of bytes) and the size of the hyperslab is SEQ_LEN. The
* total size of the file array is implied in the LAYOUT argument.
*
@@ -288,8 +286,7 @@ herr_t
H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const H5O_fill_t *fill,
const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size,
- hsize_t seq_len, hssize_t mem_offset, hssize_t file_offset,
- const void *_buf)
+ hsize_t seq_len, hssize_t file_offset, const void *_buf)
{
const uint8_t *buf = (const uint8_t*)_buf; /*cast for arithmetic */
hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */
@@ -349,7 +346,6 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
addr = layout->addr;
}
addr += file_offset;
- buf += mem_offset;
/*
* Now begin to walk through the array, copying data from disk to
@@ -417,7 +413,7 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
if(count<10) {
printf("%s: elmt_size=%d, addr=%d, seq_len=%lu\n",FUNC,(int)elmt_size,(int)addr,(unsigned long)seq_len);
- printf("%s: file_offset=%d, mem_offset=%d\n",FUNC,(int)file_offset,(int)mem_offset);
+ printf("%s: file_offset=%d\n",FUNC,(int)file_offset);
count++;
}
}
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 0557b4c..a9c247f 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -943,6 +943,13 @@ H5S_hyper_fread_opt (H5F_t *f, const struct H5O_layout_t *layout,
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary block count */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block offset */
uint8_t *buf=(uint8_t *)_buf; /* Alias for pointer arithmetic */
+ const H5S_hyper_dim_t *tdiminfo; /* Local pointer to diminfo information */
+ hssize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ fast_dim_offset;
+ hsize_t fast_dim_stride, /* Local copies of fastest changing dimension info */
+ fast_dim_block,
+ fast_dim_count,
+ fast_dim_buf_off;
intn fast_dim; /* Rank of the fastest changing dimension for the dataspace */
intn temp_dim; /* Temporary rank holder */
hsize_t acc; /* Accumulator */
@@ -1009,7 +1016,7 @@ printf("%s: Check 1.0\n",FUNC);
/* Read in the rest of the sequence */
if (H5F_seq_read(f, dxpl_id, layout, pline, fill, efl, file_space,
- elmt_size, actual_bytes, 0, buf_off, buf/*out*/)<0) {
+ elmt_size, actual_bytes, buf_off, buf/*out*/)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error");
}
@@ -1019,9 +1026,6 @@ printf("%s: Check 1.0\n",FUNC);
/* Increment the count read */
num_read+=actual_read;
- /* Decrement the number of elements left in selection */
- file_iter->hyp.elmt_left-=actual_read;
-
/* Advance the point iterator */
/* If we had enough buffer space to read in the rest of the sequence
* in the fastest changing dimension, move the iterator offset to
@@ -1084,6 +1088,17 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
last_buf_off=-1;
buf_size=0;
+ /* Set the local copy of the diminfo pointer */
+ tdiminfo=file_space->select.sel_info.hslab.diminfo;
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_start=tdiminfo[fast_dim].start;
+ fast_dim_stride=tdiminfo[fast_dim].stride;
+ fast_dim_block=tdiminfo[fast_dim].block;
+ fast_dim_count=tdiminfo[fast_dim].count;
+ fast_dim_buf_off=slab[fast_dim]*fast_dim_stride;
+ fast_dim_offset=fast_dim_start+file_space->select.offset[fast_dim];
+
/* Read in data until an entire sequence can't be read in any longer */
while(num_read<nelmts) {
/* Check if we are running out of room in the buffer */
@@ -1116,7 +1131,7 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
else {
/* Read in the sequence */
if (H5F_seq_read(f, dxpl_id, layout, pline, fill, efl, file_space,
- elmt_size, buf_size, 0, last_buf_off, buf/*out*/)<0) {
+ elmt_size, buf_size, last_buf_off, buf/*out*/)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error");
} /* end if */
@@ -1133,67 +1148,63 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
/* Increment the count read */
num_read+=actual_read;
- /* Decrement the number of elements left in selection */
- file_iter->hyp.elmt_left-=actual_read;
+ /* Increment the offset and count for the fastest changing dimension */
+
+ /* Move to the next block in the current dimension */
+ /* Check for partial block read! */
+ if(actual_read<fast_dim_block) {
+ offset[fast_dim]+=actual_read;
+ buf_off+=actual_bytes;
+ continue; /* don't bother checking slower dimensions */
+ } /* end if */
+ else {
+ offset[fast_dim]+=fast_dim_stride; /* reset the offset in the fastest dimension */
+ buf_off+=fast_dim_buf_off;
+ tmp_count[fast_dim]++;
+ } /* end else */
- /* Increment the offset and count */
- temp_dim=fast_dim;
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[fast_dim]<fast_dim_count)
+ continue; /* don't bother checking slower dimensions */
+ else {
+ tmp_count[fast_dim]=0; /* reset back to the beginning of the line */
+ offset[fast_dim]=fast_dim_offset;
+
+ /* Re-compute the initial buffer offset */
+ for(i=0,buf_off=0; i<ndims; i++)
+ buf_off+=offset[i]*slab[i];
+ } /* end else */
+
+ /* Increment the offset and count for the other dimensions */
+ temp_dim=fast_dim-1;
while(temp_dim>=0) {
- if(temp_dim==fast_dim) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ buf_off+=slab[temp_dim];
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim]<tdiminfo[temp_dim].block)
+ break;
+ else {
/* Move to the next block in the current dimension */
- /* Check for partial block read! */
- if(actual_read<file_space->select.sel_info.hslab.diminfo[fast_dim].block) {
- offset[temp_dim]+=actual_read;
- buf_off+=actual_bytes;
- break;
- } /* end if */
- else {
- offset[temp_dim]+=file_space->select.sel_info.hslab.diminfo[temp_dim].stride; /* reset the offset in the fastest dimension */
- buf_off+=slab[temp_dim]*file_space->select.sel_info.hslab.diminfo[temp_dim].stride;
- tmp_count[temp_dim]++;
- } /* end else */
+ offset[temp_dim]+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block);
+ buf_off+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block)*slab[temp_dim];
+ tmp_block[temp_dim]=0;
+ tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<file_space->select.sel_info.hslab.diminfo[temp_dim].count)
+ if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
break;
else {
tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- offset[temp_dim]=file_space->select.sel_info.hslab.diminfo[temp_dim].start+file_space->select.offset[temp_dim];
+ tmp_block[temp_dim]=0;
+ offset[temp_dim]=tdiminfo[temp_dim].start+file_space->select.offset[temp_dim];
/* Re-compute the initial buffer offset */
for(i=0,buf_off=0; i<ndims; i++)
buf_off+=offset[i]*slab[i];
- } /* end else */
- } /* end if */
- else {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- buf_off+=slab[temp_dim];
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim]<file_space->select.sel_info.hslab.diminfo[temp_dim].block)
- break;
- else {
- /* Move to the next block in the current dimension */
- offset[temp_dim]+=(file_space->select.sel_info.hslab.diminfo[temp_dim].stride-file_space->select.sel_info.hslab.diminfo[temp_dim].block);
- buf_off+=(file_space->select.sel_info.hslab.diminfo[temp_dim].stride-file_space->select.sel_info.hslab.diminfo[temp_dim].block)*slab[temp_dim];
- tmp_block[temp_dim]=0;
- tmp_count[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<file_space->select.sel_info.hslab.diminfo[temp_dim].count)
- break;
- else {
- tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- tmp_block[temp_dim]=0;
- offset[temp_dim]=file_space->select.sel_info.hslab.diminfo[temp_dim].start+file_space->select.offset[temp_dim];
-
- /* Re-compute the initial buffer offset */
- for(i=0,buf_off=0; i<ndims; i++)
- buf_off+=offset[i]*slab[i];
- }
- } /* end else */
+ }
} /* end else */
/* Decrement dimension count */
@@ -1205,7 +1216,7 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
if(last_buf_off>=0) {
/* Read in the sequence */
if (H5F_seq_read(f, dxpl_id, layout, pline, fill, efl, file_space,
- elmt_size, buf_size, 0, last_buf_off, buf/*out*/)<0) {
+ elmt_size, buf_size, last_buf_off, buf/*out*/)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error");
} /* end if */
} /* end if */
@@ -1214,6 +1225,9 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
HDmemcpy(file_iter->hyp.pos, offset, ndims*sizeof(hssize_t));
} /* end if */
+ /* Decrement the number of elements left in selection */
+ file_iter->hyp.elmt_left-=num_read;
+
FUNC_LEAVE (num_read);
} /* H5S_hyper_fread_opt() */
@@ -1501,6 +1515,13 @@ H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout,
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary block count */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block offset */
const uint8_t *buf=(const uint8_t *)_buf; /* Alias for pointer arithmetic */
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ hssize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ fast_dim_offset;
+ hsize_t fast_dim_stride, /* Local copies of fastest changing dimension info */
+ fast_dim_block,
+ fast_dim_count,
+ fast_dim_buf_off;
intn fast_dim; /* Rank of the fastest changing dimension for the dataspace */
intn temp_dim; /* Temporary rank holder */
hsize_t acc; /* Accumulator */
@@ -1567,7 +1588,7 @@ printf("%s: Check 1.0\n",FUNC);
/* Read in the rest of the sequence */
if (H5F_seq_write(f, dxpl_id, layout, pline, fill, efl, file_space,
- elmt_size, actual_bytes, 0, buf_off, buf)<0) {
+ elmt_size, actual_bytes, buf_off, buf)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_WRITEERROR, 0, "write error");
}
@@ -1577,9 +1598,6 @@ printf("%s: Check 1.0\n",FUNC);
/* Increment the count write */
num_write+=actual_write;
- /* Decrement the number of elements left in selection */
- file_iter->hyp.elmt_left-=actual_write;
-
/* Advance the point iterator */
/* If we had enough buffer space to write out the rest of the sequence
* in the fastest changing dimension, move the iterator offset to
@@ -1642,6 +1660,17 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
last_buf_off=-1;
buf_size=0;
+ /* Set the local copy of the diminfo pointer */
+ tdiminfo=file_space->select.sel_info.hslab.diminfo;
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_start=tdiminfo[fast_dim].start;
+ fast_dim_stride=tdiminfo[fast_dim].stride;
+ fast_dim_block=tdiminfo[fast_dim].block;
+ fast_dim_count=tdiminfo[fast_dim].count;
+ fast_dim_buf_off=slab[fast_dim]*fast_dim_stride;
+ fast_dim_offset=fast_dim_start+file_space->select.offset[fast_dim];
+
/* Read in data until an entire sequence can't be written out any longer */
while(num_write<nelmts) {
/* Check if we are running out of room in the buffer */
@@ -1674,7 +1703,7 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
else {
/* Write out the sequence */
if (H5F_seq_write(f, dxpl_id, layout, pline, fill, efl, file_space,
- elmt_size, buf_size, 0, last_buf_off, buf)<0) {
+ elmt_size, buf_size, last_buf_off, buf)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_WRITEERROR, 0, "write error");
} /* end if */
@@ -1691,67 +1720,63 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
/* Increment the count write */
num_write+=actual_write;
- /* Decrement the number of elements left in selection */
- file_iter->hyp.elmt_left-=actual_write;
+ /* Increment the offset and count for the fastest changing dimension */
+
+ /* Move to the next block in the current dimension */
+ /* Check for partial block write! */
+ if(actual_write<fast_dim_block) {
+ offset[fast_dim]+=actual_write;
+ buf_off+=actual_bytes;
+ continue; /* don't bother checking slower dimensions */
+ } /* end if */
+ else {
+ offset[fast_dim]+=fast_dim_stride; /* reset the offset in the fastest dimension */
+ buf_off+=fast_dim_buf_off;
+ tmp_count[fast_dim]++;
+ } /* end else */
- /* Increment the offset and count */
- temp_dim=fast_dim;
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[fast_dim]<fast_dim_count)
+ continue; /* don't bother checking slower dimensions */
+ else {
+ tmp_count[fast_dim]=0; /* reset back to the beginning of the line */
+ offset[fast_dim]=fast_dim_offset;
+
+ /* Re-compute the initial buffer offset */
+ for(i=0,buf_off=0; i<ndims; i++)
+ buf_off+=offset[i]*slab[i];
+ } /* end else */
+
+ /* Increment the offset and count for the other dimensions */
+ temp_dim=fast_dim-1;
while(temp_dim>=0) {
- if(temp_dim==fast_dim) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ buf_off+=slab[temp_dim];
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim]<tdiminfo[temp_dim].block)
+ break;
+ else {
/* Move to the next block in the current dimension */
- /* Check for partial block write! */
- if(actual_write<file_space->select.sel_info.hslab.diminfo[fast_dim].block) {
- offset[temp_dim]+=actual_write;
- buf_off+=actual_bytes;
- break;
- } /* end if */
- else {
- offset[temp_dim]+=file_space->select.sel_info.hslab.diminfo[temp_dim].stride; /* reset the offset in the fastest dimension */
- buf_off+=slab[temp_dim]*file_space->select.sel_info.hslab.diminfo[temp_dim].stride;
- tmp_count[temp_dim]++;
- } /* end else */
+ offset[temp_dim]+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block);
+ buf_off+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block)*slab[temp_dim];
+ tmp_block[temp_dim]=0;
+ tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<file_space->select.sel_info.hslab.diminfo[temp_dim].count)
+ if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
break;
else {
tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- offset[temp_dim]=file_space->select.sel_info.hslab.diminfo[temp_dim].start+file_space->select.offset[temp_dim];
+ tmp_block[temp_dim]=0;
+ offset[temp_dim]=tdiminfo[temp_dim].start+file_space->select.offset[temp_dim];
/* Re-compute the initial buffer offset */
for(i=0,buf_off=0; i<ndims; i++)
buf_off+=offset[i]*slab[i];
- } /* end else */
- } /* end if */
- else {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- buf_off+=slab[temp_dim];
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim]<file_space->select.sel_info.hslab.diminfo[temp_dim].block)
- break;
- else {
- /* Move to the next block in the current dimension */
- offset[temp_dim]+=(file_space->select.sel_info.hslab.diminfo[temp_dim].stride-file_space->select.sel_info.hslab.diminfo[temp_dim].block);
- buf_off+=(file_space->select.sel_info.hslab.diminfo[temp_dim].stride-file_space->select.sel_info.hslab.diminfo[temp_dim].block)*slab[temp_dim];
- tmp_block[temp_dim]=0;
- tmp_count[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<file_space->select.sel_info.hslab.diminfo[temp_dim].count)
- break;
- else {
- tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- tmp_block[temp_dim]=0;
- offset[temp_dim]=file_space->select.sel_info.hslab.diminfo[temp_dim].start+file_space->select.offset[temp_dim];
-
- /* Re-compute the initial buffer offset */
- for(i=0,buf_off=0; i<ndims; i++)
- buf_off+=offset[i]*slab[i];
- }
- } /* end else */
+ }
} /* end else */
/* Decrement dimension count */
@@ -1763,7 +1788,7 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
if(last_buf_off>=0) {
/* Write out the sequence */
if (H5F_seq_write(f, dxpl_id, layout, pline, fill, efl, file_space,
- elmt_size, buf_size, 0, last_buf_off, buf)<0) {
+ elmt_size, buf_size, last_buf_off, buf)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_WRITEERROR, 0, "write error");
} /* end if */
} /* end if */
@@ -1772,6 +1797,9 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
HDmemcpy(file_iter->hyp.pos, offset, ndims*sizeof(hssize_t));
} /* end if */
+ /* Decrement the number of elements left in selection */
+ file_iter->hyp.elmt_left-=num_write;
+
FUNC_LEAVE (num_write);
} /* H5S_hyper_fwrite_opt() */
@@ -2032,6 +2060,13 @@ H5S_hyper_mread_opt (const void *_buf, size_t elmt_size,
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block offset */
const uint8_t *src=(const uint8_t *)_buf; /* Alias for pointer arithmetic */
uint8_t *dst=(uint8_t *)_tconv_buf; /* Alias for pointer arithmetic */
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ hssize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ fast_dim_offset;
+ hsize_t fast_dim_stride, /* Local copies of fastest changing dimension info */
+ fast_dim_block,
+ fast_dim_count,
+ fast_dim_buf_off;
intn fast_dim; /* Rank of the fastest changing dimension for the dataspace */
intn temp_dim; /* Temporary rank holder */
hsize_t acc; /* Accumulator */
@@ -2105,14 +2140,11 @@ printf("%s: Check 1.0\n",FUNC);
HDmemcpy(dst,src+buf_off,actual_bytes);
/* Increment the offset of the buffer */
- dst+=elmt_size*actual_read;
+ dst+=actual_bytes;
/* Increment the count read */
num_read+=actual_read;
- /* Decrement the number of elements left in selection */
- mem_iter->hyp.elmt_left-=actual_read;
-
/* Advance the point iterator */
/* If we had enough buffer space to read in the rest of the sequence
* in the fastest changing dimension, move the iterator offset to
@@ -2175,6 +2207,17 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
(int)i,(int)mem_space->select.sel_info.hslab.diminfo[i].count);
#endif /* QAK */
+ /* Set the local copy of the diminfo pointer */
+ tdiminfo=mem_space->select.sel_info.hslab.diminfo;
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_start=tdiminfo[fast_dim].start;
+ fast_dim_stride=tdiminfo[fast_dim].stride;
+ fast_dim_block=tdiminfo[fast_dim].block;
+ fast_dim_count=tdiminfo[fast_dim].count;
+ fast_dim_buf_off=slab[fast_dim]*fast_dim_stride;
+ fast_dim_offset=fast_dim_start+mem_space->select.offset[fast_dim];
+
/* Read in data until an entire sequence can't be written out any longer */
while(num_read<nelmts) {
/* Check if we are running out of room in the buffer */
@@ -2193,72 +2236,68 @@ for(i=0; i<mem_space->extent.u.simple.rank; i++)
HDmemcpy(dst,src+buf_off,actual_bytes);
/* Increment the offset of the buffer */
- dst+=elmt_size*actual_read;
+ dst+=actual_bytes;
/* Increment the count read */
num_read+=actual_read;
- /* Decrement the number of elements left in selection */
- mem_iter->hyp.elmt_left-=actual_read;
+ /* Increment the offset and count for the fastest changing dimension */
+
+ /* Move to the next block in the current dimension */
+ /* Check for partial block read! */
+ if(actual_read<fast_dim_block) {
+ offset[fast_dim]+=actual_read;
+ buf_off+=actual_bytes;
+ continue; /* don't bother checking slower dimensions */
+ } /* end if */
+ else {
+ offset[fast_dim]+=fast_dim_stride; /* reset the offset in the fastest dimension */
+ buf_off+=fast_dim_buf_off;
+ tmp_count[fast_dim]++;
+ } /* end else */
- /* Increment the offset and count */
- temp_dim=fast_dim;
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[fast_dim]<fast_dim_count)
+ continue; /* don't bother checking slower dimensions */
+ else {
+ tmp_count[fast_dim]=0; /* reset back to the beginning of the line */
+ offset[fast_dim]=fast_dim_offset;
+
+ /* Re-compute the initial buffer offset */
+ for(i=0,buf_off=0; i<ndims; i++)
+ buf_off+=offset[i]*slab[i];
+ } /* end else */
+
+ /* Increment the offset and count for the other dimensions */
+ temp_dim=fast_dim-1;
while(temp_dim>=0) {
- if(temp_dim==fast_dim) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ buf_off+=slab[temp_dim];
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim]<tdiminfo[temp_dim].block)
+ break;
+ else {
/* Move to the next block in the current dimension */
- /* Check for partial block read! */
- if(actual_read<mem_space->select.sel_info.hslab.diminfo[fast_dim].block) {
- offset[temp_dim]+=actual_read;
- buf_off+=actual_bytes;
- break;
- } /* end if */
- else {
- offset[temp_dim]+=mem_space->select.sel_info.hslab.diminfo[temp_dim].stride; /* reset the offset in the fastest dimension */
- buf_off+=slab[temp_dim]*mem_space->select.sel_info.hslab.diminfo[temp_dim].stride;
- tmp_count[temp_dim]++;
- } /* end else */
+ offset[temp_dim]+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block);
+ buf_off+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block)*slab[temp_dim];
+ tmp_block[temp_dim]=0;
+ tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<mem_space->select.sel_info.hslab.diminfo[temp_dim].count)
+ if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
break;
else {
tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- offset[temp_dim]=mem_space->select.sel_info.hslab.diminfo[temp_dim].start+mem_space->select.offset[temp_dim];
+ tmp_block[temp_dim]=0;
+ offset[temp_dim]=tdiminfo[temp_dim].start+mem_space->select.offset[temp_dim];
/* Re-compute the initial buffer offset */
for(i=0,buf_off=0; i<ndims; i++)
buf_off+=offset[i]*slab[i];
- } /* end else */
- } /* end if */
- else {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- buf_off+=slab[temp_dim];
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim]<mem_space->select.sel_info.hslab.diminfo[temp_dim].block)
- break;
- else {
- /* Move to the next block in the current dimension */
- offset[temp_dim]+=(mem_space->select.sel_info.hslab.diminfo[temp_dim].stride-mem_space->select.sel_info.hslab.diminfo[temp_dim].block);
- buf_off+=(mem_space->select.sel_info.hslab.diminfo[temp_dim].stride-mem_space->select.sel_info.hslab.diminfo[temp_dim].block)*slab[temp_dim];
- tmp_block[temp_dim]=0;
- tmp_count[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<mem_space->select.sel_info.hslab.diminfo[temp_dim].count)
- break;
- else {
- tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- tmp_block[temp_dim]=0;
- offset[temp_dim]=mem_space->select.sel_info.hslab.diminfo[temp_dim].start+mem_space->select.offset[temp_dim];
-
- /* Re-compute the initial buffer offset */
- for(i=0,buf_off=0; i<ndims; i++)
- buf_off+=offset[i]*slab[i];
- }
- } /* end else */
+ }
} /* end else */
/* Decrement dimension count */
@@ -2270,6 +2309,9 @@ for(i=0; i<mem_space->extent.u.simple.rank; i++)
HDmemcpy(mem_iter->hyp.pos, offset, ndims*sizeof(hssize_t));
} /* end if */
+ /* Decrement the number of elements left in selection */
+ mem_iter->hyp.elmt_left-=num_read;
+
FUNC_LEAVE (num_read);
} /* end H5S_hyper_mread_opt() */
@@ -2525,6 +2567,13 @@ H5S_hyper_mwrite_opt (const void *_tconv_buf, size_t elmt_size,
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block offset */
const uint8_t *src=(const uint8_t *)_tconv_buf; /* Alias for pointer arithmetic */
uint8_t *dst=(uint8_t *)_buf; /* Alias for pointer arithmetic */
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ hssize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ fast_dim_offset;
+ hsize_t fast_dim_stride, /* Local copies of fastest changing dimension info */
+ fast_dim_block,
+ fast_dim_count,
+ fast_dim_buf_off;
intn fast_dim; /* Rank of the fastest changing dimension for the dataspace */
intn temp_dim; /* Temporary rank holder */
hsize_t acc; /* Accumulator */
@@ -2599,14 +2648,11 @@ printf("%s: Check 1.0\n",FUNC);
HDmemcpy(dst+buf_off,src,actual_bytes);
/* Increment the offset of the buffer */
- src+=elmt_size*actual_write;
+ src+=actual_bytes;
/* Increment the count write */
num_write+=actual_write;
- /* Decrement the number of elements left in selection */
- mem_iter->hyp.elmt_left-=actual_write;
-
/* Advance the point iterator */
/* If we had enough buffer space to write out the rest of the sequence
* in the fastest changing dimension, move the iterator offset to
@@ -2669,6 +2715,17 @@ for(i=0; i<file_space->extent.u.simple.rank; i++)
(int)i,(int)mem_space->select.sel_info.hslab.diminfo[i].count);
#endif /* QAK */
+ /* Set the local copy of the diminfo pointer */
+ tdiminfo=mem_space->select.sel_info.hslab.diminfo;
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_start=tdiminfo[fast_dim].start;
+ fast_dim_stride=tdiminfo[fast_dim].stride;
+ fast_dim_block=tdiminfo[fast_dim].block;
+ fast_dim_count=tdiminfo[fast_dim].count;
+ fast_dim_buf_off=slab[fast_dim]*fast_dim_stride;
+ fast_dim_offset=fast_dim_start+mem_space->select.offset[fast_dim];
+
/* Read in data until an entire sequence can't be written out any longer */
while(num_write<nelmts) {
/* Check if we are running out of room in the buffer */
@@ -2691,72 +2748,68 @@ printf("%s: buf_off=%u, actual_bytes=%u\n",FUNC,(unsigned)buf_off,(int)actual_by
#endif /* QAK */
/* Increment the offset of the buffer */
- src+=elmt_size*actual_write;
+ src+=actual_bytes;
/* Increment the count write */
num_write+=actual_write;
- /* Decrement the number of elements left in selection */
- mem_iter->hyp.elmt_left-=actual_write;
+ /* Increment the offset and count for the fastest changing dimension */
+
+ /* Move to the next block in the current dimension */
+ /* Check for partial block write! */
+ if(actual_write<fast_dim_block) {
+ offset[fast_dim]+=actual_write;
+ buf_off+=actual_bytes;
+ continue; /* don't bother checking slower dimensions */
+ } /* end if */
+ else {
+ offset[fast_dim]+=fast_dim_stride; /* reset the offset in the fastest dimension */
+ buf_off+=fast_dim_buf_off;
+ tmp_count[fast_dim]++;
+ } /* end else */
- /* Increment the offset and count */
- temp_dim=fast_dim;
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[fast_dim]<fast_dim_count)
+ continue; /* don't bother checking slower dimensions */
+ else {
+ tmp_count[fast_dim]=0; /* reset back to the beginning of the line */
+ offset[fast_dim]=fast_dim_offset;
+
+ /* Re-compute the initial buffer offset */
+ for(i=0,buf_off=0; i<ndims; i++)
+ buf_off+=offset[i]*slab[i];
+ } /* end else */
+
+ /* Increment the offset and count for the other dimensions */
+ temp_dim=fast_dim-1;
while(temp_dim>=0) {
- if(temp_dim==fast_dim) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ buf_off+=slab[temp_dim];
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim]<tdiminfo[temp_dim].block)
+ break;
+ else {
/* Move to the next block in the current dimension */
- /* Check for partial block write! */
- if(actual_write<mem_space->select.sel_info.hslab.diminfo[fast_dim].block) {
- offset[temp_dim]+=actual_write;
- buf_off+=actual_bytes;
- break;
- } /* end if */
- else {
- offset[temp_dim]+=mem_space->select.sel_info.hslab.diminfo[temp_dim].stride; /* reset the offset in the fastest dimension */
- buf_off+=slab[temp_dim]*mem_space->select.sel_info.hslab.diminfo[temp_dim].stride;
- tmp_count[temp_dim]++;
- } /* end else */
+ offset[temp_dim]+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block);
+ buf_off+=(tdiminfo[temp_dim].stride-tdiminfo[temp_dim].block)*slab[temp_dim];
+ tmp_block[temp_dim]=0;
+ tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<mem_space->select.sel_info.hslab.diminfo[temp_dim].count)
+ if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
break;
else {
tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- offset[temp_dim]=mem_space->select.sel_info.hslab.diminfo[temp_dim].start+mem_space->select.offset[temp_dim];
+ tmp_block[temp_dim]=0;
+ offset[temp_dim]=tdiminfo[temp_dim].start+mem_space->select.offset[temp_dim];
/* Re-compute the initial buffer offset */
for(i=0,buf_off=0; i<ndims; i++)
buf_off+=offset[i]*slab[i];
- } /* end else */
- } /* end if */
- else {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- buf_off+=slab[temp_dim];
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim]<mem_space->select.sel_info.hslab.diminfo[temp_dim].block)
- break;
- else {
- /* Move to the next block in the current dimension */
- offset[temp_dim]+=(mem_space->select.sel_info.hslab.diminfo[temp_dim].stride-mem_space->select.sel_info.hslab.diminfo[temp_dim].block);
- buf_off+=(mem_space->select.sel_info.hslab.diminfo[temp_dim].stride-mem_space->select.sel_info.hslab.diminfo[temp_dim].block)*slab[temp_dim];
- tmp_block[temp_dim]=0;
- tmp_count[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<mem_space->select.sel_info.hslab.diminfo[temp_dim].count)
- break;
- else {
- tmp_count[temp_dim]=0; /* reset back to the beginning of the line */
- tmp_block[temp_dim]=0;
- offset[temp_dim]=mem_space->select.sel_info.hslab.diminfo[temp_dim].start+mem_space->select.offset[temp_dim];
-
- /* Re-compute the initial buffer offset */
- for(i=0,buf_off=0; i<ndims; i++)
- buf_off+=offset[i]*slab[i];
- }
- } /* end else */
+ }
} /* end else */
/* Decrement dimension count */
@@ -2768,6 +2821,9 @@ printf("%s: buf_off=%u, actual_bytes=%u\n",FUNC,(unsigned)buf_off,(int)actual_by
HDmemcpy(mem_iter->hyp.pos, offset, ndims*sizeof(hssize_t));
} /* end if */
+ /* Decrement the number of elements left in selection */
+ mem_iter->hyp.elmt_left-=num_write;
+
FUNC_LEAVE (num_write);
} /* end H5S_hyper_mwrite_opt() */