mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
[svn-r10738] Purpose:
bug fix 366 Description: the printing of the array indices was done relatively to the stripmine data (data read by hyperslabs when its memory requiremnts are too large) this was causing an incorrect numbering of the array indices (the next read would initialize the indices to zero) Solution: added a field to the print context that keeps track of the stripmine position and pass to the rendering function the total element position Platforms tested: Linux Misc. update:
This commit is contained in:
parent
bbe03d7361
commit
1b313aa2f6
@ -541,6 +541,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
|
||||
size_t ncols = 80; /*available output width */
|
||||
h5tools_str_t buffer; /*string into which to render */
|
||||
int multiline; /*datum was multiline */
|
||||
hsize_t curr_pos; /* total data element position */
|
||||
int elmt_counter = 0;/*counts the # elements printed.
|
||||
*I (ptl?) needed something that
|
||||
*isn't going to get reset when a new
|
||||
@ -659,7 +660,12 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
|
||||
if (secnum)
|
||||
multiline++;
|
||||
|
||||
h5tools_simple_prefix(stream, info, ctx, i, secnum);
|
||||
/* pass to the prefix the total position instead of the current
|
||||
stripmine position i; this is necessary to print the array
|
||||
indices */
|
||||
curr_pos = ctx->sm_pos + i;
|
||||
|
||||
h5tools_simple_prefix(stream, info, ctx, curr_pos, secnum);
|
||||
} else if ((i || ctx->continuation) && secnum == 0) {
|
||||
fputs(OPT(info->elmt_suf2, " "), stream);
|
||||
ctx->cur_column += strlen(OPT(info->elmt_suf2, " "));
|
||||
@ -994,6 +1000,11 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
|
||||
/* Print the data */
|
||||
flags = (elmtno == 0) ? START_OF_DATA : 0;
|
||||
flags |= ((elmtno + hs_nelmts) >= p_nelmts) ? END_OF_DATA : 0;
|
||||
|
||||
/* initialize the current stripmine position i; this is necessary to print the array
|
||||
indices */
|
||||
ctx.sm_pos = elmtno;
|
||||
|
||||
h5tools_dump_simple_data(stream, info, dset, &ctx, flags, hs_nelmts,
|
||||
p_type, sm_buf);
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
#define ESCAPE_HTML 1
|
||||
#define OPT(X,S) ((X) ? (X) : (S))
|
||||
#define OPTIONAL_LINE_BREAK "\001" /* Special strings embedded in the output */
|
||||
#define START_OF_DATA 0x0001
|
||||
#define END_OF_DATA 0x0002
|
||||
#define START_OF_DATA 0x0001
|
||||
#define END_OF_DATA 0x0002
|
||||
|
||||
/*
|
||||
* Information about how to format output.
|
||||
@ -399,23 +399,24 @@ typedef struct dump_header{
|
||||
} dump_header;
|
||||
|
||||
typedef struct h5tools_context_t {
|
||||
size_t cur_column; /*current column for output */
|
||||
size_t cur_elmt; /*current element/output line */
|
||||
int need_prefix; /*is line prefix needed? */
|
||||
int ndims; /*dimensionality */
|
||||
hsize_t p_min_idx[H5S_MAX_RANK]; /*min selected index */
|
||||
hsize_t p_max_idx[H5S_MAX_RANK]; /*max selected index */
|
||||
int prev_multiline; /*was prev datum multiline? */
|
||||
size_t prev_prefix_len;/*length of previous prefix */
|
||||
int continuation; /*continuation of previous data?*/
|
||||
hsize_t size_last_dim; /*the size of the last dimension,
|
||||
*needed so we can break after each
|
||||
*row */
|
||||
int indent_level; /*the number of times we need some
|
||||
*extra indentation */
|
||||
int default_indent_level; /*this is used when the indent level gets changed */
|
||||
hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
|
||||
hsize_t pos[H5S_MAX_RANK]; /* matrix position */
|
||||
size_t cur_column; /*current column for output */
|
||||
size_t cur_elmt; /*current element/output line */
|
||||
int need_prefix; /*is line prefix needed? */
|
||||
int ndims; /*dimensionality */
|
||||
hsize_t p_min_idx[H5S_MAX_RANK]; /*min selected index */
|
||||
hsize_t p_max_idx[H5S_MAX_RANK]; /*max selected index */
|
||||
int prev_multiline; /*was prev datum multiline? */
|
||||
size_t prev_prefix_len; /*length of previous prefix */
|
||||
int continuation; /*continuation of previous data?*/
|
||||
hsize_t size_last_dim; /*the size of the last dimension,
|
||||
*needed so we can break after each
|
||||
*row */
|
||||
int indent_level; /*the number of times we need some
|
||||
*extra indentation */
|
||||
int default_indent_level; /*this is used when the indent level gets changed */
|
||||
hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
|
||||
hsize_t pos[H5S_MAX_RANK]; /* matrix position */
|
||||
hsize_t sm_pos; /* current stripmine element position */
|
||||
} h5tools_context_t;
|
||||
|
||||
|
||||
@ -517,7 +518,7 @@ extern int h5tools_canreadf(const char* name,
|
||||
hid_t dcpl_id);
|
||||
extern int h5tools_can_encode(H5Z_filter_t filtn);
|
||||
|
||||
void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims);
|
||||
void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims);
|
||||
|
||||
|
||||
#endif /* H5TOOLS_H__ */
|
||||
#endif /* H5TOOLS_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user