diff options
Diffstat (limited to 'tools/lib/h5diff_array.c')
-rw-r--r-- | tools/lib/h5diff_array.c | 5437 |
1 files changed, 3210 insertions, 2227 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 6da37e2..2476aaf 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -17,6 +17,12 @@ #include "h5diff.h" #include "ph5diff.h" #include "H5private.h" +#include "h5tools.h" + + +#include <sys/timeb.h> +#include <time.h> + /*------------------------------------------------------------------------- * printf formatting @@ -24,6 +30,11 @@ */ #define F_FORMAT "%-15g %-15g %-15g\n" + +#if H5_SIZEOF_LONG_DOUBLE !=0 +#define LD_FORMAT "%-15Lf %-15Lf %-15Lf\n" +#endif + #define I_FORMAT "%-15d %-15d %-15d\n" #define C_FORMAT "%-16c %-17c\n" #define S_FORMAT "%-16s %-17s\n" @@ -35,6 +46,11 @@ /* with -p option */ #define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n" + +#if H5_SIZEOF_LONG_DOUBLE !=0 +#define LD_FORMAT_P "%-15.10Lf %-15.10Lf %-15.10Lf %-14.10Lf\n" +#endif + #define I_FORMAT_P "%-15d %-15d %-15d %-14f\n" #define UI_FORMAT_P "%-15u %-15u %-15u %-14f\n" #define LI_FORMAT_P "%-15ld %-15ld %-15ld %-14f\n" @@ -45,6 +61,11 @@ /* not comparable */ #define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n" + +#if H5_SIZEOF_LONG_DOUBLE !=0 +#define LD_FORMAT_P_NOTCOMP "%-15.10Lf %-15.10Lf %-15.10Lf not comparable\n" +#endif + #define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n" #define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n" #define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n" @@ -57,15 +78,13 @@ #define H5DIFF_FLT_EPSILON .00001 #define H5DIFF_DBL_EPSILON .000000001 -static hbool_t equal_float(float value, float expected); -static hbool_t equal_double(double value, double expected); /*------------------------------------------------------------------------- * -p relative error formula * - * We assume the true value of a quantity to be A (value in first dataset) - * and the measured or inferred value to be B (value in second dataset). - * The relative error is defined by + * We assume the true value of a quantity to be A (value in first dataset) + * and the measured or inferred value to be B (value in second dataset). + * The relative error is defined by * * B - A * -------- @@ -120,96 +139,33 @@ 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(unsigned char *mem1,unsigned char *mem2,hsize_t i,unsigned u,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); +#if H5_SIZEOF_LONG_DOUBLE !=0 +static hbool_t equal_ldouble(long double value, long double expected); +#endif +static int print_data(diff_opt_t *options); +static void print_pos(int *ph,int pp,hsize_t curr_pos,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 ); +static void print_char_pos(int *ph,int pp,hsize_t curr_pos,unsigned u,hsize_t *acc,hsize_t *pos,int rank,hsize_t *dims,const char *obj1,const char *obj2 ); +static void h5diff_print_char(char ch); /*------------------------------------------------------------------------- - * - * Local functions - * - *------------------------------------------------------------------------- - */ - -/*------------------------------------------------------------------------- - * Function: print_data - * - * Purpose: print data only in report or verbose modes, and do not print in quiet mode + * NaN detection *------------------------------------------------------------------------- */ -static -int print_data(diff_opt_t *options) +typedef enum dtype_t { - return ( (options->m_report || options->m_verbose) && !options->m_quiet)?1:0; -} + FLT_FLOAT, FLT_DOUBLE, +#if H5_SIZEOF_LONG_DOUBLE !=0 + FLT_LDOUBLE, +#endif +} dtype_t; -/*------------------------------------------------------------------------- - * Function: print_pos - * - * Purpose: print in matrix notation, converting from an array index position - * - *------------------------------------------------------------------------- - */ +static int my_isnan(dtype_t type, void *val); -static -void print_pos( int *ph, /* print header */ - int pp, /* print percentage */ - hsize_t curr_pos, - hsize_t *acc, - hsize_t *pos, - int rank, - hsize_t *dims, - const char *obj1, - const char *obj2 ) -{ - int i; - - /* print header */ - if ( *ph==1 ) - { - *ph=0; - - parallel_print("%-16s","size:"); - print_dimensions (rank,dims); - parallel_print("%-11s",""); - print_dimensions (rank,dims); - parallel_print("\n"); - - if (pp) - { - parallel_print("%-15s %-15s %-15s %-15s %-15s\n", - "position", - (obj1!=NULL) ? obj1 : " ", - (obj2!=NULL) ? obj2 : " ", - "difference", - "relative"); - parallel_print("------------------------------------------------------------------------\n"); - } - else - { - parallel_print("%-15s %-15s %-15s %-20s\n", - "position", - (obj1!=NULL) ? obj1 : " ", - (obj2!=NULL) ? obj2 : " ", - "difference"); - parallel_print("------------------------------------------------------------\n"); - } - } /* end print header */ - - for ( i = 0; i < rank; i++) - { - pos[i] = curr_pos/acc[i]; - curr_pos -= acc[i]*pos[i]; - } - assert( curr_pos == 0 ); - - parallel_print("[ " ); - for ( i = 0; i < rank; i++) - { - parallel_print("%"H5_PRINTF_LL_WIDTH"u ", (unsigned long_long)pos[i]); - } - parallel_print("]" ); -} /*------------------------------------------------------------------------- @@ -239,134 +195,142 @@ hsize_t diff_array( void *_mem1, hid_t container1_id, hid_t container2_id) /* dataset where the reference came from*/ { - hsize_t nfound=0; /* number of differences found */ - 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 */ - hsize_t i; - int j; - - /* get the size. */ - size = H5Tget_size( m_type ); - - acc[rank-1]=1; - for(j=(rank-2); j>=0; j--) - { - acc[j]=acc[j+1]*dims[j+1]; - } - for ( j = 0; j < rank; j++) - pos[j]=0; - - 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); - } + hsize_t nfound=0; /* number of differences found */ + size_t size; /* size of datum */ + unsigned char *mem1 = (unsigned char*)_mem1; + unsigned char *mem2 = (unsigned char*)_mem2; + hsize_t acc[32]; /* accumulator position */ + hsize_t pos[32]; /* matrix position */ + int ph=1; /* print header */ + hsize_t i; + int j; + + + /* get the size. */ + size = H5Tget_size( m_type ); + + acc[rank-1]=1; + for(j=(rank-2); j>=0; j--) + { + acc[j]=acc[j+1]*dims[j+1]; + } + for ( j = 0; j < rank; j++) + pos[j]=0; - else - { - switch (H5Tget_class(m_type)) - { - default: - assert(0); - break; + if(H5Tis_variable_str(m_type)) + { + 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 */ + } - /*------------------------------------------------------------------------- - * float and integer atomic types - *------------------------------------------------------------------------- - */ - - case H5T_FLOAT: - - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) - nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) - nfound=diff_double(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - break; - - case H5T_INTEGER: - - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) - nfound=diff_schar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) - nfound=diff_uchar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) - nfound=diff_short(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) - nfound=diff_ushort(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_INT)) - nfound=diff_int(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) - nfound=diff_uint(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) - nfound=diff_long(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) - nfound=diff_ulong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) - nfound=diff_llong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) - nfound=diff_ullong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - - break; + else + { + switch (H5Tget_class(m_type)) + { + default: + assert(0); + break; - /*------------------------------------------------------------------------- - * Other types than float and integer - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * float and integer atomic types + *------------------------------------------------------------------------- + */ - case H5T_COMPOUND: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_ENUM: - case H5T_ARRAY: - case H5T_VLEN: - case H5T_REFERENCE: - - for ( i = 0; i < nelmts; i++) - { - nfound+=diff_datum( - mem1 + i * size, - mem2 + i * size, /* offset */ - m_type, - i, - rank, - dims, - acc, - pos, - options, - name1, - name2, - container1_id, - container2_id, - &ph); - if (options->n && nfound>=options->count) - return nfound; - } /* i */ - } /* switch */ - } /* else */ + case H5T_FLOAT: + + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) + nfound=diff_double(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + +#if H5_SIZEOF_LONG_DOUBLE !=0 + else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE)) + nfound=diff_ldouble(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); +#endif + + break; + + case H5T_INTEGER: + + if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) + nfound=diff_schar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + nfound=diff_uchar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) + nfound=diff_short(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) + nfound=diff_ushort(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_INT)) + nfound=diff_int(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + nfound=diff_uint(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) + nfound=diff_long(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + nfound=diff_ulong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + nfound=diff_llong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + nfound=diff_ullong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); + + break; + + /*------------------------------------------------------------------------- + * Other types than float and integer + *------------------------------------------------------------------------- + */ + + case H5T_COMPOUND: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_ARRAY: + case H5T_VLEN: + case H5T_REFERENCE: + + for ( i = 0; i < nelmts; i++) + { + nfound+=diff_datum( + mem1 + i * size, + mem2 + i * size, /* offset */ + m_type, + i, + rank, + dims, + acc, + pos, + options, + name1, + name2, + container1_id, + container2_id, + &ph); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ + } /* switch */ + } /* else */ - return nfound; + return nfound; } /*------------------------------------------------------------------------- @@ -422,1637 +386,1944 @@ hsize_t diff_datum(void *_mem1, hid_t container2_id, /*where the reference came from*/ int *ph) /*print header */ { - unsigned char *mem1 = (unsigned char*)_mem1; - unsigned char *mem2 = (unsigned char*)_mem2; - unsigned u; - hid_t memb_type; - size_t type_size; - size_t offset; - int nmembs; - int j; - hsize_t nelmts; - size_t size=0; - int iszero1; - int iszero2; - hid_t obj1_id; - hid_t obj2_id; - hsize_t nfound=0; /* differences found */ - int ret=0; /* check return error */ - float f1, f2; - double per; - int both_zero; + unsigned char *mem1 = (unsigned char*)_mem1; + unsigned char *mem2 = (unsigned char*)_mem2; + unsigned u; + hid_t memb_type; + size_t type_size; + size_t offset; + int nmembs; + int j; + hsize_t nelmts; + size_t size=0; + int iszero1; + int iszero2; + hid_t obj1_id; + hid_t obj2_id; + hsize_t nfound=0; /* differences found */ + int ret=0; /* check return error */ + float f1, f2; + double per; + int both_zero; + + type_size = H5Tget_size( m_type ); + + switch (H5Tget_class(m_type)) + { + default: + assert(0); + break; + case H5T_TIME: + assert(0); + break; + + /*------------------------------------------------------------------------- + * H5T_COMPOUND + *------------------------------------------------------------------------- + */ + case H5T_COMPOUND: - type_size = H5Tget_size( m_type ); + nmembs = H5Tget_nmembers(m_type); - switch (H5Tget_class(m_type)) - { - default: - assert(0); - break; - case H5T_TIME: - assert(0); - break; + for (j = 0; j < nmembs; j++) + { + offset = H5Tget_member_offset(m_type, (unsigned)j); + memb_type = H5Tget_member_type(m_type, (unsigned)j); + nfound+=diff_datum( + mem1+offset, + mem2+offset, + memb_type, + i, + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + container1_id, + container2_id, + ph); + H5Tclose(memb_type); + } + break; - /*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - case H5T_COMPOUND: - nmembs = H5Tget_nmembers(m_type); - for (j = 0; j < nmembs; j++) - { - offset = H5Tget_member_offset(m_type, (unsigned)j); - memb_type = H5Tget_member_type(m_type, (unsigned)j); - nfound+=diff_datum( - mem1+offset, - mem2+offset, - memb_type, - i, - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - container1_id, - container2_id, - ph); - H5Tclose(memb_type); - } - break; + /*------------------------------------------------------------------------- + * H5T_STRING + *------------------------------------------------------------------------- + */ + case H5T_STRING: - /*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - 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); - - /* check for NULL pointer for string */ - if(s!=NULL) - 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); - - } - break; + { + H5T_str_t pad; + char *s; - /*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - case H5T_BITFIELD: - { - /* byte-by-byte comparison */ - for (u=0; u<type_size; u++) - nfound+=character_compare_opt( - mem1 + u, - mem2 + u, /* offset */ - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - ph); - - } - break; + /* Get pointer to first string to compare */ + s = (char *)mem1; - /*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - case H5T_OPAQUE: - - /* byte-by-byte comparison */ - for (u=0; u<type_size; u++) - nfound+=character_compare_opt( - mem1 + u, - mem2 + u, /* offset */ - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - ph); - - break; + /* 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 */ + u, /* string character position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + ph); + } + } + break; - /*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - case H5T_ENUM: + /*------------------------------------------------------------------------- + * H5T_BITFIELD + *------------------------------------------------------------------------- + */ + case H5T_BITFIELD: + + /* byte-by-byte comparison */ + for (u=0; u<type_size; u++) + nfound+=character_compare_opt( + mem1 + u, + mem2 + u, /* offset */ + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + ph); + + break; - /* For enumeration types we compare the names instead of the + /*------------------------------------------------------------------------- + * H5T_OPAQUE + *------------------------------------------------------------------------- + */ + case H5T_OPAQUE: + + /* byte-by-byte comparison */ + for (u=0; u<type_size; u++) + nfound+=character_compare_opt( + mem1 + u, + mem2 + u, /* offset */ + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + ph); + + break; + + + /*------------------------------------------------------------------------- + * H5T_ENUM + *------------------------------------------------------------------------- + */ + case H5T_ENUM: + + /* For enumeration types we compare the names instead of the integer values. For each pair of elements being compared, we convert both bit patterns to their corresponding enumeration constant and do a string comparison - */ + */ - { - char enum_name1[1024]; - char enum_name2[1024]; + { + char enum_name1[1024]; + char enum_name2[1024]; - /* disable error reporting */ - H5E_BEGIN_TRY { + /* disable error reporting */ + H5E_BEGIN_TRY { - if ((H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1) >= 0) && - (H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2) >= 0)) - { - if (HDstrcmp(enum_name1,enum_name2)!=0) - { - nfound=1; - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(S_FORMAT,enum_name1,enum_name2); - } - } - else - { - for (u=0; u<type_size; u++) - nfound+=character_compare_opt( - mem1 + u, - mem2 + u, /* offset */ - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - ph); - } - } - /* enable error reporting */ - } H5E_END_TRY; - } + if ((H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1) >= 0) && + (H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2) >= 0)) + { + if (HDstrcmp(enum_name1,enum_name2)!=0) + { + nfound=1; + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(S_FORMAT,enum_name1,enum_name2); + } + } + else + { + for (u=0; u<type_size; u++) + nfound+=character_compare_opt( + mem1 + u, + mem2 + u, /* offset */ + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + ph); + } + } + /* enable error reporting */ + } H5E_END_TRY; + } - break; + break; - /*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - case H5T_ARRAY: - { - hsize_t adims[H5S_MAX_RANK]; - hsize_t ndims; - /* get the array's base datatype for each element */ - memb_type = H5Tget_super(m_type); - size = H5Tget_size(memb_type); - ndims = H5Tget_array_ndims(m_type); - H5Tget_array_dims2(m_type, adims); - assert(ndims >= 1 && ndims <= H5S_MAX_RANK); - - /* calculate the number of array elements */ - for (u = 0, nelmts = 1; u <ndims; u++) - nelmts *= adims[u]; - for (u = 0; u < nelmts; u++) - nfound+=diff_datum( - mem1 + u * size, - mem2 + u * size, /* offset */ - memb_type, - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - container1_id, - container2_id, - ph); - H5Tclose(memb_type); - } - break; + /*------------------------------------------------------------------------- + * H5T_ARRAY + *------------------------------------------------------------------------- + */ + case H5T_ARRAY: - /*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ + { + hsize_t adims[H5S_MAX_RANK]; + hsize_t ndims; + /* get the array's base datatype for each element */ + memb_type = H5Tget_super(m_type); + size = H5Tget_size(memb_type); + ndims = H5Tget_array_ndims(m_type); + H5Tget_array_dims2(m_type, adims); + assert(ndims >= 1 && ndims <= H5S_MAX_RANK); + + /* calculate the number of array elements */ + for (u = 0, nelmts = 1; u <ndims; u++) + nelmts *= adims[u]; + for (u = 0; u < nelmts; u++) + nfound+=diff_datum( + mem1 + u * size, + mem2 + u * size, /* offset */ + memb_type, + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + container1_id, + container2_id, + ph); + H5Tclose(memb_type); + } + break; - case H5T_VLEN: - - /* get the VL sequences's base datatype for each element */ - memb_type = H5Tget_super(m_type); - size = H5Tget_size(memb_type); - - /* get the number of sequence elements */ - nelmts = ((hvl_t *)mem1)->len; - - for (j = 0; j < (int)nelmts; j++) - nfound+=diff_datum( - ((char *)(((hvl_t *)mem1)->p)) + j * size, - ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */ - memb_type, - i, /* index position */ - rank, - dims, - acc, - pos, - options, - obj1, - obj2, - container1_id, - container2_id, - ph); - - H5Tclose(memb_type); - - break; - - - case H5T_REFERENCE: - - iszero1=all_zero(_mem1, H5Tget_size(m_type)); - iszero2=all_zero(_mem2, H5Tget_size(m_type)); - if (iszero1 != iszero2) - { - return 1; - } - else if (!iszero1 && !iszero2) - { - - /*------------------------------------------------------------------------- - * H5T_STD_REF_DSETREG - * Dataset region reference - *------------------------------------------------------------------------- - */ - if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) - { - hid_t region1_id; - hid_t region2_id; - - if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1))<0) - ret= -1; - if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2))<0) - ret= -1; - if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1))<0) - ret= -1; - if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2))<0) - ret= -1; - - if (ret==-1) { - options->err_stat=1; - return 0; - } - nfound = diff_region(obj1_id,obj2_id,region1_id,region2_id,options); + /*------------------------------------------------------------------------- + * H5T_REFERENCE + *------------------------------------------------------------------------- + */ - H5Oclose(obj1_id); - H5Oclose(obj2_id); - H5Sclose(region1_id); - H5Sclose(region2_id); + case H5T_REFERENCE: - }/*dataset reference*/ + iszero1=all_zero(_mem1, H5Tget_size(m_type)); + iszero2=all_zero(_mem2, H5Tget_size(m_type)); + if (iszero1 != iszero2) + { + return 1; + } + else if (!iszero1 && !iszero2) + { + /*------------------------------------------------------------------------- + * H5T_STD_REF_DSETREG + * Dataset region reference + *------------------------------------------------------------------------- + */ - /*------------------------------------------------------------------------- - * H5T_STD_REF_OBJ - * Object references. get the type and OID of the referenced object - *------------------------------------------------------------------------- - */ - else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) - { - H5O_type_t obj1_type; - H5O_type_t obj2_type; - - if(H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) - ret = -1; - if(H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) - ret = -1; - if(ret == -1) { - options->err_stat = 1; - return 0; - } /* end if */ - - /* check object type */ - if(obj1_type != obj2_type) - { - parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); - options->not_cmp = 1; - return 0; - } + if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) + { + hid_t region1_id; + hid_t region2_id; + + if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1))<0) + ret= -1; + if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2))<0) + ret= -1; + if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1))<0) + ret= -1; + if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2))<0) + ret= -1; + + if (ret==-1) { + options->err_stat=1; + return 0; + } - if((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1)) < 0) - ret = -1; - if((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2)) < 0) - ret = -1; - if(ret == -1) { - options->err_stat = 1; - return 0; - } /* end if */ - - /* compare */ - if(obj1_type == H5O_TYPE_DATASET) - nfound = diff_datasetid(obj1_id, - obj2_id, - NULL, - NULL, - options); - else { - parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>", - obj1, obj2); - options->not_cmp = 1; - } + nfound = diff_region(obj1_id,obj2_id,region1_id,region2_id,options); - H5Oclose(obj1_id); - H5Oclose(obj2_id); + H5Oclose(obj1_id); + H5Oclose(obj2_id); + H5Sclose(region1_id); + H5Sclose(region2_id); - }/*object reference*/ + }/*dataset reference*/ - }/*is zero*/ + /*------------------------------------------------------------------------- + * H5T_STD_REF_OBJ + * Object references. get the type and OID of the referenced object + *------------------------------------------------------------------------- + */ + else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) + { + H5O_type_t obj1_type; + H5O_type_t obj2_type; + + if(H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) + ret = -1; + if(H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) + ret = -1; + if(ret == -1) { + options->err_stat = 1; + return 0; + } /* end if */ + + /* check object type */ + if(obj1_type != obj2_type) + { + parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); + options->not_cmp = 1; + return 0; + } - break; + if((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1)) < 0) + ret = -1; + if((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2)) < 0) + ret = -1; + if(ret == -1) { + options->err_stat = 1; + return 0; + } /* end if */ + + /* compare */ + if(obj1_type == H5O_TYPE_DATASET) + nfound = diff_datasetid(obj1_id, + obj2_id, + NULL, + NULL, + options); + else { + parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>", + obj1, obj2); + options->not_cmp = 1; + } + H5Oclose(obj1_id); + H5Oclose(obj2_id); - case H5T_INTEGER: + }/*object reference*/ + }/*is zero*/ - /*------------------------------------------------------------------------- - * H5T_NATIVE_SCHAR - *------------------------------------------------------------------------- - */ - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) - { - char temp1_char; - char temp2_char; - assert(type_size==sizeof(char)); - memcpy(&temp1_char, mem1, sizeof(char)); - memcpy(&temp2_char, mem2, sizeof(char)); - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_char-temp2_char) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER(temp1_char,temp2_char); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_char,temp2_char,ABS(temp1_char-temp2_char),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER(temp1_char,temp2_char); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_char,temp2_char,ABS(temp1_char-temp2_char),per); - } - nfound++; - } - } - else if (temp1_char != temp2_char) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); - } - nfound++; - } - - } /*H5T_NATIVE_SCHAR*/ - /*------------------------------------------------------------------------- - * H5T_NATIVE_UCHAR - *------------------------------------------------------------------------- - */ - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) - { - unsigned char temp1_uchar; - unsigned char temp2_uchar; - assert(type_size==sizeof(unsigned char)); - - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - /* -d and !-p */ - if (options->d && !options->p) - { - if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per); - } - nfound++; - } - } - else if (temp1_uchar != temp2_uchar) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - - } /*H5T_NATIVE_UCHAR*/ + break; + /*------------------------------------------------------------------------- + * H5T_VLEN + *------------------------------------------------------------------------- + */ - /*------------------------------------------------------------------------- - * H5T_NATIVE_SHORT - *------------------------------------------------------------------------- - */ + case H5T_VLEN: - else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) - { - short temp1_short; - short temp2_short; - assert(type_size==sizeof(short)); - - memcpy(&temp1_short, mem1, sizeof(short)); - memcpy(&temp2_short, mem2, sizeof(short)); - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_short-temp2_short) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER(temp1_short,temp2_short); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_short,temp2_short,ABS(temp1_short-temp2_short),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER(temp1_short,temp2_short); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_short,temp2_short,ABS(temp1_short-temp2_short),per); - } - nfound++; - } - } - else if (temp1_short != temp2_short) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); - } - nfound++; - } - - - } /*H5T_NATIVE_SHORT*/ + /* get the VL sequences's base datatype for each element */ + memb_type = H5Tget_super(m_type); + size = H5Tget_size(memb_type); - /*------------------------------------------------------------------------- - * H5T_NATIVE_USHORT - *------------------------------------------------------------------------- - */ + /* get the number of sequence elements */ + nelmts = ((hvl_t *)mem1)->len; - else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) - { - unsigned short temp1_ushort; - unsigned short temp2_ushort; - assert(type_size==sizeof(short)); - - memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - /* -d and !-p */ - if (options->d && !options->p) - { - if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) - { - - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort),per); - } - nfound++; - } - } - else if (temp1_ushort != temp2_ushort) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - } /*H5T_NATIVE_USHORT*/ + for (j = 0; j < (int)nelmts; j++) + nfound+=diff_datum( + ((char *)(((hvl_t *)mem1)->p)) + j * size, + ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */ + memb_type, + i, /* index position */ + rank, + dims, + acc, + pos, + options, + obj1, + obj2, + container1_id, + container2_id, + ph); + H5Tclose(memb_type); - /*------------------------------------------------------------------------- - * H5T_NATIVE_INT - *------------------------------------------------------------------------- - */ + break; - else if (H5Tequal(m_type, H5T_NATIVE_INT)) - { - int temp1_int; - int temp2_int; - assert(type_size==sizeof(int)); - - memcpy(&temp1_int, mem1, sizeof(int)); - memcpy(&temp2_int, mem2, sizeof(int)); - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_int-temp2_int) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER(temp1_int,temp2_int); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_int,temp2_int,ABS(temp1_int-temp2_int),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER(temp1_int,temp2_int); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_int,temp2_int,ABS(temp1_int-temp2_int),per); - } - nfound++; - } - } - else if (temp1_int != temp2_int) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); - } - nfound++; - } - } /*H5T_NATIVE_INT*/ - /*------------------------------------------------------------------------- - * H5T_NATIVE_UINT - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_INTEGER + *------------------------------------------------------------------------- + */ - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) - { - unsigned int temp1_uint; - unsigned int temp2_uint; - assert(type_size==sizeof(int)); - - memcpy(&temp1_uint, mem1, sizeof(unsigned int)); - memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - /* -d and !-p */ - if (options->d && !options->p) - { - if ( PDIFF(temp1_uint,temp2_uint) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(UI_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER_UNSIGN(signed int,temp1_uint,temp2_uint); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER_UNSIGN(signed int,temp1_uint,temp2_uint); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per); - } - nfound++; - } - } - else if (temp1_uint != temp2_uint) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(UI_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - } /*H5T_NATIVE_UINT*/ + case H5T_INTEGER: - /*------------------------------------------------------------------------- - * H5T_NATIVE_LONG - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_NATIVE_SCHAR + *------------------------------------------------------------------------- + */ + if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) + { + char temp1_char; + char temp2_char; + assert(type_size==sizeof(char)); + memcpy(&temp1_char, mem1, sizeof(char)); + memcpy(&temp2_char, mem2, sizeof(char)); + /* -d and !-p */ + if (options->d && !options->p) + { + if (ABS(temp1_char-temp2_char) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER(temp1_char,temp2_char); - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) - { - long temp1_long; - long temp2_long; - assert(type_size==sizeof(long)); - - memcpy(&temp1_long, mem1, sizeof(long)); - memcpy(&temp2_long, mem2, sizeof(long)); - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_long-temp2_long) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER(temp1_long,temp2_long); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, - ABS(temp1_long-temp2_long)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_long,temp2_long,ABS(temp1_long-temp2_long),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER(temp1_long,temp2_long); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_long,temp2_long, - ABS(temp1_long-temp2_long), - per); - } - nfound++; - } - } - else if (temp1_long != temp2_long) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); - } - nfound++; - } - } /*H5T_NATIVE_LONG*/ + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); + } + options->not_cmp=1; + nfound++; + } - /*------------------------------------------------------------------------- - * H5T_NATIVE_ULONG - *------------------------------------------------------------------------- - */ + else - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) - { - unsigned long temp1_ulong; - unsigned long temp2_ulong; - assert(type_size==sizeof(unsigned long)); - - memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - /* -d and !-p */ - if (options->d && !options->p) - { - if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong),per); - } - nfound++; - } - } - else if (temp1_ulong != temp2_ulong) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - - - } /*H5T_NATIVE_ULONG*/ + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_char,temp2_char,ABS(temp1_char-temp2_char),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER(temp1_char,temp2_char); - /*------------------------------------------------------------------------- - * H5T_NATIVE_LLONG - *------------------------------------------------------------------------- - */ + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); + } + options->not_cmp=1; + nfound++; + } - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) - { - long_long temp1_llong; - long_long temp2_llong; - assert(type_size==sizeof(long_long)); - - memcpy(&temp1_llong, mem1, sizeof(long_long)); - memcpy(&temp2_llong, mem2, sizeof(long_long)); - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_llong-temp2_llong) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - } - else if (temp1_llong != temp2_llong) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - } /*H5T_NATIVE_LLONG*/ + else - /*------------------------------------------------------------------------- - * H5T_NATIVE_ULLONG - *------------------------------------------------------------------------- - */ + if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_char,temp2_char,ABS(temp1_char-temp2_char),per); + } + nfound++; + } + } + else if (temp1_char != temp2_char) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); + } + nfound++; + } - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) - { - unsigned long_long temp1_ullong; - unsigned long_long temp2_ullong; - assert(type_size==sizeof(unsigned long_long)); - - memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); - memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - /* -d and !-p */ - if (options->d && !options->p) - { - if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long)options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long)options->delta ) - { - - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - } - else if (temp1_ullong != temp2_ullong) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - } /*H5T_NATIVE_ULLONG*/ - - - break; /* H5T_INTEGER class */ - - case H5T_FLOAT: + } /*H5T_NATIVE_SCHAR*/ - /*------------------------------------------------------------------------- - * H5T_NATIVE_FLOAT - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5T_NATIVE_UCHAR + *------------------------------------------------------------------------- + */ + else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + { + unsigned char temp1_uchar; + unsigned char temp2_uchar; + assert(type_size==sizeof(unsigned char)); + + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + /* -d and !-p */ + if (options->d && !options->p) + { + if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + options->not_cmp=1; + nfound++; + } + + else - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) - { - float temp1_float; - float temp2_float; - assert(type_size==sizeof(float)); - memcpy(&temp1_float, mem1, sizeof(float)); - memcpy(&temp2_float, mem2, sizeof(float)); - - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_float-temp2_float) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - - PER(temp1_float,temp2_float); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_float,temp2_float, - ABS(temp1_float-temp2_float), - ABS(1-temp2_float/temp1_float)); - } - nfound++; - } - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - PER(temp1_float,temp2_float); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, - ABS(temp1_float-temp2_float)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT_P,temp1_float,temp2_float, - ABS(temp1_float-temp2_float), - ABS(1-temp2_float/temp1_float)); - } - nfound++; - } - } - - else if (equal_float(temp1_float,temp2_float)==FALSE) - { - - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); - } - nfound++; - } - - } /*H5T_NATIVE_FLOAT*/ - - /*------------------------------------------------------------------------- - * H5T_NATIVE_DOUBLE - *------------------------------------------------------------------------- - */ - - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) - { - double temp1_double; - double temp2_double; - assert(type_size==sizeof(double)); - - memcpy(&temp1_double, mem1, sizeof(double)); - memcpy(&temp2_double, mem2, sizeof(double)); - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_double-temp2_double) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,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++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,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++; - } - } - - - /* -d and -p */ - else if ( options->d && options->p) - { - - PER(temp1_double,temp2_double); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,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++; - } - - else - - if ( per > options->percent && - ABS(temp1_double-temp2_double) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,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++; - } - } - - else if (equal_double(temp1_double,temp2_double)==FALSE) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); - } - nfound++; - } - } /*H5T_NATIVE_DOUBLE*/ - - - break; /* H5T_FLOAT class */ + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per); + } + nfound++; + } + } + else if (temp1_uchar != temp2_uchar) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + + } /*H5T_NATIVE_UCHAR*/ + + + /*------------------------------------------------------------------------- + * H5T_NATIVE_SHORT + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) + { + short temp1_short; + short temp2_short; + assert(type_size==sizeof(short)); + + memcpy(&temp1_short, mem1, sizeof(short)); + memcpy(&temp2_short, mem2, sizeof(short)); + /* -d and !-p */ + if (options->d && !options->p) + { + if (ABS(temp1_short-temp2_short) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER(temp1_short,temp2_short); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_short,temp2_short,ABS(temp1_short-temp2_short),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER(temp1_short,temp2_short); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_short,temp2_short,ABS(temp1_short-temp2_short),per); + } + nfound++; + } + } + else if (temp1_short != temp2_short) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); + } + nfound++; + } + + + } /*H5T_NATIVE_SHORT*/ + + /*------------------------------------------------------------------------- + * H5T_NATIVE_USHORT + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) + { + unsigned short temp1_ushort; + unsigned short temp2_ushort; + assert(type_size==sizeof(short)); + + memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + /* -d and !-p */ + if (options->d && !options->p) + { + if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) + { + + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort),per); + } + nfound++; + } + } + else if (temp1_ushort != temp2_ushort) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + } /*H5T_NATIVE_USHORT*/ + + + /*------------------------------------------------------------------------- + * H5T_NATIVE_INT + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_INT)) + { + int temp1_int; + int temp2_int; + assert(type_size==sizeof(int)); + + memcpy(&temp1_int, mem1, sizeof(int)); + memcpy(&temp2_int, mem2, sizeof(int)); + /* -d and !-p */ + if (options->d && !options->p) + { + if (ABS(temp1_int-temp2_int) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER(temp1_int,temp2_int); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_int,temp2_int,ABS(temp1_int-temp2_int),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER(temp1_int,temp2_int); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_int,temp2_int,ABS(temp1_int-temp2_int),per); + } + nfound++; + } + } + else if (temp1_int != temp2_int) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); + } + nfound++; + } + } /*H5T_NATIVE_INT*/ + + + /*------------------------------------------------------------------------- + * H5T_NATIVE_UINT + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + { + unsigned int temp1_uint; + unsigned int temp2_uint; + assert(type_size==sizeof(int)); + + memcpy(&temp1_uint, mem1, sizeof(unsigned int)); + memcpy(&temp2_uint, mem2, sizeof(unsigned int)); + /* -d and !-p */ + if (options->d && !options->p) + { + if ( PDIFF(temp1_uint,temp2_uint) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(UI_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER_UNSIGN(signed int,temp1_uint,temp2_uint); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER_UNSIGN(signed int,temp1_uint,temp2_uint); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint),per); + } + nfound++; + } + } + else if (temp1_uint != temp2_uint) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(UI_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + } /*H5T_NATIVE_UINT*/ + + + /*------------------------------------------------------------------------- + * H5T_NATIVE_LONG + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) + { + long temp1_long; + long temp2_long; + assert(type_size==sizeof(long)); + + memcpy(&temp1_long, mem1, sizeof(long)); + memcpy(&temp2_long, mem2, sizeof(long)); + /* -d and !-p */ + if (options->d && !options->p) + { + if (ABS(temp1_long-temp2_long) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER(temp1_long,temp2_long); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + ABS(temp1_long-temp2_long)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_long,temp2_long,ABS(temp1_long-temp2_long),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER(temp1_long,temp2_long); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_long,temp2_long, + ABS(temp1_long-temp2_long), + per); + } + nfound++; + } + } + else if (temp1_long != temp2_long) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); + } + nfound++; + } + } /*H5T_NATIVE_LONG*/ + + /*------------------------------------------------------------------------- + * H5T_NATIVE_ULONG + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + { + unsigned long temp1_ulong; + unsigned long temp2_ulong; + assert(type_size==sizeof(unsigned long)); + + memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + /* -d and !-p */ + if (options->d && !options->p) + { + if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong),per); + } + nfound++; + } + } + else if (temp1_ulong != temp2_ulong) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + + + } /*H5T_NATIVE_ULONG*/ + + /*------------------------------------------------------------------------- + * H5T_NATIVE_LLONG + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + { + long_long temp1_llong; + long_long temp2_llong; + assert(type_size==sizeof(long_long)); + + memcpy(&temp1_llong, mem1, sizeof(long_long)); + memcpy(&temp2_llong, mem2, sizeof(long_long)); + /* -d and !-p */ + if (options->d && !options->p) + { + if (ABS(temp1_llong-temp2_llong) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER(temp1_llong,temp2_llong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER(temp1_llong,temp2_llong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); + } + nfound++; + } + } + else if (temp1_llong != temp2_llong) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + + } /*H5T_NATIVE_LLONG*/ + + /*------------------------------------------------------------------------- + * H5T_NATIVE_ULLONG + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + { + unsigned long_long temp1_ullong; + unsigned long_long temp2_ullong; + assert(type_size==sizeof(unsigned long_long)); + + memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); + memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); + /* -d and !-p */ + if (options->d && !options->p) + { + if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long)options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + ull2float(temp1_ullong,&f1); + ull2float(temp2_ullong,&f2); + PER(f1,f2); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + ull2float(temp1_ullong,&f1); + ull2float(temp2_ullong,&f2); + PER(f1,f2); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long)options->delta ) + { + + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); + } + nfound++; + } + } + else if (temp1_ullong != temp2_ullong) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + + } /*H5T_NATIVE_ULLONG*/ + + + break; /* H5T_INTEGER class */ + + + /*------------------------------------------------------------------------- + * H5T_FLOAT + *------------------------------------------------------------------------- + */ + + case H5T_FLOAT: + + + + /*------------------------------------------------------------------------- + * H5T_NATIVE_FLOAT + *------------------------------------------------------------------------- + */ + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + { + float temp1_float; + float temp2_float; + int isnan1; + int isnan2; + + assert(type_size==sizeof(float)); + + memcpy(&temp1_float, mem1, sizeof(float)); + memcpy(&temp2_float, mem2, sizeof(float)); + + /* logic for detecting NaNs is different with options -d, -p and no options */ + + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (options->d && !options->p) + { + + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_FLOAT,&temp1_float); + isnan2 = my_isnan(FLT_FLOAT,&temp2_float); + + if ( !isnan1 && !isnan2) + { + + if (ABS(temp1_float-temp2_float) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; + } + + } /* NaN */ + } + /*------------------------------------------------------------------------- + * !-d and -p + *------------------------------------------------------------------------- + */ + else if (!options->d && options->p) + { + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_FLOAT,&temp1_float); + isnan2 = my_isnan(FLT_FLOAT,&temp2_float); + + if ( !isnan1 && !isnan2) + { + + PER(temp1_float,temp2_float); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_float,temp2_float, + ABS(temp1_float-temp2_float), + ABS(1-temp2_float/temp1_float)); + } + nfound++; + } + + } /* NaN */ + } + + /*------------------------------------------------------------------------- + * -d and -p + *------------------------------------------------------------------------- + */ + + else if ( options->d && options->p) + { + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_FLOAT,&temp1_float); + isnan2 = my_isnan(FLT_FLOAT,&temp2_float); + + if ( !isnan1 && !isnan2) + { + + PER(temp1_float,temp2_float); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, + ABS(temp1_float-temp2_float)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT_P,temp1_float,temp2_float, + ABS(temp1_float-temp2_float), + ABS(1-temp2_float/temp1_float)); + } + nfound++; + } + + } /* NaN */ + } + + /*------------------------------------------------------------------------- + * no -d and -p + *------------------------------------------------------------------------- + */ + else if (equal_float(temp1_float,temp2_float)==FALSE) + { + + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; + } + } /*H5T_NATIVE_FLOAT*/ + + /*------------------------------------------------------------------------- + * H5T_NATIVE_DOUBLE + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) + { + double temp1_double; + double temp2_double; + int isnan1; + int isnan2; + + + assert(type_size==sizeof(double)); + + memcpy(&temp1_double, mem1, sizeof(double)); + memcpy(&temp2_double, mem2, sizeof(double)); + + /* logic for detecting NaNs is different with options -d, -p and no options */ + + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (options->d && !options->p) + { + + /*------------------------------------------------------------------------- + * 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) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + } + + } /* NaN */ + } + + /*------------------------------------------------------------------------- + * !-d and -p + *------------------------------------------------------------------------- + */ + else if (!options->d && options->p) + { + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); + + if ( !isnan1 && !isnan2) + { + + PER(temp1_double,temp2_double); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,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++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,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 */ + } + + /*------------------------------------------------------------------------- + * -d and -p + *------------------------------------------------------------------------- + */ + else if ( options->d && options->p) + { + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); + + if ( !isnan1 && !isnan2) + { + + PER(temp1_double,temp2_double); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,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++; + } + + else + + if ( per > options->percent && + ABS(temp1_double-temp2_double) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,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 */ + } + + /*------------------------------------------------------------------------- + * no -d and -p + *------------------------------------------------------------------------- + */ + else if (equal_double(temp1_double,temp2_double)==FALSE) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + } + } /*H5T_NATIVE_DOUBLE*/ + +#if H5_SIZEOF_LONG_DOUBLE !=0 + + + /*------------------------------------------------------------------------- + * H5T_NATIVE_LDOUBLE + *------------------------------------------------------------------------- + */ + + else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE)) + { + long double temp1_double; + long double temp2_double; + int isnan1; + int isnan2; + + + assert(type_size==sizeof(long double)); + + memcpy(&temp1_double, mem1, sizeof(long double)); + memcpy(&temp2_double, mem2, sizeof(long double)); + + /* logic for detecting NaNs is different with options -d, -p and no options */ + + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (options->d && !options->p) + { + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); + + if ( !isnan1 && !isnan2) + { + + if (ABS(temp1_double-temp2_double) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LD_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + } + + } /* NaN */ + } + + /*------------------------------------------------------------------------- + * !-d and -p + *------------------------------------------------------------------------- + */ + else if (!options->d && options->p) + { + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); + + if ( !isnan1 && !isnan2) + { + + PER(temp1_double,temp2_double); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LD_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + + } /* NaN */ + } + + /*------------------------------------------------------------------------- + * -d and -p + *------------------------------------------------------------------------- + */ + else if ( options->d && options->p) + { + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_LDOUBLE,&temp1_double); + isnan2 = my_isnan(FLT_LDOUBLE,&temp2_double); + + if ( !isnan1 && !isnan2) + { + + PER(temp1_double,temp2_double); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); + } + options->not_cmp=1; + nfound++; + } + + else + + if ( per > options->percent && + ABS(temp1_double-temp2_double) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LD_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + + } /* NaN */ + } + + /*------------------------------------------------------------------------- + * no -d and -p + *------------------------------------------------------------------------- + */ + else if (equal_ldouble(temp1_double,temp2_double)==FALSE) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LD_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + } + } /*H5T_NATIVE_DOUBLE*/ + + +#endif /* H5_SIZEOF_LONG_DOUBLE */ + + + + break; /* H5T_FLOAT class */ } /* switch */ @@ -2093,16 +2364,16 @@ static hbool_t all_zero(const void *_mem, size_t size) static void print_region_block(int i, hsize_t *ptdata, int ndims) { - int j; + int j; - parallel_print(" "); - for (j = 0; j < ndims; j++) - parallel_print("%s%lu", j ? "," : " (", - (unsigned long)ptdata[i * 2 * ndims + j]); - for (j = 0; j < ndims; j++) - parallel_print("%s%lu", j ? "," : ")-(", - (unsigned long)ptdata[i * 2 * ndims + j + ndims]); - parallel_print(")"); + parallel_print(" "); + for (j = 0; j < ndims; j++) + parallel_print("%s%lu", j ? "," : " (", + (unsigned long)ptdata[i * 2 * ndims + j]); + for (j = 0; j < ndims; j++) + parallel_print("%s%lu", j ? "," : ")-(", + (unsigned long)ptdata[i * 2 * ndims + j + ndims]); + parallel_print(")"); } @@ -2120,13 +2391,13 @@ void print_region_block(int i, hsize_t *ptdata, int ndims) static void print_points(int i, hsize_t *ptdata, int ndims) { - int j; + int j; - parallel_print(" "); - for (j = 0; j < ndims; j++) - parallel_print("%s%lu", j ? "," : "(", - (unsigned long)(ptdata[i * ndims + j])); - parallel_print(")"); + parallel_print(" "); + for (j = 0; j < ndims; j++) + parallel_print("%s%lu", j ? "," : "(", + (unsigned long)(ptdata[i * ndims + j])); + parallel_print(")"); } @@ -2324,6 +2595,7 @@ static hsize_t character_compare(unsigned char *mem1, unsigned char *mem2, hsize_t i, + unsigned u, int rank, hsize_t *dims, hsize_t *acc, @@ -2333,25 +2605,28 @@ hsize_t character_compare(unsigned char *mem1, const char *obj2, int *ph) { - hsize_t nfound=0; /* differences found */ - unsigned char temp1_uchar; - unsigned char temp2_uchar; + hsize_t nfound=0; /* differences found */ + unsigned char temp1_uchar; + unsigned char temp2_uchar; - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - if (temp1_uchar != temp2_uchar) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(C_FORMAT,temp1_uchar,temp2_uchar); - } - nfound++; - } + if (temp1_uchar != temp2_uchar) + { + if ( print_data(options) ) + { + print_char_pos(ph,0,i,u,acc,pos,rank,dims,obj1,obj2); + parallel_print(" "); + h5diff_print_char(temp1_uchar); + parallel_print(" "); + h5diff_print_char(temp2_uchar); + parallel_print("\n"); + } + nfound++; + } - return nfound; + return nfound; } @@ -2377,73 +2652,73 @@ hsize_t character_compare_opt(unsigned char *mem1, const char *obj2, int *ph) { - hsize_t nfound=0; /* differences found */ - unsigned char temp1_uchar; - unsigned char temp2_uchar; - double per; - int both_zero; - - memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - /* -d and !-p */ - - if (options->d && !options->p) - { - if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per); - } - nfound++; - } - } - else if (temp1_uchar != temp2_uchar) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - - return nfound; - + hsize_t nfound=0; /* differences found */ + unsigned char temp1_uchar; + unsigned char temp2_uchar; + double per; + int both_zero; + + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + /* -d and !-p */ + + if (options->d && !options->p) + { + if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per); + } + nfound++; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar),per); + } + nfound++; + } + } + else if (temp1_uchar != temp2_uchar) + { + if ( print_data(options) ) + { + print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + + return nfound; + } @@ -2476,129 +2751,182 @@ hsize_t diff_float(unsigned char *mem1, hsize_t i; double per; int both_zero; - - - /* -d and !-p */ + int isnan1; + int isnan2; + + + /*------------------------------------------------------------------------- + * -d and !-p + *------------------------------------------------------------------------- + */ + if (options->d && !options->p) { for ( i = 0; i < nelmts; i++) { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - - if (ABS(temp1_float-temp2_float) > options->delta) + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_FLOAT,&temp1_float); + isnan2 = my_isnan(FLT_FLOAT,&temp2_float); + + if ( !isnan1 && !isnan2) { - if ( print_data(options) ) + if (ABS(temp1_float-temp2_float) > options->delta) { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(F_FORMAT,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); + 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_float,temp2_float,ABS(temp1_float-temp2_float)); + } + nfound++; } - nfound++; - } + } /* NaN */ mem1+=sizeof(float); mem2+=sizeof(float); 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_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - - PER(temp1_float,temp2_float); - - if (not_comparable && !both_zero) /* not comparable */ + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_FLOAT,&temp1_float); + isnan2 = my_isnan(FLT_FLOAT,&temp2_float); + + if ( !isnan1 && !isnan2) { - 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_float,temp2_float, - ABS(temp1_float-temp2_float)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent ) + + PER(temp1_float,temp2_float); + + 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_float,temp2_float, - ABS(temp1_float-temp2_float), - ABS(1-temp2_float/temp1_float)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, + ABS(temp1_float-temp2_float)); } + options->not_cmp=1; nfound++; } - mem1+=sizeof(float); - mem2+=sizeof(float); - 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_float,temp2_float, + ABS(temp1_float-temp2_float), + ABS(1-temp2_float/temp1_float)); + } + nfound++; + } + } /* NaN */ + mem1+=sizeof(float); + mem2+=sizeof(float); + 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_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - - PER(temp1_float,temp2_float); - - if (not_comparable && !both_zero) /* not comparable */ + + /*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + isnan1 = my_isnan(FLT_FLOAT,&temp1_float); + isnan2 = my_isnan(FLT_FLOAT,&temp2_float); + + if ( !isnan1 && !isnan2) { - 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_float,temp2_float, - ABS(temp1_float-temp2_float)); - } - options->not_cmp=1; - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta ) + + PER(temp1_float,temp2_float); + + 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_float,temp2_float, - ABS(temp1_float-temp2_float), - ABS(1-temp2_float/temp1_float)); + parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, + ABS(temp1_float-temp2_float)); } + options->not_cmp=1; nfound++; } - mem1+=sizeof(float); - mem2+=sizeof(float); - if (options->n && nfound>=options->count) - return nfound; - } + + else + + if ( per > options->percent && ABS(temp1_float-temp2_float) > 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_float,temp2_float, + ABS(temp1_float-temp2_float), + ABS(1-temp2_float/temp1_float)); + } + nfound++; + } + + } /* NaN */ + mem1+=sizeof(float); + mem2+=sizeof(float); + if (options->n && nfound>=options->count) + return nfound; + } /* i */ } + + /*------------------------------------------------------------------------- + * no -d and -p + *------------------------------------------------------------------------- + */ else { - + + + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + + if (equal_float(temp1_float,temp2_float)==FALSE) { if ( print_data(options) ) @@ -2609,15 +2937,20 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(float); mem2+=sizeof(float); if (options->n && nfound>=options->count) return nfound; + } /* nelmts */ - + + + + + } - + return nfound; } @@ -2652,17 +2985,17 @@ hsize_t diff_double(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -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) ) @@ -2679,18 +3012,18 @@ hsize_t diff_double(unsigned char *mem1, return nfound; } } - + /* !-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) ) @@ -2703,9 +3036,9 @@ hsize_t diff_double(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2724,18 +3057,18 @@ hsize_t diff_double(unsigned char *mem1, return nfound; } } - + /* -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) ) @@ -2748,9 +3081,9 @@ hsize_t diff_double(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) { if ( print_data(options) ) @@ -2771,12 +3104,12 @@ hsize_t diff_double(unsigned char *mem1, } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + if (equal_double(temp1_double,temp2_double)==FALSE) { if ( print_data(options) ) @@ -2787,18 +3120,199 @@ hsize_t diff_double(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(double); mem2+=sizeof(double); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } + +/*------------------------------------------------------------------------- + * Function: diff_ldouble + * + * Purpose: diff a H5T_NATIVE_LDOUBLE type + * + * Return: number of differences found + * + *------------------------------------------------------------------------- + */ +#if H5_SIZEOF_LONG_DOUBLE !=0 + +hsize_t diff_ldouble(unsigned char *mem1, + unsigned char *mem2, + hsize_t nelmts, + hsize_t hyper_start, + int rank, + hsize_t *dims, + hsize_t *acc, + hsize_t *pos, + diff_opt_t *options, + const char *obj1, + const char *obj2, + int *ph) + +{ + hsize_t nfound=0; /* number of differences found */ + long double temp1_double; + long double temp2_double; + hsize_t i; + double per; + int both_zero; + + + /* -d and !-p */ + if (options->d && !options->p) + { + + for ( i = 0; i < nelmts; i++) + { + memcpy(&temp1_double, mem1, sizeof(long double)); + memcpy(&temp2_double, mem2, sizeof(long double)); + + if (ABS(temp1_double-temp2_double) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LD_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + } + mem1+=sizeof(long double); + mem2+=sizeof(long double); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* !-d and -p */ + else if (!options->d && options->p) + { + + for ( i = 0; i < nelmts; i++) + { + memcpy(&temp1_double, mem1, sizeof(long double)); + memcpy(&temp2_double, mem2, sizeof(long 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(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); + } + options->not_cmp=1; + 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(LD_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + mem1+=sizeof(long double); + mem2+=sizeof(long double); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* -d and -p */ + else if ( options->d && options->p) + { + + for ( i = 0; i < nelmts; i++) + { + memcpy(&temp1_double, mem1, sizeof(long double)); + memcpy(&temp2_double, mem2, sizeof(long 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(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, + ABS(temp1_double-temp2_double)); + } + options->not_cmp=1; + 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(LD_FORMAT_P,temp1_double,temp2_double, + ABS(temp1_double-temp2_double), + ABS(1-temp2_double/temp1_double)); + } + nfound++; + } + mem1+=sizeof(long double); + mem2+=sizeof(long double); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + + for ( i = 0; i < nelmts; i++) + { + memcpy(&temp1_double, mem1, sizeof(long double)); + memcpy(&temp2_double, mem2, sizeof(long double)); + + if (equal_ldouble(temp1_double,temp2_double)==FALSE) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LD_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double)); + } + nfound++; + } + + mem1+=sizeof(long double); + mem2+=sizeof(long double); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + + return nfound; +} + +#endif /* H5_SIZEOF_LONG_DOUBLE */ + /*------------------------------------------------------------------------- * Function: diff_schar * @@ -2828,17 +3342,17 @@ hsize_t diff_schar(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if (ABS(temp1_char-temp2_char) > options->delta) { if ( print_data(options) ) @@ -2855,18 +3369,18 @@ hsize_t diff_schar(unsigned char *mem1, return nfound; } } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + PER(temp1_char,temp2_char); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2879,9 +3393,9 @@ hsize_t diff_schar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2900,18 +3414,18 @@ hsize_t diff_schar(unsigned char *mem1, return nfound; } } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + PER(temp1_char,temp2_char); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2924,9 +3438,9 @@ hsize_t diff_schar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) { if ( print_data(options) ) @@ -2944,16 +3458,16 @@ hsize_t diff_schar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if (temp1_char != temp2_char) { if ( print_data(options) ) @@ -2964,15 +3478,15 @@ hsize_t diff_schar(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(char); mem2+=sizeof(char); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3007,17 +3521,17 @@ hsize_t diff_uchar(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) { if ( print_data(options) ) @@ -3033,20 +3547,20 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3059,9 +3573,9 @@ hsize_t diff_uchar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3080,18 +3594,18 @@ hsize_t diff_uchar(unsigned char *mem1, return nfound; } } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3104,9 +3618,9 @@ hsize_t diff_uchar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) { if ( print_data(options) ) @@ -3124,16 +3638,16 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if (temp1_uchar != temp2_uchar) { if ( print_data(options) ) @@ -3144,15 +3658,15 @@ hsize_t diff_uchar(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned char); mem2+=sizeof(unsigned char); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3185,16 +3699,16 @@ hsize_t diff_short(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if (ABS(temp1_short-temp2_short) > options->delta) { if ( print_data(options) ) @@ -3210,20 +3724,20 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3236,9 +3750,9 @@ hsize_t diff_short(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3256,21 +3770,21 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3283,9 +3797,9 @@ hsize_t diff_short(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) { if ( print_data(options) ) @@ -3303,16 +3817,16 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if (temp1_short != temp2_short) { if ( print_data(options) ) @@ -3323,15 +3837,15 @@ hsize_t diff_short(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(short); mem2+=sizeof(short); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3365,16 +3879,16 @@ hsize_t diff_ushort(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) { if ( print_data(options) ) @@ -3390,20 +3904,20 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3416,9 +3930,9 @@ hsize_t diff_ushort(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3436,21 +3950,21 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3463,9 +3977,9 @@ hsize_t diff_ushort(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) { if ( print_data(options) ) @@ -3483,16 +3997,16 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if (temp1_ushort != temp2_ushort) { if ( print_data(options) ) @@ -3503,15 +4017,15 @@ hsize_t diff_ushort(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned short); mem2+=sizeof(unsigned short); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3546,16 +4060,16 @@ hsize_t diff_int(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + if (ABS(temp1_int-temp2_int) > options->delta) { if ( print_data(options) ) @@ -3571,20 +4085,20 @@ hsize_t diff_int(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3597,9 +4111,9 @@ hsize_t diff_int(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3617,21 +4131,21 @@ hsize_t diff_int(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3644,9 +4158,9 @@ hsize_t diff_int(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) { if ( print_data(options) ) @@ -3664,16 +4178,16 @@ hsize_t diff_int(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + if (temp1_int != temp2_int) { if ( print_data(options) ) @@ -3684,15 +4198,15 @@ hsize_t diff_int(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(int); mem2+=sizeof(int); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3727,16 +4241,16 @@ hsize_t diff_uint(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + if ( PDIFF(temp1_uint,temp2_uint) > options->delta) { if ( print_data(options) ) @@ -3752,20 +4266,20 @@ hsize_t diff_uint(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + PER_UNSIGN(signed int,temp1_uint,temp2_uint); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3777,9 +4291,9 @@ hsize_t diff_uint(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3797,21 +4311,21 @@ hsize_t diff_uint(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + PER_UNSIGN(signed int,temp1_uint,temp2_uint); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3823,9 +4337,9 @@ hsize_t diff_uint(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) { if ( print_data(options) ) @@ -3843,16 +4357,16 @@ hsize_t diff_uint(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + if (temp1_uint != temp2_uint) { if ( print_data(options) ) @@ -3863,15 +4377,15 @@ hsize_t diff_uint(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned int); mem2+=sizeof(unsigned int); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3906,19 +4420,19 @@ hsize_t diff_long(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + if (ABS(temp1_long-temp2_long) > options->delta) { if ( print_data(options) ) @@ -3936,18 +4450,18 @@ hsize_t diff_long(unsigned char *mem1, } } } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3960,9 +4474,9 @@ hsize_t diff_long(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3980,21 +4494,21 @@ hsize_t diff_long(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4007,9 +4521,9 @@ hsize_t diff_long(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) { if ( print_data(options) ) @@ -4027,16 +4541,16 @@ hsize_t diff_long(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + if (temp1_long != temp2_long) { if ( print_data(options) ) @@ -4047,15 +4561,15 @@ hsize_t diff_long(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(long); mem2+=sizeof(long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4091,20 +4605,20 @@ hsize_t diff_ulong(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) { if ( print_data(options) ) @@ -4120,22 +4634,22 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4147,9 +4661,9 @@ hsize_t diff_ulong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4167,21 +4681,21 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4193,9 +4707,9 @@ hsize_t diff_ulong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) { if ( print_data(options) ) @@ -4213,16 +4727,16 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + if (temp1_ulong != temp2_ulong) { if ( print_data(options) ) @@ -4233,15 +4747,15 @@ hsize_t diff_ulong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned long); mem2+=sizeof(unsigned long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4276,16 +4790,16 @@ hsize_t diff_llong(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + if (ABS( temp1_llong-temp2_llong) > options->delta) { if ( print_data(options) ) @@ -4301,20 +4815,20 @@ hsize_t diff_llong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + PER(temp1_llong,temp2_llong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4326,9 +4840,9 @@ hsize_t diff_llong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4344,21 +4858,21 @@ hsize_t diff_llong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + PER(temp1_llong,temp2_llong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4370,9 +4884,9 @@ hsize_t diff_llong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) { if ( print_data(options) ) @@ -4388,16 +4902,16 @@ hsize_t diff_llong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + if (temp1_llong != temp2_llong) { if ( print_data(options) ) @@ -4408,15 +4922,15 @@ hsize_t diff_llong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(long_long); mem2+=sizeof(long_long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4452,16 +4966,16 @@ hsize_t diff_ullong(unsigned char *mem1, float f1, f2; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long) options->delta) { if ( print_data(options) ) @@ -4477,22 +4991,22 @@ hsize_t diff_ullong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4504,9 +5018,9 @@ hsize_t diff_ullong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4522,23 +5036,23 @@ hsize_t diff_ullong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4550,9 +5064,9 @@ hsize_t diff_ullong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long)options->delta ) { if ( print_data(options) ) @@ -4568,16 +5082,16 @@ hsize_t diff_ullong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + if (temp1_ullong != temp2_ullong) { if ( print_data(options) ) @@ -4588,15 +5102,15 @@ hsize_t diff_ullong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned long_long); mem2+=sizeof(unsigned long_long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4654,49 +5168,178 @@ error: /*------------------------------------------------------------------------- - * Function: equal_float, equal_double - * - * Purpose: use a relative error formula to deal with floating point - * uncertainty + * Function: equal_double * - * Programmer: pvn - * October 24, 2006 + * Purpose: use a relative error formula to deal with floating point + * uncertainty * * Modifications: + * 8/1/2007. handle NaNs * *------------------------------------------------------------------------- */ +static +hbool_t equal_double(double value, double expected) +{ + int both_zero; + int is_zero; +/*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + int isnan1 = my_isnan(FLT_DOUBLE,&value); + int isnan2 = my_isnan(FLT_DOUBLE,&expected); + /*------------------------------------------------------------------------- + * we consider NaN == NaN to be true + *------------------------------------------------------------------------- + */ + if ( isnan1 && isnan2 ) + { + return TRUE; + } + + /*------------------------------------------------------------------------- + * one is a NaN, do not compare but assume difference + *------------------------------------------------------------------------- + */ + if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) + { + return FALSE; + } + + /*------------------------------------------------------------------------- + * both are not NaNs, compare + *------------------------------------------------------------------------- + */ -static -hbool_t equal_double(double value, double expected) + BOTH_ZERO(value,expected) + if (both_zero) + return TRUE; + + IS_ZERO(expected) + if (is_zero) + return(equal_double(expected,value)); + + if ( ABS( (value-expected) / expected) < H5DIFF_DBL_EPSILON) + return TRUE; + else + return FALSE; + +} + +/*------------------------------------------------------------------------- + * Function: equal_ldouble + * + * Purpose: use a relative error formula to deal with floating point + * uncertainty + * + *------------------------------------------------------------------------- + */ + +#if H5_SIZEOF_LONG_DOUBLE !=0 +static +hbool_t equal_ldouble(long double value, long double expected) { int both_zero; int is_zero; +/*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + int isnan1 = my_isnan(FLT_LDOUBLE,&value); + int isnan2 = my_isnan(FLT_LDOUBLE,&expected); + + /*------------------------------------------------------------------------- + * we consider NaN == NaN to be true + *------------------------------------------------------------------------- + */ + if ( isnan1 && isnan2 ) + { + return TRUE; + } + + /*------------------------------------------------------------------------- + * one is a NaN, do not compare but assume difference + *------------------------------------------------------------------------- + */ + if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) + { + return FALSE; + } + + /*------------------------------------------------------------------------- + * both are not NaNs, compare + *------------------------------------------------------------------------- + */ + BOTH_ZERO(value,expected) if (both_zero) return TRUE; IS_ZERO(expected) if (is_zero) - return(equal_double(expected,value)); + return(equal_ldouble(expected,value)); if ( ABS( (value-expected) / expected) < H5DIFF_DBL_EPSILON) return TRUE; else return FALSE; - + } +#endif /* #if H5_SIZEOF_LONG_DOUBLE !=0 */ + -static -hbool_t equal_float(float value, float expected) +/*------------------------------------------------------------------------- + * Function: equal_float + * + * Purpose: use a relative error formula to deal with floating point + * uncertainty + * + * Modifications: + * 8/1/2007. handle NaNs + * + *------------------------------------------------------------------------- + */ +static +hbool_t equal_float(float value, float expected) { int both_zero; int is_zero; +/*------------------------------------------------------------------------- + * detect NaNs + *------------------------------------------------------------------------- + */ + int isnan1 = my_isnan(FLT_FLOAT,&value); + int isnan2 = my_isnan(FLT_FLOAT,&expected); + + /*------------------------------------------------------------------------- + * we consider NaN == NaN to be true + *------------------------------------------------------------------------- + */ + if ( isnan1 && isnan2 ) + { + return TRUE; + } + + /*------------------------------------------------------------------------- + * one is a NaN, do not compare but assume difference + *------------------------------------------------------------------------- + */ + if ( (isnan1 && !isnan2) || ( !isnan1 && isnan2 ) ) + { + return FALSE; + } + + /*------------------------------------------------------------------------- + * both are not NaNs, compare + *------------------------------------------------------------------------- + */ + BOTH_ZERO(value,expected) if (both_zero) return TRUE; @@ -4709,7 +5352,347 @@ hbool_t equal_float(float value, float expected) return TRUE; else return FALSE; - + +} + + + +/*------------------------------------------------------------------------- + * Function: my_isnan + * + * Purpose: Determines whether VAL points to NaN. + * + * Return: TRUE or FALSE + * + * Programmer: Robb Matzke + * Monday, July 6, 1998 + * + * Modifications: + * Pedro Vicente, 12 October 2007. + * Add a string detection type for WIN32 + * + *------------------------------------------------------------------------- + */ +static int +my_isnan(dtype_t type, void *val) +{ + int retval = 0; + char s[256]; + + if (FLT_FLOAT==type) + { + float x; + HDmemcpy(&x, val, sizeof(float)); + retval = (x!=x); + + + + } + else if (FLT_DOUBLE==type) + { + double x; + HDmemcpy(&x, val, sizeof(double)); + retval = (x!=x); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 + } + else if (FLT_LDOUBLE==type) + { + long double x; + HDmemcpy(&x, val, sizeof(long double)); + retval = (x!=x); +#endif + } + else + { + return 0; + } + + /* + * Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if + * the result contains a NaN string. + */ + if (!retval) + { + if (FLT_FLOAT==type) + { + float x; + HDmemcpy(&x, val, sizeof(float)); + sprintf(s, "%g", x); + + + } + else if (FLT_DOUBLE==type) + { + double x; + HDmemcpy(&x, val, sizeof(double)); + sprintf(s, "%g", x); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 + } + else if (FLT_LDOUBLE==type) + { + long double x; + HDmemcpy(&x, val, sizeof(long double)); + sprintf(s, "%Lg", x); +#endif + } + else + { + return 0; + } + + + if ( HDstrstr(s, "NaN") || + HDstrstr(s, "NAN") || + HDstrstr(s, "nan") || + HDstrstr(s, "-1.#IND") /* WIN32 */ + ) + { + + retval = 1; + } + + + + + } + +#ifdef H5_VMS + /* For "float" and "double" on OpenVMS/Alpha, NaN is + * actually a valid value of maximal value.*/ + if(!retval) + { + if (FLT_FLOAT==type) + { + float x; + HDmemcpy(&x, val, sizeof(float)); + retval = (x==FLT_MAX || x==-FLT_MAX); + } else if (FLT_DOUBLE==type) { + double x; + HDmemcpy(&x, val, sizeof(double)); + retval = (x==DBL_MAX || x==-DBL_MAX); + } else + { + return 0; + } + } +#endif /*H5_VMS*/ + + return retval; +} + + + + + +/*------------------------------------------------------------------------- + * + * Local functions + * + *------------------------------------------------------------------------- + */ + +/*------------------------------------------------------------------------- + * Function: print_data + * + * Purpose: print data only in report or verbose modes, and do not print in quiet mode + *------------------------------------------------------------------------- + */ +static +int print_data(diff_opt_t *options) +{ + return ( (options->m_report || options->m_verbose) && !options->m_quiet)?1:0; +} + +/*------------------------------------------------------------------------- + * Function: print_pos + * + * Purpose: print in matrix notation, converting from an array index position + * + *------------------------------------------------------------------------- + */ + +static +void print_pos( int *ph, /* print header */ + int pp, /* print percentage */ + hsize_t curr_pos, + hsize_t *acc, + hsize_t *pos, + int rank, + hsize_t *dims, + const char *obj1, + const char *obj2 ) +{ + int i; + + /* print header */ + if ( *ph==1 ) + { + *ph=0; + + parallel_print("%-16s","size:"); + print_dimensions (rank,dims); + parallel_print("%-11s",""); + print_dimensions (rank,dims); + parallel_print("\n"); + + if (pp) + { + parallel_print("%-15s %-15s %-15s %-15s %-15s\n", + "position", + (obj1!=NULL) ? obj1 : " ", + (obj2!=NULL) ? obj2 : " ", + "difference", + "relative"); + parallel_print("------------------------------------------------------------------------\n"); + } + else + { + parallel_print("%-15s %-15s %-15s %-20s\n", + "position", + (obj1!=NULL) ? obj1 : " ", + (obj2!=NULL) ? obj2 : " ", + "difference"); + parallel_print("------------------------------------------------------------\n"); + } + } /* end print header */ + + for ( i = 0; i < rank; i++) + { + pos[i] = curr_pos/acc[i]; + curr_pos -= acc[i]*pos[i]; + } + assert( curr_pos == 0 ); + + if ( rank > 0 ) + { + parallel_print("[ " ); + for ( i = 0; i < rank; i++) + { + parallel_print(HSIZE_T_FORMAT, (unsigned long_long)pos[i]); + parallel_print(" "); + } + parallel_print("]" ); + } } +/*------------------------------------------------------------------------- + * Function: print_char_pos + * + * Purpose: print character position in string + * + *------------------------------------------------------------------------- + */ + +static +void print_char_pos( int *ph, /* print header */ + int pp, /* print percentage */ + hsize_t curr_pos, + unsigned u, + hsize_t *acc, + hsize_t *pos, + int rank, + hsize_t *dims, + const char *obj1, + const char *obj2 ) +{ + int i; + + /* print header */ + if ( *ph==1 ) + { + *ph=0; + parallel_print("%-16s","size:"); + print_dimensions (rank,dims); + parallel_print("%-11s",""); + print_dimensions (rank,dims); + parallel_print("\n"); + + if (pp) + { + parallel_print("%-15s %-15s %-15s %-15s %-15s\n", + "position", + (obj1!=NULL) ? obj1 : " ", + (obj2!=NULL) ? obj2 : " ", + "difference", + "relative"); + parallel_print("------------------------------------------------------------------------\n"); + } + else + { + parallel_print("%-15s %-15s %-15s %-20s\n", + "position", + (obj1!=NULL) ? obj1 : " ", + (obj2!=NULL) ? obj2 : " ", + "difference"); + parallel_print("------------------------------------------------------------\n"); + } + } /* end print header */ + + for ( i = 0; i < rank; i++) + { + pos[i] = curr_pos/acc[i]; + curr_pos -= acc[i]*pos[i]; + } + assert( curr_pos == 0 ); + + parallel_print("[ " ); + if ( rank > 0 ) + { + + for ( i = 0; i < rank; i++) + { + parallel_print(HSIZE_T_FORMAT, (unsigned long_long)pos[i]); + parallel_print(" "); + } + + } + else + { + parallel_print("%u", (unsigned)u); + } + parallel_print("]" ); +} + +/*------------------------------------------------------------------------- + * Function: h5diff_print_char. Adapted from h5tools_print_char + * + * Purpose: Print a char + * + *------------------------------------------------------------------------- + */ +static void h5diff_print_char(char ch) +{ + + switch (ch) + { + case '"': + parallel_print("\\\""); + break; + case '\\': + parallel_print( "\\\\"); + break; + case '\b': + parallel_print("\\b"); + break; + case '\f': + parallel_print("\\f"); + break; + case '\n': + parallel_print("\\n"); + break; + case '\r': + parallel_print("\\r"); + break; + case '\t': + parallel_print("\\t"); + break; + default: + if (isprint(ch)) + parallel_print( "%c", ch); + else + parallel_print( "\\%03o", ch); + + break; + } +}
\ No newline at end of file |