2003-10-23 05:56:21 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2003-10-23 05:56:21 +08:00
|
|
|
* 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 *
|
2017-04-18 03:32:16 +08:00
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
2021-02-17 22:52:36 +08:00
|
|
|
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
2017-04-18 03:32:16 +08:00
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
* help@hdfgroup.org. *
|
2003-10-23 05:56:21 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
2021-03-04 20:29:10 +08:00
|
|
|
#ifndef H5DIFF_H
|
|
|
|
#define H5DIFF_H
|
2003-10-23 05:56:21 +08:00
|
|
|
|
|
|
|
#include "hdf5.h"
|
2020-04-22 02:36:10 +08:00
|
|
|
#include "h5tools.h"
|
2003-10-23 05:56:21 +08:00
|
|
|
#include "h5trav.h"
|
|
|
|
|
2010-09-17 01:48:06 +08:00
|
|
|
#define MAX_FILENAME 1024
|
|
|
|
|
2011-05-07 06:02:24 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* This is used to pass multiple args into diff().
|
2017-10-17 06:26:23 +08:00
|
|
|
* Passing this instead of several each arg provides smoother extensibility
|
2011-05-07 06:02:24 +08:00
|
|
|
* through its members along with MPI code for ph5diff
|
|
|
|
* as it doesn't require interface change.
|
|
|
|
*------------------------------------------------------------------------*/
|
|
|
|
typedef struct {
|
2020-09-30 22:27:10 +08:00
|
|
|
h5trav_type_t type[2];
|
|
|
|
hbool_t is_same_trgobj;
|
2011-05-07 06:02:24 +08:00
|
|
|
} diff_args_t;
|
2003-10-23 05:56:21 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* command line options
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-09-17 05:46:16 +08:00
|
|
|
/* linked list to keep exclude path list */
|
|
|
|
struct exclude_path_list {
|
2020-09-30 22:27:10 +08:00
|
|
|
const char * obj_path;
|
|
|
|
h5trav_type_t obj_type;
|
|
|
|
struct exclude_path_list *next;
|
2010-09-17 05:46:16 +08:00
|
|
|
};
|
2003-10-23 05:56:21 +08:00
|
|
|
|
2019-12-28 13:02:26 +08:00
|
|
|
/* Enumeration value for keeping track of whether an error occurred or differences were found */
|
|
|
|
typedef enum {
|
|
|
|
H5DIFF_NO_ERR, /* No error occurred */
|
|
|
|
H5DIFF_ERR_DIFF, /* Differences were found */
|
|
|
|
H5DIFF_ERR /* An error occurred */
|
|
|
|
} diff_err_t;
|
|
|
|
|
2003-10-23 05:56:21 +08:00
|
|
|
typedef struct {
|
2020-09-30 22:27:10 +08:00
|
|
|
int mode_quiet; /* quiet mode: no output at all */
|
|
|
|
int mode_report; /* report mode: print the data */
|
|
|
|
int mode_verbose; /* verbose mode: print the data, list of objcets, warnings */
|
|
|
|
int mode_verbose_level; /* control verbose details */
|
|
|
|
int mode_list_not_cmp; /* list not comparable messages */
|
|
|
|
int print_header; /* print header */
|
|
|
|
int print_percentage; /* print percentage */
|
|
|
|
int print_dims; /* print dimension index */
|
|
|
|
int delta_bool; /* delta, absolute value to compare */
|
|
|
|
double delta; /* delta value */
|
|
|
|
int use_system_epsilon; /* flag to use system epsilon (1 or 0) */
|
|
|
|
int percent_bool; /* relative error to compare*/
|
|
|
|
double percent; /* relative error value */
|
|
|
|
hbool_t follow_links; /* follow symbolic links */
|
|
|
|
int no_dangle_links; /* return error when find dangling link */
|
|
|
|
int cmn_objs; /* do we have common objects */
|
|
|
|
int not_cmp; /* are the objects comparable */
|
|
|
|
int contents; /* equal contents */
|
|
|
|
int do_nans; /* consider Nans while diffing floats */
|
|
|
|
int exclude_path; /* exclude path to an object */
|
|
|
|
int exclude_attr_path; /* exclude path to an object */
|
|
|
|
struct exclude_path_list *exclude; /* keep exclude path list */
|
|
|
|
struct exclude_path_list *exclude_attr; /* keep exclude attribute list */
|
|
|
|
int count_bool; /* count, compare up to count */
|
|
|
|
hsize_t count; /* count value */
|
|
|
|
diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */
|
|
|
|
hsize_t nelmts; /* total number of elements */
|
|
|
|
hsize_t hs_nelmts; /* number of elements to read at a time*/
|
|
|
|
int rank; /* dimensionality */
|
|
|
|
size_t m_size; /* m_size for diff */
|
|
|
|
hid_t m_tid; /* m_tid for diff */
|
|
|
|
hsize_t dims[H5S_MAX_RANK]; /* dimensions of object */
|
|
|
|
hsize_t p_min_idx[H5S_MAX_RANK]; /* min selected index */
|
|
|
|
hsize_t p_max_idx[H5S_MAX_RANK]; /* max selected index */
|
|
|
|
hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
|
|
|
|
hsize_t pos[H5S_MAX_RANK]; /* matrix position */
|
|
|
|
hsize_t sm_pos[H5S_MAX_RANK]; /* stripmine position */
|
|
|
|
char * obj_name[2]; /* name for object */
|
|
|
|
struct subset_t * sset[2]; /* subsetting parameters */
|
|
|
|
h5tools_vol_info_t vol_info[2]; /* VOL information for input file, output file */
|
|
|
|
hbool_t custom_vol[2]; /* Using a custom input, output VOL? */
|
2003-10-29 01:40:05 +08:00
|
|
|
} diff_opt_t;
|
2003-10-23 05:56:21 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* public functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5TOOLS_DLL hsize_t h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2,
|
|
|
|
diff_opt_t *opts);
|
2005-02-10 02:19:54 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5TOOLS_DLL hsize_t diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2,
|
|
|
|
diff_opt_t *opts, diff_args_t *argdata);
|
2011-08-09 05:59:09 +08:00
|
|
|
|
2005-02-09 19:36:17 +08:00
|
|
|
#ifdef H5_HAVE_PARALLEL
|
2010-05-12 04:10:25 +08:00
|
|
|
H5TOOLS_DLL void phdiff_dismiss_workers(void);
|
|
|
|
H5TOOLS_DLL void print_manager_output(void);
|
2005-02-09 19:36:17 +08:00
|
|
|
#endif
|
2003-10-23 05:56:21 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* private functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name,
|
|
|
|
diff_opt_t *opts);
|
2003-10-23 05:56:21 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t diff_datasetid(hid_t dset1_id, hid_t dset2_id, const char *obj1_name, const char *obj2_name,
|
|
|
|
diff_opt_t *opts);
|
2020-07-16 00:20:16 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, const char *grp2,
|
|
|
|
trav_info_t *info2, trav_table_t *table, diff_opt_t *opts);
|
2020-07-16 00:20:16 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_t container2_id);
|
2020-07-16 00:20:16 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
int diff_can_type(hid_t f_type1, hid_t f_type2, int rank1, int rank2, hsize_t *dims1, hsize_t *dims2,
|
|
|
|
hsize_t *maxdim1, hsize_t *maxdim2, diff_opt_t *opts, int is_compound);
|
2020-07-16 00:20:16 +08:00
|
|
|
|
|
|
|
hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2,
|
2020-09-30 22:27:10 +08:00
|
|
|
const char *path1, const char *path2, diff_opt_t *opts);
|
2003-11-04 06:10:57 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts);
|
2003-11-04 06:10:57 +08:00
|
|
|
|
2003-10-23 05:56:21 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* utility functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2012-08-16 00:04:26 +08:00
|
|
|
/* in h5diff_util.c */
|
2004-07-21 03:21:03 +08:00
|
|
|
void print_found(hsize_t nfound);
|
2003-10-29 01:40:05 +08:00
|
|
|
void print_type(hid_t type);
|
2020-09-30 22:27:10 +08:00
|
|
|
const char *diff_basename(const char *name);
|
|
|
|
const char *get_type(h5trav_type_t type);
|
|
|
|
const char *get_class(H5T_class_t tclass);
|
|
|
|
const char *get_sign(H5T_sign_t sign);
|
|
|
|
void print_dimensions(int rank, hsize_t *dims);
|
|
|
|
herr_t match_up_memsize(hid_t f_tid1_id, hid_t f_tid2_id, hid_t *m_tid1, hid_t *m_tid2, size_t *m_size1,
|
|
|
|
size_t *m_size2);
|
2012-08-16 00:04:26 +08:00
|
|
|
/* in h5diff.c */
|
2020-09-30 22:27:10 +08:00
|
|
|
int print_objname(diff_opt_t *opts, hsize_t nfound);
|
|
|
|
void do_print_objname(const char *OBJ, const char *path1, const char *path2, diff_opt_t *opts);
|
|
|
|
void do_print_attrname(const char *attr, const char *path1, const char *path2);
|
2007-09-13 23:44:56 +08:00
|
|
|
|
2021-03-04 20:29:10 +08:00
|
|
|
#endif /* H5DIFF_H */
|