summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2008-04-30 19:51:13 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2008-04-30 19:51:13 (GMT)
commitaec106e324ce20e5efb725c25a6a333c7970127b (patch)
tree234df369115a46b08037c5f385061cf58823e497 /tools/lib
parent5773fd34bc5adf59b4530d95ac9f0c0585902803 (diff)
downloadhdf5-aec106e324ce20e5efb725c25a6a333c7970127b.zip
hdf5-aec106e324ce20e5efb725c25a6a333c7970127b.tar.gz
hdf5-aec106e324ce20e5efb725c25a6a333c7970127b.tar.bz2
[svn-r14903] Undoing change committed in r14902.
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c217
-rw-r--r--tools/lib/h5diff_array.c276
-rw-r--r--tools/lib/h5diff_dset.c1369
-rw-r--r--tools/lib/h5diff_util.c268
-rw-r--r--tools/lib/h5tools.c42
5 files changed, 1132 insertions, 1040 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 4f4074f..9d64e44 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -47,7 +47,7 @@
int
print_objname (diff_opt_t * options, hsize_t nfound)
{
- return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0;
+ return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
@@ -186,15 +186,17 @@ hsize_t h5diff(const char *fname1,
const char *objname2,
diff_opt_t *options)
{
- trav_info_t *info1;
- trav_info_t *info2;
- hid_t file1_id = (-1), file2_id = (-1);
+ trav_info_t *info1=NULL;
+ trav_info_t *info2=NULL;
+ hid_t file1_id = (-1);
+ hid_t file2_id = (-1);
char filenames[2][1024];
hsize_t nfound = 0;
HDmemset(filenames, 0, 1024 * 2);
- if(options->m_quiet && (options->m_verbose || options->m_report)) {
+ if(options->m_quiet && (options->m_verbose || options->m_report))
+ {
printf("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
options->err_stat=1;
return 0;
@@ -206,9 +208,11 @@ hsize_t h5diff(const char *fname1,
*/
/* disable error reporting */
- H5E_BEGIN_TRY {
- /* Open the files */
- if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ H5E_BEGIN_TRY
+ {
+ /* open the files */
+ if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ {
printf("h5diff: <%s>: unable to open file\n", fname1);
options->err_stat = 1;
@@ -219,7 +223,8 @@ hsize_t h5diff(const char *fname1,
#endif
goto out;
} /* end if */
- if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
+ if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ {
printf("h5diff: <%s>: unable to open file\n", fname2);
options->err_stat = 1;
@@ -255,11 +260,12 @@ hsize_t h5diff(const char *fname1,
goto out;
} /* end if */
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* object name was supplied
*-------------------------------------------------------------------------
*/
- if(objname1) {
+ if( objname1 )
+ {
#ifdef H5_HAVE_PARALLEL
if(g_Parallel)
/* Let tasks know that they won't be needed */
@@ -267,22 +273,31 @@ hsize_t h5diff(const char *fname1,
#endif
assert(objname2);
options->cmn_objs = 1; /* eliminate warning */
- nfound = diff_compare(file1_id, fname1, objname1, info1,
- file2_id, fname2, objname2, info2,
+ nfound = diff_compare(file1_id,
+ fname1,
+ objname1,
+ info1,
+ file2_id,
+ fname2,
+ objname2,
+ info2,
options);
} /* end if */
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* compare all
*-------------------------------------------------------------------------
*/
- else {
+ else
+ {
#ifdef H5_HAVE_PARALLEL
- if(g_Parallel) {
+ if(g_Parallel)
+ {
int i;
- if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024)) {
+ if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024))
+ {
fprintf(stderr, "The parallel diff only supports path names up to 1024 characters\n");
MPI_Abort(MPI_COMM_WORLD, 0);
} /* end if */
@@ -295,7 +310,12 @@ hsize_t h5diff(const char *fname1,
MPI_Send(filenames, (1024 * 2), MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD);
} /* end if */
#endif
- nfound = diff_match(file1_id, info1, file2_id, info2, options);
+
+ nfound = diff_match(file1_id,
+ info1,
+ file2_id,
+ info2,
+ options);
} /* end else */
trav_info_free(info1);
@@ -303,7 +323,8 @@ hsize_t h5diff(const char *fname1,
out:
/* close */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(file1_id);
H5Fclose(file2_id);
} H5E_END_TRY;
@@ -332,22 +353,23 @@ out:
*-------------------------------------------------------------------------
*/
hsize_t diff_match(hid_t file1_id,
- trav_info_t * info1,
- hid_t file2_id,
- trav_info_t * info2,
- diff_opt_t * options)
+ trav_info_t *info1,
+ hid_t file2_id,
+ trav_info_t *info2,
+ diff_opt_t *options)
{
trav_table_t *table = NULL;
- size_t curr1, curr2;
- unsigned infile[2];
- hsize_t nfound = 0;
- unsigned i;
+ size_t curr1;
+ size_t curr2;
+ unsigned infile[2];
+ hsize_t nfound = 0;
+ unsigned i;
/*-------------------------------------------------------------------------
* build the list
*-------------------------------------------------------------------------
*/
- trav_table_init(&table);
+ trav_table_init( &table );
curr1 = 0;
curr2 = 0;
@@ -393,11 +415,12 @@ hsize_t diff_match(hid_t file1_id,
curr2++;
} /* end while */
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* print the list
*-------------------------------------------------------------------------
*/
- if(options->m_verbose) {
+ if(options->m_verbose)
+ {
printf("\n");
printf("file1 file2\n");
printf("---------------------------------------\n");
@@ -702,59 +725,64 @@ hsize_t diff_match(hid_t file1_id,
*-------------------------------------------------------------------------
*/
-hsize_t diff_compare (hid_t file1_id,
- const char *file1_name,
- const char *obj1_name,
- trav_info_t * info1,
- hid_t file2_id,
- const char *file2_name,
- const char *obj2_name,
- trav_info_t * info2,
- diff_opt_t * options)
+hsize_t diff_compare(hid_t file1_id,
+ const char *file1_name,
+ const char *obj1_name,
+ trav_info_t *info1,
+ hid_t file2_id,
+ const char *file2_name,
+ const char *obj2_name,
+ trav_info_t *info2,
+ diff_opt_t *options)
{
- int f1 = 0, f2 = 0;
- hsize_t nfound = 0;
-
- ssize_t i = h5trav_getindex (info1, obj1_name);
- ssize_t j = h5trav_getindex (info2, obj2_name);
-
- if (i == -1)
- {
- parallel_print ("Object <%s> could not be found in <%s>\n", obj1_name,
- file1_name);
- f1 = 1;
- }
- if (j == -1)
- {
- parallel_print ("Object <%s> could not be found in <%s>\n", obj2_name,
- file2_name);
- f2 = 1;
- }
- if (f1 || f2)
- {
- options->err_stat = 1;
- return 0;
- }
-
- /* use the name with "/" first, as obtained by iterator function */
- obj1_name = info1->paths[i].path;
- obj2_name = info2->paths[j].path;
-
- /* objects are not the same type */
- if (info1->paths[i].type != info2->paths[j].type)
- {
- if (options->m_verbose)
- parallel_print("Comparison not possible: <%s> is of type %s and <%s> is of type %s\n",
- obj1_name, get_type(info1->paths[i].type), obj2_name,
- get_type(info2->paths[j].type));
- options->not_cmp=1;
- return 0;
- }
-
- nfound =
- diff (file1_id, obj1_name, file2_id, obj2_name, options, info1->paths[i].type);
-
- return nfound;
+ int f1 = 0;
+ int f2 = 0;
+ hsize_t nfound = 0;
+
+ ssize_t i = h5trav_getindex (info1, obj1_name);
+ ssize_t j = h5trav_getindex (info2, obj2_name);
+
+ if (i == -1)
+ {
+ parallel_print ("Object <%s> could not be found in <%s>\n", obj1_name,
+ file1_name);
+ f1 = 1;
+ }
+ if (j == -1)
+ {
+ parallel_print ("Object <%s> could not be found in <%s>\n", obj2_name,
+ file2_name);
+ f2 = 1;
+ }
+ if (f1 || f2)
+ {
+ options->err_stat = 1;
+ return 0;
+ }
+
+ /* use the name with "/" first, as obtained by iterator function */
+ obj1_name = info1->paths[i].path;
+ obj2_name = info2->paths[j].path;
+
+ /* objects are not the same type */
+ if (info1->paths[i].type != info2->paths[j].type)
+ {
+ if (options->m_verbose)
+ parallel_print("Comparison not possible: <%s> is of type %s and <%s> is of type %s\n",
+ obj1_name, get_type(info1->paths[i].type), obj2_name,
+ get_type(info2->paths[j].type));
+ options->not_cmp=1;
+ return 0;
+ }
+
+ nfound = diff(file1_id,
+ obj1_name,
+ file2_id,
+ obj2_name,
+ options,
+ info1->paths[i].type);
+
+ return nfound;
}
@@ -784,14 +812,15 @@ hsize_t diff(hid_t file1_id,
diff_opt_t * options,
h5trav_type_t type)
{
- hid_t type1_id = (-1);
- hid_t type2_id = (-1);
- hid_t grp1_id = (-1);
- hid_t grp2_id = (-1);
- int ret;
+ hid_t type1_id = (-1);
+ hid_t type2_id = (-1);
+ hid_t grp1_id = (-1);
+ hid_t grp2_id = (-1);
+ int ret;
hsize_t nfound = 0;
- switch(type) {
+ switch(type)
+ {
/*-------------------------------------------------------------------------
* H5TRAV_TYPE_DATASET
*-------------------------------------------------------------------------
@@ -801,7 +830,8 @@ hsize_t diff(hid_t file1_id,
* verbose, always print name
*-------------------------------------------------------------------------
*/
- if(options->m_verbose) {
+ if(options->m_verbose)
+ {
if(print_objname(options, (hsize_t)1))
do_print_objname("dataset", path1, path2);
nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
@@ -813,15 +843,18 @@ hsize_t diff(hid_t file1_id,
* disabling quiet mode
*-------------------------------------------------------------------------
*/
- else {
- if(options->m_quiet == 0) {
+ else
+ {
+ if(options->m_quiet == 0)
+ {
/* shut up temporarily */
options->m_quiet = 1;
nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
/* print again */
options->m_quiet = 0;
- if(nfound) {
+ if(nfound)
+ {
if(print_objname(options,nfound))
do_print_objname("dataset", path1, path2);
nfound = diff_dataset(file1_id, file2_id, path1, path2, options);
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 008b6b9..c5646ed 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -119,7 +119,7 @@ static int not_comparable;
is_zero=1; \
}
-# define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b))
+#define PDIFF(a,b) ( (b>a) ? (b-a) : (a-b))
/*-------------------------------------------------------------------------
* local prototypes
@@ -127,11 +127,12 @@ static int not_comparable;
*/
static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id,hid_t region1_id, hid_t region2_id, diff_opt_t *options);
static hbool_t all_zero(const void *_mem, size_t size);
-static int ull2float(unsigned long_long ull_value, float *f_value);
static hsize_t character_compare(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
static hsize_t character_compare_opt(unsigned char *mem1,unsigned char *mem2,hsize_t i,int rank,hsize_t *dims,hsize_t *acc,hsize_t *pos,diff_opt_t *options,const char *obj1,const char *obj2,int *ph);
static hbool_t equal_float(float value, float expected);
static hbool_t equal_double(double value, double expected);
+static int ull2float(unsigned long_long ull_value, float *f_value);
+
/*-------------------------------------------------------------------------
* NaN detection
@@ -266,8 +267,6 @@ hsize_t diff_array( void *_mem1,
size_t size; /* size of datum */
unsigned char *mem1 = (unsigned char*)_mem1;
unsigned char *mem2 = (unsigned char*)_mem2;
- unsigned char *tmp1;
- unsigned char *tmp2;
hsize_t acc[32]; /* accumulator position */
hsize_t pos[32]; /* matrix position */
int ph=1; /* print header */
@@ -288,23 +287,26 @@ hsize_t diff_array( void *_mem1,
if(H5Tis_variable_str(m_type))
{
- tmp1 = ((unsigned char**)mem1)[0];
- tmp2 = ((unsigned char**)mem2)[0];
- nfound+=diff_datum(
- tmp1,
- tmp2,
- m_type,
- (hsize_t)0,
- rank,
- dims,
- acc,
- pos,
- options,
- name1,
- name2,
- container1_id,
- container2_id,
- &ph);
+ for ( i = 0; i < nelmts; i++)
+ {
+ nfound+=diff_datum(
+ ((unsigned char**)mem1)[(size_t)i],
+ ((unsigned char**)mem2)[(size_t)i],
+ m_type,
+ i,
+ rank,
+ dims,
+ acc,
+ pos,
+ options,
+ name1,
+ name2,
+ container1_id,
+ container2_id,
+ &ph);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* i */
}
else
@@ -515,42 +517,35 @@ hsize_t diff_datum(void *_mem1,
case H5T_STRING:
{
-
H5T_str_t pad;
char *s;
- if(H5Tis_variable_str(m_type))
- {
- /* mem1 is the pointer into the struct where a `char*' is stored. So we have
- * to dereference the pointer to get the `char*' to pass to HDstrlen(). */
- s = *(char**)mem1;
- if(s!=NULL)
- size = HDstrlen(s);
- }
- else
- {
- s = (char *)mem1;
- size = H5Tget_size(m_type);
- }
-
- pad = H5Tget_strpad(m_type);
-
+ /* Get pointer to first string to compare */
+ s = (char *)mem1;
+
/* check for NULL pointer for string */
if(s!=NULL)
{
+ if(H5Tis_variable_str(m_type))
+ size = HDstrlen(s);
+ else
+ size = H5Tget_size(m_type);
+
+ pad = H5Tget_strpad(m_type);
+
for (u=0; u<size && (s[u] || pad!=H5T_STR_NULLTERM); u++)
nfound+=character_compare(
- mem1 + u,
- mem2 + u, /* offset */
- i, /* index position */
- rank,
- dims,
- acc,
- pos,
- options,
- obj1,
- obj2,
- ph);
+ mem1 + u,
+ mem2 + u, /* offset */
+ i, /* index position */
+ rank,
+ dims,
+ acc,
+ pos,
+ options,
+ obj1,
+ obj2,
+ ph);
}
}
@@ -697,7 +692,6 @@ hsize_t diff_datum(void *_mem1,
H5Tclose(memb_type);
}
break;
-
/*-------------------------------------------------------------------------
@@ -2867,7 +2861,6 @@ hsize_t diff_float(unsigned char *mem1,
}
-
/*-------------------------------------------------------------------------
* Function: diff_double
*
@@ -2897,80 +2890,111 @@ hsize_t diff_double(unsigned char *mem1,
hsize_t i;
double per;
int both_zero;
+ int isnan1;
+ int isnan2;
-
- /* -d and !-p */
+
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
+
if (options->d && !options->p)
{
-
for ( i = 0; i < nelmts; i++)
{
memcpy(&temp1_double, mem1, sizeof(double));
memcpy(&temp2_double, mem2, sizeof(double));
-
- if (ABS(temp1_double-temp2_double) > options->delta)
- {
- if ( print_data(options) )
+
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
+
+ if ( !isnan1 && !isnan2)
+ {
+ if (ABS(temp1_double-temp2_double) > options->delta)
{
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ }
+ nfound++;
}
- nfound++;
- }
+ } /* NaN */
mem1+=sizeof(double);
mem2+=sizeof(double);
if (options->n && nfound>=options->count)
return nfound;
- }
+ } /* i */
}
-
- /* !-d and -p */
+
+ /*-------------------------------------------------------------------------
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
else if (!options->d && options->p)
{
-
for ( i = 0; i < nelmts; i++)
{
memcpy(&temp1_double, mem1, sizeof(double));
memcpy(&temp2_double, mem2, sizeof(double));
- PER(temp1_double,temp2_double);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
- }
- options->not_cmp=1;
- nfound++;
- }
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
- else
+ if ( !isnan1 && !isnan2)
+ {
+
+ PER(temp1_double,temp2_double);
- if ( per > options->percent )
+ if (not_comparable && !both_zero) /* not comparable */
{
if ( print_data(options) )
{
print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
+ parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
+ ABS(temp1_double-temp2_double));
}
+ options->not_cmp=1;
nfound++;
}
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
- return nfound;
- }
+
+ else
+
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P,temp1_double,temp2_double,
+ ABS(temp1_double-temp2_double),
+ ABS(1-temp2_double/temp1_double));
+ }
+ nfound++;
+ }
+ } /* NaN */
+ mem1+=sizeof(double);
+ mem2+=sizeof(double);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* i */
}
- /* -d and -p */
+ /*-------------------------------------------------------------------------
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
else if ( options->d && options->p)
{
@@ -2979,41 +3003,58 @@ hsize_t diff_double(unsigned char *mem1,
memcpy(&temp1_double, mem1, sizeof(double));
memcpy(&temp2_double, mem2, sizeof(double));
- PER(temp1_double,temp2_double);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double));
- }
- options->not_cmp=1;
- nfound++;
- }
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double);
+ isnan2 = my_isnan(FLT_DOUBLE,&temp2_double);
- else
+ if ( !isnan1 && !isnan2)
+ {
+
+ PER(temp1_double,temp2_double);
- if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta )
+ if (not_comparable && !both_zero) /* not comparable */
{
if ( print_data(options) )
{
print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
parallel_print(SPACES);
- parallel_print(F_FORMAT_P,temp1_double,temp2_double,
- ABS(temp1_double-temp2_double),
- ABS(1-temp2_double/temp1_double));
+ parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double,
+ ABS(temp1_double-temp2_double));
}
+ options->not_cmp=1;
nfound++;
}
- mem1+=sizeof(double);
- mem2+=sizeof(double);
- if (options->n && nfound>=options->count)
- return nfound;
- }
+
+ else
+
+ if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT_P,temp1_double,temp2_double,
+ ABS(temp1_double-temp2_double),
+ ABS(1-temp2_double/temp1_double));
+ }
+ nfound++;
+ }
+
+ } /* NaN */
+ mem1+=sizeof(double);
+ mem2+=sizeof(double);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* i */
}
+
+ /*-------------------------------------------------------------------------
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
else
{
@@ -3044,6 +3085,9 @@ hsize_t diff_double(unsigned char *mem1,
return nfound;
}
+
+
+
/*-------------------------------------------------------------------------
* Function: diff_schar
*
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index ea833db..3f4e6a3 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -19,33 +19,6 @@
#include "h5tools.h"
/*-------------------------------------------------------------------------
- * Function: print_size
- *
- * Purpose: print dimensions
- *
- *-------------------------------------------------------------------------
- */
-#if defined (H5DIFF_DEBUG)
-static void
-print_size (int rank, hsize_t *dims)
-{
- int i;
-
- parallel_print("[" );
- for ( i = 0; i < rank-1; i++)
- {
- parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[i]);
- parallel_print("x");
- }
- parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]);
- parallel_print("]\n" );
-
-}
-#endif /* H5DIFF_DEBUG */
-
-
-
-/*-------------------------------------------------------------------------
* Function: diff_dataset
*
* Purpose: check for comparable datasets and read into a compatible
@@ -65,79 +38,85 @@ hsize_t diff_dataset( hid_t file1_id,
const char *obj2_name,
diff_opt_t *options)
{
- hid_t did1 = -1;
- hid_t did2 = -1;
- hid_t dcpl1 = -1;
- hid_t dcpl2 = -1;
- hsize_t nfound = 0;
-
-/*-------------------------------------------------------------------------
- * open the handles
- *-------------------------------------------------------------------------
- */
- /* disable error reporting */
- H5E_BEGIN_TRY {
- /* Open the datasets */
- if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) {
- printf("Cannot open dataset <%s>\n", obj1_name);
- goto error;
- }
- if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) {
- printf("Cannot open dataset <%s>\n", obj2_name);
- goto error;
- }
- /* enable error reporting */
- } H5E_END_TRY;
-
-
- if((dcpl1 = H5Dget_create_plist(did1)) < 0)
- goto error;
- if((dcpl2 = H5Dget_create_plist(did2)) < 0)
- goto error;
-
-/*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
- *-------------------------------------------------------------------------
- */
- if ((h5tools_canreadf((options->m_verbose?obj1_name:NULL),dcpl1)==1) &&
- (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2)==1))
- {
- nfound=diff_datasetid(did1,
- did2,
- obj1_name,
- obj2_name,
- options);
- }
-/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- /* disable error reporting */
- H5E_BEGIN_TRY {
- H5Pclose(dcpl1);
- H5Pclose(dcpl2);
- H5Dclose(did1);
- H5Dclose(did2);
- /* enable error reporting */
- } H5E_END_TRY;
-
- return nfound;
-
+ hid_t did1 = -1;
+ hid_t did2 = -1;
+ hid_t dcpl1 = -1;
+ hid_t dcpl2 = -1;
+ hsize_t nfound = 0;
+
+ /*-------------------------------------------------------------------------
+ * open the handles
+ *-------------------------------------------------------------------------
+ */
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* open the datasets */
+ if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0)
+ {
+ printf("Cannot open dataset <%s>\n", obj1_name);
+ goto error;
+ }
+
+ if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0)
+ {
+ printf("Cannot open dataset <%s>\n", obj2_name);
+ goto error;
+ }
+ /* enable error reporting */
+ } H5E_END_TRY;
+
+
+ if ((dcpl1 = H5Dget_create_plist(did1)) < 0)
+ goto error;
+ if ((dcpl2 = H5Dget_create_plist(did2)) < 0)
+ goto error;
+
+ /*-------------------------------------------------------------------------
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if ((h5tools_canreadf((options->m_verbose?obj1_name:NULL),dcpl1)==1) &&
+ (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2)==1))
+ {
+ nfound=diff_datasetid(did1,
+ did2,
+ obj1_name,
+ obj2_name,
+ options);
+ }
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl1);
+ H5Pclose(dcpl2);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ /* enable error reporting */
+ } H5E_END_TRY;
+
+ return nfound;
+
error:
- options->err_stat=1;
- /* disable error reporting */
- H5E_BEGIN_TRY {
- H5Pclose(dcpl1);
- H5Pclose(dcpl2);
- H5Dclose(did1);
- H5Dclose(did2);
- /* enable error reporting */
- } H5E_END_TRY;
-
- return nfound;
+ options->err_stat=1;
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dcpl1);
+ H5Pclose(dcpl2);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ /* enable error reporting */
+ } H5E_END_TRY;
+
+ return nfound;
}
/*-------------------------------------------------------------------------
@@ -154,7 +133,6 @@ error:
*
* Modifications:
*
- *
* October 2006: Read by hyperslabs for big datasets.
*
* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
@@ -204,448 +182,456 @@ hsize_t diff_datasetid( hid_t did1,
const char *obj2_name,
diff_opt_t *options)
{
- hid_t sid1=-1;
- hid_t sid2=-1;
- hid_t f_tid1=-1;
- hid_t f_tid2=-1;
- hid_t m_tid1=-1;
- hid_t m_tid2=-1;
- size_t m_size1;
- size_t m_size2;
- H5T_sign_t sign1;
- H5T_sign_t sign2;
- int rank1;
- int rank2;
- hsize_t nelmts1;
- hsize_t nelmts2;
- hsize_t dims1[H5S_MAX_RANK];
- hsize_t dims2[H5S_MAX_RANK];
- hsize_t maxdim1[H5S_MAX_RANK];
- hsize_t maxdim2[H5S_MAX_RANK];
- const char *name1=NULL; /* relative names */
- const char *name2=NULL;
- hsize_t storage_size1;
- hsize_t storage_size2;
- hsize_t nfound=0; /* number of differences found */
- int cmp=1; /* do diff or not */
- void *buf1=NULL;
- void *buf2=NULL;
- void *sm_buf1=NULL;
- void *sm_buf2=NULL;
- size_t need; /* bytes needed for malloc */
- int i;
-
- /* Get the dataspace handle */
- if ( (sid1 = H5Dget_space(did1)) < 0 )
- goto error;
-
- /* Get rank */
- if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 )
- goto error;
-
- /* Get the dataspace handle */
- if ( (sid2 = H5Dget_space(did2)) < 0 )
- goto error;
-
- /* Get rank */
- if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 )
- goto error;
-
- /* Get dimensions */
- if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 )
- goto error;
-
- /* Get dimensions */
- if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 )
- goto error;
-
-/*-------------------------------------------------------------------------
- * Get the file data type
- *-------------------------------------------------------------------------
- */
-
- /* Get the data type */
- if ( (f_tid1 = H5Dget_type(did1)) < 0 )
- goto error;
-
- /* Get the data type */
- if ( (f_tid2 = H5Dget_type(did2)) < 0 )
- goto error;
-
-/*-------------------------------------------------------------------------
- * check for empty datasets
- *-------------------------------------------------------------------------
- */
-
- storage_size1=H5Dget_storage_size(did1);
- storage_size2=H5Dget_storage_size(did2);
-
- if (storage_size1==0 || storage_size2==0)
- {
- if (options->m_verbose && obj1_name && obj2_name)
- parallel_print("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name);
- cmp=0;
- options->not_cmp=1;
- }
-
-/*-------------------------------------------------------------------------
- * check for comparable TYPE and SPACE
- *-------------------------------------------------------------------------
- */
-
- if (diff_can_type(f_tid1,
- f_tid2,
- rank1,
- rank2,
- dims1,
- dims2,
- maxdim1,
- maxdim2,
- obj1_name,
- obj2_name,
- options)!=1)
- {
- cmp=0;
- options->not_cmp=1;
- }
-
-/*-------------------------------------------------------------------------
- * memory type and sizes
- *-------------------------------------------------------------------------
- */
- if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0)
- goto error;
-
- if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0)
- goto error;
-
- m_size1 = H5Tget_size( m_tid1 );
- m_size2 = H5Tget_size( m_tid2 );
-
-/*-------------------------------------------------------------------------
- * check for different signed/unsigned types
- *-------------------------------------------------------------------------
- */
-
- sign1=H5Tget_sign(m_tid1);
- sign2=H5Tget_sign(m_tid2);
- if ( sign1 != sign2 )
- {
- if (options->m_verbose && obj1_name) {
- parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1));
- parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
+ hid_t sid1=-1;
+ hid_t sid2=-1;
+ hid_t f_tid1=-1;
+ hid_t f_tid2=-1;
+ hid_t m_tid1=-1;
+ hid_t m_tid2=-1;
+ size_t m_size1;
+ size_t m_size2;
+ H5T_sign_t sign1;
+ H5T_sign_t sign2;
+ int rank1;
+ int rank2;
+ hsize_t nelmts1;
+ hsize_t nelmts2;
+ hsize_t dims1[H5S_MAX_RANK];
+ hsize_t dims2[H5S_MAX_RANK];
+ hsize_t maxdim1[H5S_MAX_RANK];
+ hsize_t maxdim2[H5S_MAX_RANK];
+ const char *name1=NULL; /* relative names */
+ const char *name2=NULL;
+ hsize_t storage_size1;
+ hsize_t storage_size2;
+ hsize_t nfound=0; /* number of differences found */
+ int cmp=1; /* do diff or not */
+ void *buf1=NULL;
+ void *buf2=NULL;
+ void *sm_buf1=NULL;
+ void *sm_buf2=NULL;
+ size_t need; /* bytes needed for malloc */
+ int i;
+
+ /* get the dataspace handle */
+ if ( (sid1 = H5Dget_space(did1)) < 0 )
+ goto error;
+
+ /* get rank */
+ if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 )
+ goto error;
+
+ /* get the dataspace handle */
+ if ( (sid2 = H5Dget_space(did2)) < 0 )
+ goto error;
+
+ /* get rank */
+ if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 )
+ goto error;
+
+ /* get dimensions */
+ if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 )
+ goto error;
+
+ /* get dimensions */
+ if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 )
+ goto error;
+
+ /*-------------------------------------------------------------------------
+ * get the file data type
+ *-------------------------------------------------------------------------
+ */
+
+ /* get the data type */
+ if ( (f_tid1 = H5Dget_type(did1)) < 0 )
+ goto error;
+
+ /* get the data type */
+ if ( (f_tid2 = H5Dget_type(did2)) < 0 )
+ goto error;
+
+ /*-------------------------------------------------------------------------
+ * check for empty datasets
+ *-------------------------------------------------------------------------
+ */
+
+ storage_size1=H5Dget_storage_size(did1);
+ storage_size2=H5Dget_storage_size(did2);
+ if (storage_size1<0 || storage_size2<0)
+ goto error;
+
+ if (storage_size1==0 || storage_size2==0)
+ {
+ if (options->m_verbose && obj1_name && obj2_name)
+ parallel_print("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name);
+ cmp=0;
+ options->not_cmp=1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for comparable TYPE and SPACE
+ *-------------------------------------------------------------------------
+ */
+
+ if (diff_can_type(f_tid1,
+ f_tid2,
+ rank1,
+ rank2,
+ dims1,
+ dims2,
+ maxdim1,
+ maxdim2,
+ obj1_name,
+ obj2_name,
+ options)!=1)
+ {
+ cmp=0;
+ options->not_cmp=1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * memory type and sizes
+ *-------------------------------------------------------------------------
+ */
+ if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0)
+ goto error;
+
+ if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0)
+ goto error;
+
+ m_size1 = H5Tget_size( m_tid1 );
+ m_size2 = H5Tget_size( m_tid2 );
+
+ /*-------------------------------------------------------------------------
+ * check for different signed/unsigned types
+ *-------------------------------------------------------------------------
+ */
+
+ sign1=H5Tget_sign(m_tid1);
+ sign2=H5Tget_sign(m_tid2);
+ if ( sign1 != sign2 )
+ {
+ if (options->m_verbose && obj1_name)
+ {
+ parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1));
+ parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
+ }
+
+ cmp=0;
+ options->not_cmp=1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * only attempt to compare if possible
+ *-------------------------------------------------------------------------
+ */
+ if (cmp)
+ {
+
+ /*-------------------------------------------------------------------------
+ * get number of elements
+ *-------------------------------------------------------------------------
+ */
+ nelmts1 = 1;
+ for (i = 0; i < rank1; i++)
+ {
+ nelmts1 *= dims1[i];
+ }
+
+ nelmts2 = 1;
+ for (i = 0; i < rank2; i++)
+ {
+ nelmts2 *= dims2[i];
+ }
+
+ assert(nelmts1==nelmts2);
+
+ /*-------------------------------------------------------------------------
+ * "upgrade" the smaller memory size
+ *-------------------------------------------------------------------------
+ */
+
+ if ( m_size1 != m_size2 )
+ {
+ if ( m_size1 < m_size2 )
+ {
+ H5Tclose(m_tid1);
+
+ if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0)
+ goto error;
+
+ m_size1 = H5Tget_size( m_tid1 );
+ }
+ else
+ {
+ H5Tclose(m_tid2);
+
+ if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0)
+ goto error;
+
+ m_size2 = H5Tget_size( m_tid2 );
+ }
+ }
+ assert(m_size1==m_size2);
+
+ /* print names */
+ if (obj1_name) {
+ name1=diff_basename(obj1_name);
+ }
+ if (obj2_name) {
+ name2=diff_basename(obj2_name);
+ }
+
+
+ /*-------------------------------------------------------------------------
+ * read/compare
+ *-------------------------------------------------------------------------
+ */
+
+ need = (size_t)(nelmts1*m_size1); /* bytes needed */
+ if ( need < H5TOOLS_MALLOCSIZE)
+ {
+ buf1 = HDmalloc(need);
+ buf2 = HDmalloc(need);
+ }
+
+ if ( buf1!=NULL && buf2!=NULL)
+ {
+ if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 )
+ goto error;
+ if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 )
+ goto error;
+
+ /* array diff */
+ nfound = diff_array(buf1,
+ buf2,
+ nelmts1,
+ (hsize_t)0,
+ rank1,
+ dims1,
+ options,
+ name1,
+ name2,
+ m_tid1,
+ did1,
+ did2);
+ }
+
+ else /* possibly not enough memory, read/compare by hyperslabs */
+
+ {
+ size_t p_type_nbytes = m_size1; /*size of memory type */
+ hsize_t p_nelmts = nelmts1; /*total selected elmts */
+ hsize_t elmtno; /*counter */
+ int carry; /*counter carry value */
+ unsigned int vl_data = 0; /*contains VL datatypes */
+
+ /* stripmine info */
+ hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
+ hsize_t sm_nbytes; /*bytes per stripmine */
+ hsize_t sm_nelmts; /*elements per stripmine*/
+ hid_t sm_space; /*stripmine data space */
+
+ /* hyperslab info */
+ hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */
+ hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */
+ hsize_t hs_nelmts; /*elements in request */
+ hsize_t zero[8]; /*vector of zeros */
+
+ /* check if we have VL data in the dataset's datatype */
+ if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE)
+ vl_data = TRUE;
+
+ /*
+ * determine the strip mine size and allocate a buffer. The strip mine is
+ * a hyperslab whose size is manageable.
+ */
+ sm_nbytes = p_type_nbytes;
+
+ for (i = rank1; i > 0; --i)
+ {
+ sm_size[i - 1] = MIN(dims1[i - 1], H5TOOLS_BUFSIZE / sm_nbytes);
+ sm_nbytes *= sm_size[i - 1];
+ assert(sm_nbytes > 0);
+ }
+
+ sm_buf1 = malloc((size_t)sm_nbytes);
+ sm_buf2 = malloc((size_t)sm_nbytes);
+
+ sm_nelmts = sm_nbytes / p_type_nbytes;
+ sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
+
+ /* the stripmine loop */
+ memset(hs_offset, 0, sizeof hs_offset);
+ memset(zero, 0, sizeof zero);
+
+ for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts)
+ {
+ /* calculate the hyperslab size */
+ if (rank1 > 0)
+ {
+ for (i = 0, hs_nelmts = 1; i < rank1; i++)
+ {
+ hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]);
+ hs_nelmts *= hs_size[i];
+ }
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ goto error;
+ if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ goto error;
+ if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
+ goto error;
+ }
+ else
+ {
+ H5Sselect_all(sid1);
+ H5Sselect_all(sid2);
+ H5Sselect_all(sm_space);
+ hs_nelmts = 1;
+ } /* rank */
+
+ if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 )
+ goto error;
+ if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 )
+ goto error;
+
+ /* get array differences. in the case of hyperslab read, increment the
+ number of differences found in each hyperslab and pass the
+ position at the beggining for printing
+ */
+ nfound += diff_array(sm_buf1,
+ sm_buf2,
+ hs_nelmts,
+ elmtno,
+ rank1,
+ dims1,
+ options,
+ name1,
+ name2,
+ m_tid1,
+ did1,
+ did2);
+
+ /* reclaim any VL memory, if necessary */
+ if(vl_data)
+ {
+ H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1);
+ H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2);
+ }
+
+ /* calculate the next hyperslab offset */
+ for (i = rank1, carry = 1; i > 0 && carry; --i)
+ {
+ hs_offset[i - 1] += hs_size[i - 1];
+ if (hs_offset[i - 1] == dims1[i - 1])
+ hs_offset[i - 1] = 0;
+ else
+ carry = 0;
+ } /* i */
+ } /* elmtno */
+
+ H5Sclose(sm_space);
+ /* free */
+ if (sm_buf1!=NULL)
+ {
+ free(sm_buf1);
+ sm_buf1=NULL;
+ }
+ if (sm_buf2!=NULL)
+ {
+ free(sm_buf2);
+ sm_buf2=NULL;
+ }
+
+ } /* hyperslab read */
+ }/*cmp*/
+
+ /*-------------------------------------------------------------------------
+ * compare attributes
+ * the if condition refers to cases when the dataset is a referenced object
+ *-------------------------------------------------------------------------
+ */
+
+ if (obj1_name)
+ nfound += diff_attr(did1,did2,obj1_name,obj2_name,options);
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+ /* free */
+ if (buf1!=NULL)
+ {
+ free(buf1);
+ buf1=NULL;
}
-
- cmp=0;
- options->not_cmp=1;
- }
-
-/*-------------------------------------------------------------------------
- * only attempt to compare if possible
- *-------------------------------------------------------------------------
- */
- if (cmp)
- {
-
-/*-------------------------------------------------------------------------
- * get number of elements
- *-------------------------------------------------------------------------
- */
- nelmts1 = 1;
- for (i = 0; i < rank1; i++)
- {
- nelmts1 *= dims1[i];
- }
-
- nelmts2 = 1;
- for (i = 0; i < rank2; i++)
- {
- nelmts2 *= dims2[i];
- }
-
- assert(nelmts1==nelmts2);
-
-/*-------------------------------------------------------------------------
- * "upgrade" the smaller memory size
- *-------------------------------------------------------------------------
- */
-
- if ( m_size1 != m_size2 )
- {
- if ( m_size1 < m_size2 )
+ if (buf2!=NULL)
{
- H5Tclose(m_tid1);
-
- if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0)
- goto error;
-
- m_size1 = H5Tget_size( m_tid1 );
+ free(buf2);
+ buf2=NULL;
}
- else
+ if (sm_buf1!=NULL)
{
- H5Tclose(m_tid2);
-
- if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0)
- goto error;
-
- m_size2 = H5Tget_size( m_tid2 );
+ free(sm_buf1);
+ sm_buf1=NULL;
}
- }
- assert(m_size1==m_size2);
-
- /* print names */
- if (obj1_name) {
- name1=diff_basename(obj1_name);
- }
- if (obj2_name) {
- name2=diff_basename(obj2_name);
- }
-
-
-/*-------------------------------------------------------------------------
- * read/compare
- *-------------------------------------------------------------------------
- */
-
- need = (size_t)(nelmts1*m_size1); /* bytes needed */
- if ( need < H5TOOLS_MALLOCSIZE)
- {
- buf1 = HDmalloc(need);
- buf2 = HDmalloc(need);
- }
-
- if ( buf1!=NULL && buf2!=NULL)
- {
- if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 )
- goto error;
- if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 )
- goto error;
-
- /* array diff */
- nfound = diff_array(buf1,
- buf2,
- nelmts1,
- (hsize_t)0,
- rank1,
- dims1,
- options,
- name1,
- name2,
- m_tid1,
- did1,
- did2);
- }
-
- else /* possibly not enough memory, read/compare by hyperslabs */
-
- {
- size_t p_type_nbytes = m_size1; /*size of memory type */
- hsize_t p_nelmts = nelmts1; /*total selected elmts */
- hsize_t elmtno; /*counter */
- int carry; /*counter carry value */
- unsigned int vl_data = 0; /*contains VL datatypes */
-
- /* stripmine info */
- hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
- hsize_t sm_nbytes; /*bytes per stripmine */
- hsize_t sm_nelmts; /*elements per stripmine*/
- hid_t sm_space; /*stripmine data space */
-
- /* hyperslab info */
- hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */
- hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */
- hsize_t hs_nelmts; /*elements in request */
- hsize_t zero[8]; /*vector of zeros */
-
- /* check if we have VL data in the dataset's datatype */
- if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE)
- vl_data = TRUE;
-
- /*
- * determine the strip mine size and allocate a buffer. The strip mine is
- * a hyperslab whose size is manageable.
- */
- sm_nbytes = p_type_nbytes;
-
- for (i = rank1; i > 0; --i) {
- sm_size[i - 1] = MIN(dims1[i - 1], H5TOOLS_BUFSIZE / sm_nbytes);
- sm_nbytes *= sm_size[i - 1];
- assert(sm_nbytes > 0);
+ if (sm_buf2!=NULL)
+ {
+ free(sm_buf2);
+ sm_buf2=NULL;
}
- sm_buf1 = malloc((size_t)sm_nbytes);
- sm_buf2 = malloc((size_t)sm_nbytes);
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(sid1);
+ H5Sclose(sid2);
+ H5Tclose(f_tid1);
+ H5Tclose(f_tid2);
+ H5Tclose(m_tid1);
+ H5Tclose(m_tid2);
+ } H5E_END_TRY;
- sm_nelmts = sm_nbytes / p_type_nbytes;
- sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
+ return nfound;
- /* the stripmine loop */
- memset(hs_offset, 0, sizeof hs_offset);
- memset(zero, 0, sizeof zero);
-
- for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts)
- {
- /* calculate the hyperslab size */
- if (rank1 > 0)
- {
- for (i = 0, hs_nelmts = 1; i < rank1; i++)
- {
- hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]);
- hs_nelmts *= hs_size[i];
- }
- if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- goto error;
- if (H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- goto error;
- if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
- goto error;
- }
- else
- {
- H5Sselect_all(sid1);
- H5Sselect_all(sid2);
- H5Sselect_all(sm_space);
- hs_nelmts = 1;
- } /* rank */
-
- if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 )
- goto error;
- if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 )
- goto error;
-
- /* get array differences. in the case of hyperslab read, increment the number of differences
- found in each hyperslab and pass the position at the beggining for printing */
- nfound += diff_array(sm_buf1,
- sm_buf2,
- hs_nelmts,
- elmtno,
- rank1,
- dims1,
- options,
- name1,
- name2,
- m_tid1,
- did1,
- did2);
-
- /* reclaim any VL memory, if necessary */
- if(vl_data)
- {
- H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1);
- H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2);
- }
-
- /* calculate the next hyperslab offset */
- for (i = rank1, carry = 1; i > 0 && carry; --i)
- {
- hs_offset[i - 1] += hs_size[i - 1];
- if (hs_offset[i - 1] == dims1[i - 1])
- hs_offset[i - 1] = 0;
- else
- carry = 0;
- } /* i */
- } /* elmtno */
+error:
+ options->err_stat=1;
- H5Sclose(sm_space);
/* free */
+ if (buf1!=NULL)
+ {
+ free(buf1);
+ buf1=NULL;
+ }
+ if (buf2!=NULL)
+ {
+ free(buf2);
+ buf2=NULL;
+ }
if (sm_buf1!=NULL)
{
- free(sm_buf1);
- sm_buf1=NULL;
+ free(sm_buf1);
+ sm_buf1=NULL;
}
if (sm_buf2!=NULL)
{
- free(sm_buf2);
- sm_buf2=NULL;
+ free(sm_buf2);
+ sm_buf2=NULL;
}
- } /* hyperslab read */
- }/*cmp*/
-
-/*-------------------------------------------------------------------------
- * compare attributes
- * the if condition refers to cases when the dataset is a referenced object
- *-------------------------------------------------------------------------
- */
-
- if (obj1_name)
- nfound += diff_attr(did1,did2,obj1_name,obj2_name,options);
-
-/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
-
- /* free */
- if (buf1!=NULL)
- {
- free(buf1);
- buf1=NULL;
- }
- if (buf2!=NULL)
- {
- free(buf2);
- buf2=NULL;
- }
- if (sm_buf1!=NULL)
- {
- free(sm_buf1);
- sm_buf1=NULL;
- }
- if (sm_buf2!=NULL)
- {
- free(sm_buf2);
- sm_buf2=NULL;
- }
-
- H5E_BEGIN_TRY {
- H5Sclose(sid1);
- H5Sclose(sid2);
- H5Tclose(f_tid1);
- H5Tclose(f_tid2);
- H5Tclose(m_tid1);
- H5Tclose(m_tid2);
- } H5E_END_TRY;
-
- return nfound;
-
-error:
- options->err_stat=1;
-
- /* free */
- if (buf1!=NULL)
- {
- free(buf1);
- buf1=NULL;
- }
- if (buf2!=NULL)
- {
- free(buf2);
- buf2=NULL;
- }
- if (sm_buf1!=NULL)
- {
- free(sm_buf1);
- sm_buf1=NULL;
- }
- if (sm_buf2!=NULL)
- {
- free(sm_buf2);
- sm_buf2=NULL;
- }
-
- /* disable error reporting */
- H5E_BEGIN_TRY {
- H5Sclose(sid1);
- H5Sclose(sid2);
- H5Tclose(f_tid1);
- H5Tclose(f_tid2);
- H5Tclose(m_tid1);
- H5Tclose(m_tid2);
- /* enable error reporting */
- } H5E_END_TRY;
-
- return nfound;
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(sid1);
+ H5Sclose(sid2);
+ H5Tclose(f_tid1);
+ H5Tclose(f_tid2);
+ H5Tclose(m_tid1);
+ H5Tclose(m_tid2);
+ /* enable error reporting */
+ } H5E_END_TRY;
+
+ return nfound;
}
/*-------------------------------------------------------------------------
@@ -677,163 +663,164 @@ int diff_can_type( hid_t f_tid1, /* file data type */
const char *obj2_name,
diff_opt_t *options )
{
-
-
- H5T_class_t tclass1;
- H5T_class_t tclass2;
- int maxdim_diff=0; /* maximum dimensions are different */
- int dim_diff=0; /* current dimensions are different */
- int i;
-
-/*-------------------------------------------------------------------------
- * check for the same class
- *-------------------------------------------------------------------------
- */
-
- if ((tclass1=H5Tget_class(f_tid1)) < 0)
- return -1;
-
- if ((tclass2=H5Tget_class(f_tid2)) < 0)
- return -1;
-
- if ( tclass1 != tclass2 )
- {
- if (options->m_verbose && obj1_name) {
- printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n",
- obj1_name, get_class(tclass1),
- obj2_name, get_class(tclass2) );
- }
- return 0;
- }
-
-/*-------------------------------------------------------------------------
- * check for non supported classes
- *-------------------------------------------------------------------------
- */
-
- assert(tclass1==tclass2);
- switch (tclass1)
- {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_COMPOUND:
- case H5T_STRING:
- case H5T_ARRAY:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_REFERENCE:
-
- break;
-
- default: /*H5T_TIME */
- if (options->m_verbose && obj1_name )
- printf("Comparison not supported: <%s> and <%s> are of class %s\n",
- obj1_name,obj2_name,get_class(tclass2) );
- return 0;
- }
-
-/*-------------------------------------------------------------------------
- * check for equal file datatype; warning only
- *-------------------------------------------------------------------------
- */
-
- if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name)
- {
- printf("Warning: different storage datatype\n");
- printf("<%s> has file datatype ", obj1_name);
- print_type(f_tid1);
- printf("\n");
- printf("<%s> has file datatype ", obj2_name);
- print_type(f_tid2);
- printf("\n");
- }
-
-/*-------------------------------------------------------------------------
- * check for the same rank
- *-------------------------------------------------------------------------
- */
-
- if ( rank1 != rank2 )
- {
- if (options->m_verbose && obj1_name) {
- printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1);
- print_dimensions(rank1,dims1);
- printf(", max dimensions ");
- print_dimensions(rank1,maxdim1);
- printf("\n" );
- printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
- print_dimensions(rank2,dims2);
- printf(", max dimensions ");
- print_dimensions(rank2,maxdim2);
- }
- return 0;
- }
-
-/*-------------------------------------------------------------------------
- * check for different dimensions
- *-------------------------------------------------------------------------
- */
-
- assert(rank1==rank2);
- for ( i=0; i<rank1; i++)
- {
- if (maxdim1 && maxdim2)
- {
- if ( maxdim1[i] != maxdim2[i] )
- maxdim_diff=1;
- }
- if ( dims1[i] != dims2[i] )
- dim_diff=1;
- }
-
-/*-------------------------------------------------------------------------
- * current dimensions
- *-------------------------------------------------------------------------
- */
-
- if (dim_diff==1)
- {
- if (options->m_verbose && obj1_name) {
- printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1);
- print_dimensions(rank1,dims1);
- if (maxdim1 && maxdim2) {
- printf(", max dimensions ");
- print_dimensions(rank1,maxdim1);
- printf("\n" );
- printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
- print_dimensions(rank2,dims2);
- printf(", max dimensions ");
- print_dimensions(rank2,maxdim2);
- }
- }
- return 0;
- }
-
-/*-------------------------------------------------------------------------
- * maximum dimensions; just give a warning
- *-------------------------------------------------------------------------
- */
- if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name )
- {
- if (options->m_verbose) {
- printf( "Warning: different maximum dimensions\n");
- printf("<%s> has max dimensions ", obj1_name);
- print_dimensions(rank1,maxdim1);
- printf("\n");
- printf("<%s> has max dimensions ", obj2_name);
- print_dimensions(rank2,maxdim2);
- printf("\n");
- }
- }
-
- return 1;
+ H5T_class_t tclass1;
+ H5T_class_t tclass2;
+ int maxdim_diff=0; /* maximum dimensions are different */
+ int dim_diff=0; /* current dimensions are different */
+ int i;
+
+ /*-------------------------------------------------------------------------
+ * check for the same class
+ *-------------------------------------------------------------------------
+ */
+
+ if ((tclass1=H5Tget_class(f_tid1)) < 0)
+ return -1;
+
+ if ((tclass2=H5Tget_class(f_tid2)) < 0)
+ return -1;
+
+ if ( tclass1 != tclass2 )
+ {
+ if (options->m_verbose && obj1_name)
+ {
+ printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n",
+ obj1_name, get_class(tclass1),
+ obj2_name, get_class(tclass2) );
+ }
+ return 0;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for non supported classes
+ *-------------------------------------------------------------------------
+ */
+
+ assert(tclass1==tclass2);
+ switch (tclass1)
+ {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_COMPOUND:
+ case H5T_STRING:
+ case H5T_ARRAY:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_REFERENCE:
+
+ break;
+
+ default: /*H5T_TIME */
+ if (options->m_verbose && obj1_name )
+ printf("Comparison not supported: <%s> and <%s> are of class %s\n",
+ obj1_name,obj2_name,get_class(tclass2) );
+ return 0;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for equal file datatype; warning only
+ *-------------------------------------------------------------------------
+ */
+
+ if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name)
+ {
+ printf("Warning: different storage datatype\n");
+ printf("<%s> has file datatype ", obj1_name);
+ print_type(f_tid1);
+ printf("\n");
+ printf("<%s> has file datatype ", obj2_name);
+ print_type(f_tid2);
+ printf("\n");
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for the same rank
+ *-------------------------------------------------------------------------
+ */
+
+ if ( rank1 != rank2 )
+ {
+ if (options->m_verbose && obj1_name)
+ {
+ printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1);
+ print_dimensions(rank1,dims1);
+ printf(", max dimensions ");
+ print_dimensions(rank1,maxdim1);
+ printf("\n" );
+ printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
+ print_dimensions(rank2,dims2);
+ printf(", max dimensions ");
+ print_dimensions(rank2,maxdim2);
+ }
+ return 0;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for different dimensions
+ *-------------------------------------------------------------------------
+ */
+
+ assert(rank1==rank2);
+ for ( i=0; i<rank1; i++)
+ {
+ if (maxdim1 && maxdim2)
+ {
+ if ( maxdim1[i] != maxdim2[i] )
+ maxdim_diff=1;
+ }
+ if ( dims1[i] != dims2[i] )
+ dim_diff=1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * current dimensions
+ *-------------------------------------------------------------------------
+ */
+
+ if (dim_diff==1)
+ {
+ if (options->m_verbose && obj1_name)
+ {
+ printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1);
+ print_dimensions(rank1,dims1);
+ if (maxdim1 && maxdim2)
+ {
+ printf(", max dimensions ");
+ print_dimensions(rank1,maxdim1);
+ printf("\n" );
+ printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
+ print_dimensions(rank2,dims2);
+ printf(", max dimensions ");
+ print_dimensions(rank2,maxdim2);
+ }
+ }
+ return 0;
+ }
+
+ /*-------------------------------------------------------------------------
+ * maximum dimensions; just give a warning
+ *-------------------------------------------------------------------------
+ */
+ if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name )
+ {
+ if (options->m_verbose)
+ {
+ printf( "Warning: different maximum dimensions\n");
+ printf("<%s> has max dimensions ", obj1_name);
+ print_dimensions(rank1,maxdim1);
+ printf("\n");
+ printf("<%s> has max dimensions ", obj2_name);
+ print_dimensions(rank2,maxdim2);
+ printf("\n");
+ }
+ }
+
+ return 1;
}
-
-
/*-------------------------------------------------------------------------
* Function: print_sizes
*
@@ -887,3 +874,29 @@ void print_sizes( const char *obj1,
printf("\n");
}
#endif /* H5DIFF_DEBUG */
+
+/*-------------------------------------------------------------------------
+ * Function: print_size
+ *
+ * Purpose: print dimensions
+ *
+ *-------------------------------------------------------------------------
+ */
+#if defined (H5DIFF_DEBUG)
+static void
+print_size (int rank, hsize_t *dims)
+{
+ int i;
+
+ parallel_print("[" );
+ for ( i = 0; i < rank-1; i++)
+ {
+ parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[i]);
+ parallel_print("x");
+ }
+ parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]);
+ parallel_print("]\n" );
+
+}
+#endif /* H5DIFF_DEBUG */
+
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 9e9c556..4cddbfb 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -131,91 +131,91 @@ print_dimensions (int rank, hsize_t *dims)
*/
void print_type(hid_t type)
{
- switch (H5Tget_class(type))
- {
- default:
- return;
- case H5T_INTEGER:
- if (H5Tequal(type, H5T_STD_I8BE)) {
- printf("H5T_STD_I8BE");
- } else if (H5Tequal(type, H5T_STD_I8LE)) {
- printf("H5T_STD_I8LE");
- } else if (H5Tequal(type, H5T_STD_I16BE)) {
- printf("H5T_STD_I16BE");
- } else if (H5Tequal(type, H5T_STD_I16LE)) {
- printf("H5T_STD_I16LE");
- } else if (H5Tequal(type, H5T_STD_I32BE)) {
- printf("H5T_STD_I32BE");
- } else if (H5Tequal(type, H5T_STD_I32LE)) {
- printf("H5T_STD_I32LE");
- } else if (H5Tequal(type, H5T_STD_I64BE)) {
- printf("H5T_STD_I64BE");
- } else if (H5Tequal(type, H5T_STD_I64LE)) {
- printf("H5T_STD_I64LE");
- } else if (H5Tequal(type, H5T_STD_U8BE)) {
- printf("H5T_STD_U8BE");
- } else if (H5Tequal(type, H5T_STD_U8LE)) {
- printf("H5T_STD_U8LE");
- } else if (H5Tequal(type, H5T_STD_U16BE)) {
- printf("H5T_STD_U16BE");
- } else if (H5Tequal(type, H5T_STD_U16LE)) {
- printf("H5T_STD_U16LE");
- } else if (H5Tequal(type, H5T_STD_U32BE)) {
- printf("H5T_STD_U32BE");
- } else if (H5Tequal(type, H5T_STD_U32LE)) {
- printf("H5T_STD_U32LE");
- } else if (H5Tequal(type, H5T_STD_U64BE)) {
- printf("H5T_STD_U64BE");
- } else if (H5Tequal(type, H5T_STD_U64LE)) {
- printf("H5T_STD_U64LE");
- } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
- printf("H5T_NATIVE_SCHAR");
- } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
- printf("H5T_NATIVE_UCHAR");
- } else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
- printf("H5T_NATIVE_SHORT");
- } else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
- printf("H5T_NATIVE_USHORT");
- } else if (H5Tequal(type, H5T_NATIVE_INT)) {
- printf("H5T_NATIVE_INT");
- } else if (H5Tequal(type, H5T_NATIVE_UINT)) {
- printf("H5T_NATIVE_UINT");
- } else if (H5Tequal(type, H5T_NATIVE_LONG)) {
- printf("H5T_NATIVE_LONG");
- } else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
- printf("H5T_NATIVE_ULONG");
- } else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
- printf("H5T_NATIVE_LLONG");
- } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
- printf("H5T_NATIVE_ULLONG");
- } else {
- printf("undefined integer");
- }
- break;
-
- case H5T_FLOAT:
- if (H5Tequal(type, H5T_IEEE_F32BE)) {
- printf("H5T_IEEE_F32BE");
- } else if (H5Tequal(type, H5T_IEEE_F32LE)) {
- printf("H5T_IEEE_F32LE");
- } else if (H5Tequal(type, H5T_IEEE_F64BE)) {
- printf("H5T_IEEE_F64BE");
- } else if (H5Tequal(type, H5T_IEEE_F64LE)) {
- printf("H5T_IEEE_F64LE");
- } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
- printf("H5T_NATIVE_FLOAT");
- } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
- printf("H5T_NATIVE_DOUBLE");
+ switch (H5Tget_class(type))
+ {
+ default:
+ return;
+ case H5T_INTEGER:
+ if (H5Tequal(type, H5T_STD_I8BE)) {
+ printf("H5T_STD_I8BE");
+ } else if (H5Tequal(type, H5T_STD_I8LE)) {
+ printf("H5T_STD_I8LE");
+ } else if (H5Tequal(type, H5T_STD_I16BE)) {
+ printf("H5T_STD_I16BE");
+ } else if (H5Tequal(type, H5T_STD_I16LE)) {
+ printf("H5T_STD_I16LE");
+ } else if (H5Tequal(type, H5T_STD_I32BE)) {
+ printf("H5T_STD_I32BE");
+ } else if (H5Tequal(type, H5T_STD_I32LE)) {
+ printf("H5T_STD_I32LE");
+ } else if (H5Tequal(type, H5T_STD_I64BE)) {
+ printf("H5T_STD_I64BE");
+ } else if (H5Tequal(type, H5T_STD_I64LE)) {
+ printf("H5T_STD_I64LE");
+ } else if (H5Tequal(type, H5T_STD_U8BE)) {
+ printf("H5T_STD_U8BE");
+ } else if (H5Tequal(type, H5T_STD_U8LE)) {
+ printf("H5T_STD_U8LE");
+ } else if (H5Tequal(type, H5T_STD_U16BE)) {
+ printf("H5T_STD_U16BE");
+ } else if (H5Tequal(type, H5T_STD_U16LE)) {
+ printf("H5T_STD_U16LE");
+ } else if (H5Tequal(type, H5T_STD_U32BE)) {
+ printf("H5T_STD_U32BE");
+ } else if (H5Tequal(type, H5T_STD_U32LE)) {
+ printf("H5T_STD_U32LE");
+ } else if (H5Tequal(type, H5T_STD_U64BE)) {
+ printf("H5T_STD_U64BE");
+ } else if (H5Tequal(type, H5T_STD_U64LE)) {
+ printf("H5T_STD_U64LE");
+ } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
+ printf("H5T_NATIVE_SCHAR");
+ } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
+ printf("H5T_NATIVE_UCHAR");
+ } else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
+ printf("H5T_NATIVE_SHORT");
+ } else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
+ printf("H5T_NATIVE_USHORT");
+ } else if (H5Tequal(type, H5T_NATIVE_INT)) {
+ printf("H5T_NATIVE_INT");
+ } else if (H5Tequal(type, H5T_NATIVE_UINT)) {
+ printf("H5T_NATIVE_UINT");
+ } else if (H5Tequal(type, H5T_NATIVE_LONG)) {
+ printf("H5T_NATIVE_LONG");
+ } else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
+ printf("H5T_NATIVE_ULONG");
+ } else if (H5Tequal(type, H5T_NATIVE_LLONG)) {
+ printf("H5T_NATIVE_LLONG");
+ } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) {
+ printf("H5T_NATIVE_ULLONG");
+ } else {
+ printf("undefined integer");
+ }
+ break;
+
+ case H5T_FLOAT:
+ if (H5Tequal(type, H5T_IEEE_F32BE)) {
+ printf("H5T_IEEE_F32BE");
+ } else if (H5Tequal(type, H5T_IEEE_F32LE)) {
+ printf("H5T_IEEE_F32LE");
+ } else if (H5Tequal(type, H5T_IEEE_F64BE)) {
+ printf("H5T_IEEE_F64BE");
+ } else if (H5Tequal(type, H5T_IEEE_F64LE)) {
+ printf("H5T_IEEE_F64LE");
+ } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
+ printf("H5T_NATIVE_FLOAT");
+ } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
+ printf("H5T_NATIVE_DOUBLE");
#if H5_SIZEOF_LONG_DOUBLE !=0
- } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
- printf("H5T_NATIVE_LDOUBLE");
+ } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) {
+ printf("H5T_NATIVE_LDOUBLE");
#endif
- } else {
- printf("undefined float");
- }
- break;
-
- }/*switch*/
+ } else {
+ printf("undefined float");
+ }
+ break;
+
+ }/*switch*/
}
/*-------------------------------------------------------------------------
@@ -232,21 +232,21 @@ void print_type(hid_t type)
const char*
diff_basename(const char *name)
{
- size_t i;
-
- if (name==NULL)
- return NULL;
-
- /* Find the end of the base name */
- i = strlen(name);
- while (i>0 && '/'==name[i-1])
- --i;
-
- /* Skip backward over base name */
- while (i>0 && '/'!=name[i-1])
- --i;
-
- return(name+i);
+ size_t i;
+
+ if (name==NULL)
+ return NULL;
+
+ /* Find the end of the base name */
+ i = strlen(name);
+ while (i>0 && '/'==name[i-1])
+ --i;
+
+ /* Skip backward over base name */
+ while (i>0 && '/'!=name[i-1])
+ --i;
+
+ return(name+i);
}
/*-------------------------------------------------------------------------
@@ -295,15 +295,15 @@ get_type(h5trav_type_t type)
const char*
get_sign(H5T_sign_t sign)
{
- switch (sign)
- {
- default:
- return("H5T_SGN_ERROR");
- case H5T_SGN_NONE:
- return("H5T_SGN_NONE");
- case H5T_SGN_2:
- return("H5T_SGN_2");
- }
+ switch (sign)
+ {
+ default:
+ return("H5T_SGN_ERROR");
+ case H5T_SGN_NONE:
+ return("H5T_SGN_NONE");
+ case H5T_SGN_2:
+ return("H5T_SGN_2");
+ }
}
@@ -321,33 +321,33 @@ get_sign(H5T_sign_t sign)
const char*
get_class(H5T_class_t tclass)
{
- switch (tclass)
- {
- default:
- return("Invalid class");
- case H5T_TIME:
- return("H5T_TIME");
- case H5T_INTEGER:
- return("H5T_INTEGER");
- case H5T_FLOAT:
- return("H5T_FLOAT");
- case H5T_STRING:
- return("H5T_STRING");
- case H5T_BITFIELD:
- return("H5T_BITFIELD");
- case H5T_OPAQUE:
- return("H5T_OPAQUE");
- case H5T_COMPOUND:
- return("H5T_COMPOUND");
- case H5T_REFERENCE:
- return("H5T_REFERENCE");
- case H5T_ENUM:
- return("H5T_ENUM");
- case H5T_VLEN:
- return("H5T_VLEN");
- case H5T_ARRAY:
- return("H5T_ARRAY");
- }
+ switch (tclass)
+ {
+ default:
+ return("Invalid class");
+ case H5T_TIME:
+ return("H5T_TIME");
+ case H5T_INTEGER:
+ return("H5T_INTEGER");
+ case H5T_FLOAT:
+ return("H5T_FLOAT");
+ case H5T_STRING:
+ return("H5T_STRING");
+ case H5T_BITFIELD:
+ return("H5T_BITFIELD");
+ case H5T_OPAQUE:
+ return("H5T_OPAQUE");
+ case H5T_COMPOUND:
+ return("H5T_COMPOUND");
+ case H5T_REFERENCE:
+ return("H5T_REFERENCE");
+ case H5T_ENUM:
+ return("H5T_ENUM");
+ case H5T_VLEN:
+ return("H5T_VLEN");
+ case H5T_ARRAY:
+ return("H5T_ARRAY");
+ }
}
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 6fc09d7..120d433 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -538,29 +538,31 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
hsize_t nelmts, hid_t type, void *_mem)
{
unsigned char *mem = (unsigned char*)_mem;
- hsize_t i; /*element counter */
- char *s, *section; /*a section of output */
- int secnum; /*section sequence number */
- size_t size; /*size of each datum */
- 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
- *line is formed. I'm going to use
- *this var to count elements and
- *break after we see a number equal
- *to the ctx->size_last_dim. */
+ hsize_t i; /*element counter */
+ char *s;
+ char *section; /*a section of output */
+ int secnum; /*section sequence number */
+ size_t size; /*size of each datum */
+ 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
+ *line is formed. I'm going to use
+ *this var to count elements and
+ *break after we see a number equal
+ *to the ctx->size_last_dim. */
/* binary dump */
- if(bin_output) {
+ if(bin_output)
+ {
do_bin_output(stream, nelmts, type, _mem);
- bin_output = 0;
} /* end if */
- else {
- /* Setup */
+ else
+ {
+ /* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
size = H5Tget_size(type);
@@ -613,7 +615,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
}
/*
- * We need to break after each row_counter of a dimension---> we should
+ * We need to break after each row of a dimension---> we should
* break at the end of the each last dimension well that is the
* way the dumper did it before
*/