MISR Toolkit  1.5.1
h5diff.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF5. The full HDF5 copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the COPYING file, which can be found at the root of the source code *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 #ifndef H5DIFF_H__
15 #define H5DIFF_H__
16 
17 #include "hdf5.h"
18 #include "h5trav.h"
19 
20 /*
21  * Debug printf macros. The prefix allows output filtering by test scripts.
22  */
23 #ifdef H5DIFF_DEBUG
24 #define h5difftrace(x) HDfprintf(stderr, "h5diff debug: " x)
25 #define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2)
26 #define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3)
27 #define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4)
28 #define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5)
29 #else
30 #define h5difftrace(x)
31 #define h5diffdebug2(x1, x2)
32 #define h5diffdebug3(x1, x2, x3)
33 #define h5diffdebug4(x1, x2, x3, x4)
34 #define h5diffdebug5(x1, x2, x3, x4, x5)
35 #endif
36 
37 #define MAX_FILENAME 1024
38 
39 /*-------------------------------------------------------------------------
40  * This is used to pass multiple args into diff().
41  * Passing this instead of several each arg provides smoother extensibility
42  * through its members along with MPI code for ph5diff
43  * as it doesn't require interface change.
44  *------------------------------------------------------------------------*/
45 typedef struct {
48 } diff_args_t;
49 /*-------------------------------------------------------------------------
50  * command line options
51  *-------------------------------------------------------------------------
52  */
53 /* linked list to keep exclude path list */
55  char *obj_path;
58 };
59 
60 typedef struct {
61  int m_quiet; /* quiet mide: no output at all */
62  int m_report; /* report mode: print the data */
63  int m_verbose; /* verbose mode: print the data, list of objcets, warnings */
64  int m_verbose_level; /* control verbose details */
65  int d; /* delta, absolute value to compare */
66  double delta; /* delta value */
67  int p; /* relative error to compare*/
68  int use_system_epsilon; /* flag to use system epsilon (1 or 0) */
69  double percent; /* relative error value */
70  int n; /* count, compare up to count */
71  hsize_t count; /* count value */
72  hbool_t follow_links; /* follow symbolic links */
73  int no_dangle_links; /* return error when find dangling link */
74  int err_stat; /* an error ocurred (1, error, 0, no error) */
75  int cmn_objs; /* do we have common objects */
76  int not_cmp; /* are the objects comparable */
77  int contents; /* equal contents */
78  int do_nans; /* consider Nans while diffing floats */
79  int m_list_not_cmp; /* list not comparable messages */
80  int exclude_path; /* exclude path to an object */
81  struct exclude_path_list * exclude; /* keep exclude path list */
82 } diff_opt_t;
83 
84 
85 /*-------------------------------------------------------------------------
86  * public functions
87  *-------------------------------------------------------------------------
88  */
89 
90 #ifdef __cplusplus
91 extern "C" {
92 #endif
93 
94 H5TOOLS_DLL hsize_t h5diff(const char *fname1,
95  const char *fname2,
96  const char *objname1,
97  const char *objname2,
98  diff_opt_t *opts);
99 
100 H5TOOLS_DLL hsize_t diff( hid_t file1_id,
101  const char *path1,
102  hid_t file2_id,
103  const char *path2,
104  diff_opt_t *opts,
105  diff_args_t *argdata);
106 
107 #ifdef H5_HAVE_PARALLEL
108 H5TOOLS_DLL void phdiff_dismiss_workers(void);
109 H5TOOLS_DLL void print_manager_output(void);
110 #endif
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 
117 
118 /*-------------------------------------------------------------------------
119  * private functions
120  *-------------------------------------------------------------------------
121  */
122 
123 
124 hsize_t diff_dataset( hid_t file1_id,
125  hid_t file2_id,
126  const char *obj1_name,
127  const char *obj2_name,
128  diff_opt_t *opts);
129 
130 hsize_t diff_datasetid( hid_t dset1_id,
131  hid_t dset2_id,
132  const char *obj1_name,
133  const char *obj2_name,
134  diff_opt_t *opts);
135 
136 
137 hsize_t diff_match( hid_t file1_id, const char *grp1, trav_info_t *info1,
138  hid_t file2_id, const char *grp2, trav_info_t *info2,
139  trav_table_t *table, diff_opt_t *opts );
140 
141 hsize_t diff_array( void *_mem1,
142  void *_mem2,
143  hsize_t nelmts,
144  hsize_t hyper_start,
145  int rank,
146  hsize_t *dims,
147  diff_opt_t *opts,
148  const char *name1,
149  const char *name2,
150  hid_t m_type,
151  hid_t container1_id,
152  hid_t container2_id); /* dataset where the reference came from*/
153 
154 
155 int diff_can_type( hid_t f_type1, /* file data type */
156  hid_t f_type2, /* file data type */
157  int rank1,
158  int rank2,
159  hsize_t *dims1,
160  hsize_t *dims2,
161  hsize_t *maxdim1,
162  hsize_t *maxdim2,
163  const char *obj1_name,
164  const char *obj2_name,
165  diff_opt_t *opts,
166  int is_compound);
167 
168 
169 hsize_t diff_attr(hid_t loc1_id,
170  hid_t loc2_id,
171  const char *path1,
172  const char *path2,
173  diff_opt_t *opts);
174 
175 
176 /*-------------------------------------------------------------------------
177  * utility functions
178  *-------------------------------------------------------------------------
179  */
180 
181 /* in h5diff_util.c */
182 void print_found(hsize_t nfound);
183 void print_type(hid_t type);
184 const char* diff_basename(const char *name);
185 const char* get_type(h5trav_type_t type);
186 const char* get_class(H5T_class_t tclass);
187 const char* get_sign(H5T_sign_t sign);
188 void print_dimensions (int rank, hsize_t *dims);
189 herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
190  hid_t *m_tid1, hid_t *m_tid2,
191  size_t *m_size1, size_t *m_size2);
192 /* in h5diff.c */
193 int print_objname(diff_opt_t *opts, hsize_t nfound);
194 void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts);
195 void do_print_attrname (const char *attr, const char *path1, const char *path2);
196 
197 #endif /* H5DIFF_H__ */
198 
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)
unsigned int hbool_t
Definition: H5public.h:142
H5T_class_t
Definition: H5Tpublic.h:28
#define H5TOOLS_DLL
Definition: H5api_adpt.h:260
void print_found(hsize_t nfound)
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, const char *obj1_name, const char *obj2_name, diff_opt_t *opts, int is_compound)
int p
Definition: h5diff.h:67
hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
const char * diff_basename(const char *name)
H5T_sign_t
Definition: H5Tpublic.h:57
HDFFCLIBAPI void intf dims[]
char * obj_path
Definition: h5diff.h:55
int herr_t
Definition: H5public.h:124
void print_type(hid_t type)
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)
int no_dangle_links
Definition: h5diff.h:73
unsigned long long hsize_t
Definition: H5public.h:169
hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, diff_opt_t *opts, const char *name1, const char *name2, hid_t m_type, hid_t container1_id, hid_t container2_id)
int exclude_path
Definition: h5diff.h:80
void print_dimensions(int rank, hsize_t *dims)
h5trav_type_t
Definition: h5trav.h:36
double percent
Definition: h5diff.h:69
hsize_t diff_datasetid(hid_t dset1_id, hid_t dset2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
double delta
Definition: h5diff.h:66
h5trav_type_t obj_type
Definition: h5diff.h:56
int sign(double x)
int m_quiet
Definition: h5diff.h:61
int use_system_epsilon
Definition: h5diff.h:68
const char * get_sign(H5T_sign_t sign)
HDFFCLIBAPI _fcd name
int err_stat
Definition: h5diff.h:74
const char * get_type(h5trav_type_t type)
int d
Definition: h5diff.h:65
int m_verbose_level
Definition: h5diff.h:64
int contents
Definition: h5diff.h:77
int hid_t
Definition: H5Ipublic.h:54
void do_print_attrname(const char *attr, const char *path1, const char *path2)
int m_report
Definition: h5diff.h:62
int cmn_objs
Definition: h5diff.h:75
int m_verbose
Definition: h5diff.h:63
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)
const char * get_class(H5T_class_t tclass)
struct exclude_path_list * next
Definition: h5diff.h:57
int not_cmp
Definition: h5diff.h:76
H5TOOLS_DLL hsize_t h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *opts)
int do_nans
Definition: h5diff.h:78
hbool_t follow_links
Definition: h5diff.h:72
HDFFCLIBAPI intf intf intf * type
hbool_t is_same_trgobj
Definition: h5diff.h:47
void do_print_objname(const char *OBJ, const char *path1, const char *path2, diff_opt_t *opts)
int m_list_not_cmp
Definition: h5diff.h:79
struct exclude_path_list * exclude
Definition: h5diff.h:81
hsize_t count
Definition: h5diff.h:71
HDFFCLIBAPI intf * rank
int n
Definition: h5diff.h:70
hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts)
int print_objname(diff_opt_t *opts, hsize_t nfound)

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52