From 150fb83345bbf9ff6659231ba3f5bcdd536fb35c Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Sat, 6 Mar 2021 03:34:25 +0100 Subject: fix block coordinate printing example (#437) --- examples/h5_vds.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/h5_vds.c b/examples/h5_vds.c index 6bef06f..e036204 100644 --- a/examples/h5_vds.c +++ b/examples/h5_vds.c @@ -60,7 +60,7 @@ main(void) hsize_t start_out[2], stride_out[2], count_out[2], block_out[2]; int wdata[DIM0], /* Write buffer for source dataset */ rdata[VDSDIM0][VDSDIM1], /* Read buffer for virtual dataset */ - i, j, k, l; + i, j, k, l, block_inc; int fill_value = -1; /* Fill value for VDS */ H5D_layout_t layout; /* Storage layout */ size_t num_map; /* Number of mappings */ @@ -178,13 +178,14 @@ main(void) buf = (hsize_t *)malloc(sizeof(hsize_t) * 2 * RANK2 * nblocks); status = H5Sget_select_hyper_blocklist(vspace, (hsize_t)0, nblocks, buf); for (l = 0; l < nblocks; l++) { + block_inc = 2 * RANK2 * l; printf("("); for (k = 0; k < RANK2 - 1; k++) - printf("%d,", (int)buf[k]); - printf("%d ) - (", (int)buf[k]); + printf("%d,", (int)buf[block_inc + k]); + printf("%d) - (", (int)buf[block_inc + k]); for (k = 0; k < RANK2 - 1; k++) - printf("%d,", (int)buf[RANK2 + k]); - printf("%d)\n", (int)buf[RANK2 + k]); + printf("%d,", (int)buf[block_inc + RANK2 + k]); + printf("%d)\n", (int)buf[block_inc + RANK2 + k]); } /* We also can use new APIs to get start, stride, count and block */ if (H5Sis_regular_hyperslab(vspace)) { -- cgit v0.12