mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r7813] Purpose:
h5diff new feature Description: added compare for attributes a new options flag (-a) was added to the options structure. it is 0 by default (no compare ) the output of the compare is the same that for datasets, and all the other flags also apply for attributes (the memory compare is done in the same function diff_array) all the other requirements for compare of datasets (type, space) are identical too Platforms tested: linux solaris 2.7 IRIX Misc. update:
This commit is contained in:
parent
15505bd890
commit
75a5e8a0e6
1
MANIFEST
1
MANIFEST
@ -1148,6 +1148,7 @@
|
||||
./tools/lib/talign.c
|
||||
./tools/lib/h5diff.c
|
||||
./tools/lib/h5diff_array.c
|
||||
./tools/lib/h5diff_attr.c
|
||||
./tools/lib/h5diff_dset.c
|
||||
./tools/lib/h5diff_util.c
|
||||
./tools/lib/h5trav.c
|
||||
|
@ -19,7 +19,7 @@
|
||||
/* Due to alignment issue in Alpha clusters, options must be declared here
|
||||
* not as a local variable in main().
|
||||
*/
|
||||
diff_opt_t options = {0,0,0,0,0,0,0,0};
|
||||
diff_opt_t options = {0,0,0,0,0,0,0,0,0};
|
||||
|
||||
static void usage(void);
|
||||
static int check_n_input( const char* );
|
||||
@ -116,6 +116,9 @@ int main(int argc, const char *argv[])
|
||||
case 'v':
|
||||
options.verbose = 1;
|
||||
break;
|
||||
case 'a':
|
||||
options.attr = 1;
|
||||
break;
|
||||
case 'r':
|
||||
options.r = 1;
|
||||
break;
|
||||
@ -304,6 +307,7 @@ void usage(void)
|
||||
printf("[-n count] Print difference up to count number\n");
|
||||
printf("[-d delta] Print difference when it is greater than limit delta\n");
|
||||
printf("[-p relative] Print difference when it is greater than a relative limit\n");
|
||||
printf("[-a] Compare attributes\n");
|
||||
printf("\n");
|
||||
printf("Items in [] are optional\n");
|
||||
printf("[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)\n");
|
||||
|
@ -41,7 +41,7 @@ PROGS=$(PUB_PROGS) $(TEST_PROGS)
|
||||
|
||||
## Source and object files for the library; do not install
|
||||
##
|
||||
LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c
|
||||
LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c
|
||||
LIB_OBJ=$(LIB_SRC:.c=.lo)
|
||||
PUB_LIB=
|
||||
AUX_LIB=$(LIB)
|
||||
|
@ -57,6 +57,7 @@ typedef struct {
|
||||
int n; /* count */
|
||||
int count; /* count value */
|
||||
int verbose; /* print information */
|
||||
int attr; /* compare attributes */
|
||||
} diff_opt_t;
|
||||
|
||||
|
||||
@ -132,6 +133,26 @@ int diff_array( void *buf1,
|
||||
const char *obj2,
|
||||
hid_t m_type );
|
||||
|
||||
|
||||
int diff_can_type( hid_t f_type1, /* file data type */
|
||||
hid_t f_type2, /* file data type */
|
||||
int rank1,
|
||||
int rank2,
|
||||
hsize_t *dims1,
|
||||
hsize_t *dims2,
|
||||
hsize_t *maxdim1,
|
||||
hsize_t *maxdim2,
|
||||
const char *obj1_name,
|
||||
const char *obj2_name,
|
||||
diff_opt_t *options );
|
||||
|
||||
|
||||
int diff_attr(hid_t loc1_id,
|
||||
hid_t loc2_id,
|
||||
diff_opt_t *options
|
||||
);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* utility functions
|
||||
*-------------------------------------------------------------------------
|
||||
|
226
tools/lib/h5diff_attr.c
Normal file
226
tools/lib/h5diff_attr.c
Normal file
@ -0,0 +1,226 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "h5diff.h"
|
||||
#include "H5private.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: diff_attr
|
||||
*
|
||||
* Purpose: diff attributes located in LOC1_ID and LOC2_ID, which are
|
||||
* obtained either from
|
||||
* loc_id = H5Gopen( fid, name);
|
||||
* loc_id = H5Dopen( fid, name);
|
||||
* loc_id = H5Topen( fid, name);
|
||||
*
|
||||
* Return:
|
||||
* 0 : no differences found
|
||||
* 1 : differences found
|
||||
* -1 : error ocurred
|
||||
*
|
||||
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
|
||||
*
|
||||
* Date: November, 03, 2003
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int diff_attr(hid_t loc1_id,
|
||||
hid_t loc2_id,
|
||||
diff_opt_t *options
|
||||
)
|
||||
{
|
||||
hid_t attr1_id; /* attr ID */
|
||||
hid_t attr2_id; /* attr ID */
|
||||
hid_t space1_id; /* space ID */
|
||||
hid_t space2_id; /* space ID */
|
||||
hid_t ftype1_id; /* file data type ID */
|
||||
hid_t ftype2_id; /* file data type ID */
|
||||
hid_t mtype1_id; /* memory data type ID */
|
||||
hid_t mtype2_id; /* memory data type ID */
|
||||
size_t msize1; /* memory size of memory type */
|
||||
size_t msize2; /* memory size of memory type */
|
||||
void *buf1=NULL; /* data buffer */
|
||||
void *buf2=NULL; /* data buffer */
|
||||
hsize_t nelmts1; /* number of elements in dataset */
|
||||
int rank1; /* rank of dataset */
|
||||
int rank2; /* rank of dataset */
|
||||
hsize_t dims1[H5S_MAX_RANK];/* dimensions of dataset */
|
||||
hsize_t dims2[H5S_MAX_RANK];/* dimensions of dataset */
|
||||
char name1[255];
|
||||
char name2[255];
|
||||
int n1, n2, i, j, nfound;
|
||||
|
||||
if ((n1 = H5Aget_num_attrs(loc1_id))<0)
|
||||
goto error;
|
||||
if ((n2 = H5Aget_num_attrs(loc2_id))<0)
|
||||
goto error;
|
||||
|
||||
if (n1!=n2)
|
||||
return 1;
|
||||
|
||||
for ( i = 0; i < n1; i++)
|
||||
{
|
||||
|
||||
/* reset buffers for every attribute, we might goto out and call free */
|
||||
buf1=NULL;
|
||||
buf2=NULL;
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* open
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/* open attribute */
|
||||
if ((attr1_id = H5Aopen_idx(loc1_id, i))<0)
|
||||
goto error;
|
||||
if ((attr2_id = H5Aopen_idx(loc2_id, i))<0)
|
||||
goto error;
|
||||
|
||||
/* get name */
|
||||
if (H5Aget_name( attr1_id, 255, name1 )<0)
|
||||
goto error;
|
||||
if (H5Aget_name( attr1_id, 255, name2 )<0)
|
||||
goto error;
|
||||
|
||||
if (HDstrcmp(name1,name2)!=0)
|
||||
{
|
||||
if (options->verbose)
|
||||
{
|
||||
printf("Different name for attributes: <%s> and <%s>\n", name1, name2);
|
||||
}
|
||||
H5Aclose(attr1_id);
|
||||
H5Aclose(attr2_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* get the file datatype */
|
||||
if ((ftype1_id = H5Aget_type( attr1_id )) < 0 )
|
||||
goto error;
|
||||
if ((ftype2_id = H5Aget_type( attr2_id )) < 0 )
|
||||
goto error;
|
||||
|
||||
/* get the dataspace handle */
|
||||
if ((space1_id = H5Aget_space( attr1_id )) < 0 )
|
||||
goto error;
|
||||
if ((space2_id = H5Aget_space( attr2_id )) < 0 )
|
||||
goto error;
|
||||
|
||||
/* get dimensions */
|
||||
if ( (rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0 )
|
||||
goto error;
|
||||
if ( (rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0 )
|
||||
goto error;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for comparable TYPE and SPACE
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (diff_can_type(ftype1_id,
|
||||
ftype2_id,
|
||||
rank1,
|
||||
rank2,
|
||||
dims1,
|
||||
dims2,
|
||||
NULL,
|
||||
NULL,
|
||||
name1,
|
||||
name2,
|
||||
options)!=1)
|
||||
goto error;
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* read to memory
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
nelmts1=1;
|
||||
for (j=0; j<rank1; j++)
|
||||
nelmts1*=dims1[j];
|
||||
if ((mtype1_id=H5Tget_native_type(ftype1_id,H5T_DIR_DEFAULT))<0)
|
||||
goto error;
|
||||
if ((mtype2_id=H5Tget_native_type(ftype2_id,H5T_DIR_DEFAULT))<0)
|
||||
goto error;
|
||||
if ((msize1=H5Tget_size(mtype1_id))<0)
|
||||
goto error;
|
||||
if ((msize2=H5Tget_size(mtype2_id))<0)
|
||||
goto error;
|
||||
|
||||
assert(msize1==msize2);
|
||||
|
||||
buf1=(void *) HDmalloc((unsigned)(nelmts1*msize1));
|
||||
buf2=(void *) HDmalloc((unsigned)(nelmts1*msize2));
|
||||
if ( buf1==NULL || buf2==NULL){
|
||||
printf( "cannot read into memory\n" );
|
||||
goto error;
|
||||
}
|
||||
if (H5Aread(attr1_id,mtype1_id,buf1)<0)
|
||||
goto error;
|
||||
if (H5Aread(attr2_id,mtype2_id,buf2)<0)
|
||||
goto error;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* array compare
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (options->verbose)
|
||||
printf( "Comparing <%s> with <%s>\n", name1, name2 );
|
||||
nfound = diff_array(buf1,buf2,nelmts1,rank1,dims1,options,name1,name2,mtype1_id);
|
||||
if (options->verbose)
|
||||
printf("%d attribute differences found\n", nfound );
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* close
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (H5Tclose(ftype1_id)<0) goto error;
|
||||
if (H5Tclose(ftype2_id)<0) goto error;
|
||||
if (H5Tclose(mtype1_id)<0) goto error;
|
||||
if (H5Tclose(mtype2_id)<0) goto error;
|
||||
if (H5Sclose(space1_id)<0) goto error;
|
||||
if (H5Sclose(space2_id)<0) goto error;
|
||||
if (H5Aclose(attr1_id)<0) goto error;
|
||||
if (H5Aclose(attr2_id)<0) goto error;
|
||||
if (buf1)
|
||||
HDfree(buf1);
|
||||
if (buf2)
|
||||
HDfree(buf2);
|
||||
} /* i */
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
H5E_BEGIN_TRY {
|
||||
H5Tclose(ftype1_id);
|
||||
H5Tclose(ftype2_id);
|
||||
H5Tclose(mtype1_id);
|
||||
H5Tclose(mtype2_id);
|
||||
H5Sclose(space1_id);
|
||||
H5Sclose(space2_id);
|
||||
H5Aclose(attr1_id);
|
||||
H5Aclose(attr2_id);
|
||||
if (buf1)
|
||||
HDfree(buf1);
|
||||
if (buf2)
|
||||
HDfree(buf2);
|
||||
} H5E_END_TRY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "H5private.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: diff_dataset
|
||||
*
|
||||
@ -30,9 +28,8 @@
|
||||
*
|
||||
* Date: May 9, 2003
|
||||
*
|
||||
* Comments:
|
||||
*
|
||||
* Modifications:
|
||||
* Modifications: November 3, 2003
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -53,10 +50,10 @@ int diff_dataset( hid_t file1_id,
|
||||
int rank1, rank2;
|
||||
void *buf1=NULL, *buf2=NULL;
|
||||
hsize_t tot_cnt1, tot_cnt2;
|
||||
hsize_t dims1[32], dims2[32];
|
||||
hsize_t maxdim1[32], maxdim2[32];
|
||||
H5T_class_t tclass1;
|
||||
H5T_class_t tclass2;
|
||||
hsize_t dims1[H5S_MAX_RANK];
|
||||
hsize_t dims2[H5S_MAX_RANK];
|
||||
hsize_t maxdim1[H5S_MAX_RANK];
|
||||
hsize_t maxdim2[H5S_MAX_RANK];
|
||||
int nfound=0; /* number of differences found */
|
||||
const char *name1=NULL; /* relative names */
|
||||
const char *name2=NULL;
|
||||
@ -130,63 +127,6 @@ int diff_dataset( hid_t file1_id,
|
||||
goto out;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for the same class
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ((tclass1=H5Tget_class(f_type1))<0)
|
||||
goto out;
|
||||
|
||||
if ((tclass2=H5Tget_class(f_type2))<0)
|
||||
goto out;
|
||||
|
||||
if ( tclass1 != tclass2 )
|
||||
{
|
||||
if (options->verbose) {
|
||||
printf("Comparison not supported\n");
|
||||
printf("<%s> is of class %s and <%s> is of class %s\n",
|
||||
obj1_name, get_class(tclass1),
|
||||
obj2_name, get_class(tclass2) );
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for non supported classes
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
assert(tclass1==tclass2);
|
||||
switch (tclass1)
|
||||
{
|
||||
#if 0
|
||||
case H5T_COMPOUND:
|
||||
case H5T_STRING:
|
||||
case H5T_ARRAY:
|
||||
case H5T_BITFIELD:
|
||||
case H5T_OPAQUE:
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
#endif
|
||||
|
||||
case H5T_TIME:
|
||||
case H5T_REFERENCE:
|
||||
|
||||
|
||||
if (options->verbose ) {
|
||||
printf("Comparison not supported\n");
|
||||
printf("<%s> is of class %s and <%s> is of class %s\n",
|
||||
obj1_name, get_class(tclass1),
|
||||
obj2_name, get_class(tclass2) );
|
||||
}
|
||||
goto out;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for empty datasets
|
||||
*-------------------------------------------------------------------------
|
||||
@ -203,80 +143,25 @@ int diff_dataset( hid_t file1_id,
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for the same rank
|
||||
* check for comparable TYPE and SPACE
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( rank1 != rank2 )
|
||||
{
|
||||
if (options->verbose) {
|
||||
printf("Comparison not supported\n");
|
||||
printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
|
||||
print_dims(rank1,dims1);
|
||||
printf(", max dimensions ");
|
||||
print_dims(rank1,maxdim1);
|
||||
printf("\n" );
|
||||
printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
|
||||
print_dims(rank2,dims2);
|
||||
printf(", max dimensions ");
|
||||
print_dims(rank2,maxdim2);
|
||||
}
|
||||
|
||||
if (diff_can_type(f_type1,
|
||||
f_type2,
|
||||
rank1,
|
||||
rank2,
|
||||
dims1,
|
||||
dims2,
|
||||
maxdim1,
|
||||
maxdim2,
|
||||
obj1_name,
|
||||
obj2_name,
|
||||
options)!=1)
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for different dimensions
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
assert(rank1==rank2);
|
||||
for ( i=0; i<rank1; i++)
|
||||
{
|
||||
if ( maxdim1[i] != maxdim2[i] )
|
||||
maxdim_diff=1;
|
||||
if ( dims1[i] != dims2[i] )
|
||||
dim_diff=1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* current dimensions
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (dim_diff==1)
|
||||
{
|
||||
if (options->verbose) {
|
||||
printf("Comparison not supported\n");
|
||||
printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
|
||||
print_dims(rank1,dims1);
|
||||
printf(", max dimensions ");
|
||||
print_dims(rank1,maxdim1);
|
||||
printf("\n" );
|
||||
printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
|
||||
print_dims(rank2,dims2);
|
||||
printf(", max dimensions ");
|
||||
print_dims(rank2,maxdim2);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* maximum dimensions; just give a warning
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (maxdim_diff==1)
|
||||
{
|
||||
if (options->verbose) {
|
||||
printf( "Warning: Different maximum dimensions\n");
|
||||
printf("<%s> has max dimensions ", obj1_name);
|
||||
print_dims(rank1,maxdim1);
|
||||
printf("\n");
|
||||
printf("<%s> has max dimensions ", obj2_name);
|
||||
print_dims(rank2,maxdim2);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* get number of elements
|
||||
*-------------------------------------------------------------------------
|
||||
@ -332,7 +217,6 @@ int diff_dataset( hid_t file1_id,
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if 0
|
||||
can1=diff_can(m_type1);
|
||||
can2=diff_can(m_type2);
|
||||
if ( (can1==0 || can2==0))
|
||||
@ -346,7 +230,6 @@ int diff_dataset( hid_t file1_id,
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for different signed/unsigned types
|
||||
@ -401,8 +284,6 @@ int diff_dataset( hid_t file1_id,
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* read
|
||||
*-------------------------------------------------------------------------
|
||||
@ -426,6 +307,16 @@ int diff_dataset( hid_t file1_id,
|
||||
if (options->verbose)
|
||||
printf("%d differences found\n", nfound );
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* compare attributes
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (options->attr)
|
||||
diff_attr(dset1_id,dset1_id,options);
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* close
|
||||
*-------------------------------------------------------------------------
|
||||
@ -454,3 +345,193 @@ out:
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: diff_can_type
|
||||
*
|
||||
* Purpose: check for comparable TYPE and SPACE
|
||||
*
|
||||
* Return:
|
||||
* 1, can compare
|
||||
* 0, cannot compare
|
||||
* -1, error
|
||||
*
|
||||
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
|
||||
*
|
||||
* Date: November 3, 2003
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int diff_can_type( hid_t f_type1, /* file data type */
|
||||
hid_t f_type2, /* file data type */
|
||||
int rank1,
|
||||
int rank2,
|
||||
hsize_t *dims1,
|
||||
hsize_t *dims2,
|
||||
hsize_t *maxdim1,
|
||||
hsize_t *maxdim2,
|
||||
const char *obj1_name,
|
||||
const char *obj2_name,
|
||||
diff_opt_t *options )
|
||||
{
|
||||
|
||||
|
||||
H5T_class_t tclass1;
|
||||
H5T_class_t tclass2;
|
||||
int nfound=0; /* number of differences found */
|
||||
const char *name1=NULL; /* relative names */
|
||||
const char *name2=NULL;
|
||||
int maxdim_diff=0; /* maximum dimensions are different */
|
||||
int dim_diff=0; /* current dimensions are different */
|
||||
int i;
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for the same class
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ((tclass1=H5Tget_class(f_type1))<0)
|
||||
return -1;
|
||||
|
||||
if ((tclass2=H5Tget_class(f_type2))<0)
|
||||
return -1;
|
||||
|
||||
if ( tclass1 != tclass2 )
|
||||
{
|
||||
if (options->verbose) {
|
||||
printf("Comparison not supported\n");
|
||||
printf("<%s> is of class %s and <%s> is of class %s\n",
|
||||
obj1_name, get_class(tclass1),
|
||||
obj2_name, get_class(tclass2) );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for non supported classes
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
assert(tclass1==tclass2);
|
||||
switch (tclass1)
|
||||
{
|
||||
case H5T_INTEGER:
|
||||
case H5T_FLOAT:
|
||||
case H5T_COMPOUND:
|
||||
case H5T_STRING:
|
||||
case H5T_ARRAY:
|
||||
case H5T_BITFIELD:
|
||||
case H5T_OPAQUE:
|
||||
case H5T_ENUM:
|
||||
case H5T_VLEN:
|
||||
return 1;
|
||||
|
||||
default: /*H5T_TIME, H5T_REFERENCE */
|
||||
if (options->verbose ) {
|
||||
printf("Comparison not supported\n");
|
||||
printf("<%s> is of class %s and <%s> is of class %s\n",
|
||||
obj1_name, get_class(tclass1),
|
||||
obj2_name, get_class(tclass2) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for equal file datatype; warning only
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( (H5Tequal(f_type1, f_type2)==0) && options->verbose)
|
||||
{
|
||||
printf("Warning: Different storage datatype\n");
|
||||
printf("<%s> has file datatype ", obj1_name);
|
||||
print_type(f_type1);
|
||||
printf("\n");
|
||||
printf("<%s> has file datatype ", obj2_name);
|
||||
print_type(f_type2);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for the same rank
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( rank1 != rank2 )
|
||||
{
|
||||
if (options->verbose) {
|
||||
printf("Comparison not supported\n");
|
||||
printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
|
||||
print_dims(rank1,dims1);
|
||||
printf(", max dimensions ");
|
||||
print_dims(rank1,maxdim1);
|
||||
printf("\n" );
|
||||
printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
|
||||
print_dims(rank2,dims2);
|
||||
printf(", max dimensions ");
|
||||
print_dims(rank2,maxdim2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* check for different dimensions
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
assert(rank1==rank2);
|
||||
for ( i=0; i<rank1; i++)
|
||||
{
|
||||
if (maxdim1 && maxdim2)
|
||||
{
|
||||
if ( maxdim1[i] != maxdim2[i] )
|
||||
maxdim_diff=1;
|
||||
}
|
||||
if ( dims1[i] != dims2[i] )
|
||||
dim_diff=1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* current dimensions
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (dim_diff==1)
|
||||
{
|
||||
if (options->verbose) {
|
||||
printf("Comparison not supported\n");
|
||||
printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
|
||||
print_dims(rank1,dims1);
|
||||
if (maxdim1 && maxdim2) {
|
||||
printf(", max dimensions ");
|
||||
print_dims(rank1,maxdim1);
|
||||
printf("\n" );
|
||||
printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
|
||||
print_dims(rank2,dims2);
|
||||
printf(", max dimensions ");
|
||||
print_dims(rank2,maxdim2);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* maximum dimensions; just give a warning
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
if (maxdim1 && maxdim2 && maxdim_diff==1)
|
||||
{
|
||||
if (options->verbose) {
|
||||
printf( "Warning: Different maximum dimensions\n");
|
||||
printf("<%s> has max dimensions ", obj1_name);
|
||||
print_dims(rank1,maxdim1);
|
||||
printf("\n");
|
||||
printf("<%s> has max dimensions ", obj2_name);
|
||||
print_dims(rank2,maxdim2);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -23,8 +23,7 @@ file1 file2
|
||||
</float> and </float> are empty datasets
|
||||
</integer> and </integer> are empty datasets
|
||||
</opaque> and </opaque> are empty datasets
|
||||
Comparison not supported
|
||||
</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
|
||||
</ref> and </ref> are empty datasets
|
||||
</string> and </string> are empty datasets
|
||||
</vlen> and </vlen> are empty datasets
|
||||
|
||||
|
@ -23,8 +23,7 @@ file1 file2
|
||||
</float> and </float> are empty datasets
|
||||
</integer> and </integer> are empty datasets
|
||||
</opaque> and </opaque> are empty datasets
|
||||
Comparison not supported
|
||||
</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
|
||||
</ref> and </ref> are empty datasets
|
||||
</string> and </string> are empty datasets
|
||||
</vlen> and </vlen> are empty datasets
|
||||
|
||||
|
@ -23,8 +23,7 @@ file1 file2
|
||||
</float> and </float> are empty datasets
|
||||
</integer> and </integer> are empty datasets
|
||||
</opaque> and </opaque> are empty datasets
|
||||
Comparison not supported
|
||||
</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
|
||||
</ref> and </ref> are empty datasets
|
||||
</string> and </string> are empty datasets
|
||||
</vlen> and </vlen> are empty datasets
|
||||
|
||||
|
@ -23,8 +23,7 @@ file1 file2
|
||||
</float> and </float> are empty datasets
|
||||
</integer> and </integer> are empty datasets
|
||||
</opaque> and </opaque> are empty datasets
|
||||
Comparison not supported
|
||||
</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
|
||||
</ref> and </ref> are empty datasets
|
||||
</string> and </string> are empty datasets
|
||||
</vlen> and </vlen> are empty datasets
|
||||
|
||||
|
@ -23,8 +23,7 @@ file1 file2
|
||||
</float> and </float> are empty datasets
|
||||
</integer> and </integer> are empty datasets
|
||||
</opaque> and </opaque> are empty datasets
|
||||
Comparison not supported
|
||||
</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
|
||||
</ref> and </ref> are empty datasets
|
||||
</string> and </string> are empty datasets
|
||||
</vlen> and </vlen> are empty datasets
|
||||
|
||||
|
@ -23,8 +23,7 @@ file1 file2
|
||||
</float> and </float> are empty datasets
|
||||
</integer> and </integer> are empty datasets
|
||||
</opaque> and </opaque> are empty datasets
|
||||
Comparison not supported
|
||||
</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
|
||||
</ref> and </ref> are empty datasets
|
||||
</string> and </string> are empty datasets
|
||||
</vlen> and </vlen> are empty datasets
|
||||
|
||||
|
@ -23,8 +23,7 @@ file1 file2
|
||||
</float> and </float> are empty datasets
|
||||
</integer> and </integer> are empty datasets
|
||||
</opaque> and </opaque> are empty datasets
|
||||
Comparison not supported
|
||||
</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
|
||||
</ref> and </ref> are empty datasets
|
||||
</string> and </string> are empty datasets
|
||||
</vlen> and </vlen> are empty datasets
|
||||
|
||||
|
@ -23,8 +23,7 @@ file1 file2
|
||||
</float> and </float> are empty datasets
|
||||
</integer> and </integer> are empty datasets
|
||||
</opaque> and </opaque> are empty datasets
|
||||
Comparison not supported
|
||||
</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
|
||||
</ref> and </ref> are empty datasets
|
||||
</string> and </string> are empty datasets
|
||||
</vlen> and </vlen> are empty datasets
|
||||
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
|
||||
[-n count] Print difference up to count number
|
||||
[-d delta] Print difference when it is greater than limit delta
|
||||
[-p relative] Print difference when it is greater than a relative limit
|
||||
[-a] Compare attributes
|
||||
|
||||
Items in [] are optional
|
||||
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
|
||||
|
Loading…
Reference in New Issue
Block a user