h5diff.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * Copyright by The HDF Group.                                               *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00013  * access to either file, you may request a copy from help@hdfgroup.org.     *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 #ifndef H5DIFF_H__
00017 #define H5DIFF_H__
00018 
00019 #include "hdf5.h"
00020 #include "h5trav.h"
00021 
00022 /*-------------------------------------------------------------------------
00023  * command line options
00024  *-------------------------------------------------------------------------
00025  */
00026 
00027 typedef struct {
00028     int      m_quiet;               /* quiet mide: no output at all */
00029     int      m_report;              /* report mode: print the data */
00030     int      m_verbose;             /* verbose mode: print the data, list of objcets, warnings */
00031     int      d;                     /* delta, absolute value to compare */
00032     double   delta;                 /* delta value */
00033     int      p;                     /* relative error to compare*/
00034     int      use_system_epsilon;    /* flag to use system epsilon (1 or 0) */
00035     double   percent;               /* relative error value */
00036     int      n;                     /* count, compare up to count */
00037     hsize_t  count;                 /* count value */
00038     int      follow_links;          /* follow symbolic links */
00039     int      no_dangle_links;       /* return error when find dangling link */
00040     int      err_stat;              /* an error ocurred (1, error, 0, no error) */
00041     int      cmn_objs;              /* do we have common objects */
00042     int      not_cmp;               /* are the objects comparable */
00043     int      contents;              /* equal contents */
00044     int      do_nans;               /* consider Nans while diffing floats */
00045     int      m_list_not_cmp;        /* list not comparable messages */
00046 } diff_opt_t;
00047 
00048 
00049 /*-------------------------------------------------------------------------
00050  * public functions
00051  *-------------------------------------------------------------------------
00052  */
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 
00058 hsize_t  h5diff(const char *fname1,
00059                 const char *fname2,
00060                 const char *objname1,
00061                 const char *objname2,
00062                 diff_opt_t *options);
00063 
00064 #ifdef H5_HAVE_PARALLEL
00065 void phdiff_dismiss_workers(void);
00066 void print_manager_output(void);
00067 #endif
00068 
00069 #ifdef __cplusplus
00070 }
00071 #endif
00072 
00073 
00074 
00075 /*-------------------------------------------------------------------------
00076  * private functions
00077  *-------------------------------------------------------------------------
00078  */
00079 
00080 
00081 hsize_t diff_dataset( hid_t file1_id,
00082                       hid_t file2_id,
00083                       const char *obj1_name,
00084                       const char *obj2_name,
00085                       diff_opt_t *options);
00086 
00087 hsize_t diff_datasetid( hid_t dset1_id,
00088                         hid_t dset2_id,
00089                         const char *obj1_name,
00090                         const char *obj2_name,
00091                         diff_opt_t *options);
00092 
00093 hsize_t diff( hid_t      file1_id,
00094               const char *path1,
00095               hid_t      file2_id,
00096               const char *path2,
00097               diff_opt_t *options,
00098               h5trav_type_t  type );
00099 
00100 hsize_t diff_compare( hid_t file1_id,
00101                       const char *file1_name,
00102                       const char *obj1_name,
00103                       trav_info_t *info1,
00104                       hid_t file2_id,
00105                       const char *file2_name,
00106                       const char *obj2_name,
00107                       trav_info_t *info2,
00108                       diff_opt_t *options );
00109 
00110 hsize_t diff_match( hid_t file1_id,
00111                     trav_info_t *info1,
00112                     hid_t file2_id,
00113                     trav_info_t *info2,
00114                     diff_opt_t *options );
00115 
00116 hsize_t diff_array( void *_mem1,
00117                     void *_mem2,
00118                     hsize_t nelmts,
00119                     hsize_t hyper_start,
00120                     int rank,
00121                     hsize_t *dims,
00122                     diff_opt_t *options,
00123                     const char *name1,
00124                     const char *name2,
00125                     hid_t m_type,
00126                     hid_t container1_id,
00127                     hid_t container2_id); /* dataset where the reference came from*/
00128 
00129 
00130 int diff_can_type( hid_t       f_type1, /* file data type */
00131                    hid_t       f_type2, /* file data type */
00132                    int         rank1,
00133                    int         rank2,
00134                    hsize_t     *dims1,
00135                    hsize_t     *dims2,
00136                    hsize_t     *maxdim1,
00137                    hsize_t     *maxdim2,
00138                    const char  *obj1_name,
00139                    const char  *obj2_name,
00140                    diff_opt_t  *options,
00141                    int         is_compound);
00142 
00143 
00144 hsize_t diff_attr(hid_t loc1_id,
00145                   hid_t loc2_id,
00146                   const char *path1,
00147                   const char *path2,
00148                   diff_opt_t *options);
00149 
00150 
00151 /*-------------------------------------------------------------------------
00152  * utility functions
00153  *-------------------------------------------------------------------------
00154  */
00155 
00156 void        print_found(hsize_t nfound);
00157 void        parallel_print(const char* format, ... );
00158 void        print_type(hid_t type);
00159 const char* diff_basename(const char *name);
00160 const char* get_type(h5trav_type_t type);
00161 const char* get_class(H5T_class_t tclass);
00162 const char* get_sign(H5T_sign_t sign);
00163 void        print_dimensions (int rank, hsize_t *dims);
00164 int         print_objname(diff_opt_t *options, hsize_t nfound);
00165 void        do_print_objname (const char *OBJ, const char *path1, const char *path2);
00166 
00167 
00168 
00169 hsize_t diff_datum(void       *_mem1,
00170                    void       *_mem2,
00171                    hid_t      m_type,
00172                    hsize_t    i,
00173                    int        rank,
00174                    hsize_t    *dims,
00175                    hsize_t    *acc,
00176                    hsize_t    *pos,
00177                    diff_opt_t *options,
00178                    const char *obj1,
00179                    const char *obj2,
00180                    hid_t      container1_id,
00181                    hid_t      container2_id, /*where the reference came from*/
00182                    int        *ph);           /*print header */
00183 
00184 
00185 
00186 hsize_t diff_float(unsigned char *mem1,
00187                    unsigned char *mem2,
00188                    hsize_t       nelmts,
00189                    hsize_t       hyper_start,
00190                    int           rank,
00191                    hsize_t       *dims,
00192                    hsize_t       *acc,
00193                    hsize_t       *pos,
00194                    diff_opt_t    *options,
00195                    const char    *obj1,
00196                    const char    *obj2,
00197                    int           *ph);
00198 
00199 hsize_t diff_double(unsigned char *mem1,
00200                     unsigned char *mem2,
00201                     hsize_t       nelmts,
00202                     hsize_t       hyper_start,
00203                     int           rank,
00204                     hsize_t       *dims,
00205                     hsize_t       *acc,
00206                     hsize_t       *pos,
00207                     diff_opt_t    *options,
00208                     const char    *obj1,
00209                     const char    *obj2,
00210                     int           *ph);
00211 
00212 #if H5_SIZEOF_LONG_DOUBLE !=0
00213 
00214 hsize_t diff_ldouble(unsigned char *mem1,
00215                      unsigned char *mem2,
00216                      hsize_t       nelmts,
00217                      hsize_t       hyper_start,
00218                      int           rank,
00219                      hsize_t       *dims,
00220                      hsize_t       *acc,
00221                      hsize_t       *pos,
00222                      diff_opt_t    *options,
00223                      const char    *obj1,
00224                      const char    *obj2,
00225                      int           *ph);
00226 
00227 #endif
00228 
00229 hsize_t diff_schar(unsigned char *mem1,
00230                    unsigned char *mem2,
00231                    hsize_t       nelmts,
00232                    hsize_t       hyper_start,
00233                    int           rank,
00234                    hsize_t       *dims,
00235                    hsize_t       *acc,
00236                    hsize_t       *pos,
00237                    diff_opt_t    *options,
00238                    const char    *obj1,
00239                    const char    *obj2,
00240                    int           *ph);
00241 
00242 hsize_t diff_uchar(unsigned char *mem1,
00243                    unsigned char *mem2,
00244                    hsize_t       nelmts,
00245                    hsize_t       hyper_start,
00246                    int           rank,
00247                    hsize_t       *dims,
00248                    hsize_t       *acc,
00249                    hsize_t       *pos,
00250                    diff_opt_t    *options,
00251                    const char    *obj1,
00252                    const char    *obj2,
00253                    int           *ph);
00254 
00255 hsize_t diff_short(unsigned char *mem1,
00256                    unsigned char *mem2,
00257                    hsize_t       nelmts,
00258                    hsize_t       hyper_start,
00259                    int           rank,
00260                    hsize_t       *dims,
00261                    hsize_t       *acc,
00262                    hsize_t       *pos,
00263                    diff_opt_t    *options,
00264                    const char    *obj1,
00265                    const char    *obj2,
00266                    int           *ph);
00267 
00268 hsize_t diff_ushort(unsigned char *mem1,
00269                    unsigned char *mem2,
00270                    hsize_t       nelmts,
00271                    hsize_t       hyper_start,
00272                    int           rank,
00273                    hsize_t       *dims,
00274                    hsize_t       *acc,
00275                    hsize_t       *pos,
00276                    diff_opt_t    *options,
00277                    const char    *obj1,
00278                    const char    *obj2,
00279                    int           *ph);
00280 
00281 hsize_t diff_int(unsigned char *mem1,
00282                    unsigned char *mem2,
00283                    hsize_t       nelmts,
00284                    hsize_t       hyper_start,
00285                    int           rank,
00286                    hsize_t       *dims,
00287                    hsize_t       *acc,
00288                    hsize_t       *pos,
00289                    diff_opt_t    *options,
00290                    const char    *obj1,
00291                    const char    *obj2,
00292                    int           *ph);
00293 
00294 hsize_t diff_uint(unsigned char *mem1,
00295                    unsigned char *mem2,
00296                    hsize_t       nelmts,
00297                    hsize_t       hyper_start,
00298                    int           rank,
00299                    hsize_t       *dims,
00300                    hsize_t       *acc,
00301                    hsize_t       *pos,
00302                    diff_opt_t    *options,
00303                    const char    *obj1,
00304                    const char    *obj2,
00305                    int           *ph);
00306 
00307 hsize_t diff_long(unsigned char *mem1,
00308                    unsigned char *mem2,
00309                    hsize_t       nelmts,
00310                    hsize_t       hyper_start,
00311                    int           rank,
00312                    hsize_t       *dims,
00313                    hsize_t       *acc,
00314                    hsize_t       *pos,
00315                    diff_opt_t    *options,
00316                    const char    *obj1,
00317                    const char    *obj2,
00318                    int           *ph);
00319 
00320 hsize_t diff_ulong(unsigned char *mem1,
00321                    unsigned char *mem2,
00322                    hsize_t       nelmts,
00323                    hsize_t       hyper_start,
00324                    int           rank,
00325                    hsize_t       *dims,
00326                    hsize_t       *acc,
00327                    hsize_t       *pos,
00328                    diff_opt_t    *options,
00329                    const char    *obj1,
00330                    const char    *obj2,
00331                    int           *ph);
00332 
00333 hsize_t diff_llong(unsigned char *mem1,
00334                    unsigned char *mem2,
00335                    hsize_t       nelmts,
00336                    hsize_t       hyper_start,
00337                    int           rank,
00338                    hsize_t       *dims,
00339                    hsize_t       *acc,
00340                    hsize_t       *pos,
00341                    diff_opt_t    *options,
00342                    const char    *obj1,
00343                    const char    *obj2,
00344                    int           *ph);
00345 
00346 hsize_t diff_ullong(unsigned char *mem1,
00347                    unsigned char *mem2,
00348                    hsize_t       nelmts,
00349                    hsize_t       hyper_start,
00350                    int           rank,
00351                    hsize_t       *dims,
00352                    hsize_t       *acc,
00353                    hsize_t       *pos,
00354                    diff_opt_t    *options,
00355                    const char    *obj1,
00356                    const char    *obj2,
00357                    int           *ph);
00358 
00359 #endif  /* H5DIFF_H__ */
00360