diff options
Diffstat (limited to 'tools')
76 files changed, 475 insertions, 4700 deletions
diff --git a/tools/Makefile.in b/tools/Makefile.in index b9388e9..ddee5d8 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -19,7 +19,7 @@ srcdir=@srcdir@ ## All subdirectories except for the ``lib'' subdirectory. ## -SUBDIRS=h5dump h5diff h5ls misc gifconv h5import +SUBDIRS=h5dump h5diff h5ls misc gifconv h5import h5repack ## Add include directory to the C preprocessor flags, add -lh5tools and ## -lhdf5 to the list of libraries. diff --git a/tools/h5diff/Dependencies b/tools/h5diff/Dependencies index bc78ee5..46db276 100644 --- a/tools/h5diff/Dependencies +++ b/tools/h5diff/Dependencies @@ -1,20 +1,23 @@ ## This file is machine generated on GNU systems. ## Only temporary changes may be made here. -h5diff.lo: \ - $(srcdir)/h5diff.c \ +h5diff_main.lo: \ + $(top_srcdir)/tools/h5diff/h5diff_main.c \ + $(top_srcdir)/tools/lib/h5diff.h \ $(top_srcdir)/src/hdf5.h \ $(top_srcdir)/src/H5public.h \ $(top_builddir)/src/H5pubconf.h \ $(top_srcdir)/src/H5api_adpt.h \ - $(top_srcdir)/src/H5Ipublic.h \ $(top_srcdir)/src/H5Apublic.h \ + $(top_srcdir)/src/H5Ipublic.h \ $(top_srcdir)/src/H5ACpublic.h \ $(top_srcdir)/src/H5Bpublic.h \ $(top_srcdir)/src/H5Dpublic.h \ $(top_srcdir)/src/H5Epublic.h \ + $(top_srcdir)/src/H5Epubgen.h \ $(top_srcdir)/src/H5Fpublic.h \ $(top_srcdir)/src/H5FDpublic.h \ + $(top_srcdir)/src/H5FPpublic.h \ $(top_srcdir)/src/H5Gpublic.h \ $(top_srcdir)/src/H5Opublic.h \ $(top_srcdir)/src/H5HGpublic.h \ @@ -27,33 +30,78 @@ h5diff.lo: \ $(top_srcdir)/src/H5Tpublic.h \ $(top_srcdir)/src/H5FDcore.h \ $(top_srcdir)/src/H5FDfamily.h \ + $(top_srcdir)/src/H5FDgass.h \ + $(top_srcdir)/src/H5FDlog.h \ + $(top_srcdir)/src/H5FDmpi.h \ $(top_srcdir)/src/H5FDfphdf5.h \ $(top_srcdir)/src/H5FDmpio.h \ + $(top_srcdir)/src/H5FDmpiposix.h \ + $(top_srcdir)/src/H5FDmulti.h \ + $(top_srcdir)/src/H5FDsec2.h \ + $(top_srcdir)/src/H5FDsrb.h \ + $(top_srcdir)/src/H5FDstdio.h \ + $(top_srcdir)/src/H5FDstream.h \ + $(top_srcdir)/tools/lib/h5trav.h +testh5diff_attr.lo: \ + $(top_srcdir)/tools/h5diff/testh5diff_attr.c \ + $(top_srcdir)/tools/h5diff/testh5diff.h \ + $(top_srcdir)/src/hdf5.h \ + $(top_srcdir)/src/H5public.h \ + $(top_builddir)/src/H5pubconf.h \ + $(top_srcdir)/src/H5api_adpt.h \ + $(top_srcdir)/src/H5Apublic.h \ + $(top_srcdir)/src/H5Ipublic.h \ + $(top_srcdir)/src/H5ACpublic.h \ + $(top_srcdir)/src/H5Bpublic.h \ + $(top_srcdir)/src/H5Dpublic.h \ + $(top_srcdir)/src/H5Epublic.h \ + $(top_srcdir)/src/H5Epubgen.h \ + $(top_srcdir)/src/H5Fpublic.h \ + $(top_srcdir)/src/H5FDpublic.h \ + $(top_srcdir)/src/H5FPpublic.h \ + $(top_srcdir)/src/H5Gpublic.h \ + $(top_srcdir)/src/H5Opublic.h \ + $(top_srcdir)/src/H5HGpublic.h \ + $(top_srcdir)/src/H5HLpublic.h \ + $(top_srcdir)/src/H5MMpublic.h \ + $(top_srcdir)/src/H5Ppublic.h \ + $(top_srcdir)/src/H5Zpublic.h \ + $(top_srcdir)/src/H5Rpublic.h \ + $(top_srcdir)/src/H5Spublic.h \ + $(top_srcdir)/src/H5Tpublic.h \ + $(top_srcdir)/src/H5FDcore.h \ + $(top_srcdir)/src/H5FDfamily.h \ $(top_srcdir)/src/H5FDgass.h \ $(top_srcdir)/src/H5FDlog.h \ + $(top_srcdir)/src/H5FDmpi.h \ + $(top_srcdir)/src/H5FDfphdf5.h \ + $(top_srcdir)/src/H5FDmpio.h \ $(top_srcdir)/src/H5FDmpiposix.h \ $(top_srcdir)/src/H5FDmulti.h \ $(top_srcdir)/src/H5FDsec2.h \ $(top_srcdir)/src/H5FDsrb.h \ $(top_srcdir)/src/H5FDstdio.h \ $(top_srcdir)/src/H5FDstream.h \ - $(srcdir)/h5trav.h \ $(top_srcdir)/src/H5private.h \ - $(top_srcdir)/src/H5MPprivate.h -h5trav.lo: \ - $(srcdir)/h5trav.c \ + $(top_srcdir)/src/H5MPprivate.h \ + $(top_srcdir)/src/H5FSprivate.h +testh5diff_basic.lo: \ + $(top_srcdir)/tools/h5diff/testh5diff_basic.c \ + $(top_srcdir)/tools/h5diff/testh5diff.h \ $(top_srcdir)/src/hdf5.h \ $(top_srcdir)/src/H5public.h \ $(top_builddir)/src/H5pubconf.h \ $(top_srcdir)/src/H5api_adpt.h \ - $(top_srcdir)/src/H5Ipublic.h \ $(top_srcdir)/src/H5Apublic.h \ + $(top_srcdir)/src/H5Ipublic.h \ $(top_srcdir)/src/H5ACpublic.h \ $(top_srcdir)/src/H5Bpublic.h \ $(top_srcdir)/src/H5Dpublic.h \ $(top_srcdir)/src/H5Epublic.h \ + $(top_srcdir)/src/H5Epubgen.h \ $(top_srcdir)/src/H5Fpublic.h \ $(top_srcdir)/src/H5FDpublic.h \ + $(top_srcdir)/src/H5FPpublic.h \ $(top_srcdir)/src/H5Gpublic.h \ $(top_srcdir)/src/H5Opublic.h \ $(top_srcdir)/src/H5HGpublic.h \ @@ -66,33 +114,80 @@ h5trav.lo: \ $(top_srcdir)/src/H5Tpublic.h \ $(top_srcdir)/src/H5FDcore.h \ $(top_srcdir)/src/H5FDfamily.h \ + $(top_srcdir)/src/H5FDgass.h \ + $(top_srcdir)/src/H5FDlog.h \ + $(top_srcdir)/src/H5FDmpi.h \ $(top_srcdir)/src/H5FDfphdf5.h \ $(top_srcdir)/src/H5FDmpio.h \ + $(top_srcdir)/src/H5FDmpiposix.h \ + $(top_srcdir)/src/H5FDmulti.h \ + $(top_srcdir)/src/H5FDsec2.h \ + $(top_srcdir)/src/H5FDsrb.h \ + $(top_srcdir)/src/H5FDstdio.h \ + $(top_srcdir)/src/H5FDstream.h \ + $(top_srcdir)/src/H5private.h \ + $(top_srcdir)/src/H5MPprivate.h \ + $(top_srcdir)/src/H5FSprivate.h +testh5diff_dset.lo: \ + $(top_srcdir)/tools/h5diff/testh5diff_dset.c \ + $(top_srcdir)/tools/h5diff/testh5diff.h \ + $(top_srcdir)/src/hdf5.h \ + $(top_srcdir)/src/H5public.h \ + $(top_builddir)/src/H5pubconf.h \ + $(top_srcdir)/src/H5api_adpt.h \ + $(top_srcdir)/src/H5Apublic.h \ + $(top_srcdir)/src/H5Ipublic.h \ + $(top_srcdir)/src/H5ACpublic.h \ + $(top_srcdir)/src/H5Bpublic.h \ + $(top_srcdir)/src/H5Dpublic.h \ + $(top_srcdir)/src/H5Epublic.h \ + $(top_srcdir)/src/H5Epubgen.h \ + $(top_srcdir)/src/H5Fpublic.h \ + $(top_srcdir)/src/H5FDpublic.h \ + $(top_srcdir)/src/H5FPpublic.h \ + $(top_srcdir)/src/H5Gpublic.h \ + $(top_srcdir)/src/H5Opublic.h \ + $(top_srcdir)/src/H5HGpublic.h \ + $(top_srcdir)/src/H5HLpublic.h \ + $(top_srcdir)/src/H5MMpublic.h \ + $(top_srcdir)/src/H5Ppublic.h \ + $(top_srcdir)/src/H5Zpublic.h \ + $(top_srcdir)/src/H5Rpublic.h \ + $(top_srcdir)/src/H5Spublic.h \ + $(top_srcdir)/src/H5Tpublic.h \ + $(top_srcdir)/src/H5FDcore.h \ + $(top_srcdir)/src/H5FDfamily.h \ $(top_srcdir)/src/H5FDgass.h \ $(top_srcdir)/src/H5FDlog.h \ + $(top_srcdir)/src/H5FDmpi.h \ + $(top_srcdir)/src/H5FDfphdf5.h \ + $(top_srcdir)/src/H5FDmpio.h \ $(top_srcdir)/src/H5FDmpiposix.h \ $(top_srcdir)/src/H5FDmulti.h \ $(top_srcdir)/src/H5FDsec2.h \ $(top_srcdir)/src/H5FDsrb.h \ $(top_srcdir)/src/H5FDstdio.h \ $(top_srcdir)/src/H5FDstream.h \ - $(srcdir)/h5trav.h \ $(top_srcdir)/src/H5private.h \ - $(top_srcdir)/src/H5MPprivate.h -h5difftst.lo: \ - $(srcdir)/h5difftst.c \ + $(top_srcdir)/src/H5MPprivate.h \ + $(top_srcdir)/src/H5FSprivate.h +testh5diff_util.lo: \ + $(top_srcdir)/tools/h5diff/testh5diff_util.c \ + $(top_srcdir)/tools/h5diff/testh5diff.h \ $(top_srcdir)/src/hdf5.h \ $(top_srcdir)/src/H5public.h \ $(top_builddir)/src/H5pubconf.h \ $(top_srcdir)/src/H5api_adpt.h \ - $(top_srcdir)/src/H5Ipublic.h \ $(top_srcdir)/src/H5Apublic.h \ + $(top_srcdir)/src/H5Ipublic.h \ $(top_srcdir)/src/H5ACpublic.h \ $(top_srcdir)/src/H5Bpublic.h \ $(top_srcdir)/src/H5Dpublic.h \ $(top_srcdir)/src/H5Epublic.h \ + $(top_srcdir)/src/H5Epubgen.h \ $(top_srcdir)/src/H5Fpublic.h \ $(top_srcdir)/src/H5FDpublic.h \ + $(top_srcdir)/src/H5FPpublic.h \ $(top_srcdir)/src/H5Gpublic.h \ $(top_srcdir)/src/H5Opublic.h \ $(top_srcdir)/src/H5HGpublic.h \ @@ -105,10 +200,54 @@ h5difftst.lo: \ $(top_srcdir)/src/H5Tpublic.h \ $(top_srcdir)/src/H5FDcore.h \ $(top_srcdir)/src/H5FDfamily.h \ + $(top_srcdir)/src/H5FDgass.h \ + $(top_srcdir)/src/H5FDlog.h \ + $(top_srcdir)/src/H5FDmpi.h \ $(top_srcdir)/src/H5FDfphdf5.h \ $(top_srcdir)/src/H5FDmpio.h \ + $(top_srcdir)/src/H5FDmpiposix.h \ + $(top_srcdir)/src/H5FDmulti.h \ + $(top_srcdir)/src/H5FDsec2.h \ + $(top_srcdir)/src/H5FDsrb.h \ + $(top_srcdir)/src/H5FDstdio.h \ + $(top_srcdir)/src/H5FDstream.h \ + $(top_srcdir)/src/H5private.h \ + $(top_srcdir)/src/H5MPprivate.h \ + $(top_srcdir)/src/H5FSprivate.h +testh5diff_main.lo: \ + $(top_srcdir)/tools/h5diff/testh5diff_main.c \ + $(top_srcdir)/tools/h5diff/testh5diff.h \ + $(top_srcdir)/src/hdf5.h \ + $(top_srcdir)/src/H5public.h \ + $(top_builddir)/src/H5pubconf.h \ + $(top_srcdir)/src/H5api_adpt.h \ + $(top_srcdir)/src/H5Apublic.h \ + $(top_srcdir)/src/H5Ipublic.h \ + $(top_srcdir)/src/H5ACpublic.h \ + $(top_srcdir)/src/H5Bpublic.h \ + $(top_srcdir)/src/H5Dpublic.h \ + $(top_srcdir)/src/H5Epublic.h \ + $(top_srcdir)/src/H5Epubgen.h \ + $(top_srcdir)/src/H5Fpublic.h \ + $(top_srcdir)/src/H5FDpublic.h \ + $(top_srcdir)/src/H5FPpublic.h \ + $(top_srcdir)/src/H5Gpublic.h \ + $(top_srcdir)/src/H5Opublic.h \ + $(top_srcdir)/src/H5HGpublic.h \ + $(top_srcdir)/src/H5HLpublic.h \ + $(top_srcdir)/src/H5MMpublic.h \ + $(top_srcdir)/src/H5Ppublic.h \ + $(top_srcdir)/src/H5Zpublic.h \ + $(top_srcdir)/src/H5Rpublic.h \ + $(top_srcdir)/src/H5Spublic.h \ + $(top_srcdir)/src/H5Tpublic.h \ + $(top_srcdir)/src/H5FDcore.h \ + $(top_srcdir)/src/H5FDfamily.h \ $(top_srcdir)/src/H5FDgass.h \ $(top_srcdir)/src/H5FDlog.h \ + $(top_srcdir)/src/H5FDmpi.h \ + $(top_srcdir)/src/H5FDfphdf5.h \ + $(top_srcdir)/src/H5FDmpio.h \ $(top_srcdir)/src/H5FDmpiposix.h \ $(top_srcdir)/src/H5FDmulti.h \ $(top_srcdir)/src/H5FDsec2.h \ @@ -116,4 +255,5 @@ h5difftst.lo: \ $(top_srcdir)/src/H5FDstdio.h \ $(top_srcdir)/src/H5FDstream.h \ $(top_srcdir)/src/H5private.h \ - $(top_srcdir)/src/H5MPprivate.h + $(top_srcdir)/src/H5MPprivate.h \ + $(top_srcdir)/src/H5FSprivate.h diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 1c543b5..a616658 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -1,4 +1,3 @@ -## HDF5 Library Makefile(.in) ## ## Copyright by the Board of Trustees of the University of Illinois. ## All rights reserved. @@ -12,6 +11,8 @@ ## 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. ## +## HDF5 Library Makefile(.in) +## top_srcdir=@top_srcdir@ top_builddir=../.. srcdir=@srcdir@ @@ -31,6 +32,7 @@ TEST_SCRIPTS=$(srcdir)/testh5diff.sh ## These are our main targets: library and tools. ## LIBHDF5=$(top_builddir)/src/libhdf5.la +LIBTOOLS=../lib/libh5tools.la PUB_PROGS=h5diff PROGS=$(PUB_PROGS) $(TEST_PROGS) @@ -47,10 +49,12 @@ MOSTLYCLEAN=*.h5 ## Source and object files for programs... ## -PROG_SRC=h5diff.c h5trav.c h5difftst.c +PROG_SRC= h5diff_main.c testh5diff_attr.c testh5diff_basic.c testh5diff_dset.c testh5diff_util.c testh5diff_main.c PROG_OBJ=$(PROG_SRC:.c=.lo) +OBJS= h5diff_main.lo +TEST_OBJS=testh5diff_attr.lo testh5diff_basic.lo testh5diff_dset.lo testh5diff_util.lo testh5diff_main.lo -PRIVATE_HDR=h5trav.h +PRIVATE_HDR=testh5diff.h ## Source and object files for the tests ## @@ -64,13 +68,13 @@ check test _test: $(PROGS) ## How to build the programs...They all depend on the hdf5 library and ## the tools library compiled in this directory. ## -$(PROGS): $(LIBHDF5) +$(PROGS): $(LIBTOOLS) $(LIBHDF5) -h5diff: h5diff.lo h5trav.lo - @$(LT_LINK_EXE) $(CFLAGS) -o $@ h5diff.lo h5trav.lo $(LIBHDF5) $(LDFLAGS) $(LIBS) +h5diff: $(OBJS) + @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS) -h5difftst: h5difftst.lo - @$(LT_LINK_EXE) $(CFLAGS) -o $@ h5difftst.lo $(LIBHDF5) $(LDFLAGS) $(LIBS) +h5difftst: $(TEST_OBJS) + @$(LT_LINK_EXE) $(CFLAGS) -o $@ $(TEST_OBJS) $(LIBTOOLS) $(LIBHDF5) $(LDFLAGS) $(LIBS) @CONCLUDE@ diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c deleted file mode 100644 index eb8debe..0000000 --- a/tools/h5diff/h5diff.c +++ /dev/null @@ -1,2718 +0,0 @@ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 <stdio.h> -#include <stdlib.h> -#include <math.h> -#include "hdf5.h" -#include "h5trav.h" -#include "H5private.h" - - - -#if 0 -#define H5DIFF_DEBUG -#endif - -#define FFORMAT "%-15.10g %-15.10g %-15.10g\n" -#define IFORMAT "%-15d %-15d %-15d\n" -#define UIFORMAT "%-15u %-15u %-15u\n" -#define LIFORMAT "%-15ld %-15ld %-15ld\n" -#define ULIFORMAT "%-15lu %-15lu %-15lu\n" -/* with -p option */ -#define FPFORMAT "%-15.10g %-15.10g %-15.10g %-14.10g\n" -#define IPFORMAT "%-15d %-15d %-15d %-14d\n" -#define UIPFORMAT "%-15u %-15u %-15u %-14u\n" -#define LPIFORMAT "%-15ld %-15ld %-15ld %-14ld\n" -#define ULPIFORMAT "%-15lu %-15lu %-15lu %-14lu\n" -#define SPACES " " - - -typedef struct options_t -{ - int r; /* report only what objects differ */ - int d; /* delta */ - double delta; /* delta value */ - int p; /* relative error */ - double percent; /* relative error value */ - int n; /* count */ - int count; /* count value */ -} options_t; - -/* Due to alignment issue in Alpha clusters, options must be declared here - * not as a local variable in main(). - */ -options_t options = {0,0,0,0,0,0,0}; - -/*------------------------------------------------------------------------- - * prototypes - *------------------------------------------------------------------------- - */ - -static int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name, - const char *obj2_name, options_t opts ); -static int diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj2_name, - options_t opts, int type ); -static int compare( hid_t file1_id, const char *file1_name, const char *obj1_name, - int nobjects1, info_t *info1, - hid_t file2_id, const char *file2_name, const char *obj2_name, - int nobjects2, info_t *info2, - options_t opts ); -static int match( hid_t file1_id, int nobjects1, info_t *info1, - hid_t file2_id, int nobjects2, info_t *info2, options_t opts ); -static int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims, - options_t opts, const char *obj1, const char *obj2, - hid_t m_type ); - -/*------------------------------------------------------------------------- - * utility functions - *------------------------------------------------------------------------- - */ - -#ifdef NOT_YET -static void list( const char *filename, int nobjects, info_t *info ); -#endif /* NOT_YET */ -static int h5diff_can_diff( hid_t type_id ); -static void print_datatype(hid_t type); -static int check_n_input( const char* ); -static int check_f_input( const char* ); -static int get_index( const char *obj, int nobjects, info_t *info ); -static int compare_object( char *obj1, char *obj2 ); -static void usage(void); -static const char* h5diff_basename(const char *name); -static const char* get_type(int type); -static const char* get_class(H5T_class_t tclass); -static const char* get_sign(H5T_sign_t sign); -static void print_dims( int r, hsize_t *d ); -static void print_pos( int *ph, int p, unsigned int curr_pos, int *acc, - int *pos, int rank, const char *obj1, const char *obj2 ); -#if defined (H5DIFF_DEBUG) -static void print_sizes( const char *obj1, const char *obj2, - hid_t f_type1, hid_t f_type2, - hid_t m_type1, hid_t m_type2 ); -#endif - - -/*------------------------------------------------------------------------- - * Function: usage - * - * Purpose: print a usage message - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - *------------------------------------------------------------------------- - */ -static -void usage(void) -{ - printf("Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] \n"); - printf("\n"); - printf("file1 File name of the first HDF5 file\n"); - printf("file2 File name of the second HDF5 file\n"); - printf("[obj1] Name of an HDF5 object, in absolute path\n"); - printf("[obj2] Name of an HDF5 object, in absolute path\n"); - printf("[OPTIONS] are:\n"); - printf("[-h] Print out this information\n"); - printf("[-r] Print only what objects differ, not the differences\n"); - 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("\n"); - printf("Items in [] are optional\n"); - printf("[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)\n"); - printf("The 'count' value must be a positive integer\n"); - printf("The 'delta' and 'relative' values must be positive numbers\n"); - printf("The -d compare criteria is |a - b| > delta\n"); - printf("The -p compare criteria is |1 - b/a| > relative\n"); - printf("\n"); - printf("Examples:\n"); - printf("\n"); - printf("1) h5diff file1 file2 /a/b /a/c\n"); - printf("\n"); - printf(" Compares object '/a/b' in file1 with '/a/c' in file2\n"); - printf("\n"); - printf("2) h5diff file1 file2 /a/b\n"); - printf("\n"); - printf(" Compares object '/a/b' in both files\n"); - printf("\n"); - printf("3) h5diff file1 file2\n"); - printf("\n"); - printf(" Compares all objects in both files\n"); - printf("\n"); - exit(0); -} - - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: H5diff main program - * - * Return: An exit status of 0 means no differences were found, 1 means some - * differences were found. - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -int main(int argc, const char *argv[]) -{ - int i; - const char *s = NULL; - hid_t file1_id, file2_id; - int nobjects1, nobjects2; - info_t *info1=NULL; - info_t *info2=NULL; - void *edata; - hid_t (*func)(void*); - const char *file1_name = NULL; - const char *file2_name = NULL; - const char *obj1_name = NULL; - const char *obj2_name = NULL; - int nfound=0, ret; - -/*------------------------------------------------------------------------- - * print the command line options - *------------------------------------------------------------------------- - */ - - printf("$h5diff"); - for (i=1; i<argc ; i++) - { - printf(" %s", argv[i] ); - } - printf("\n"); - - -/*------------------------------------------------------------------------- - * initial check of command line options - *------------------------------------------------------------------------- - */ - - if ( argc==2 && (strcmp("-h",argv[1])==0) ) - usage(); - - if ( argc<3 ) - { - printf("Number of arguments is only %d\n", argc ); - usage(); - } - -/*------------------------------------------------------------------------- - * file names are first - *------------------------------------------------------------------------- - */ - - if ( argc>=3 ) - { - file1_name = argv[1]; - file2_name = argv[2]; - } - -/*------------------------------------------------------------------------- - * open the files first; if they are not valid, no point in continuing - *------------------------------------------------------------------------- - */ - - /* disable error reporting */ - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); - - /* Open the files */ - if ((file1_id=H5Fopen(file1_name,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) - { - printf("h5diff: %s: No such file or directory\n", file1_name ); - exit(1); - } - if ((file2_id=H5Fopen(file2_name,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) - { - printf("h5diff: %s: No such file or directory\n", file2_name ); - exit(1); - } - /* enable error reporting */ - H5Eset_auto(func, edata); - - -/*------------------------------------------------------------------------- - * parse command line options - *------------------------------------------------------------------------- - */ - for (i=3; i<argc ; i++) - { - /* get the single-letter switches */ - if ( '-'==argv[i][0] ) - { - for (s=argv[i]+1; *s; s++) - { - switch (*s) { - default: - printf("-%s is an invalid option\n", s ); - usage(); - break; - case 'h': - usage(); - case 'r': - options.r = 1; - break; - case 'd': - /* if it is not another option */ - if ( '-' != argv[i+1][0] ) - { - options.d=1; - if ( check_f_input(argv[i+1])==-1) - { - printf("<-d %s> is not a valid option\n", argv[i+1] ); - usage(); - } - options.delta = atof(argv[i+1]); - } - else - { - printf("<-d %s> is not a valid option\n", argv[i+1] ); - usage(); - } - break; - case 'p': - if ( '-' !=argv[i+1][0] ) - { - options.p=1; - if ( check_f_input(argv[i+1])==-1) - { - printf("<-p %s> is not a valid option\n", argv[i+1] ); - usage(); - } - options.percent = atof(argv[i+1]); - } - break; - case 'n': - if ( '-' !=argv[i+1][0] ) - { - options.n=1; - if ( check_n_input(argv[i+1])==-1) - { - printf("<-n %s> is not a valid option\n", argv[i+1] ); - usage(); - } - options.count = atoi(argv[i+1]); - } - break; - } /*switch*/ - } /*for*/ - } /*if*/ - - else /* not single-letter switches */ - - { - /* check if it is not a -d, -p parameter */ - if ( '-' !=argv[i-1][0] ) - { - if ( obj1_name==NULL ) - obj1_name = argv[i]; - if ( obj2_name==NULL ) - { - /* check if we have a second object name */ - if ( i+1<argc && '-' !=argv[i+1][0] ) - /* yes */ - obj2_name = argv[i+1]; - else - /* no */ - obj2_name = obj1_name; - } - } - } - - }/*for*/ - -/*------------------------------------------------------------------------- - * get the number of objects in the files - *------------------------------------------------------------------------- - */ - - nobjects1 = H5get_object_info( file1_id, NULL ); - nobjects2 = H5get_object_info( file2_id, NULL ); - -/*------------------------------------------------------------------------- - * get the list of objects in the files - *------------------------------------------------------------------------- - */ - - info1 = (info_t*) malloc( nobjects1 * sizeof(info_t)); - info2 = (info_t*) malloc( nobjects2 * sizeof(info_t)); - if (info1==NULL || info2==NULL) - return 0; - - H5get_object_info( file1_id, info1 ); - H5get_object_info( file2_id, info2 ); - -/*------------------------------------------------------------------------- - * object name was supplied - *------------------------------------------------------------------------- - */ - - if ( obj1_name ) - { - nfound=compare(file1_id,file1_name,obj1_name,nobjects1,info1, - file2_id,file2_name,obj2_name,nobjects2,info2,options); - } - -/*------------------------------------------------------------------------- - * compare all - *------------------------------------------------------------------------- - */ - - else - { - nfound=match(file1_id,nobjects1,info1, - file2_id,nobjects2,info2,options); - } - - /* close */ - assert( (H5Fclose(file1_id)) >=0); - assert( (H5Fclose(file2_id)) >=0); - - info_free(info1,nobjects1); - info_free(info2,nobjects2); - printf("\n"); - ret= (nfound==0 ? 0 : 1 ); - return ret; - -} - - -/*------------------------------------------------------------------------- - * Function: check_n_input - * - * Purpose: check for valid input - * - * Return: 1 for ok, -1 for fail - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static -int check_n_input( const char *str ) -{ - unsigned i; - char c; - - for ( i = 0; i < strlen(str); i++) - { - c = str[i]; - if ( i==0 ) - { - if ( c < 49 || c > 57 ) /* ascii values between 1 and 9 */ - return -1; - } - else - if ( c < 48 || c > 57 ) /* 0 also */ - return -1; - } - return 1; -} - -/*------------------------------------------------------------------------- - * Function: check_f_input - * - * Purpose: check for valid input - * - * Return: 1 for ok, -1 for fail - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static -int check_f_input( const char *str ) -{ - unsigned i; - char c; - - /* '0' values not allowed */ - if ( strlen(str)==1 && str[0]=='0' ) - return -1; - - for ( i = 0; i < strlen(str); i++) - { - c = str[i]; - if ( c < 48 || c > 57 ) /* ascii values between 0 and 9 */ - if ( c!= 46) /* . */ - return -1; - } - return 1; -} - -/*------------------------------------------------------------------------- - * Function: list - * - * Purpose: print list of objects in file - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -#ifdef NOT_YET -static -void list( const char *filename, int nobjects, info_t *info ) -{ - int i; - - printf("File <%s>: # of entries = %d\n", filename, nobjects ); - for ( i = 0; i < nobjects; i++) - { - switch ( info[i].type ) - { - case H5G_GROUP: - printf("%s %20s\n", info[i].name, "group" ); - break; - case H5G_DATASET: - printf("%s %20s\n", info[i].name, "dataset" ); - break; - case H5G_TYPE: - printf("%s %20s\n", info[i].name, "datatype" ); - break; - case H5G_LINK: - printf("%s %20s\n", info[i].name, "link" ); - break; - default: - printf("%s %20s\n", info[i].name, "User defined object" ); - break; - } - } - -} -#endif /* NOT_YET */ - - -/*------------------------------------------------------------------------- - * Function: compare_object - * - * Purpose: do the compare criteria - * - * Return: strcmp value - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static -int compare_object( char *obj1, char *obj2 ) -{ - int cmp; - cmp = strcmp(obj1,obj2); - return cmp; - -} - - -/*------------------------------------------------------------------------- - * Function: match - * - * Purpose: Find commom objects; the algorithm used for this search is the - * cosequential match algorithm and is described in - * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley. - * - * Return: Number of differences found - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static -int match( hid_t file1_id, int nobjects1, info_t *info1, - hid_t file2_id, int nobjects2, info_t *info2, options_t opts ) -{ - int cmp; - int more_names_exist = (nobjects1>0 && nobjects2>0) ? 1 : 0; - int curr1=0; - int curr2=0; - int i; - /*build a common list */ - table_t *table=NULL; - unsigned long infile[2]; - char c1, c2; - int nfound=0; - -/*------------------------------------------------------------------------- - * build the list - *------------------------------------------------------------------------- - */ - table_init( &table ); - - - while ( more_names_exist ) - { - cmp = compare_object( info1[curr1].name, info2[curr2].name ); - if ( cmp == 0 ) - { - infile[0]=1; infile[1]=1; - table_add(infile, info1[curr1].name, info1[curr1].type, table ); - - curr1++; - curr2++; - } - else if ( cmp < 0 ) - { - infile[0]=1; infile[1]=0; - table_add(infile, info1[curr1].name, info1[curr1].type, table ); - curr1++; - } - else - { - infile[0]=0; infile[1]=1; - table_add(infile, info2[curr2].name, info2[curr2].type, table ); - curr2++; - } - - more_names_exist = (curr1<nobjects1 && curr2<nobjects2) ? 1 : 0; - - - } /* end while */ - - /* list1 did not end */ - if (curr1<nobjects1) - { - while ( curr1<nobjects1 ) - { - infile[0]=1; infile[1]=0; - table_add(infile, info1[curr1].name, info1[curr1].type, table ); - curr1++; - } - } - - /* list2 did not end */ - if (curr2<nobjects2) - { - while ( curr2<nobjects2 ) - { - infile[0]=0; infile[1]=1; - table_add(infile, info2[curr2].name, info2[curr2].type, table ); - curr2++; - } - } - -/*------------------------------------------------------------------------- - * print the list - *------------------------------------------------------------------------- - */ - - printf("file1 file2\n"); - printf("---------------------------------------\n"); - for (i = 0; i < table->nobjs; i++) - { - c1 = (table->objs[i].objno[0]) ? 'x' : ' '; - c2 = (table->objs[i].objno[1]) ? 'x' : ' '; - printf("%5c %6c %-15s\n", c1, c2, table->objs[i].objname); - } - printf("\n"); - - -/*------------------------------------------------------------------------- - * do the diff for common objects - *------------------------------------------------------------------------- - */ - - for (i = 0; i < table->nobjs; i++) - { - if ( table->objs[i].objno[0]==1 && table->objs[i].objno[1]==1 ) - nfound+=diff( file1_id, table->objs[i].objname, - file2_id, table->objs[i].objname, - opts, table->objs[i].type ); - } - - /* free table */ - table_free(table); - return nfound; -} - - - -/*------------------------------------------------------------------------- - * Function: get_index - * - * Purpose: get index in list - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -int get_index( const char *obj, int nobjects, info_t *info ) -{ - char *pdest; - int result; - int i; - - for ( i = 0; i < nobjects; i++) - { - if ( strcmp(obj,info[i].name)==0 ) - return i; - - pdest = strstr( info[i].name, obj ); - result = (int)(pdest - info[i].name); - - /* found at position 1, meaning without '/' */ - if( pdest != NULL && result==1 ) - return i; - } - return -1; -} - -/*------------------------------------------------------------------------- - * Function: compare - * - * Purpose: get objects form list, and check for the same type - * - * Return: Number of differences found - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static -int compare( hid_t file1_id, const char *file1_name, const char *obj1_name, - int nobjects1, info_t *info1, - hid_t file2_id, const char *file2_name, const char *obj2_name, - int nobjects2, info_t *info2, - options_t opts ) -{ - - int f1=0, f2=0; - int nfound=0; - - int i = get_index( obj1_name, nobjects1, info1 ); - int j = get_index( obj2_name, nobjects2, info2 ); - - if ( i == -1 ) - { - printf( "Object <%s> could not be found in <%s>\n", obj1_name, file1_name ); - f1=1; - } - if ( j == -1 ) - { - printf( "Object <%s> could not be found in <%s>\n", obj2_name, file2_name ); - f2=1; - } - if ( f1 || f2 ) - return -1; - - /* use the name with "/" first, as obtained by iterator function */ - obj1_name=info1[i].name; - obj2_name=info2[j].name; - - /* objects are not the same type */ - if ( info1[i].type != info2[j].type ) - { - printf("Comparison not supported\n"); - printf("<%s> is of type %s and <%s> is of type %s\n", - obj1_name, get_type(info1[i].type), - obj2_name, get_type(info2[j].type) ); - return 0; - } - - nfound=diff( file1_id, obj1_name, file2_id, obj2_name, opts, info1[i].type ); - - return nfound; -} - - -/*------------------------------------------------------------------------- - * Function: diff - * - * Purpose: switch between types and choose the diff function - * - * Return: Number of differences found - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static -int diff( hid_t file1_id, const char *obj1_name, hid_t file2_id, const char *obj2_name, - options_t opts, int type ) -{ - int nfound=0; - - switch ( type ) - { - case H5G_DATASET: - nfound=diff_dataset(file1_id,file2_id,obj1_name,obj2_name,opts); - break; - - default: - printf("Comparison not supported\n"); - printf("<%s> is of type %s and <%s> is of type %s\n", - obj1_name, get_type(type), - obj2_name, get_type(type) ); - break; - } - - printf("\n"); - return nfound; -} - -/*------------------------------------------------------------------------- - * Function: diff_dataset - * - * Purpose: check for comparable datasets and read into a compatible - * memory type - * - * Return: Number of differences found - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static -int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name, - const char *obj2_name, options_t opts ) -{ - void *edata; - hid_t (*func)(void*); - hid_t dset1_id =-1; - hid_t dset2_id =-1; - hid_t space1_id =-1; - hid_t space2_id =-1; - 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; - 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; - 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 can1, can2; /* supported diff */ - int i; - - - /* disable error reporting */ - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); - -/*------------------------------------------------------------------------- - * open the handles - *------------------------------------------------------------------------- - */ - - /* Open the datasets */ - if ( (dset1_id = H5Dopen(file1_id,obj1_name)) < 0 ) - { - printf("Cannot open dataset <%s>\n", obj1_name ); - goto out; - } - if ( (dset2_id = H5Dopen(file2_id,obj2_name)) < 0 ) - { - printf("Cannot open dataset <%s>\n", obj2_name ); - goto out; - } - /* enable error reporting */ - H5Eset_auto(func, edata); - - /* Get the dataspace handle */ - if ( (space1_id = H5Dget_space(dset1_id)) < 0 ) - goto out; - - /* Get rank */ - if ( (rank1 = H5Sget_simple_extent_ndims(space1_id)) < 0 ) - goto out; - - /* Get the dataspace handle */ - if ( (space2_id = H5Dget_space(dset2_id)) < 0 ) - goto out; - - /* Get rank */ - if ( (rank2 = H5Sget_simple_extent_ndims(space2_id)) < 0 ) - goto out; - - /* Get dimensions */ - if ( H5Sget_simple_extent_dims(space1_id,dims1,maxdim1) < 0 ) - goto out; - - /* Get dimensions */ - if ( H5Sget_simple_extent_dims(space2_id,dims2,maxdim2) < 0 ) - goto out; - -/*------------------------------------------------------------------------- - * Get the file data type - *------------------------------------------------------------------------- - */ - - /* Get the data type */ - if ( (f_type1 = H5Dget_type(dset1_id)) < 0 ) - goto out; - - /* Get the data type */ - if ( (f_type2 = H5Dget_type(dset2_id)) < 0 ) - 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 ) - { - 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) - { - case H5T_TIME: - case H5T_STRING: - case H5T_BITFIELD: - case H5T_OPAQUE: - case H5T_COMPOUND: - case H5T_REFERENCE: - case H5T_ENUM: - case H5T_VLEN: - case H5T_ARRAY: - 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 the same rank - *------------------------------------------------------------------------- - */ - - if ( rank1 != rank2 ) - { - 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; - } - -/*------------------------------------------------------------------------- - * 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) - { - 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) - { - 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 - *------------------------------------------------------------------------- - */ - - tot_cnt1 = 1; - for (i = 0; i < rank1; i++) - { - tot_cnt1 *= dims1[i]; - } - - tot_cnt2 = 1; - for (i = 0; i < rank2; i++) - { - tot_cnt2 *= dims2[i]; - } - - assert(tot_cnt1==tot_cnt2); - -/*------------------------------------------------------------------------- - * check for equal file datatype; warning only - *------------------------------------------------------------------------- - */ - - if ( (H5Tequal(f_type1, f_type2)==0) ) - { - printf("Warning: Different storage datatype\n"); - printf("<%s> has file datatype ", obj1_name); - print_datatype(f_type1); - printf("\n"); - printf("<%s> has file datatype ", obj2_name); - print_datatype(f_type2); - printf("\n"); - } - -/*------------------------------------------------------------------------- - * memory type and sizes - *------------------------------------------------------------------------- - */ - - m_type1 = H5Tget_native_type( f_type1 ,H5T_DIR_DEFAULT); - m_type2 = H5Tget_native_type( f_type2 ,H5T_DIR_DEFAULT); - - m_size1 = H5Tget_size( m_type1 ); - m_size2 = H5Tget_size( m_type2 ); - -#if defined (H5DIFF_DEBUG) - print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); -#endif - -/*------------------------------------------------------------------------- - * check for the comparable types in array_diff - *------------------------------------------------------------------------- - */ - - can1=h5diff_can_diff(m_type1); - can2=h5diff_can_diff(m_type2); - if ( can1==0 || can2==0 ) - { - printf("Comparison not supported\n"); - if ( can1==0 ) - printf("<%s> type is not supported\n", obj1_name); - if ( can2==0 ) - printf("<%s> type is not supported\n", obj2_name); - goto out; - } - -/*------------------------------------------------------------------------- - * check for different signed/unsigned types - *------------------------------------------------------------------------- - */ - - sign1=H5Tget_sign(m_type1); - sign2=H5Tget_sign(m_type2); - if ( sign1 != sign2 ) - { - printf("Comparison not supported\n"); - printf("<%s> has sign %s\n", obj1_name, get_sign(sign1)); - printf("<%s> has sign %s", obj2_name, get_sign(sign2)); - goto out; - } - - -/*------------------------------------------------------------------------- - * "upgrade" the smaller memory size - *------------------------------------------------------------------------- - */ - - if ( m_size1 != m_size2 ) - { - if ( m_size1 < m_size2 ) - { - assert( (H5Tclose(m_type1)) >=0); - m_type1 = H5Tget_native_type( f_type2 , H5T_DIR_DEFAULT); - m_size1 = H5Tget_size( m_type1 ); - } - else - { - assert( (H5Tclose(m_type2)) >=0); - m_type2 = H5Tget_native_type( f_type1 , H5T_DIR_DEFAULT); - m_size2 = H5Tget_size( m_type2 ); - } -#if defined (H5DIFF_DEBUG) - printf("WARNING: Size was upgraded\n"); - print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); -#endif - } - assert(m_size1==m_size2); - - buf1 = (void *) malloc((unsigned) (tot_cnt1*m_size1)); - buf2 = (void *) malloc((unsigned) (tot_cnt2*m_size2)); - - if ( buf1 == NULL || buf2 == NULL ) - { - printf( "cannot read into memory\n" ); - goto out; - } - -/*------------------------------------------------------------------------- - * read - *------------------------------------------------------------------------- - */ - - if ( H5Dread(dset1_id,m_type1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 ) - goto out; - - if ( H5Dread(dset2_id,m_type2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 ) - goto out; - -/*------------------------------------------------------------------------- - * array compare - *------------------------------------------------------------------------- - */ - printf( "Comparing <%s> with <%s>\n", obj1_name, obj2_name ); - name1=h5diff_basename(obj1_name); - name2=h5diff_basename(obj2_name); - nfound = array_diff(buf1,buf2,tot_cnt1,rank1,dims1,opts,name1,name2,m_type1); - printf("%d differences found\n", nfound ); - -/*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - -out: - - if ( buf1) free(buf1); - if ( buf2) free(buf2); - - /* Close */ - if ( dset1_id!=-1 ) assert( (H5Dclose(dset1_id)) >=0); - if ( dset2_id!=-1 ) assert( (H5Dclose(dset2_id)) >=0); - if ( space1_id!=-1 ) assert( (H5Sclose(space1_id)) >=0); - if ( space2_id!=-1 ) assert( (H5Sclose(space2_id)) >=0); - if ( f_type1!=-1 ) assert( (H5Tclose(f_type1)) >=0); - if ( f_type2!=-1 ) assert( (H5Tclose(f_type2)) >=0); - if ( m_type1!=-1 ) assert( (H5Tclose(m_type1)) >=0); - if ( m_type2!=-1 ) assert( (H5Tclose(m_type2)) >=0); - - return nfound; - -} - - - - -/*------------------------------------------------------------------------- - * Function: array_diff - * - * Purpose: compare array; currenttly only the NATIVE types below are supported - * - * Return: number of differences found - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 30, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static -int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims, - options_t opts, const char *obj1, const char *obj2, - hid_t m_type ) -{ - char fmt_llong[255], fmt_ullong[255]; - char fmt_llongp[255], fmt_ullongp[255]; - size_t type_size;/* just check */ - int nfound=0; /* number of differences found */ - int ph=1; /* print header */ - int acc[32]; /* accumulator and matrix position */ - int pos[32]; - unsigned i; - int j; - char *_buf1 = (char*)buf1; - char *_buf2 = (char*)buf2; - - - /* Build default formats for long long types */ - sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", - H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullong, "%%%su %%%su %%%su\n", - H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", - H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", - H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - - - acc[rank-1]=1; - for(j=(rank-2); j>=0; j--) - { - acc[j]=acc[j+1]*(int)dims[j+1]; - } - - /* Get the size. */ - type_size = H5Tget_size( m_type ); - -/*------------------------------------------------------------------------- - * H5T_NATIVE_SCHAR - *------------------------------------------------------------------------- - */ - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) - { - char temp1_char; - char temp2_char; - assert(type_size==sizeof(char)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_char, _buf1, sizeof(char)); - memcpy(&temp2_char, _buf2, sizeof(char)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (abs(temp1_char-temp2_char) > opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char), - abs(1-temp2_char/temp1_char)); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > opts.percent && - abs(temp1_char-temp2_char) > opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char), - abs(1-temp2_char/temp1_char)); - } - nfound++; - } - } - else if (temp1_char != temp2_char) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_char,temp2_char,abs(temp1_char-temp2_char)); - } - nfound++; - } - - _buf1+=sizeof(char); - _buf2+=sizeof(char); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_uchar, _buf1, sizeof(unsigned char)); - memcpy(&temp2_uchar, _buf2, sizeof(unsigned char)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (abs(temp1_uchar-temp2_uchar) > opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar), - abs(1-temp2_uchar/temp1_uchar)); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > opts.percent && - abs(temp1_uchar-temp2_uchar) > opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar), - abs(1-temp2_uchar/temp1_uchar)); - } - nfound++; - } - } - else if (temp1_uchar != temp2_uchar) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_uchar,temp2_uchar,abs(temp1_uchar-temp2_uchar)); - } - nfound++; - } - - _buf1+=sizeof(unsigned char); - _buf2+=sizeof(unsigned char); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_short, _buf1, sizeof(short)); - memcpy(&temp2_short, _buf2, sizeof(short)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (abs(temp1_short-temp2_short) > opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short), - abs(1-temp2_short/temp1_short)); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > opts.percent && - abs(temp1_short-temp2_short) > opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short), - abs(1-temp2_short/temp1_short)); - } - nfound++; - } - } - else if (temp1_short != temp2_short) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_short,temp2_short,abs(temp1_short-temp2_short)); - } - nfound++; - } - - _buf1+=sizeof(short); - _buf2+=sizeof(short); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_ushort, _buf1, sizeof(unsigned short)); - memcpy(&temp2_ushort, _buf2, sizeof(unsigned short)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (abs(temp1_ushort-temp2_ushort) > opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort), - abs(1-temp2_ushort/temp1_ushort)); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > opts.percent && - abs(temp1_ushort-temp2_ushort) > opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort), - abs(1-temp2_ushort/temp1_ushort)); - } - nfound++; - } - } - else if (temp1_ushort != temp2_ushort) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_ushort,temp2_ushort,abs(temp1_ushort-temp2_ushort)); - } - nfound++; - } - - _buf1+=sizeof(unsigned short); - _buf2+=sizeof(unsigned short); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_int, _buf1, sizeof(int)); - memcpy(&temp2_int, _buf2, sizeof(int)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (abs(temp1_int-temp2_int) > opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int), - abs(1-temp2_int/temp1_int)); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > opts.percent && - abs(temp1_int-temp2_int) > opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int), - abs(1-temp2_int/temp1_int)); - } - nfound++; - } - } - else if (temp1_int != temp2_int) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(IFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int)); - } - nfound++; - } - - _buf1+=sizeof(int); - _buf2+=sizeof(int); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_uint, _buf1, sizeof(unsigned int)); - memcpy(&temp2_uint, _buf2, sizeof(unsigned int)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (abs((int)(temp1_uint-temp2_uint)) > opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(UIFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint))); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(UIPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), - abs((int)(1-temp2_uint/temp1_uint))); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > opts.percent && - abs((int)(temp1_uint-temp2_uint)) > opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(UIPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), - abs((int)(1-temp2_uint/temp1_uint))); - } - nfound++; - } - } - else if (temp1_uint != temp2_uint) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(UIFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint))); - } - nfound++; - } - - _buf1+=sizeof(unsigned int); - _buf2+=sizeof(unsigned int); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_long, _buf1, sizeof(long)); - memcpy(&temp2_long, _buf2, sizeof(long)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (labs(temp1_long-temp2_long) > (long)opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long), - labs(1-temp2_long/temp1_long)); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)opts.percent && - labs(temp1_long-temp2_long) > (long)opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(LPIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long), - labs(1-temp2_long/temp1_long)); - } - nfound++; - } - } - else if (temp1_long != temp2_long) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(LIFORMAT,temp1_long,temp2_long,labs(temp1_long-temp2_long)); - } - nfound++; - } - - _buf1+=sizeof(long); - _buf2+=sizeof(long); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_ulong, _buf1, sizeof(unsigned long)); - memcpy(&temp2_ulong, _buf2, sizeof(unsigned long)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (labs((long)(temp1_ulong-temp2_ulong)) > (long)opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(ULIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong))); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(ULPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)), - labs((long)(1-temp2_ulong/temp1_ulong))); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)opts.percent && - labs((long)(temp1_ulong-temp2_ulong)) > (long)opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(ULPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)), - labs((long)(1-temp2_ulong/temp1_ulong))); - } - nfound++; - } - } - else if (temp1_ulong != temp2_ulong) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(ULIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong))); - } - nfound++; - } - - _buf1+=sizeof(unsigned long); - _buf2+=sizeof(unsigned long); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_llong, _buf1, sizeof(long_long)); - memcpy(&temp2_llong, _buf2, sizeof(long_long)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (labs((long)(temp1_llong-temp2_llong)) > (long)opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(fmt_llong,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong))); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(fmt_llongp,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)), - (long_long)labs((long)(1-temp2_llong/temp1_llong))); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)opts.percent && - labs((long)(temp1_llong-temp2_llong)) > (long)opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(fmt_llongp,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong)), - (long_long)labs((long)(1-temp2_llong/temp1_llong))); - } - nfound++; - } - } - else if (temp1_llong != temp2_llong) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(fmt_llong,temp1_llong,temp2_llong,(long_long)labs((long)(temp1_llong-temp2_llong))); - } - nfound++; - } - - _buf1+=sizeof(long_long); - _buf2+=sizeof(long_long); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_ullong, _buf1, sizeof(unsigned long_long)); - memcpy(&temp2_ullong, _buf2, sizeof(unsigned long_long)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (labs((long)(temp1_ullong-temp2_ullong)) > (long)opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(fmt_ullong,temp1_ullong,temp2_ullong, - (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(fmt_ullongp,temp1_ullong,temp2_ullong, - (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), - (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong))); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)opts.percent && - labs((long)(temp1_ullong-temp2_ullong)) > (long)opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(fmt_ullongp,temp1_ullong,temp2_ullong, - (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), - (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong))); - } - nfound++; - } - } - else if (temp1_ullong != temp2_ullong) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(fmt_ullong,temp1_ullong,temp2_ullong, - (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); - } - nfound++; - } - - _buf1+=sizeof(unsigned long_long); - _buf2+=sizeof(unsigned long_long); - }/* i */ - - } /*H5T_NATIVE_ULLONG*/ - -/*------------------------------------------------------------------------- - * H5T_NATIVE_FLOAT - *------------------------------------------------------------------------- - */ - - else if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) - { - float temp1_float; - float temp2_float; - assert(type_size==sizeof(float)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_float, _buf1, sizeof(float)); - memcpy(&temp2_float, _buf2, sizeof(float)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (fabs(temp1_float-temp2_float) > opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float), - fabs(1-temp2_float/temp1_float)); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > opts.percent && - fabs(temp1_float-temp2_float) > opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(FPFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float), - fabs(1-temp2_float/temp1_float)); - } - nfound++; - } - } - else if (temp1_float != temp2_float) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(FFORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float)); - } - nfound++; - } - - _buf1+=sizeof(float); - _buf2+=sizeof(float); - }/* i */ - - } /*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)); - for ( i = 0; i < tot_cnt; i++) - { - memcpy(&temp1_double, _buf1, sizeof(double)); - memcpy(&temp2_double, _buf2, sizeof(double)); - /* -d and !-p */ - if (opts.d && !opts.p) - { - if (fabs(temp1_double-temp2_double) > opts.delta) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!opts.d && opts.p) - { - if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > opts.percent ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double), - fabs(1-temp2_double/temp1_double)); - } - nfound++; - } - } - /* -d and -p */ - else if ( opts.d && opts.p) - { - if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > opts.percent && - fabs(temp1_double-temp2_double) > opts.delta ) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,1,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(FPFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double), - fabs(1-temp2_double/temp1_double)); - } - nfound++; - } - } - else if (temp1_double != temp2_double) - { - if (opts.n && nfound>=opts.count) - return nfound; - if ( opts.r==0 ) - { - print_pos(&ph,0,i,acc,pos,rank,obj1,obj2); - printf(SPACES); - printf(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double)); - } - nfound++; - } - - _buf1+=sizeof(double); - _buf2+=sizeof(double); - }/* i */ - - } /*H5T_NATIVE_DOUBLE*/ - -/*------------------------------------------------------------------------- - * no more - *------------------------------------------------------------------------- - */ - else - { - assert(0); - } - - return nfound; -} - - - - - - -/*------------------------------------------------------------------------- - * Function: h5diff_can_diff - * - * Purpose: Check if TYPE_ID is supported; only the listed types are - * supported in the current version - * - *------------------------------------------------------------------------- - */ -static -int h5diff_can_diff(hid_t type_id) -{ - int ret=0; - if ( (H5Tequal(type_id, H5T_NATIVE_FLOAT)==1)|| - (H5Tequal(type_id, H5T_NATIVE_DOUBLE)==1)|| - (H5Tequal(type_id, H5T_NATIVE_INT)==1)|| - (H5Tequal(type_id, H5T_NATIVE_UINT)==1)|| - (H5Tequal(type_id, H5T_NATIVE_SCHAR)==1)|| - (H5Tequal(type_id, H5T_NATIVE_UCHAR)==1)|| - (H5Tequal(type_id, H5T_NATIVE_SHORT)==1)|| - (H5Tequal(type_id, H5T_NATIVE_USHORT)==1)|| - (H5Tequal(type_id, H5T_NATIVE_LONG)==1)|| - (H5Tequal(type_id, H5T_NATIVE_ULONG)==1)|| - (H5Tequal(type_id, H5T_NATIVE_LLONG)==1)|| - (H5Tequal(type_id, H5T_NATIVE_ULLONG)==1) - ) - ret=1; - return ret; -} - - - - -/*------------------------------------------------------------------------- - * Function: print_pos - * - * Purpose: convert an array index position to matrix notation - * - * Return: pos matrix array - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static -void print_pos( int *ph, int p, unsigned int curr_pos, int *acc, - int *pos, int rank, const char *obj1, const char *obj2 ) -{ - int i; - - /* print header */ - if ( *ph==1 ) - { - *ph=0; - if (p) - { - printf("%-15s %-15s %-15s %-15s %-15s\n", "position", obj1, obj2, "difference", - "relative"); - printf("------------------------------------------------------------------------\n"); - } - else - { - printf("%-15s %-15s %-15s %-20s\n", "position", obj1, obj2, "difference"); - printf("------------------------------------------------------------\n"); - } - } - - for ( i = 0; i < rank; i++) - pos[i]=0; - - for ( i = 0; i < rank; i++) - { - pos[i] = curr_pos/acc[i]; - curr_pos -= acc[i]*pos[i]; - } - assert( curr_pos == 0 ); - - printf("[ " ); - for ( i = 0; i < rank; i++) - { - printf("%d ", pos[i] ); - } - printf("]" ); -} - -/*------------------------------------------------------------------------- - * Function: print_dims - * - * Purpose: print dimensions - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - *------------------------------------------------------------------------- - */ -static -void print_dims( int r, hsize_t *d ) -{ - int i; - printf("[ " ); - for ( i=0; i<r; i++ ) - printf("%d ",(int)d[i] ); - printf("] " ); -} - - -/*------------------------------------------------------------------------- - * Function: print_datatype - * - * Purpose: Print name of datatype - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: Adapted from h5dump for H5T_INTEGER and H5T_FLOAT classes only - * - *------------------------------------------------------------------------- - */ -static -void print_datatype(hid_t type) -{ - switch (H5Tget_class(type)) - { - default: - return; - case H5T_INTEGER: - if (H5Tequal(type, H5T_STD_I8BE)) { - printf("H5T_STD_I8BE"); - } else if (H5Tequal(type, H5T_STD_I8LE)) { - printf("H5T_STD_I8LE"); - } else if (H5Tequal(type, H5T_STD_I16BE)) { - printf("H5T_STD_I16BE"); - } else if (H5Tequal(type, H5T_STD_I16LE)) { - printf("H5T_STD_I16LE"); - } else if (H5Tequal(type, H5T_STD_I32BE)) { - printf("H5T_STD_I32BE"); - } else if (H5Tequal(type, H5T_STD_I32LE)) { - printf("H5T_STD_I32LE"); - } else if (H5Tequal(type, H5T_STD_I64BE)) { - printf("H5T_STD_I64BE"); - } else if (H5Tequal(type, H5T_STD_I64LE)) { - printf("H5T_STD_I64LE"); - } else if (H5Tequal(type, H5T_STD_U8BE)) { - printf("H5T_STD_U8BE"); - } else if (H5Tequal(type, H5T_STD_U8LE)) { - printf("H5T_STD_U8LE"); - } else if (H5Tequal(type, H5T_STD_U16BE)) { - printf("H5T_STD_U16BE"); - } else if (H5Tequal(type, H5T_STD_U16LE)) { - printf("H5T_STD_U16LE"); - } else if (H5Tequal(type, H5T_STD_U32BE)) { - printf("H5T_STD_U32BE"); - } else if (H5Tequal(type, H5T_STD_U32LE)) { - printf("H5T_STD_U32LE"); - } else if (H5Tequal(type, H5T_STD_U64BE)) { - printf("H5T_STD_U64BE"); - } else if (H5Tequal(type, H5T_STD_U64LE)) { - printf("H5T_STD_U64LE"); - } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { - printf("H5T_NATIVE_SCHAR"); - } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { - printf("H5T_NATIVE_UCHAR"); - } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { - printf("H5T_NATIVE_SHORT"); - } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { - printf("H5T_NATIVE_USHORT"); - } else if (H5Tequal(type, H5T_NATIVE_INT)) { - printf("H5T_NATIVE_INT"); - } else if (H5Tequal(type, H5T_NATIVE_UINT)) { - printf("H5T_NATIVE_UINT"); - } else if (H5Tequal(type, H5T_NATIVE_LONG)) { - printf("H5T_NATIVE_LONG"); - } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { - printf("H5T_NATIVE_ULONG"); - } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { - printf("H5T_NATIVE_LLONG"); - } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { - printf("H5T_NATIVE_ULLONG"); - } else { - printf("undefined integer"); - } - break; - - case H5T_FLOAT: - if (H5Tequal(type, H5T_IEEE_F32BE)) { - printf("H5T_IEEE_F32BE"); - } else if (H5Tequal(type, H5T_IEEE_F32LE)) { - printf("H5T_IEEE_F32LE"); - } else if (H5Tequal(type, H5T_IEEE_F64BE)) { - printf("H5T_IEEE_F64BE"); - } else if (H5Tequal(type, H5T_IEEE_F64LE)) { - printf("H5T_IEEE_F64LE"); - } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { - printf("H5T_NATIVE_FLOAT"); - } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { - printf("H5T_NATIVE_DOUBLE"); - } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { - printf("H5T_NATIVE_LDOUBLE"); - } else { - printf("undefined float"); - } - break; - - }/*switch*/ -} - - - -/*------------------------------------------------------------------------- - * Function: h5diff_basename - * - * Purpose: Returns a pointer to the last component absolute name - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - *------------------------------------------------------------------------- - */ -static -const char* -h5diff_basename(const char *name) -{ - size_t i; - - /* Find the end of the base name */ - i = strlen(name); - while (i>0 && '/'==name[i-1]) - --i; - - /* Skip backward over base name */ - while (i>0 && '/'!=name[i-1]) - --i; - - return(name+i); -} - -/*------------------------------------------------------------------------- - * Function: get_type - * - * Purpose: Returns the type as a string - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - *------------------------------------------------------------------------- - */ -static -const char* -get_type(int type) -{ - switch (type) - { - case H5G_DATASET: - return("H5G_DATASET"); - case H5G_GROUP: - return("H5G_GROUP"); - case H5G_TYPE: - return("H5G_TYPE"); - case H5G_LINK: - return("H5G_LINK"); - default: - return("user defined type"); - } -} - -/*------------------------------------------------------------------------- - * Function: get_sign - * - * Purpose: Returns the sign as a string - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - *------------------------------------------------------------------------- - */ -static -const char* -get_sign(H5T_sign_t sign) -{ - switch (sign) - { - default: - return("H5T_SGN_ERROR"); - case H5T_SGN_NONE: - return("H5T_SGN_NONE"); - case H5T_SGN_2: - return("H5T_SGN_2"); - } -} - - -/*------------------------------------------------------------------------- - * Function: get_class - * - * Purpose: Returns the class as a string - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: May 9, 2003 - * - * Comments: - * - *------------------------------------------------------------------------- - */ -static -const char* -get_class(H5T_class_t tclass) -{ - switch (tclass) - { - default: - return("Invalid class"); - case H5T_TIME: - return("H5T_TIME"); - case H5T_INTEGER: - return("H5T_INTEGER"); - case H5T_FLOAT: - return("H5T_FLOAT"); - case H5T_STRING: - return("H5T_STRING"); - case H5T_BITFIELD: - return("H5T_BITFIELD"); - case H5T_OPAQUE: - return("H5T_OPAQUE"); - case H5T_COMPOUND: - return("H5T_COMPOUND"); - case H5T_REFERENCE: - return("H5T_REFERENCE"); - case H5T_ENUM: - return("H5T_ENUM"); - case H5T_VLEN: - return("H5T_VLEN"); - case H5T_ARRAY: - return("H5T_ARRAY"); - } -} - - -/*------------------------------------------------------------------------- - * Function: print_sizes - * - * Purpose: Print datatype sizes - * - *------------------------------------------------------------------------- - */ -#if defined (H5DIFF_DEBUG) -static -void print_sizes( const char *obj1, const char *obj2, - hid_t f_type1, hid_t f_type2, - hid_t m_type1, hid_t m_type2 ) -{ - size_t f_size1, f_size2; /* size of type in file */ - size_t m_size1, m_size2; /* size of type in memory */ - - f_size1 = H5Tget_size( f_type1 ); - f_size2 = H5Tget_size( f_type2 ); - m_size1 = H5Tget_size( m_type1 ); - m_size2 = H5Tget_size( m_type2 ); - - printf("\n"); - printf("------------------\n"); - printf("sizeof(char) %u\n", sizeof(char) ); - printf("sizeof(short) %u\n", sizeof(short) ); - printf("sizeof(int) %u\n", sizeof(int) ); - printf("sizeof(long) %u\n", sizeof(long) ); - printf("<%s> ------------------\n", obj1); - printf("type on file "); - print_datatype(f_type1); - printf("\n"); - printf("size on file %u\n", f_size1 ); - - printf("type on memory "); - print_datatype(m_type1); - printf("\n"); - printf("size on memory %u\n", m_size1 ); - - printf("<%s> ------------------\n", obj2); - printf("type on file "); - print_datatype(f_type2); - printf("\n"); - printf("size on file %u\n", f_size2 ); - - printf("type on memory "); - print_datatype(m_type2); - printf("\n"); - printf("size on memory %u\n", m_size2 ); - printf("\n"); -} -#endif /* H5DIFF_DEBUG */ - - diff --git a/tools/h5diff/h5difftst.c b/tools/h5diff/h5difftst.c deleted file mode 100644 index e270171..0000000 --- a/tools/h5diff/h5difftst.c +++ /dev/null @@ -1,783 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 <stdio.h> -#include <stdlib.h> -#include "hdf5.h" -#include "H5private.h" - -/*UINT_MAX Maximum value for a variable of type unsigned int. 4294967295 */ -#define UIMAX 4294967295u - -/* diff test*/ -static int do_test_1(const char *file1, const char *file2); -static int do_test_2(const char *file1, const char *file2); -static int do_test_3(const char *file1, const char *file2); -static int do_test_4(const char *file1, const char *file2); -static int do_test_5(const char *file1, const char *file2); -static int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, - hid_t type_id, void *buf ); - - -int main(int UNUSED argc, const UNUSED char *argv[]) -{ - - do_test_1("file1.h5","file2.h5"); - do_test_2("file3.h5",NULL); - do_test_3("file4.h5",NULL); - do_test_4("file5.h5",NULL); - do_test_5("file6.h5",NULL); - return 0; -} - - - -/*------------------------------------------------------------------------- - * Function: write_dataset - * - * Purpose: utility function to write a dataset - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: April 7, 2003 - * - *------------------------------------------------------------------------- - */ - -static -int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, - hid_t type_id, void *buf ) -{ - hid_t dataset_id; - hid_t space_id; - herr_t status; - - /* Create a buf space */ - space_id = H5Screate_simple(rank,dims,NULL); - - /* Create a dataset */ - dataset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT); - - /* Write the buf */ - if ( buf ) - assert(H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)>=0); - - /* Close */ - status = H5Dclose(dataset_id); - status = H5Sclose(space_id); - assert(status>=0); - - return status; - -} - -/* - -# ############################################################################## -# # Common usage -# ############################################################################## - - -# 1.0 - -h - -# 1.1 - file1.h5 file2.h5 g1/dset1 g1/dset2 - -# 1.2 - file1.h5 file2.h5 -n 2 g1/dset1 g1/dset2 - -# 1.3 - file1.h5 file2.h5 -d 5 g1/dset3 g1/dset4 - -# 1.4 - file1.h5 file2.h5 -p 0.05 g1/dset3 g1/dset4 - -# 1.5 - file1.h5 file2.h5 -r g1/dset1 g1/dset2 - -# 1.6 - file1.h5 file2.h5 - -# ############################################################################## -# # not comparable types -# ############################################################################## - -# 2.0 - file3.h5 file3.h5 dset group - -# 2.1 - file3.h5 file3.h5 dset link - -# 2.2 - file3.h5 file3.h5 dset type - -# 2.3 - file3.h5 file3.h5 group group - -# 2.4 - file3.h5 file3.h5 type type - -# 2.5 - file3.h5 file3.h5 link link - -# ############################################################################## -# # Class issues -# ############################################################################## - - -# 3.0 - file4.h5 file4.h5 string - -# 3.1 - file4.h5 file4.h5 bitfield - -# 3.2 - file4.h5 file4.h5 opaque - -# 3.3 - file4.h5 file4.h5 compound - -# 3.4 - file4.h5 file4.h5 ref - -# 3.5 - file4.h5 file4.h5 enum - -# 3.6 - file4.h5 file4.h5 vlen - -# 3.7 - file4.h5 file4.h5 array - -# 3.8 - file4.h5 file4.h5 integer float - -# ############################################################################## -# # Dimensions -# ############################################################################## - -# 4.0 - file5.h5 file5.h5 dset1 dset2 - -# 4.1 - file5.h5 file5.h5 dset3 dset4 - -# 4.2 - file5.h5 file5.h5 dset5 dset6 - - -# ############################################################################## -# # Dataset types -# ############################################################################## - -# 5.0 - file6.h5 file6.h5 dset0a dset0b - -# 5.1 - file6.h5 file6.h5 dset1a dset1b - -# 5.2 - file6.h5 file6.h5 dset2a dset2b - -# 5.3 - file6.h5 file6.h5 dset3a dset4b - -# 5.4 - file6.h5 file6.h5 dset4a dset4b - -# 5.5 - file6.h5 file6.h5 dset5a dset5b - -# 5.6 - file6.h5 file6.h5 dset6a dset6b - -# 5.7 - file6.h5 file6.h5 dset7a dset7b - -# 5.8 - file6.h5 file6.h5 dset8a dset8b - -# ############################################################################## -# # Error messages -# ############################################################################## - - -# 6.0: Check if the command line number of arguments is less than 3 - h5diff_test1.h5 - -# 6.1: Check for invalid options - h5diff_test1.h5 h5diff_test2.h5 -x - -# ############################################################################## -# # -d -# ############################################################################## - -# 6.2: no value - file1.h5 file2.h5 -d g1/dset3 g1/dset4 - -# 6.3: negative value - file1.h5 file2.h5 -d -4 g1/dset3 g1/dset4 - -# 6.4: zero - file1.h5 file2.h5 -d 0 g1/dset3 g1/dset4 - -# 6.5: non number - file1.h5 file2.h5 -d u g1/dset3 g1/dset4 - -# 6.6: hexadecimal - file1.h5 file2.h5 -d 0x1 g1/dset3 g1/dset4 - -# 6.7: string - file1.h5 file2.h5 -d "1" g1/dset3 g1/dset4 - -# 6.8: repeated option - file1.h5 file2.h5 -d 1 -d 2 g1/dset3 g1/dset4 - -# 6.9: number larger than biggest difference - file1.h5 file2.h5 -d 200 g1/dset3 g1/dset4 - -# 6.10: number smaller than smallest difference - file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4 - - -# ############################################################################## -# # -p -# ############################################################################## - - -# 6.11: no value - file1.h5 file2.h5 -p g1/dset3 g1/dset4 - -# 6.12: negative value - file1.h5 file2.h5 -p -4 g1/dset3 g1/dset4 - -# 6.13: zero - file1.h5 file2.h5 -p 0 g1/dset3 g1/dset4 - -# 6.14: non number - file1.h5 file2.h5 -p u g1/dset3 g1/dset4 - -# 6.15: hexadecimal - file1.h5 file2.h5 -p 0x1 g1/dset3 g1/dset4 - -# 6.16: string - file1.h5 file2.h5 -p "0.21" g1/dset3 g1/dset4 - -# 6.17: repeated option - file1.h5 file2.h5 -p 0.21 -p 0.22 g1/dset3 g1/dset4 - -# 6.18: number larger than biggest difference - file1.h5 file2.h5 -p 2 g1/dset3 g1/dset4 - -# 6.19: number smaller than smallest difference - file1.h5 file2.h5 -p 0.005 g1/dset3 g1/dset4 - - - -# ############################################################################## -# # -n -# ############################################################################## - - -# 6.20: no value - file1.h5 file2.h5 -n g1/dset3 g1/dset4 - -# 6.21: negative value - file1.h5 file2.h5 -n -4 g1/dset3 g1/dset4 - -# 6.22: zero - file1.h5 file2.h5 -n 0 g1/dset3 g1/dset4 - -# 6.23: non number - file1.h5 file2.h5 -n u g1/dset3 g1/dset4 - -# 6.24: hexadecimal - file1.h5 file2.h5 -n 0x1 g1/dset3 g1/dset4 - -# 6.25: string - file1.h5 file2.h5 -n "2" g1/dset3 g1/dset4 - -# 6.26: repeated option - file1.h5 file2.h5 -n 2 -n 3 g1/dset3 g1/dset4 - -# 6.27: number larger than biggest difference - file1.h5 file2.h5 -n 200 g1/dset3 g1/dset4 - -# 6.28: number smaller than smallest difference - file1.h5 file2.h5 -n 1 g1/dset3 g1/dset4 - -# ############################################################################## -# # non valid files -# ############################################################################## - - file1.h6 file2.h6 - -*/ - - -/*------------------------------------------------------------------------- - * Basic review tests - *------------------------------------------------------------------------- - */ -static -int do_test_1(const char *file1, const char *file2) -{ - - hid_t file1_id, file2_id; - hid_t group1_id, group2_id, group3_id; - herr_t status; - hsize_t dims[2] = { 3,2 }; - - /* Test */ - double data1[3][2] = {{1,1},{1,1},{1,1}}; - double data2[3][2] = {{1,1.1},{1.01,1.001},{1.0001,1.000000001}}; - double data3[3][2] = {{100,110},{100,100},{100,100}}; - double data4[3][2] = {{110,100},{90,80},{140,200}}; - -/*------------------------------------------------------------------------- - * Create two files - *------------------------------------------------------------------------- - */ - - file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - file2_id = H5Fcreate (file2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - - /* Create groups */ - group1_id = H5Gcreate(file1_id, "g1", 0); - group2_id = H5Gcreate(file2_id, "g1", 0); - group3_id = H5Gcreate(file2_id, "g2", 0); - - write_dataset(group1_id,2,dims,"dset1",H5T_NATIVE_DOUBLE,data1); - write_dataset(group2_id,2,dims,"dset2",H5T_NATIVE_DOUBLE,data2); - write_dataset(group1_id,2,dims,"dset3",H5T_NATIVE_DOUBLE,data3); - write_dataset(group2_id,2,dims,"dset4",H5T_NATIVE_DOUBLE,data4); - write_dataset(group2_id,2,dims,"dset1",H5T_NATIVE_DOUBLE,data2); - -/*------------------------------------------------------------------------- - * Close - *------------------------------------------------------------------------- - */ - status = H5Gclose(group1_id); - status = H5Gclose(group2_id); - status = H5Gclose(group3_id); - status = H5Fclose(file1_id); - status = H5Fclose(file2_id); - return status; -} - -/*------------------------------------------------------------------------- - * Compare different types: H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK - *------------------------------------------------------------------------- - */ -static -int do_test_2(const char *file1, const char UNUSED *file2) -{ - - hid_t file1_id; - hid_t group_id; - hid_t type_id; - herr_t status; - hsize_t dims[1]={1}; - /* Compound datatype */ - typedef struct s_t - { - int a; - float b; - } s_t; - -/*------------------------------------------------------------------------- - * Create one file - *------------------------------------------------------------------------- - */ - file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - -/*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,1,dims,"dset",H5T_NATIVE_INT,0); - -/*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - group_id = H5Gcreate(file1_id, "group", 0); - status = H5Gclose(group_id); - -/*------------------------------------------------------------------------- - * H5G_TYPE - *------------------------------------------------------------------------- - */ - - /* Create a memory compound datatype */ - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_INT); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT); - /* Commit compound datatype and close it */ - H5Tcommit(file1_id, "type", type_id); - H5Tclose(type_id); - -/*------------------------------------------------------------------------- - * H5G_LINK - *------------------------------------------------------------------------- - */ - - status = H5Glink(file1_id, H5G_LINK_SOFT, "dset", "link"); - -/*------------------------------------------------------------------------- - * Close - *------------------------------------------------------------------------- - */ - status = H5Fclose(file1_id); - return status; -} - - - - -/*------------------------------------------------------------------------- - * Check for non supported classes. Supported classes are H5T_INTEGER and H5T_FLOAT - * Non supported classes are - * H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_COMPOUND, H5T_REFERENCE, - * H5T_ENUM, H5T_VLEN, H5T_ARRAY - *------------------------------------------------------------------------- - */ -static -int do_test_3(const char *file1, const char UNUSED *file2) -{ - - hid_t file1_id; - hid_t dataset_id; - hid_t space_id; - hid_t type_id; - hsize_t dims[1]={1}; - herr_t status; - int val; - - /* Compound datatype */ - typedef struct s_t - { - int a; - float b; - } s_t; - - typedef enum - { - E_RED, - E_GREEN -} e_t; - -/*------------------------------------------------------------------------- - * Create a file - *------------------------------------------------------------------------- - */ - file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - -/*------------------------------------------------------------------------- - * H5T_STRING - *------------------------------------------------------------------------- - */ - space_id = H5Screate(H5S_SCALAR); - type_id = H5Tcopy(H5T_C_S1); - dataset_id = H5Dcreate(file1_id,"string",type_id,space_id,H5P_DEFAULT); - status = H5Dclose(dataset_id); - status = H5Sclose(space_id); - status = H5Tclose(type_id); - -/*------------------------------------------------------------------------- - * H5T_BITFIELD - *------------------------------------------------------------------------- - */ - - type_id = H5Tcopy(H5T_STD_B8LE); - write_dataset(file1_id,1,dims,"bitfield",type_id,0); - status = H5Tclose(type_id); - - -/*------------------------------------------------------------------------- - * H5T_OPAQUE - *------------------------------------------------------------------------- - */ - - type_id = H5Tcreate(H5T_OPAQUE, 1); - status = H5Tset_tag(type_id, "1-byte opaque type"); /* must set this */ - write_dataset(file1_id,1,dims,"opaque",type_id,0); - status = H5Tclose(type_id); - -/*------------------------------------------------------------------------- - * H5T_COMPOUND - *------------------------------------------------------------------------- - */ - - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_INT); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT); - write_dataset(file1_id,1,dims,"compound",type_id,0); - status = H5Tclose(type_id); - -/*------------------------------------------------------------------------- - * H5T_REFERENCE - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,1,dims,"ref",H5T_STD_REF_OBJ,0); - -/*------------------------------------------------------------------------- - * H5T_ENUM - *------------------------------------------------------------------------- - */ - type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); - H5Tenum_insert(type_id, "RED", (val = 0, &val)); - H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); - write_dataset(file1_id,1,dims,"enum",type_id,0); - status = H5Tclose(type_id); - -/*------------------------------------------------------------------------- - * H5T_VLEN - *------------------------------------------------------------------------- - */ - type_id = H5Tvlen_create(H5T_NATIVE_INT); - write_dataset(file1_id,1,dims,"vlen",type_id,0); - status = H5Tclose(type_id); - -/*------------------------------------------------------------------------- - * H5T_ARRAY - *------------------------------------------------------------------------- - */ - type_id = H5Tarray_create(H5T_NATIVE_INT,1,dims,NULL); - write_dataset(file1_id,1,dims,"array",type_id,0); - status = H5Tclose(type_id); - -/*------------------------------------------------------------------------- - * H5T_INTEGER vs H5T_FLOAT - *------------------------------------------------------------------------- - */ - - write_dataset(file1_id,1,dims,"integer",H5T_NATIVE_INT,0); - write_dataset(file1_id,1,dims,"float",H5T_NATIVE_FLOAT,0); - -/*------------------------------------------------------------------------- - * Close - *------------------------------------------------------------------------- - */ - status = H5Fclose(file1_id); - return status; -} - - -/*------------------------------------------------------------------------- - * Dimension issues - *------------------------------------------------------------------------- - */ -static -int do_test_4(const char *file1, const char UNUSED *file2) -{ - - hid_t file1_id; - hid_t dataset_id; - hid_t space_id; - hid_t plist_id; - herr_t status; - hsize_t dims1 [1]={7}; - hsize_t dims2 [4]={2,2,2,2}; - hsize_t dims21[4]={2,2,2,3}; - -/*------------------------------------------------------------------------- - * Create a file - *------------------------------------------------------------------------- - */ - file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - -/*------------------------------------------------------------------------- - * rank - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,1,dims1,"dset1",H5T_NATIVE_INT,NULL); - write_dataset(file1_id,4,dims2,"dset2",H5T_NATIVE_INT,NULL); - -/*------------------------------------------------------------------------- - * current dimensions - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,4,dims2,"dset3",H5T_NATIVE_INT,NULL); - write_dataset(file1_id,4,dims21,"dset4",H5T_NATIVE_INT,NULL); - -/*------------------------------------------------------------------------- - * Check for the same maximum dimensions. Give a warning if they are different - *------------------------------------------------------------------------- - */ - - space_id = H5Screate_simple(4,dims2,dims2); - dataset_id = H5Dcreate(file1_id,"dset5",H5T_NATIVE_INT,space_id,H5P_DEFAULT); - status = H5Dclose(dataset_id); - status = H5Sclose(space_id); - space_id = H5Screate_simple(4,dims2,dims21); - plist_id = H5Pcreate(H5P_DATASET_CREATE); - status = H5Pset_chunk(plist_id,4,dims2); - dataset_id = H5Dcreate(file1_id,"dset6",H5T_NATIVE_INT,space_id,plist_id); - status = H5Dclose(dataset_id); - status = H5Sclose(space_id); - -/*------------------------------------------------------------------------- - * Close - *------------------------------------------------------------------------- - */ - status = H5Fclose(file1_id); - return status; -} - - - - -/*------------------------------------------------------------------------- - * Datasets datatypes - *------------------------------------------------------------------------- - */ -static -int do_test_5(const char *file1, const char UNUSED *file2) -{ - - hid_t file1_id; - hsize_t dims[2]={3,2}; - herr_t status; - char buf1a[3][2] = {{1,1},{1,1},{1,1}}; - char buf1b[3][2] = {{1,1},{3,4},{5,6}}; - short buf2a[3][2] = {{1,1},{1,1},{1,1}}; - short buf2b[3][2] = {{1,1},{3,4},{5,6}}; - int buf3a[3][2] = {{1,1},{1,1},{1,1}}; - int buf3b[3][2] = {{1,1},{3,4},{5,6}}; - long buf4a[3][2] = {{1,1},{1,1},{1,1}}; - long buf4b[3][2] = {{1,1},{3,4},{5,6}}; - float buf5a[3][2] = {{1,1},{1,1},{1,1}}; - float buf5b[3][2] = {{1,1},{3,4},{5,6}}; - double buf6a[3][2] = {{1,1},{1,1},{1,1}}; - double buf6b[3][2] = {{1,1},{3,4},{5,6}}; - - /*unsigned/signed test - signed char -128 to 127 - unsigned char 0 to 255 - */ - char buf7a[3][2] = {{-1,-128},{-1,-1},{-1,-1}}; - unsigned char buf7b[3][2] = {{1,128},{1,1},{1,1}}; - - /* long_long test */ - long_long buf8a[3][2] = {{1,1},{1,1},{1,1}}; - long_long buf8b[3][2] = {{1,1},{3,4},{5,6}}; - unsigned long_long buf9a[3][2] = {{1,1},{1,1},{1,1}}; - unsigned long_long buf9b[3][2] = {{1,1},{3,4},{5,6}}; - - unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}}; - unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}}; - - -/*------------------------------------------------------------------------- - * Create a file - *------------------------------------------------------------------------- - */ - file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - -/*------------------------------------------------------------------------- - * Check for different storage order. Give a warning if they are different - *------------------------------------------------------------------------- - */ - - write_dataset(file1_id,2,dims,"dset0a",H5T_STD_I16LE,buf2a); - write_dataset(file1_id,2,dims,"dset0b",H5T_STD_I32LE,buf3b); - -/*------------------------------------------------------------------------- - * Check H5T_NATIVE_CHAR - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,2,dims,"dset1a",H5T_NATIVE_CHAR,buf1a); - write_dataset(file1_id,2,dims,"dset1b",H5T_NATIVE_CHAR,buf1b); - -/*------------------------------------------------------------------------- - * Check H5T_NATIVE_SHORT - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,2,dims,"dset2a",H5T_NATIVE_SHORT,buf2a); - write_dataset(file1_id,2,dims,"dset2b",H5T_NATIVE_SHORT,buf2b); - -/*------------------------------------------------------------------------- - * Check H5T_NATIVE_INT - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,2,dims,"dset3a",H5T_NATIVE_INT,buf3a); - write_dataset(file1_id,2,dims,"dset3b",H5T_NATIVE_INT,buf3b); - -/*------------------------------------------------------------------------- - * Check H5T_NATIVE_LONG - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,2,dims,"dset4a",H5T_NATIVE_LONG,buf4a); - write_dataset(file1_id,2,dims,"dset4b",H5T_NATIVE_LONG,buf4b); - -/*------------------------------------------------------------------------- - * Check H5T_NATIVE_FLOAT - *------------------------------------------------------------------------- - */ - write_dataset(file1_id,2,dims,"dset5a",H5T_NATIVE_FLOAT,buf5a); - write_dataset(file1_id,2,dims,"dset5b",H5T_NATIVE_FLOAT,buf5b); - -/*------------------------------------------------------------------------- - * Check H5T_NATIVE_DOUBLE - *------------------------------------------------------------------------- - */ - - write_dataset(file1_id,2,dims,"dset6a",H5T_NATIVE_DOUBLE,buf6a); - write_dataset(file1_id,2,dims,"dset6b",H5T_NATIVE_DOUBLE,buf6b); - -/*------------------------------------------------------------------------- - * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR - *------------------------------------------------------------------------- - */ - - write_dataset(file1_id,2,dims,"dset7a",H5T_NATIVE_CHAR,buf7a); - write_dataset(file1_id,2,dims,"dset7b",H5T_NATIVE_UCHAR,buf7b); - -/*------------------------------------------------------------------------- - * H5T_NATIVE_LLONG - *------------------------------------------------------------------------- - */ - - write_dataset(file1_id,2,dims,"dset8a",H5T_NATIVE_LLONG,buf8a); - write_dataset(file1_id,2,dims,"dset8b",H5T_NATIVE_LLONG,buf8b); - -/*------------------------------------------------------------------------- - * H5T_NATIVE_ULLONG - *------------------------------------------------------------------------- - */ - - write_dataset(file1_id,2,dims,"dset9a",H5T_NATIVE_ULLONG,buf9a); - write_dataset(file1_id,2,dims,"dset9b",H5T_NATIVE_ULLONG,buf9b); - -/*------------------------------------------------------------------------- - * H5T_NATIVE_INT - *------------------------------------------------------------------------- - */ - - write_dataset(file1_id,2,dims,"dset10a",H5T_NATIVE_UINT,buf10a); - write_dataset(file1_id,2,dims,"dset10b",H5T_NATIVE_UINT,buf10b); - - -/*------------------------------------------------------------------------- - * Close - *------------------------------------------------------------------------- - */ - status = H5Fclose(file1_id); - return status; -} - diff --git a/tools/h5diff/h5trav.c b/tools/h5diff/h5trav.c deleted file mode 100644 index a7c5652..0000000 --- a/tools/h5diff/h5trav.c +++ /dev/null @@ -1,582 +0,0 @@ - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 <stdio.h> -#include <stdlib.h> - -#include "hdf5.h" -#include "h5trav.h" -#include "H5private.h" - - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FAIL -#define FAIL -1 -#endif - -/* functions for traversal */ -int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info, int *idx ); -herr_t get_nobjects( hid_t loc_id, const char *group_name ); -herr_t get_name_type( hid_t loc_id, const char *group_name, int idx, char **name, int *type ); - - - - -/*------------------------------------------------------------------------- - * Function: H5get_object_info - * - * Purpose: - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 6, 2002 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -int H5get_object_info( hid_t file_id, info_t *info ) -{ - - table_t *table=NULL; - int nobjects=0; - - /* init table */ - table_init( &table ); - - /* iterate starting on the root group */ - if (( nobjects = traverse( file_id, "/", table, info, &nobjects )) < 0 ) - return -1; - - /* free table */ - table_free( table ); - - return nobjects; - -} - -/*------------------------------------------------------------------------- - * Function: count_objects - * - * Purpose: operator function - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October 10, 2002 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static herr_t count_objects( hid_t loc_id, const char *name, void *op_data) -{ - - H5G_stat_t statbuf; - - if (H5Gget_objinfo( loc_id, name, FALSE, &statbuf) < 0 ) - return 1; - - (*(int *)op_data)++; - - /* Define a default zero value for return. This will cause the iterator to continue */ - return 0; -} - -/*------------------------------------------------------------------------- - * Function: get_nobjects - * - * Purpose: Counts the number of objects in the group GROUP_NAME - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October 10, 2002 - * - * Return: - * Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. - * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. - * - *------------------------------------------------------------------------- - */ - -herr_t get_nobjects( hid_t loc_id, const char *group_name ) -{ - - int nobjs = 0; - - if ( H5Giterate( loc_id, group_name, NULL, count_objects, (void *)&nobjs ) < 0 ) - return -1; - - return nobjs; -} - - -/*------------------------------------------------------------------------- - * Function: opget_info - * - * Purpose: operator function - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October 10, 2002 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -static herr_t opget_info( hid_t loc_id, const char *name, void *op_data) -{ - - H5G_stat_t statbuf; - - if (H5Gget_objinfo( loc_id, name, FALSE, &statbuf) < 0 ) - return -1; - - ((info_t *)op_data)->type = statbuf.type; - ((info_t *)op_data)->name = (char *)HDstrdup(name); - - /* Define 1 for return. This will cause the iterator to stop */ - return 1; -} - - -/*------------------------------------------------------------------------- - * Function: get_name_type - * - * Purpose: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October 10, 2002 - * - * Return: - * Success: The return value of the first operator that - * returns non-zero, or zero if all members were - * processed with no operator returning non-zero. - * - * Failure: Negative if something goes wrong within the - * library, or the negative value returned by one - * of the operators. - * - *------------------------------------------------------------------------- - */ - -herr_t get_name_type( hid_t loc_id, const char *group_name, int idx, char **name, int *type ) -{ - - info_t info; - - if (H5Giterate( loc_id, group_name, &idx, opget_info, (void *)&info) < 0 ) - return -1; - - *name = info.name; - *type = info.type; - - return 0; -} - -/*------------------------------------------------------------------------- - * Function: traverse - * - * Purpose: - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -int traverse( hid_t loc_id, const char *group_name, table_t *table, info_t *info, int *idx ) -{ - - char *name=NULL; - int type; - int nobjs; - int i; - char *path=NULL; - H5G_stat_t statbuf; - int inserted_objs=0; - int j; - void *edata; - hid_t (*func)(void*); - - if (( nobjs = get_nobjects( loc_id, group_name )) < 0 ) - return -1; - - for ( i = 0; i < nobjs; i++) - { - - if (get_name_type( loc_id, group_name, i, &name, &type ) < 0 ) - return -1; - - /* allocate path buffer */ - path = (char*) malloc(strlen(group_name) + strlen(name) + 2); - - /* initialize path */ - strcpy( path, group_name ); - if ( strcmp(group_name,"/")!=0 ) - strcat( path, "/" ); - strcat( path, name ); - - /* disable error reporting */ - H5Eget_auto(&func, &edata); - H5Eset_auto(NULL, NULL); - - /* get info */ - H5Gget_objinfo( loc_id, path, TRUE, &statbuf); - H5Eset_auto(func, edata); - - /* add to array */ - if ( info ) - { - info[*idx].name = (char *)HDstrdup(path); - info[*idx].type = type; - (*idx)++; - } - - - switch ( type ) - { - - /*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - - case H5G_GROUP: - - /* increment */ - inserted_objs++; - - /* nlink is number of hard links to object */ - if (statbuf.nlink > 0 && table_search(statbuf.objno, table ) == FAIL) - { - /* add object to table */ - table_add(statbuf.objno, path, H5G_GROUP, table ); - - /* recurse with the absolute name */ - inserted_objs += traverse( loc_id, path, table, info, idx ); - } - - /* search table - group with more than one link to it */ - if (statbuf.nlink > 1) - { - if ((j = table_search(statbuf.objno, table )) < 0 ) - return -1; - - if ( table->objs[j].displayed == 0 ) - { - table->objs[j].displayed = 1; - } - else - { - printf("%s %s\n", "HARDLINK", table->objs[j].objname); - } - - } - - break; - - /*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ - - case H5G_DATASET: - - /* increment */ - inserted_objs++; - - /* nlink is number of hard links to object */ - if (statbuf.nlink > 0 && table_search(statbuf.objno, table ) == FAIL) - { - /* add object to table */ - table_add(statbuf.objno, path, H5G_DATASET, table ); - } - - /* search table - dataset with more than one link to it */ - if (statbuf.nlink > 1) - { - if ((j = table_search(statbuf.objno, table )) < 0 ) - return -1; - - if ( table->objs[j].displayed == 0 ) - { - table->objs[j].displayed = 1; - } - else - { - printf("%s %s\n", "HARDLINK", table->objs[j].objname); - } - - } - - - break; - - /*------------------------------------------------------------------------- - * H5G_TYPE - *------------------------------------------------------------------------- - */ - - case H5G_TYPE: - - /* increment */ - inserted_objs++; - - /* nlink is number of hard links to object */ - if (statbuf.nlink > 0 && table_search(statbuf.objno, table ) == FAIL) - { - /* add object to table */ - table_add(statbuf.objno, path, H5G_TYPE, table ); - } - - break; - - - /*------------------------------------------------------------------------- - * H5G_LINK - *------------------------------------------------------------------------- - */ - - case H5G_LINK: - - /* increment */ - inserted_objs++; - - break; - - - default: - break; - - } - - /*------------------------------------------------------------------------- - * end switch - *------------------------------------------------------------------------- - */ - - if ( name ) - free( name ); - - if ( path ) - free( path ); - - } /* i */ - - - - return inserted_objs; -} - - - -/*------------------------------------------------------------------------- - * Function: table_search - * - * Purpose: - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -int table_search(unsigned long *objno, table_t *table ) -{ - int i; - - for (i = 0; i < table->nobjs; i++) - if (table->objs[i].objno[0] == *objno && table->objs[i].objno[1] == *(objno + 1)) - return i; - - return FAIL; -} - - -/*------------------------------------------------------------------------- - * Function: table_add - * - * Purpose: - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -void table_add(unsigned long *objno, char *objname, int type, table_t *table) -{ - int i; - - if (table->nobjs == table->size) { - table->size *= 2; - table->objs = (obj_t*)realloc(table->objs, table->size * sizeof(obj_t)); - - for (i = table->nobjs; i < table->size; i++) { - table->objs[i].objno[0] = table->objs[i].objno[1] = 0; - table->objs[i].displayed = 0; - table->objs[i].type = H5G_UNKNOWN; - table->objs[i].objname = NULL; - } - } - - i = table->nobjs++; - table->objs[i].objno[0] = objno[0]; - table->objs[i].objno[1] = objno[1]; - free(table->objs[i].objname); - table->objs[i].objname = (char *)HDstrdup(objname); - table->objs[i].type = type; -} - - -/*------------------------------------------------------------------------- - * Function: table_init - * - * Purpose: - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -void table_init( table_t **tbl ) -{ - int i; - table_t* table = (table_t*) malloc(sizeof(table_t)); - - table->size = 20; - table->nobjs = 0; - table->objs = (obj_t*) malloc(table->size * sizeof(obj_t)); - - for (i = 0; i < table->size; i++) { - table->objs[i].objno[0] = table->objs[i].objno[1] = 0; - table->objs[i].displayed = 0; - table->objs[i].type = H5G_UNKNOWN; - table->objs[i].objname = NULL; - } - - *tbl = table; -} - - - -/*------------------------------------------------------------------------- - * Function: table_free - * - * Purpose: free table memory - * - * Return: - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: November 4, 2002 - * - * Comments: - * - * Modifications: - * - *------------------------------------------------------------------------- - */ - -void table_free( table_t *table ) -{ - int i; - - for ( i = 0; i < table->nobjs; i++) - free( table->objs[i].objname ); - - free(table->objs); - free(table); - -} - - -/*------------------------------------------------------------------------- - * Function: info_free - * - * Purpose: free info memory - * - *------------------------------------------------------------------------- - */ - -void info_free( info_t *info, int nobjs ) -{ - int i; - if ( info ) - { - for ( i = 0; i < nobjs; i++) - { - if (info[i].name) - free( info[i].name ); - } - free(info); - } - -} - diff --git a/tools/h5diff/h5trav.h b/tools/h5diff/h5trav.h deleted file mode 100644 index d2e057b..0000000 --- a/tools/h5diff/h5trav.h +++ /dev/null @@ -1,69 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * Monday, 4. November 2002 - */ -#ifndef H5TRAV_H__ -#define H5TRAV_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/*struct to store name and type of an object */ -typedef struct info_t { - char *name; - int type; -} info_t; - - -/*struct to store basic info about an object */ -typedef struct obj_t { - unsigned long objno[2]; - char *objname; - int displayed; - int type; -} obj_t; - -/*struct that stores all objects, excluding shared objects */ -typedef struct table_t { - int size; - int nobjs; - obj_t *objs; -} table_t; - - -/* public methods */ -int H5get_object_info( hid_t file_id, info_t *info ); - -/* table methods */ -void table_init(table_t **table); -void table_free(table_t *table); -int table_search(unsigned long *objno, table_t *table ); -void table_add(unsigned long *objno, char *objname, int type, table_t *table); -void info_free(info_t *info, int nobjs); - - - - -#ifdef __cplusplus -} -#endif - - -#endif /* H5TRAV_H__ */ diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 47095f1..23cbfaa 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -103,89 +103,44 @@ TOOLTEST() { TOOLTEST h5diff_10.txt -h # 1.1 -TOOLTEST h5diff_11.txt file6.h5 file6.h5 dset3a dset3b +TOOLTEST h5diff_11.txt file1.h5 file2.h5 g1/dset1 g1/dset2 # 1.2 -TOOLTEST h5diff_12.txt file1.h5 file2.h5 -n 2 g1/dset1 g1/dset2 +TOOLTEST h5diff_12.txt file1.h5 file2.h5 -v -n 2 g1/dset1 g1/dset2 # 1.3 -TOOLTEST h5diff_13.txt file1.h5 file2.h5 -d 5 g1/dset3 g1/dset4 +TOOLTEST h5diff_13.txt file1.h5 file2.h5 -v -d 5 g1/dset3 g1/dset4 # 1.4 -TOOLTEST h5diff_14.txt file1.h5 file2.h5 -p 0.05 g1/dset3 g1/dset4 +TOOLTEST h5diff_14.txt file1.h5 file2.h5 -v -p 0.05 g1/dset3 g1/dset4 # 1.5 -TOOLTEST h5diff_15.txt file1.h5 file2.h5 -r g1/dset1 g1/dset2 +TOOLTEST h5diff_15.txt file1.h5 file2.h5 -v -r g1/dset1 g1/dset2 # 1.6 -TOOLTEST h5diff_16.txt file6.h5 file6.h5 +TOOLTEST h5diff_16.txt file1.h5 file2.h5 # ############################################################################## # # not comparable types # ############################################################################## # 2.0 -TOOLTEST h5diff_20.txt file3.h5 file3.h5 dset group +TOOLTEST h5diff_20.txt file3.h5 file3.h5 -v dset group # 2.1 -TOOLTEST h5diff_21.txt file3.h5 file3.h5 dset link +TOOLTEST h5diff_21.txt file3.h5 file3.h5 -v dset link # 2.2 -TOOLTEST h5diff_22.txt file3.h5 file3.h5 dset type +TOOLTEST h5diff_22.txt file3.h5 file3.h5 -v dset type # 2.3 -TOOLTEST h5diff_23.txt file3.h5 file3.h5 group group +TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v group group # 2.4 -TOOLTEST h5diff_24.txt file3.h5 file3.h5 type type +TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v type type # 2.5 -TOOLTEST h5diff_25.txt file3.h5 file3.h5 link link - -# ############################################################################## -# # Class issues -# ############################################################################## - - -# 3.0 -TOOLTEST h5diff_30.txt file4.h5 file4.h5 string - -# 3.1 -TOOLTEST h5diff_31.txt file4.h5 file4.h5 bitfield - -# 3.2 -TOOLTEST h5diff_32.txt file4.h5 file4.h5 opaque - -# 3.3 -TOOLTEST h5diff_33.txt file4.h5 file4.h5 compound - -# 3.4 -TOOLTEST h5diff_34.txt file4.h5 file4.h5 ref - -# 3.5 -TOOLTEST h5diff_35.txt file4.h5 file4.h5 enum - -# 3.6 -TOOLTEST h5diff_36.txt file4.h5 file4.h5 vlen - -# 3.7 -TOOLTEST h5diff_37.txt file4.h5 file4.h5 array - -# 3.8 -TOOLTEST h5diff_38.txt file4.h5 file4.h5 integer float - -# ############################################################################## -# # Dimensions -# ############################################################################## - -# 4.0 -TOOLTEST h5diff_40.txt file5.h5 file5.h5 dset1 dset2 - -# 4.1 -TOOLTEST h5diff_41.txt file5.h5 file5.h5 dset3 dset4 - -# 4.2 -TOOLTEST h5diff_42.txt file5.h5 file5.h5 dset5 dset6 +TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v link link # ############################################################################## @@ -193,31 +148,31 @@ TOOLTEST h5diff_42.txt file5.h5 file5.h5 dset5 dset6 # ############################################################################## # 5.0 -TOOLTEST h5diff_50.txt file6.h5 file6.h5 dset0a dset0b +TOOLTEST h5diff_50.txt file4.h5 file4.h5 -v dset0a dset0b # 5.1 -TOOLTEST h5diff_51.txt file6.h5 file6.h5 dset1a dset1b +TOOLTEST h5diff_51.txt file4.h5 file4.h5 -v dset1a dset1b # 5.2 -TOOLTEST h5diff_52.txt file6.h5 file6.h5 dset2a dset2b +TOOLTEST h5diff_52.txt file4.h5 file4.h5 -v dset2a dset2b # 5.3 -TOOLTEST h5diff_53.txt file6.h5 file6.h5 dset3a dset4b +TOOLTEST h5diff_53.txt file4.h5 file4.h5 -v dset3a dset4b # 5.4 -TOOLTEST h5diff_54.txt file6.h5 file6.h5 dset4a dset4b +TOOLTEST h5diff_54.txt file4.h5 file4.h5 -v dset4a dset4b # 5.5 -TOOLTEST h5diff_55.txt file6.h5 file6.h5 dset5a dset5b +TOOLTEST h5diff_55.txt file4.h5 file4.h5 -v dset5a dset5b # 5.6 -TOOLTEST h5diff_56.txt file6.h5 file6.h5 dset6a dset6b +TOOLTEST h5diff_56.txt file4.h5 file4.h5 -v dset6a dset6b # 5.7 -TOOLTEST h5diff_57.txt file6.h5 file6.h5 dset7a dset7b +TOOLTEST h5diff_57.txt file4.h5 file4.h5 -v dset7a dset7b # 5.8 long_long test; different format of long_long print in Linux and IRIX -#TOOLTEST h5diff_58.txt file6.h5 file6.h5 dset8a dset8b +#TOOLTEST h5diff_58.txt file4.h5 file4.h5 dset8a dset8b # ############################################################################## # # Error messages @@ -334,6 +289,25 @@ TOOLTEST h5diff_628.txt file1.h5 file2.h5 -n 1 g1/dset3 g1/dset4 TOOLTEST h5diff_629.txt file1.h6 file2.h6 +# ############################################################################## +# # attributes +# ############################################################################## + +TOOLTEST h5diff_70.txt file5.h5 file6.h5 + +# ############################################################################## +# # all dataset datatypes +# ############################################################################## + +TOOLTEST h5diff_80.txt file7.h5 file8.h5 + + + + + + + + # ############################################################################## # # END diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index b91d516..4e88f1e 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -99,7 +99,7 @@ typedef struct { chunk_info_t chunk_g; /*global chunk INFO for the ALL case */ H5D_layout_t layout_g; /*global layout information for the ALL case */ int verbose; /*verbose mode */ - hsize_t threshold; /*minimum size to compress, in bytes */ + int threshold; /*minimum size to compress, in bytes */ } pack_opt_t; @@ -159,7 +159,8 @@ int copy_attr(hid_t loc_in, int do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, - pack_opt_t *options); /* repack options */ + pack_opt_t *options, + const char *fnamein); /* repack options */ diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 7763bd2..cc774d0 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -87,7 +87,7 @@ int copy_objects(const char* fnamein, * and create hard links *------------------------------------------------------------------------- */ - if(do_copy_refobjs(fidin,fidout,travt,options)<0) { + if(do_copy_refobjs(fidin,fidout,travt,options,fnamein)<0) { printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout); goto out; } @@ -141,25 +141,23 @@ int do_copy_objects(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in=-1; /* group ID */ - hid_t grp_out=-1; /* group ID */ - hid_t dset_in=-1; /* read dataset ID */ - hid_t dset_out=-1; /* write dataset ID */ - hid_t type_in=-1; /* named type ID */ - hid_t type_out=-1; /* named type ID */ - hid_t dcpl_id=-1; /* dataset creation property list ID */ - hid_t space_id=-1; /* space ID */ - hid_t ftype_id=-1; /* file data type ID */ - hid_t mtype_id=-1; /* memory data type ID */ + hid_t grp_in; /* group ID */ + hid_t grp_out; /* group ID */ + hid_t dset_in; /* read dataset ID */ + hid_t dset_out; /* write dataset ID */ + hid_t type_in; /* named type ID */ + hid_t type_out; /* named type ID */ + hid_t dcpl_id; /* dataset creation property list ID */ + hid_t space_id; /* space ID */ + hid_t ftype_id; /* file data type ID */ + hid_t mtype_id; /* memory data type ID */ size_t msize; /* memory size of memory type */ void *buf=NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ hsize_t dsize_in; /* input dataset size before filter */ -#ifdef LATER hsize_t dsize_out; /* output dataset size after filter */ -#endif /* LATER */ int i, j; /*------------------------------------------------------------------------- @@ -310,14 +308,12 @@ int do_copy_objects(hid_t fidin, if (copy_attr(dset_in,dset_out,options)<0) goto error; -#ifdef LATER /*------------------------------------------------------------------------- * store the storage sizes *------------------------------------------------------------------------- */ dsize_out=H5Dget_storage_size(dset_out); -#endif /* LATER */ /*close */ if (H5Dclose(dset_out)<0) @@ -486,13 +482,13 @@ int copy_attr(hid_t loc_in, pack_opt_t *options ) { - hid_t attr_id=-1; /* attr ID */ - hid_t attr_out=-1; /* attr ID */ - hid_t space_id=-1; /* space ID */ - hid_t ftype_id=-1; /* file data type ID */ - hid_t mtype_id=-1; /* memory data type ID */ + hid_t attr_id; /* attr ID */ + hid_t attr_out; /* attr ID */ + hid_t space_id; /* space ID */ + hid_t ftype_id; /* file data type ID */ + hid_t mtype_id; /* memory data type ID */ size_t msize; /* memory size of type */ - void *buf=NULL; /* data buffer */ + void *buf; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index c8b9b5d..9aacdd3 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -143,7 +143,7 @@ int apply_filters(const char* name, /* object name from traverse list */ { if (options->verbose) printf("Warning: Filter not applied to <%s>. Dataset smaller than <%d> bytes\n", - name,(int)options->threshold); + name,options->threshold); return 0; } @@ -346,7 +346,7 @@ int check_szip(hid_t type_id, /* dataset datatype */ unsigned *szip_pixels_per_block /*IN,OUT*/, pack_opt_t *options) { - size_t size=0; /* size of datatype in bytes */ + size_t size; /* size of datatype in bytes */ szip_comp_t szip; int i; unsigned ppb=*szip_pixels_per_block; @@ -360,6 +360,7 @@ int check_szip(hid_t type_id, /* dataset datatype */ { default: return 0; + break; case H5T_INTEGER: case H5T_FLOAT: break; @@ -436,7 +437,7 @@ int check_szip(hid_t type_id, /* dataset datatype */ szip.bits_per_pixel = 64; break; default: - printf("Warning: Invalid numeric type of size <%u> for SZIP\n",(unsigned)size); + printf("Warning: Invalid numeric type of size <%d> for SZIP\n",size); return 0; }} diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index cc3f6ea..8056fcc 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -61,7 +61,7 @@ int main(int argc, char **argv) else if (strcmp(argv[i], "-m") == 0) { options.threshold = parse_number(argv[i+1]); - if ((int)options.threshold==-1) { + if (options.threshold==-1) { printf("Error: Invalid treshold size <%s>\n",argv[i+1]); exit(1); } diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index 45dfac5..fa7fd11 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -41,7 +41,7 @@ void init_packobject(pack_info_t *obj) } obj->chunk.rank = -1; obj->refobj_id = -1; - obj->layout = H5D_LAYOUT_ERROR; + obj->layout = -1; obj->nfilters = 0; @@ -104,7 +104,7 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs ) } table->objs[i].chunk.rank = -1; table->objs[i].refobj_id = -1; - table->objs[i].layout = H5D_LAYOUT_ERROR; + table->objs[i].layout = -1; table->objs[i].nfilters = 0; } return 0; @@ -148,7 +148,7 @@ int options_table_init( pack_opttbl_t **tbl ) } table->objs[i].chunk.rank = -1; table->objs[i].refobj_id = -1; - table->objs[i].layout = H5D_LAYOUT_ERROR; + table->objs[i].layout = -1; table->objs[i].nfilters = 0; } diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index e824493..1035a06 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -20,7 +20,8 @@ #include "h5repack.h" static const char* MapIdToName(hid_t refobj_id, - trav_table_t *travt); + trav_table_t *travt, + const char* fname); static void close_obj(H5G_obj_t obj_type, hid_t obj_id); @@ -29,7 +30,9 @@ static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, trav_table_t *travt, - hid_t fidout /* for saving references */ + hid_t fidout, /* for saving references */ + hid_t fidin, + const char *fname ); /*------------------------------------------------------------------------- @@ -50,17 +53,18 @@ static int copy_refs_attr(hid_t loc_in, int do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, - pack_opt_t *options) /* repack options */ + pack_opt_t *options, /* repack options */ + const char *fnamein) { - hid_t grp_in=-1; /* group ID */ - hid_t grp_out=-1; /* group ID */ - hid_t dset_in=-1; /* read dataset ID */ - hid_t dset_out=-1; /* write dataset ID */ - hid_t type_in=-1; /* named type ID */ - hid_t dcpl_id=-1; /* dataset creation property list ID */ - hid_t space_id=-1; /* space ID */ - hid_t ftype_id=-1; /* file data type ID */ - hid_t mtype_id=-1; /* memory data type ID */ + hid_t grp_in; /* group ID */ + hid_t grp_out; /* group ID */ + hid_t dset_in; /* read dataset ID */ + hid_t dset_out; /* write dataset ID */ + hid_t type_in; /* named type ID */ + hid_t dcpl_id; /* dataset creation property list ID */ + hid_t space_id; /* space ID */ + hid_t ftype_id; /* file data type ID */ + hid_t mtype_id; /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ @@ -186,7 +190,7 @@ int do_copy_refobjs(hid_t fidin, } H5E_END_TRY; /* get the name. a valid name could only occur in the second traversal of the file */ - if ((refname=MapIdToName(refobj_id,travt))!=NULL) + if ((refname=MapIdToName(refobj_id,travt,fnamein))!=NULL) { /* create the reference, -1 parameter for objects */ if (H5Rcreate(&refbuf[u],fidout,refname,H5R_OBJECT,-1)<0) @@ -266,7 +270,7 @@ int do_copy_refobjs(hid_t fidin, /* get the name. a valid name could only occur in the second traversal of the file */ - if ((refname=MapIdToName(refobj_id,travt))!=NULL) + if ((refname=MapIdToName(refobj_id,travt,fnamein))!=NULL) { hid_t region_id; /* region id of the referenced dataset */ if ((region_id = H5Rget_region(dset_in,H5R_DATASET_REGION,&buf[u]))<0) @@ -319,7 +323,7 @@ int do_copy_refobjs(hid_t fidin, * copy referenced objects in attributes *------------------------------------------------------------------------- */ - if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0) + if (copy_refs_attr(dset_in,dset_out,options,travt,fidout,fidin,fnamein)<0) goto error; @@ -406,7 +410,7 @@ int do_copy_refobjs(hid_t fidin, if ((grp_in = H5Gopen(fidin,"/"))<0) goto error; - if (copy_refs_attr(grp_in,grp_out,options,travt,fidout)<0) + if (copy_refs_attr(grp_in,grp_out,options,travt,fidout,fidin,fnamein)<0) goto error; if (H5Gclose(grp_out)<0) @@ -455,14 +459,16 @@ static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, trav_table_t *travt, - hid_t fidout /* for saving references */ + hid_t fidout, /* for saving references */ + hid_t fidin, + const char *fnamein ) { - hid_t attr_id=-1; /* attr ID */ - hid_t attr_out=-1; /* attr ID */ - hid_t space_id=-1; /* space ID */ - hid_t ftype_id=-1; /* file data type ID */ - hid_t mtype_id=-1; /* memory data type ID */ + hid_t attr_id; /* attr ID */ + hid_t attr_out; /* attr ID */ + hid_t space_id; /* space ID */ + hid_t ftype_id; /* file data type ID */ + hid_t mtype_id; /* memory data type ID */ size_t msize; /* memory size of type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ @@ -558,7 +564,7 @@ static int copy_refs_attr(hid_t loc_in, } H5E_END_TRY; /* get the name. a valid name could only occur in the second traversal of the file */ - if ((refname=MapIdToName(refobj_id,travt))!=NULL) + if ((refname=MapIdToName(refobj_id,travt,fnamein))!=NULL) { /* create the reference */ if (H5Rcreate(&refbuf[k],fidout,refname,H5R_OBJECT,-1)<0) @@ -640,7 +646,7 @@ static int copy_refs_attr(hid_t loc_in, } H5E_END_TRY; /* get the name. a valid name could only occur in the second traversal of the file */ - if ((refname=MapIdToName(refobj_id,travt))!=NULL) + if ((refname=MapIdToName(refobj_id,travt,fnamein))!=NULL) { hid_t region_id; /* region id of the referenced dataset */ if ((region_id = H5Rget_region(attr_id,H5R_DATASET_REGION,&buf[k]))<0) @@ -738,16 +744,17 @@ static void close_obj(H5G_obj_t obj_type, hid_t obj_id) */ static const char* MapIdToName(hid_t refobj_id, - trav_table_t *travt) + trav_table_t *travt, + const char* fname) { hid_t id; hid_t fid; int i; - /* obtains the file ID given an object ID. This ID must be closed */ - if ((fid = H5Iget_file_id(refobj_id))<0) - { - return NULL; + /* open */ + if ((fid=H5Fopen(fname,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ){ + printf("h5repack: <%s>: %s\n", fname, H5FOPENERROR ); + exit(1); } /* linear search */ @@ -778,8 +785,7 @@ static const char* MapIdToName(hid_t refobj_id, } /* switch */ } /* i */ - if (H5Fclose(fid)<0) - return NULL; + H5Fclose(fid); return NULL; } diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 4f69d5f..e1c01eb 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -157,9 +157,9 @@ int h5repack_verify(const char *fname, pack_opt_t *options) { hid_t fid; /* file ID */ - hid_t dset_id=-1; /* dataset ID */ - hid_t dcpl_id=-1; /* dataset creation property list ID */ - hid_t space_id=-1; /* space ID */ + hid_t dset_id; /* dataset ID */ + hid_t dcpl_id; /* dataset creation property list ID */ + hid_t space_id; /* space ID */ int ret=1, i, j; trav_table_t *travt=NULL; @@ -343,12 +343,12 @@ error: int h5repack_cmpdcpl(const char *fname1, const char *fname2) { - hid_t fid1=-1; /* file ID */ - hid_t fid2=-1; /* file ID */ - hid_t dset1=-1; /* dataset ID */ - hid_t dset2=-1; /* dataset ID */ - hid_t dcpl1=-1; /* dataset creation property list ID */ - hid_t dcpl2=-1; /* dataset creation property list ID */ + hid_t fid1; /* file ID */ + hid_t fid2; /* file ID */ + hid_t dset1; /* dataset ID */ + hid_t dset2; /* dataset ID */ + hid_t dcpl1; /* dataset creation property list ID */ + hid_t dcpl2; /* dataset creation property list ID */ trav_table_t *travt1=NULL; trav_table_t *travt2=NULL; int ret=1, i; diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c index 57a5b27..74ca97e 100644 --- a/tools/h5repack/testh5repack_dset.c +++ b/tools/h5repack/testh5repack_dset.c @@ -17,9 +17,7 @@ #include "h5repack.h" static void make_dset_reg_ref(hid_t loc_id); -#ifdef LATER static void read_dset_reg_ref(hid_t loc_id); -#endif /* LATER */ @@ -82,6 +80,7 @@ void write_dset_in(hid_t loc_id, char buf22[3][2]= {{1,2},{3,4},{5,6}}; /* bitfield, opaque */ s_t buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; /* compound */ hobj_ref_t buf42[3][2]; /* reference */ + e_t buf452[3][2]; /* enum */ hvl_t buf52[3][2]; /* vlen */ int buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; /* array */ int buf72[3][2]= {{1,2},{3,4},{5,6}}; /* integer */ @@ -95,6 +94,7 @@ void write_dset_in(hid_t loc_id, char buf23[4][3][2]; /* bitfield, opaque */ s_t buf33[4][3][2]; /* compound */ hobj_ref_t buf43[4][3][2]; /* reference */ + e_t buf453[4][3][2]; /* enum */ hvl_t buf53[4][3][2]; /* vlen */ int buf63[24][3]; /* array */ int buf73[4][3][2]; /* integer */ @@ -360,6 +360,13 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ + for (i=0; i<3; i++) + for (j=0; j<2; j++) + { + if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; + } + + type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(type_id, "RED", (val = 0, &val)); H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); @@ -539,6 +546,15 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ + + for (i = 0; i < 4; i++) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 2; k++) { + if (make_diffs) buf453[i][j][k]=RED; else buf453[i][j][k]=GREEN; + } + } + } + type_id = H5Tcreate(H5T_ENUM, sizeof(e_t)); H5Tenum_insert(type_id, "RED", (val = 0, &val)); H5Tenum_insert(type_id, "GREEN", (val = 1, &val)); @@ -725,7 +741,6 @@ static void make_dset_reg_ref(hid_t loc_id) *------------------------------------------------------------------------- */ -#ifdef LATER static void read_dset_reg_ref(hid_t loc_id) { hid_t dset1; /* Dataset ID */ @@ -823,4 +838,3 @@ static void read_dset_reg_ref(hid_t loc_id) free(rbuf); free(drbuf); } -#endif /* LATER */ diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index ddecd98..1959ea2 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -38,6 +38,7 @@ int main (void) { + int verbose=0; pack_opt_t pack_options; diff_opt_t diff_options; memset(&diff_options, 0, sizeof (diff_opt_t)); @@ -58,14 +59,14 @@ int main (void) * it returns RET==0 if the objects have the same data *------------------------------------------------------------------------- */ - + TESTING(" copy of datasets"); /*------------------------------------------------------------------------- * file with all kinds of dataset datatypes *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0)<0) + if (h5repack_init (&pack_options, verbose)<0) TEST_ERROR; if (h5repack(FNAME1,FNAME1OUT,&pack_options)<0) TEST_ERROR; @@ -124,6 +125,7 @@ int main (void) *------------------------------------------------------------------------- */ PASSED(); + TESTING(" copy of datasets with all filters"); if (h5repack_init (&pack_options, 0)<0) diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c index c69abd9..3b8cb5c 100644 --- a/tools/h5repack/testh5repack_make.c +++ b/tools/h5repack/testh5repack_make.c @@ -20,7 +20,7 @@ int make_all_objects(hid_t loc_id); int make_attributes(hid_t loc_id); int make_special_objects(hid_t loc_id); -int make_early(void); +int make_early(); @@ -245,6 +245,7 @@ int make_special_objects(hid_t loc_id) hid_t dset_id; hid_t space_id; hid_t plist_id; + herr_t status; int fillvalue=2; /*------------------------------------------------------------------------- @@ -289,13 +290,13 @@ int make_special_objects(hid_t loc_id) */ plist_id = H5Pcreate(H5P_DATASET_CREATE); - H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue); + status = H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &fillvalue); space_id = H5Screate_simple(2,dims,NULL); dset_id = H5Dcreate(loc_id,"dset_fill",H5T_NATIVE_INT,space_id,plist_id); - H5Dwrite(dset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf); - H5Pclose(plist_id); - H5Dclose(dset_id); - H5Sclose(space_id); + status = H5Dwrite(dset_id,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf); + status = H5Pclose(plist_id); + status = H5Dclose(dset_id); + status = H5Sclose(space_id); return 0; @@ -309,15 +310,15 @@ int make_special_objects(hid_t loc_id) * *------------------------------------------------------------------------- */ -int make_early(void) +int make_early() { hsize_t dims[1] ={3000}; hsize_t cdims[1]={30}; - hid_t fid=-1; - hid_t dset_id=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t dcpl=-1; + hid_t fid; + hid_t dset_id; + hid_t sid; + hid_t tid; + hid_t dcpl; int i; char name[10]; int iter=100; diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index b6b979e..070bdcc 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -1,4 +1,3 @@ -## HDF5 Library Makefile(.in) ## ## Copyright by the Board of Trustees of the University of Illinois. ## All rights reserved. @@ -11,7 +10,9 @@ ## 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. -## +## +## HDF5 Library Makefile(.in) +## top_srcdir=@top_srcdir@ top_builddir=../.. srcdir=@srcdir@ @@ -40,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 +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 h5tools_filters.c LIB_OBJ=$(LIB_SRC:.c=.lo) PUB_LIB= AUX_LIB=$(LIB) @@ -48,7 +49,7 @@ AUX_LIB=$(LIB) TEST_SRC=talign.c TEST_OBJ=$(TEST_SRC:.c=.lo) -PRIVATE_HDR=h5tools.h h5tools_str.h +PRIVATE_HDR=h5tools.h h5tools_str.h h5diff.h h5trav.h ## Programs have to be built before they can be tested! ## diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 96e2bd1..f4fbb3d 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -482,4 +482,6 @@ extern int h5tools_dump_dset(FILE *stream, const h5dump_t *info, hid_t dset extern int h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type, hid_t space, void *mem, int indentlevel); +extern int h5tools_canreadf(const char* name, + hid_t dcpl_id); #endif /* H5TOOLS_H__ */ diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index 5f68da4..af41a4e 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -54,7 +54,7 @@ typedef struct trav_link_t { */ typedef struct trav_obj_t { - haddr_t objno; /* object number from H5Gget_objinfo */ + unsigned long objno[2];/* object number from H5Gget_objinfo */ unsigned flags[2]; /* h5diff.object is present or not in both files*/ char *name; /* name */ int displayed; /* hard link already traversed once */ @@ -117,10 +117,10 @@ void trav_table_init(trav_table_t **table); void trav_table_free(trav_table_t *table); -int trav_table_search(haddr_t objno, +int trav_table_search(unsigned long *objno, trav_table_t *table ); -void trav_table_add(haddr_t objno, +void trav_table_add(unsigned long *objno, char *objname, H5G_obj_t type, trav_table_t *table); diff --git a/tools/lib/h5trav_table.c b/tools/lib/h5trav_table.c index 8e794aa..940fc0e 100644 --- a/tools/lib/h5trav_table.c +++ b/tools/lib/h5trav_table.c @@ -30,12 +30,12 @@ *------------------------------------------------------------------------- */ -int trav_table_search(haddr_t objno, trav_table_t *table ) +int trav_table_search(unsigned long *objno, trav_table_t *table ) { int i; for (i = 0; i < table->nobjs; i++) - if (table->objs[i].objno == objno) + if (table->objs[i].objno[0] == *objno && table->objs[i].objno[1] == *(objno + 1)) return i; return -1; @@ -56,7 +56,7 @@ int trav_table_search(haddr_t objno, trav_table_t *table ) *------------------------------------------------------------------------- */ -void trav_table_add(haddr_t objno, +void trav_table_add(unsigned long *objno, char *name, H5G_obj_t type, trav_table_t *table) @@ -69,7 +69,7 @@ void trav_table_add(haddr_t objno, (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t)); for (i = table->nobjs; i < table->size; i++) { - table->objs[i].objno = 0; + table->objs[i].objno[0] = table->objs[i].objno[1] = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; table->objs[i].displayed = 0; table->objs[i].type = H5G_UNKNOWN; @@ -81,7 +81,8 @@ void trav_table_add(haddr_t objno, } i = table->nobjs++; - table->objs[i].objno = objno; + table->objs[i].objno[0] = objno[0]; + table->objs[i].objno[1] = objno[1]; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; HDfree(table->objs[i].name); table->objs[i].name = (char *)HDstrdup(name); @@ -118,7 +119,7 @@ void trav_table_addflags(unsigned *flags, (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t)); for (i = table->nobjs; i < table->size; i++) { - table->objs[i].objno = 0; + table->objs[i].objno[0] = table->objs[i].objno[1] = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; table->objs[i].displayed = 0; table->objs[i].type = H5G_UNKNOWN; @@ -130,7 +131,8 @@ void trav_table_addflags(unsigned *flags, } i = table->nobjs++; - table->objs[i].objno = 0; + table->objs[i].objno[0] = 0; + table->objs[i].objno[1] = 0; table->objs[i].flags[0] = flags[0]; table->objs[i].flags[1] = flags[1]; HDfree(table->objs[i].name); @@ -166,7 +168,7 @@ void trav_table_init( trav_table_t **tbl ) (trav_obj_t*)HDmalloc(table->size * sizeof(trav_obj_t)); for (i = 0; i < table->size; i++) { - table->objs[i].objno = 0; + table->objs[i].objno[0] = table->objs[i].objno[1] = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; table->objs[i].displayed = 0; table->objs[i].type = H5G_UNKNOWN; diff --git a/tools/testfiles/h5diff_10.txt b/tools/testfiles/h5diff_10.txt index fd731f1..f291c68 100644 --- a/tools/testfiles/h5diff_10.txt +++ b/tools/testfiles/h5diff_10.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff -h' ############################# -$h5diff -h Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] file1 File name of the first HDF5 file @@ -10,6 +9,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_11.txt b/tools/testfiles/h5diff_11.txt index 803b81f..d0c1aad 100644 --- a/tools/testfiles/h5diff_11.txt +++ b/tools/testfiles/h5diff_11.txt @@ -1,14 +1,10 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset3a dset3b' +Expected output for 'h5diff file1.h5 file2.h5 g1/dset1 g1/dset2' ############################# -$h5diff file6.h5 file6.h5 dset3a dset3b -Comparing </dset3a> with </dset3b> -position dset3a dset3b difference +position dset1 dset2 difference ------------------------------------------------------------ -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found - - +[ 0 1 ] 1.000000 1.100000 0.100000 +[ 1 0 ] 1.000000 1.010000 0.010000 +[ 1 1 ] 1.000000 1.001000 0.001000 +[ 2 0 ] 1.000000 1.000100 0.000100 +[ 2 1 ] 1.000000 1.000000 0.000000 diff --git a/tools/testfiles/h5diff_12.txt b/tools/testfiles/h5diff_12.txt index 3fd7989..ad9afa4 100644 --- a/tools/testfiles/h5diff_12.txt +++ b/tools/testfiles/h5diff_12.txt @@ -1,12 +1,11 @@ ############################# -Expected output for 'h5diff file1.h5 file2.h5 -n 2 g1/dset1 g1/dset2' +Expected output for 'h5diff file1.h5 file2.h5 -v -n 2 g1/dset1 g1/dset2' ############################# -$h5diff file1.h5 file2.h5 -n 2 g1/dset1 g1/dset2 -Comparing </g1/dset1> with </g1/dset2> +$h5diff file1.h5 file2.h5 -v -n 2 g1/dset1 g1/dset2 +Dataset: </g1/dset1> and </g1/dset2> position dset1 dset2 difference ------------------------------------------------------------ -[ 0 1 ] 1 1.1 0.1 -[ 1 0 ] 1 1.01 0.01 +[ 0 1 ] 1.000000 1.100000 0.100000 +[ 1 0 ] 1.000000 1.010000 0.010000 2 differences found - diff --git a/tools/testfiles/h5diff_13.txt b/tools/testfiles/h5diff_13.txt index d6ee768..406b01a 100644 --- a/tools/testfiles/h5diff_13.txt +++ b/tools/testfiles/h5diff_13.txt @@ -1,16 +1,15 @@ ############################# -Expected output for 'h5diff file1.h5 file2.h5 -d 5 g1/dset3 g1/dset4' +Expected output for 'h5diff file1.h5 file2.h5 -v -d 5 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d 5 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> +$h5diff file1.h5 file2.h5 -v -d 5 g1/dset3 g1/dset4 +Dataset: </g1/dset3> and </g1/dset4> position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100 110 10 -[ 0 1 ] 110 100 10 -[ 1 0 ] 100 90 10 -[ 1 1 ] 100 80 20 -[ 2 0 ] 100 140 40 -[ 2 1 ] 100 200 100 +[ 0 0 ] 100.000000 110.000000 10.000000 +[ 0 1 ] 110.000000 100.000000 10.000000 +[ 1 0 ] 100.000000 90.000000 10.000000 +[ 1 1 ] 100.000000 80.000000 20.000000 +[ 2 0 ] 100.000000 140.000000 40.000000 +[ 2 1 ] 100.000000 200.000000 100.000000 6 differences found - diff --git a/tools/testfiles/h5diff_14.txt b/tools/testfiles/h5diff_14.txt index 95cad0a..8efcf83 100644 --- a/tools/testfiles/h5diff_14.txt +++ b/tools/testfiles/h5diff_14.txt @@ -1,8 +1,8 @@ ############################# -Expected output for 'h5diff file1.h5 file2.h5 -p 0.05 g1/dset3 g1/dset4' +Expected output for 'h5diff file1.h5 file2.h5 -v -p 0.05 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p 0.05 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> +$h5diff file1.h5 file2.h5 -v -p 0.05 g1/dset3 g1/dset4 +Dataset: </g1/dset3> and </g1/dset4> position dset3 dset4 difference relative ------------------------------------------------------------------------ [ 0 0 ] 100 110 10 0.1 @@ -13,4 +13,3 @@ position dset3 dset4 difference relative [ 2 1 ] 100 200 100 1 6 differences found - diff --git a/tools/testfiles/h5diff_15.txt b/tools/testfiles/h5diff_15.txt index 3577f88..2ad177b 100644 --- a/tools/testfiles/h5diff_15.txt +++ b/tools/testfiles/h5diff_15.txt @@ -1,6 +1,7 @@ ############################# -Expected output for 'h5diff file1.h5 file2.h5 -r g1/dset1 g1/dset2' +Expected output for 'h5diff file1.h5 file2.h5 -v -r g1/dset1 g1/dset2' ############################# -$h5diff file1.h5 file2.h5 -r g1/dset1 g1/dset2 -Object <g1/dset2> could not be found in <file1.h5> +$h5diff file1.h5 file2.h5 -v -r g1/dset1 g1/dset2 +Dataset: </g1/dset1> and </g1/dset2> +5 differences found diff --git a/tools/testfiles/h5diff_16.txt b/tools/testfiles/h5diff_16.txt index eeb5f71..a71a14f 100644 --- a/tools/testfiles/h5diff_16.txt +++ b/tools/testfiles/h5diff_16.txt @@ -1,96 +1,10 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5' +Expected output for 'h5diff file1.h5 file2.h5' ############################# -$h5diff file6.h5 file6.h5 -file1 file2 ---------------------------------------- - x x /dset0a - x x /dset0b - x x /dset10a - x x /dset10b - x x /dset1a - x x /dset1b - x x /dset2a - x x /dset2b - x x /dset3a - x x /dset3b - x x /dset4a - x x /dset4b - x x /dset5a - x x /dset5b - x x /dset6a - x x /dset6b - x x /dset7a - x x /dset7b - x x /dset8a - x x /dset8b - x x /dset9a - x x /dset9b - -Comparing </dset0a> with </dset0a> -0 differences found - -Comparing </dset0b> with </dset0b> -0 differences found - -Comparing </dset10a> with </dset10a> -0 differences found - -Comparing </dset10b> with </dset10b> -0 differences found - -Comparing </dset1a> with </dset1a> -0 differences found - -Comparing </dset1b> with </dset1b> -0 differences found - -Comparing </dset2a> with </dset2a> -0 differences found - -Comparing </dset2b> with </dset2b> -0 differences found - -Comparing </dset3a> with </dset3a> -0 differences found - -Comparing </dset3b> with </dset3b> -0 differences found - -Comparing </dset4a> with </dset4a> -0 differences found - -Comparing </dset4b> with </dset4b> -0 differences found - -Comparing </dset5a> with </dset5a> -0 differences found - -Comparing </dset5b> with </dset5b> -0 differences found - -Comparing </dset6a> with </dset6a> -0 differences found - -Comparing </dset6b> with </dset6b> -0 differences found - -Comparing </dset7a> with </dset7a> -0 differences found - -Comparing </dset7b> with </dset7b> -0 differences found - -Comparing </dset8a> with </dset8a> -0 differences found - -Comparing </dset8b> with </dset8b> -0 differences found - -Comparing </dset9a> with </dset9a> -0 differences found - -Comparing </dset9b> with </dset9b> -0 differences found - - +position dset1 dset1 difference +------------------------------------------------------------ +[ 0 1 ] 1.000000 1.100000 0.100000 +[ 1 0 ] 1.000000 1.010000 0.010000 +[ 1 1 ] 1.000000 1.001000 0.001000 +[ 2 0 ] 1.000000 1.000100 0.000100 +[ 2 1 ] 1.000000 1.000000 0.000000 diff --git a/tools/testfiles/h5diff_20.txt b/tools/testfiles/h5diff_20.txt index ef4439a..6896f3e 100644 --- a/tools/testfiles/h5diff_20.txt +++ b/tools/testfiles/h5diff_20.txt @@ -1,7 +1,6 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 dset group' +Expected output for 'h5diff file3.h5 file3.h5 -v dset group' ############################# -$h5diff file3.h5 file3.h5 dset group -Comparison not supported -</dset> is of type H5G_DATASET and </group> is of type H5G_GROUP +$h5diff file3.h5 file3.h5 -v dset group +Comparison not possible: </dset> is of type H5G_DATASET and </group> is of type H5G_GROUP diff --git a/tools/testfiles/h5diff_21.txt b/tools/testfiles/h5diff_21.txt index 12804b8..15f91b6 100644 --- a/tools/testfiles/h5diff_21.txt +++ b/tools/testfiles/h5diff_21.txt @@ -1,7 +1,6 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 dset link' +Expected output for 'h5diff file3.h5 file3.h5 -v dset link' ############################# -$h5diff file3.h5 file3.h5 dset link -Comparison not supported -</dset> is of type H5G_DATASET and </link> is of type H5G_LINK +$h5diff file3.h5 file3.h5 -v dset link +Comparison not possible: </dset> is of type H5G_DATASET and </link> is of type H5G_LINK diff --git a/tools/testfiles/h5diff_22.txt b/tools/testfiles/h5diff_22.txt index 9e5ce85..a518e7e 100644 --- a/tools/testfiles/h5diff_22.txt +++ b/tools/testfiles/h5diff_22.txt @@ -1,7 +1,6 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 dset type' +Expected output for 'h5diff file3.h5 file3.h5 -v dset type' ############################# -$h5diff file3.h5 file3.h5 dset type -Comparison not supported -</dset> is of type H5G_DATASET and </type> is of type H5G_TYPE +$h5diff file3.h5 file3.h5 -v dset type +Comparison not possible: </dset> is of type H5G_DATASET and </type> is of type H5G_TYPE diff --git a/tools/testfiles/h5diff_23.txt b/tools/testfiles/h5diff_23.txt index d04763f..ee20e1d 100644 --- a/tools/testfiles/h5diff_23.txt +++ b/tools/testfiles/h5diff_23.txt @@ -1,8 +1,6 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 group group' +Expected output for 'h5diff file3.h5 file3.h5 -v group group' ############################# -$h5diff file3.h5 file3.h5 group group -Comparison not supported -</group> is of type H5G_GROUP and </group> is of type H5G_GROUP - +$h5diff file3.h5 file3.h5 -v group group +Group: </group> and </group> diff --git a/tools/testfiles/h5diff_24.txt b/tools/testfiles/h5diff_24.txt index 82a11d5..dc1ebb0 100644 --- a/tools/testfiles/h5diff_24.txt +++ b/tools/testfiles/h5diff_24.txt @@ -1,8 +1,6 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 type type' +Expected output for 'h5diff file3.h5 file3.h5 -v type type' ############################# -$h5diff file3.h5 file3.h5 type type -Comparison not supported -</type> is of type H5G_TYPE and </type> is of type H5G_TYPE - +$h5diff file3.h5 file3.h5 -v type type +Datatype: </type> and </type> diff --git a/tools/testfiles/h5diff_25.txt b/tools/testfiles/h5diff_25.txt index a4f56f0..1bbffac 100644 --- a/tools/testfiles/h5diff_25.txt +++ b/tools/testfiles/h5diff_25.txt @@ -1,8 +1,6 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 link link' +Expected output for 'h5diff file3.h5 file3.h5 -v link link' ############################# -$h5diff file3.h5 file3.h5 link link -Comparison not supported -</link> is of type H5G_LINK and </link> is of type H5G_LINK - +$h5diff file3.h5 file3.h5 -v link link +Link: </link> and </link> diff --git a/tools/testfiles/h5diff_50.txt b/tools/testfiles/h5diff_50.txt index 3b0bdb8..7a9866e 100644 --- a/tools/testfiles/h5diff_50.txt +++ b/tools/testfiles/h5diff_50.txt @@ -1,17 +1,7 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset0a dset0b' +Expected output for 'h5diff file4.h5 file4.h5 -v dset0a dset0b' ############################# -$h5diff file6.h5 file6.h5 dset0a dset0b -Warning: Different storage datatype -</dset0a> has file datatype H5T_STD_I16LE -</dset0b> has file datatype H5T_STD_I32LE -Comparing </dset0a> with </dset0b> -position dset0a dset0b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found - +$h5diff file4.h5 file4.h5 -v dset0a dset0b +Object <dset0a> could not be found in <file4.h5> +Object <dset0b> could not be found in <file4.h5> diff --git a/tools/testfiles/h5diff_51.txt b/tools/testfiles/h5diff_51.txt index a8de11e..6e3f3de 100644 --- a/tools/testfiles/h5diff_51.txt +++ b/tools/testfiles/h5diff_51.txt @@ -1,14 +1,7 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset1a dset1b' +Expected output for 'h5diff file4.h5 file4.h5 -v dset1a dset1b' ############################# -$h5diff file6.h5 file6.h5 dset1a dset1b -Comparing </dset1a> with </dset1b> -position dset1a dset1b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found - +$h5diff file4.h5 file4.h5 -v dset1a dset1b +Object <dset1a> could not be found in <file4.h5> +Object <dset1b> could not be found in <file4.h5> diff --git a/tools/testfiles/h5diff_52.txt b/tools/testfiles/h5diff_52.txt index 5d0d0a0..c235f43 100644 --- a/tools/testfiles/h5diff_52.txt +++ b/tools/testfiles/h5diff_52.txt @@ -1,14 +1,7 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset2a dset2b' +Expected output for 'h5diff file4.h5 file4.h5 -v dset2a dset2b' ############################# -$h5diff file6.h5 file6.h5 dset2a dset2b -Comparing </dset2a> with </dset2b> -position dset2a dset2b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found - +$h5diff file4.h5 file4.h5 -v dset2a dset2b +Object <dset2a> could not be found in <file4.h5> +Object <dset2b> could not be found in <file4.h5> diff --git a/tools/testfiles/h5diff_53.txt b/tools/testfiles/h5diff_53.txt index 4d6e3b7..eab744d 100644 --- a/tools/testfiles/h5diff_53.txt +++ b/tools/testfiles/h5diff_53.txt @@ -1,14 +1,7 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset3a dset4b' +Expected output for 'h5diff file4.h5 file4.h5 -v dset3a dset4b' ############################# -$h5diff file6.h5 file6.h5 dset3a dset4b -Comparing </dset3a> with </dset4b> -position dset3a dset4b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found - +$h5diff file4.h5 file4.h5 -v dset3a dset4b +Object <dset3a> could not be found in <file4.h5> +Object <dset4b> could not be found in <file4.h5> diff --git a/tools/testfiles/h5diff_54.txt b/tools/testfiles/h5diff_54.txt index 968d483..23397aa 100644 --- a/tools/testfiles/h5diff_54.txt +++ b/tools/testfiles/h5diff_54.txt @@ -1,14 +1,7 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset4a dset4b' +Expected output for 'h5diff file4.h5 file4.h5 -v dset4a dset4b' ############################# -$h5diff file6.h5 file6.h5 dset4a dset4b -Comparing </dset4a> with </dset4b> -position dset4a dset4b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found - +$h5diff file4.h5 file4.h5 -v dset4a dset4b +Object <dset4a> could not be found in <file4.h5> +Object <dset4b> could not be found in <file4.h5> diff --git a/tools/testfiles/h5diff_55.txt b/tools/testfiles/h5diff_55.txt index 40fa20a..0f397c9 100644 --- a/tools/testfiles/h5diff_55.txt +++ b/tools/testfiles/h5diff_55.txt @@ -1,14 +1,7 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset5a dset5b' +Expected output for 'h5diff file4.h5 file4.h5 -v dset5a dset5b' ############################# -$h5diff file6.h5 file6.h5 dset5a dset5b -Comparing </dset5a> with </dset5b> -position dset5a dset5b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found - +$h5diff file4.h5 file4.h5 -v dset5a dset5b +Object <dset5a> could not be found in <file4.h5> +Object <dset5b> could not be found in <file4.h5> diff --git a/tools/testfiles/h5diff_56.txt b/tools/testfiles/h5diff_56.txt index 6075593..59fd5a2 100644 --- a/tools/testfiles/h5diff_56.txt +++ b/tools/testfiles/h5diff_56.txt @@ -1,14 +1,7 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset6a dset6b' +Expected output for 'h5diff file4.h5 file4.h5 -v dset6a dset6b' ############################# -$h5diff file6.h5 file6.h5 dset6a dset6b -Comparing </dset6a> with </dset6b> -position dset6a dset6b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found - +$h5diff file4.h5 file4.h5 -v dset6a dset6b +Object <dset6a> could not be found in <file4.h5> +Object <dset6b> could not be found in <file4.h5> diff --git a/tools/testfiles/h5diff_57.txt b/tools/testfiles/h5diff_57.txt index 783621b..308eae0 100644 --- a/tools/testfiles/h5diff_57.txt +++ b/tools/testfiles/h5diff_57.txt @@ -1,11 +1,7 @@ ############################# -Expected output for 'h5diff file6.h5 file6.h5 dset7a dset7b' +Expected output for 'h5diff file4.h5 file4.h5 -v dset7a dset7b' ############################# -$h5diff file6.h5 file6.h5 dset7a dset7b -Warning: Different storage datatype -</dset7a> has file datatype H5T_STD_I8LE -</dset7b> has file datatype H5T_STD_U8LE -Comparison not supported -</dset7a> has sign H5T_SGN_2 -</dset7b> has sign H5T_SGN_NONE +$h5diff file4.h5 file4.h5 -v dset7a dset7b +Object <dset7a> could not be found in <file4.h5> +Object <dset7b> could not be found in <file4.h5> diff --git a/tools/testfiles/h5diff_600.txt b/tools/testfiles/h5diff_600.txt index 5c85fa5..50254b0 100644 --- a/tools/testfiles/h5diff_600.txt +++ b/tools/testfiles/h5diff_600.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5' ############################# -$h5diff file1.h5 Number of arguments is only 2 Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_601.txt b/tools/testfiles/h5diff_601.txt index e580166..2896b76 100644 --- a/tools/testfiles/h5diff_601.txt +++ b/tools/testfiles/h5diff_601.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -x' ############################# -$h5diff file1.h5 file2.h5 -x -x is an invalid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_602.txt b/tools/testfiles/h5diff_602.txt index 1b4e124..160b9e9b 100644 --- a/tools/testfiles/h5diff_602.txt +++ b/tools/testfiles/h5diff_602.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d g1/dset3 g1/dset4 <-d g1/dset3> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_603.txt b/tools/testfiles/h5diff_603.txt index 32fd29b..5630fd6 100644 --- a/tools/testfiles/h5diff_603.txt +++ b/tools/testfiles/h5diff_603.txt @@ -1,8 +1,7 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d -4 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d -4 g1/dset3 g1/dset4 -<-d -4> is not a valid option +Not a valid -d option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] file1 File name of the first HDF5 file @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_604.txt b/tools/testfiles/h5diff_604.txt index 23ac58c..58f3259 100644 --- a/tools/testfiles/h5diff_604.txt +++ b/tools/testfiles/h5diff_604.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d 0 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d 0 g1/dset3 g1/dset4 <-d 0> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_605.txt b/tools/testfiles/h5diff_605.txt index 31f9ee3..bef85ea 100644 --- a/tools/testfiles/h5diff_605.txt +++ b/tools/testfiles/h5diff_605.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d u g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d u g1/dset3 g1/dset4 <-d u> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_606.txt b/tools/testfiles/h5diff_606.txt index e62baf2..fe5308c 100644 --- a/tools/testfiles/h5diff_606.txt +++ b/tools/testfiles/h5diff_606.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d 0x1 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d 0x1 g1/dset3 g1/dset4 <-d 0x1> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_607.txt b/tools/testfiles/h5diff_607.txt index 0cdd240..01cf531 100644 --- a/tools/testfiles/h5diff_607.txt +++ b/tools/testfiles/h5diff_607.txt @@ -1,16 +1,11 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100 110 10 -[ 0 1 ] 110 100 10 -[ 1 0 ] 100 90 10 -[ 1 1 ] 100 80 20 -[ 2 0 ] 100 140 40 -[ 2 1 ] 100 200 100 -6 differences found - - +[ 0 0 ] 100.000000 110.000000 10.000000 +[ 0 1 ] 110.000000 100.000000 10.000000 +[ 1 0 ] 100.000000 90.000000 10.000000 +[ 1 1 ] 100.000000 80.000000 20.000000 +[ 2 0 ] 100.000000 140.000000 40.000000 +[ 2 1 ] 100.000000 200.000000 100.000000 diff --git a/tools/testfiles/h5diff_608.txt b/tools/testfiles/h5diff_608.txt index a93ba06..983f569 100644 --- a/tools/testfiles/h5diff_608.txt +++ b/tools/testfiles/h5diff_608.txt @@ -1,16 +1,11 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d 1 -d 2 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d 1 -d 2 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100 110 10 -[ 0 1 ] 110 100 10 -[ 1 0 ] 100 90 10 -[ 1 1 ] 100 80 20 -[ 2 0 ] 100 140 40 -[ 2 1 ] 100 200 100 -6 differences found - - +[ 0 0 ] 100.000000 110.000000 10.000000 +[ 0 1 ] 110.000000 100.000000 10.000000 +[ 1 0 ] 100.000000 90.000000 10.000000 +[ 1 1 ] 100.000000 80.000000 20.000000 +[ 2 0 ] 100.000000 140.000000 40.000000 +[ 2 1 ] 100.000000 200.000000 100.000000 diff --git a/tools/testfiles/h5diff_609.txt b/tools/testfiles/h5diff_609.txt index 4856c70..279122f 100644 --- a/tools/testfiles/h5diff_609.txt +++ b/tools/testfiles/h5diff_609.txt @@ -1,8 +1,3 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d 200 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d 200 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> -0 differences found - - diff --git a/tools/testfiles/h5diff_610.txt b/tools/testfiles/h5diff_610.txt index 0cdd240..01cf531 100644 --- a/tools/testfiles/h5diff_610.txt +++ b/tools/testfiles/h5diff_610.txt @@ -1,16 +1,11 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100 110 10 -[ 0 1 ] 110 100 10 -[ 1 0 ] 100 90 10 -[ 1 1 ] 100 80 20 -[ 2 0 ] 100 140 40 -[ 2 1 ] 100 200 100 -6 differences found - - +[ 0 0 ] 100.000000 110.000000 10.000000 +[ 0 1 ] 110.000000 100.000000 10.000000 +[ 1 0 ] 100.000000 90.000000 10.000000 +[ 1 1 ] 100.000000 80.000000 20.000000 +[ 2 0 ] 100.000000 140.000000 40.000000 +[ 2 1 ] 100.000000 200.000000 100.000000 diff --git a/tools/testfiles/h5diff_611.txt b/tools/testfiles/h5diff_611.txt index a81b283..10dec8f 100644 --- a/tools/testfiles/h5diff_611.txt +++ b/tools/testfiles/h5diff_611.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p g1/dset3 g1/dset4 <-p g1/dset3> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_612.txt b/tools/testfiles/h5diff_612.txt index e41e95c..803b64e 100644 --- a/tools/testfiles/h5diff_612.txt +++ b/tools/testfiles/h5diff_612.txt @@ -1,8 +1,7 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p -4 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p -4 g1/dset3 g1/dset4 --4 is an invalid option +Not a valid -p option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] file1 File name of the first HDF5 file @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_613.txt b/tools/testfiles/h5diff_613.txt index 2aefa0e..61e1d91 100644 --- a/tools/testfiles/h5diff_613.txt +++ b/tools/testfiles/h5diff_613.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p 0 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p 0 g1/dset3 g1/dset4 <-p 0> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_614.txt b/tools/testfiles/h5diff_614.txt index 659696c..a0a8b49 100644 --- a/tools/testfiles/h5diff_614.txt +++ b/tools/testfiles/h5diff_614.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p u g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p u g1/dset3 g1/dset4 <-p u> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_615.txt b/tools/testfiles/h5diff_615.txt index ce3d4da..2f19008 100644 --- a/tools/testfiles/h5diff_615.txt +++ b/tools/testfiles/h5diff_615.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p 0x1 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p 0x1 g1/dset3 g1/dset4 <-p 0x1> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_616.txt b/tools/testfiles/h5diff_616.txt index 576a7a9..efaf8a3 100644 --- a/tools/testfiles/h5diff_616.txt +++ b/tools/testfiles/h5diff_616.txt @@ -1,12 +1,7 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p 0.21 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p 0.21 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference relative ------------------------------------------------------------------------ [ 2 0 ] 100 140 40 0.4 [ 2 1 ] 100 200 100 1 -2 differences found - - diff --git a/tools/testfiles/h5diff_617.txt b/tools/testfiles/h5diff_617.txt index 1a2e58a..267c992 100644 --- a/tools/testfiles/h5diff_617.txt +++ b/tools/testfiles/h5diff_617.txt @@ -1,12 +1,7 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p 0.21 -p 0.22 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p 0.21 -p 0.22 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference relative ------------------------------------------------------------------------ [ 2 0 ] 100 140 40 0.4 [ 2 1 ] 100 200 100 1 -2 differences found - - diff --git a/tools/testfiles/h5diff_618.txt b/tools/testfiles/h5diff_618.txt index fc74bc0..78d3ca2 100644 --- a/tools/testfiles/h5diff_618.txt +++ b/tools/testfiles/h5diff_618.txt @@ -1,8 +1,3 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p 2 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p 2 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> -0 differences found - - diff --git a/tools/testfiles/h5diff_619.txt b/tools/testfiles/h5diff_619.txt index 22b60084..8ef4136 100644 --- a/tools/testfiles/h5diff_619.txt +++ b/tools/testfiles/h5diff_619.txt @@ -1,8 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -p 0.005 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -p 0.005 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference relative ------------------------------------------------------------------------ [ 0 0 ] 100 110 10 0.1 @@ -11,6 +9,3 @@ position dset3 dset4 difference relative [ 1 1 ] 100 80 20 0.2 [ 2 0 ] 100 140 40 0.4 [ 2 1 ] 100 200 100 1 -6 differences found - - diff --git a/tools/testfiles/h5diff_620.txt b/tools/testfiles/h5diff_620.txt index 471403a..2d01f76de 100644 --- a/tools/testfiles/h5diff_620.txt +++ b/tools/testfiles/h5diff_620.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n g1/dset3 g1/dset4 <-n g1/dset3> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_621.txt b/tools/testfiles/h5diff_621.txt index 0ce65ba..11a3e16 100644 --- a/tools/testfiles/h5diff_621.txt +++ b/tools/testfiles/h5diff_621.txt @@ -1,8 +1,7 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n -4 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n -4 g1/dset3 g1/dset4 --4 is an invalid option +Not a valid -n option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] file1 File name of the first HDF5 file @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_622.txt b/tools/testfiles/h5diff_622.txt index ded2aa0..5d082eb 100644 --- a/tools/testfiles/h5diff_622.txt +++ b/tools/testfiles/h5diff_622.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n 0 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n 0 g1/dset3 g1/dset4 <-n 0> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_623.txt b/tools/testfiles/h5diff_623.txt index ed80d2a..6bfe66b 100644 --- a/tools/testfiles/h5diff_623.txt +++ b/tools/testfiles/h5diff_623.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n u g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n u g1/dset3 g1/dset4 <-n u> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_624.txt b/tools/testfiles/h5diff_624.txt index 1cbd883..9feda50 100644 --- a/tools/testfiles/h5diff_624.txt +++ b/tools/testfiles/h5diff_624.txt @@ -1,7 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n 0x1 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n 0x1 g1/dset3 g1/dset4 <-n 0x1> is not a valid option Usage: h5diff file1 file2 [OPTIONS] [obj1[obj2]] @@ -11,6 +10,7 @@ file2 File name of the second HDF5 file [obj2] Name of an HDF5 object, in absolute path [OPTIONS] are: [-h] Print out this information +[-v] Verbose mode [-r] Print only what objects differ, not the differences [-n count] Print difference up to count number [-d delta] Print difference when it is greater than limit delta diff --git a/tools/testfiles/h5diff_625.txt b/tools/testfiles/h5diff_625.txt index d2684d3..780131f 100644 --- a/tools/testfiles/h5diff_625.txt +++ b/tools/testfiles/h5diff_625.txt @@ -1,12 +1,7 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n 2 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n 2 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100 110 10 -[ 0 1 ] 110 100 10 -2 differences found - - +[ 0 0 ] 100.000000 110.000000 10.000000 +[ 0 1 ] 110.000000 100.000000 10.000000 diff --git a/tools/testfiles/h5diff_626.txt b/tools/testfiles/h5diff_626.txt index a18e823..e1e38d6 100644 --- a/tools/testfiles/h5diff_626.txt +++ b/tools/testfiles/h5diff_626.txt @@ -1,13 +1,8 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n 2 -n 3 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n 2 -n 3 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100 110 10 -[ 0 1 ] 110 100 10 -[ 1 0 ] 100 90 10 -3 differences found - - +[ 0 0 ] 100.000000 110.000000 10.000000 +[ 0 1 ] 110.000000 100.000000 10.000000 +[ 1 0 ] 100.000000 90.000000 10.000000 diff --git a/tools/testfiles/h5diff_627.txt b/tools/testfiles/h5diff_627.txt index b67afc5..30e6c50 100644 --- a/tools/testfiles/h5diff_627.txt +++ b/tools/testfiles/h5diff_627.txt @@ -1,16 +1,11 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n 200 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n 200 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100 110 10 -[ 0 1 ] 110 100 10 -[ 1 0 ] 100 90 10 -[ 1 1 ] 100 80 20 -[ 2 0 ] 100 140 40 -[ 2 1 ] 100 200 100 -6 differences found - - +[ 0 0 ] 100.000000 110.000000 10.000000 +[ 0 1 ] 110.000000 100.000000 10.000000 +[ 1 0 ] 100.000000 90.000000 10.000000 +[ 1 1 ] 100.000000 80.000000 20.000000 +[ 2 0 ] 100.000000 140.000000 40.000000 +[ 2 1 ] 100.000000 200.000000 100.000000 diff --git a/tools/testfiles/h5diff_628.txt b/tools/testfiles/h5diff_628.txt index 891c3bb..008b4d3 100644 --- a/tools/testfiles/h5diff_628.txt +++ b/tools/testfiles/h5diff_628.txt @@ -1,11 +1,6 @@ ############################# Expected output for 'h5diff file1.h5 file2.h5 -n 1 g1/dset3 g1/dset4' ############################# -$h5diff file1.h5 file2.h5 -n 1 g1/dset3 g1/dset4 -Comparing </g1/dset3> with </g1/dset4> position dset3 dset4 difference ------------------------------------------------------------ -[ 0 0 ] 100 110 10 -1 differences found - - +[ 0 0 ] 100.000000 110.000000 10.000000 diff --git a/tools/testfiles/h5diff_629.txt b/tools/testfiles/h5diff_629.txt index 51a825f..8d7ced3 100644 --- a/tools/testfiles/h5diff_629.txt +++ b/tools/testfiles/h5diff_629.txt @@ -1,5 +1,5 @@ ############################# Expected output for 'h5diff file1.h6 file2.h6' ############################# -$h5diff file1.h6 file2.h6 -h5diff: file1.h6: No such file or directory +h5diff: <file1.h6>: unable to open file +h5diff: <file2.h6>: unable to open file diff --git a/tools/testfiles/test1.h5 b/tools/testfiles/test1.h5 Binary files differindex 54c897a..fa70b7e 100644 --- a/tools/testfiles/test1.h5 +++ b/tools/testfiles/test1.h5 diff --git a/tools/testfiles/test3.h5 b/tools/testfiles/test3.h5 Binary files differindex 36a3aa4..f48d367 100644 --- a/tools/testfiles/test3.h5 +++ b/tools/testfiles/test3.h5 diff --git a/tools/testfiles/test4.h5 b/tools/testfiles/test4.h5 Binary files differindex ce2cfee..7e1e16a 100644 --- a/tools/testfiles/test4.h5 +++ b/tools/testfiles/test4.h5 |