summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_str.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5tools_str.c')
-rw-r--r--tools/lib/h5tools_str.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index f5a1690..32fea3d 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -310,10 +310,12 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
char *
h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5dump_t *info,
hsize_t elmtno, int ndims, hsize_t min_idx[],
- hsize_t max_idx[])
+ hsize_t max_idx[], h5tools_context_t *ctx)
{
hsize_t p_prod[H5S_MAX_RANK], p_idx[H5S_MAX_RANK];
hsize_t n, i = 0;
+ hsize_t curr_pos=elmtno;
+
h5tools_str_reset(str);
@@ -330,6 +332,14 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5dump_t *info,
p_idx[i] = n / p_prod[i] + min_idx[i];
n %= p_prod[i];
}
+
+
+ for ( i = 0; i < (hsize_t)ndims; i++)
+ {
+ ctx->pos[i] = curr_pos/ctx->acc[i];
+ curr_pos -= ctx->acc[i]*ctx->pos[i];
+ }
+ assert( curr_pos == 0 );
/* Print the index values */
for (i = 0; i < (hsize_t)ndims; i++) {
@@ -337,7 +347,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5dump_t *info,
h5tools_str_append(str, "%s", OPT(info->idx_sep, ","));
h5tools_str_append(str, OPT(info->idx_n_fmt, "%lu"),
- (unsigned long)p_idx[i]);
+ (unsigned long)ctx->pos[i]);
}
} else {
/* Scalar */