summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5diff_array.c
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-02-25 21:12:57 (GMT)
committerGitHub <noreply@github.com>2021-02-25 21:12:57 (GMT)
commitc7ffe683e57fd8822fcf04320cf0500454486e53 (patch)
tree416e84f9adfbc32a9499b4dfff9f215a24684500 /tools/lib/h5diff_array.c
parentc29e1b9fdfcba9ca276600b1bad4ec2cf17bb01e (diff)
downloadhdf5-c7ffe683e57fd8822fcf04320cf0500454486e53.zip
hdf5-c7ffe683e57fd8822fcf04320cf0500454486e53.tar.gz
hdf5-c7ffe683e57fd8822fcf04320cf0500454486e53.tar.bz2
Primary change is HDFFV-11212 - new refs and JNI (#372)
* OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments
Diffstat (limited to 'tools/lib/h5diff_array.c')
-rw-r--r--tools/lib/h5diff_array.c92
1 files changed, 55 insertions, 37 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index f28c1bc..f97ef50 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -3362,48 +3362,66 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
hsize_t curr_pos = idx;
parallel_print("[ ");
- H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", i, opts->hs_nelmts, opts->err_stat);
+ H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", idx, opts->hs_nelmts,
+ opts->err_stat);
if (opts->sset[0] != NULL) {
/* Subsetting is used - calculate total position */
- hsize_t elmnt_cnt = 1;
- hsize_t dim_cnt = 0; /* previous dim size */
- hsize_t str_cnt = 0; /* previous dim stride */
- hsize_t curr_idx = idx; /* calculated running position */
- hsize_t str_idx = 0;
- hsize_t blk_idx = 0;
- hsize_t cnt_idx = 0;
- hsize_t hs_idx = 0;
- j = opts->rank - 1;
+ hsize_t prev_dim_size = 0; /* previous dim size */
+ hsize_t prev_str = 0; /* previouw stride idx*/
+ hsize_t str_cnt = 0; /* stride multiplier*/
+ hsize_t curr_idx = 0; /* calculated running position */
+ hsize_t str_idx = 0;
+ hsize_t blk_idx = 0;
+ hsize_t cnt_idx = 0;
+ hsize_t dim_size = 0; /* current dim size */
+ hsize_t elmnt_cnt = 1;
+ hsize_t next_idx = idx;
+ hsize_t data_idx = 0;
+ j = opts->rank - 1;
+ H5TOOLS_DEBUG("...begin:%ld=> opts->rank:%ld (idx:%ld)", j, opts->rank, idx);
do {
- cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - count:%ld", j,
- curr_pos, curr_idx, cnt_idx);
- blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - block:%ld", j,
- curr_pos, curr_idx, blk_idx);
- hs_idx = cnt_idx * blk_idx; /* hyperslab area value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - hs:%ld", j, curr_pos,
- curr_idx, hs_idx);
- str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - stride:%ld", j,
- curr_pos, curr_idx, str_idx);
- elmnt_cnt *= opts->dims[j]; /* Total number of elements in dimension */
- H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld", j, elmnt_cnt);
- if (str_idx > blk_idx)
- curr_idx += dim_cnt * (str_idx - blk_idx); /* */
- else if (curr_idx >= hs_idx)
- curr_idx += dim_cnt * str_cnt;
- H5TOOLS_DEBUG("... sset loop:%d with idx:%ld (curr_idx:%ld) - stride:%ld", j, idx,
- curr_idx, str_idx);
- dim_cnt = elmnt_cnt; /* */
- if (str_idx > blk_idx)
- str_cnt = str_idx - blk_idx; /* */
- else
- str_cnt = str_idx; /* */
- H5TOOLS_DEBUG("... sset loop:%d with dim_cnt:%ld - str_cnt:%ld", j, dim_cnt, str_cnt);
+ curr_idx = next_idx; /* New current data position */
+ cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */
+ blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */
+ str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */
+ H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - c:%ld b:%ld s:%ld", j,
+ curr_pos, curr_idx, cnt_idx, blk_idx, str_idx);
+ dim_size = opts->dims[j]; /* Current dimension size */
+ // elmnt_cnt *= dim_size; /* Total number of elements in dimension */
+ H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld - (prev_dim_size:%ld - dim_size:%ld) "
+ "- str_cnt:%ld",
+ j, elmnt_cnt, prev_dim_size, dim_size, str_cnt);
+ data_idx = elmnt_cnt * dim_size;
+ H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (data_idx:%ld)", j, curr_pos, data_idx);
+ for (i = 0; i < cnt_idx; i++) {
+ H5TOOLS_DEBUG("... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld (curr_idx:%ld - "
+ "data_idx:%ld)",
+ i, cnt_idx, str_cnt, curr_idx, data_idx);
+ if (curr_idx >= data_idx) {
+ /* get to next block */
+ data_idx += str_idx * dim_size;
+ /* get next block */
+ str_cnt++;
+ H5TOOLS_DEBUG(
+ "... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld - data_idx:%ld", i,
+ cnt_idx, str_cnt, data_idx);
+ }
+ H5TOOLS_DEBUG("... ... end data loop:%d with dim_cnt:%ld - str_cnt:%ld - "
+ "(curr_idx:%ld - data_idx:%ld)",
+ i, dim_size, str_cnt, curr_idx, data_idx);
+ }
+ next_idx += dim_size * str_cnt; // + prev_dim_size;
+ H5TOOLS_DEBUG("... sset loop:%d with curr_idx:%ld (next_idx:%ld)", j, curr_idx, next_idx);
+ str_cnt = 0;
+ prev_str = str_idx;
+ prev_dim_size = dim_size;
+ H5TOOLS_DEBUG("... end sset loop:%d with prev_dim_size:%ld (curr_idx:%ld - data_idx:%ld) "
+ "- str_cnt:%ld",
+ j, prev_dim_size, curr_idx, data_idx, str_cnt);
+ elmnt_cnt *= dim_size; /* Total number of elements in dimension */
j--;
- } while (curr_idx >= elmnt_cnt && j >= 0);
+ } while (next_idx >= elmnt_cnt && j >= 0);
curr_pos = curr_idx; /* New current position */
H5TOOLS_DEBUG("pos loop:%d,%d with elmnt_cnt:%ld - curr_pos:%ld", i, j, elmnt_cnt, curr_pos);
} /* if (opts->sset[0] != NULL) */