diff options
Diffstat (limited to 'tools/lib/h5diff_dset.c')
-rw-r--r-- | tools/lib/h5diff_dset.c | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index c4b4a4b..5f28c2b 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -14,13 +14,13 @@ #include "h5diff.h" #include "ph5diff.h" -#include "H5private.h" +#include "H5private.h" #include "h5tools.h" /*------------------------------------------------------------------------- * Function: diff_dataset * - * Purpose: check for comparable datasets and read into a compatible + * Purpose: check for comparable datasets and read into a compatible * memory type * * Return: Number of differences found @@ -31,10 +31,10 @@ * *------------------------------------------------------------------------- */ -hsize_t diff_dataset( hid_t file1_id, - hid_t file2_id, - const char *obj1_name, - const char *obj2_name, +hsize_t diff_dataset( hid_t file1_id, + hid_t file2_id, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { hid_t dset1_id=-1; @@ -64,20 +64,20 @@ hsize_t diff_dataset( hid_t file1_id, } H5E_END_TRY; - if ((dcpl1_id=H5Dget_create_plist(dset1_id))<0) + if ((dcpl1_id=H5Dget_create_plist(dset1_id))<0) goto error; - if ((dcpl2_id=H5Dget_create_plist(dset2_id))<0) + if ((dcpl2_id=H5Dget_create_plist(dset2_id))<0) goto error; /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration + * check if the dataset creation property list has filters that + * are not registered in the current configuration * 1) the external filters GZIP and SZIP might not be available * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ if ((h5tools_canreadf((options->m_verbose?obj1_name:NULL),dcpl1_id)==1) && - (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2_id)==1)) + (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2_id)==1)) { nfound=diff_datasetid(dset1_id, dset2_id, @@ -97,7 +97,7 @@ hsize_t diff_dataset( hid_t file1_id, H5Dclose(dset2_id); /* enable error reporting */ } H5E_END_TRY; - + return nfound; error: @@ -110,7 +110,7 @@ error: H5Dclose(dset2_id); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -121,7 +121,7 @@ error: /*------------------------------------------------------------------------- * Function: diff_datasetid * - * Purpose: check for comparable datasets and read into a compatible + * Purpose: check for comparable datasets and read into a compatible * memory type * * Return: Number of differences found @@ -132,19 +132,19 @@ error: * *------------------------------------------------------------------------- */ -hsize_t diff_datasetid( hid_t dset1_id, - hid_t dset2_id, - const char *obj1_name, - const char *obj2_name, +hsize_t diff_datasetid( hid_t dset1_id, + hid_t dset2_id, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { hid_t space1_id =-1; hid_t space2_id =-1; - hid_t f_type1=-1, f_type2=-1; /* file data type */ + hid_t f_type1=-1, f_type2=-1; /* file data type */ hid_t m_type1=-1, m_type2=-1; /* memory data type */ size_t m_size1, m_size2; /* size of type in memory */ H5T_sign_t sign1, sign2; /* sign of type */ - int rank1, rank2; + int rank1, rank2; void *buf1=NULL, *buf2=NULL; hsize_t nelmts1, nelmts2; hsize_t dims1[H5S_MAX_RANK]; @@ -184,7 +184,7 @@ hsize_t diff_datasetid( hid_t dset1_id, goto error; /*------------------------------------------------------------------------- - * Get the file data type + * Get the file data type *------------------------------------------------------------------------- */ @@ -206,7 +206,7 @@ hsize_t diff_datasetid( hid_t dset1_id, storage_size2=H5Dget_storage_size(dset2_id); if (storage_size1<=0 && storage_size2<=0) { - if (options->m_verbose && obj1_name && obj2_name) + if (options->m_verbose && obj1_name && obj2_name) parallel_print("<%s> and <%s> are empty datasets\n", obj1_name, obj2_name); cmp=0; options->not_cmp=1; @@ -218,16 +218,16 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ - if (diff_can_type(f_type1, - f_type2, - rank1, + if (diff_can_type(f_type1, + f_type2, + rank1, rank2, - dims1, + dims1, dims2, - maxdim1, + maxdim1, maxdim2, - obj1_name, - obj2_name, + obj1_name, + obj2_name, options)!=1) { cmp=0; @@ -238,13 +238,13 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ nelmts1 = 1; - for (i = 0; i < rank1; i++) + for (i = 0; i < rank1; i++) { nelmts1 *= dims1[i]; } - + nelmts2 = 1; - for (i = 0; i < rank2; i++) + for (i = 0; i < rank2; i++) { nelmts2 *= dims2[i]; } @@ -258,7 +258,7 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ - if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) + if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) { printf("Warning: Different storage datatype\n"); printf("<%s> has file datatype ", obj1_name); @@ -285,7 +285,7 @@ hsize_t diff_datasetid( hid_t dset1_id, #if defined (H5DIFF_DEBUG) if (obj1_name) print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); -#endif +#endif /*------------------------------------------------------------------------- * check for different signed/unsigned types @@ -306,7 +306,7 @@ hsize_t diff_datasetid( hid_t dset1_id, } /*------------------------------------------------------------------------- - * "upgrade" the smaller memory size + * "upgrade" the smaller memory size *------------------------------------------------------------------------- */ @@ -334,15 +334,15 @@ hsize_t diff_datasetid( hid_t dset1_id, printf("WARNING: Size was upgraded\n"); if (obj1_name) print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); -#endif +#endif } assert(m_size1==m_size2); /*------------------------------------------------------------------------- - * only attempt to compare if possible + * only attempt to compare if possible *------------------------------------------------------------------------- */ - if (cmp) + if (cmp) { buf1 = (void *) HDmalloc((unsigned) (nelmts1*m_size1)); @@ -375,7 +375,7 @@ hsize_t diff_datasetid( hid_t dset1_id, if (obj2_name) { name2=diff_basename(obj2_name); } - nfound = diff_array(buf1, + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -401,8 +401,8 @@ hsize_t diff_datasetid( hid_t dset1_id, * close *------------------------------------------------------------------------- */ - - + + if ( buf1) HDfree(buf1); if ( buf2) HDfree(buf2); /* close */ @@ -416,7 +416,7 @@ hsize_t diff_datasetid( hid_t dset1_id, H5Tclose(m_type2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; error: @@ -434,7 +434,7 @@ error: H5Tclose(m_type2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -443,7 +443,7 @@ error: * * Purpose: check for comparable TYPE and SPACE * - * Return: + * Return: * 1, can compare * 0, cannot compare * -1, error @@ -455,20 +455,20 @@ error: *------------------------------------------------------------------------- */ -int diff_can_type( hid_t f_type1, /* file data type */ +int diff_can_type( hid_t f_type1, /* file data type */ hid_t f_type2, /* file data type */ - int rank1, + int rank1, int rank2, - hsize_t *dims1, + hsize_t *dims1, hsize_t *dims2, - hsize_t *maxdim1, + hsize_t *maxdim1, hsize_t *maxdim2, - const char *obj1_name, - const char *obj2_name, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { - - + + H5T_class_t tclass1; H5T_class_t tclass2; int maxdim_diff=0; /* maximum dimensions are different */ @@ -476,21 +476,21 @@ int diff_can_type( hid_t f_type1, /* file data type */ int i; /*------------------------------------------------------------------------- - * check for the same class + * check for the same class *------------------------------------------------------------------------- */ - if ((tclass1=H5Tget_class(f_type1))<0) + if ((tclass1=H5Tget_class(f_type1))<0) return -1; - if ((tclass2=H5Tget_class(f_type2))<0) + if ((tclass2=H5Tget_class(f_type2))<0) return -1; if ( tclass1 != tclass2 ) { if (options->m_verbose && obj1_name) { - printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", - obj1_name, get_class(tclass1), + printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", + obj1_name, get_class(tclass1), obj2_name, get_class(tclass2) ); } return 0; @@ -502,7 +502,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ */ assert(tclass1==tclass2); - switch (tclass1) + switch (tclass1) { case H5T_INTEGER: case H5T_FLOAT: @@ -514,12 +514,12 @@ int diff_can_type( hid_t f_type1, /* file data type */ case H5T_ENUM: case H5T_VLEN: case H5T_REFERENCE: - + break; - + default: /*H5T_TIME */ - if (options->m_verbose && obj1_name ) - printf("Comparison not supported: <%s> and <%s> are of class %s\n", + if (options->m_verbose && obj1_name ) + printf("Comparison not supported: <%s> and <%s> are of class %s\n", obj1_name,obj2_name,get_class(tclass2) ); return 0; } @@ -529,7 +529,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ *------------------------------------------------------------------------- */ - if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) + if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) { printf("Warning: Different storage datatype\n"); printf("<%s> has file datatype ", obj1_name); @@ -544,7 +544,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ * check for the same rank *------------------------------------------------------------------------- */ - + if ( rank1 != rank2 ) { if (options->m_verbose && obj1_name) { @@ -565,9 +565,9 @@ int diff_can_type( hid_t f_type1, /* file data type */ * check for different dimensions *------------------------------------------------------------------------- */ - + assert(rank1==rank2); - for ( i=0; i<rank1; i++) + for ( i=0; i<rank1; i++) { if (maxdim1 && maxdim2) { |