File: XdmfDiff.h

package info (click to toggle)
xdmf 3.0%2Bgit20160803-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 35,388 kB
  • ctags: 36,627
  • sloc: ansic: 265,382; cpp: 162,889; python: 10,976; f90: 1,378; yacc: 687; fortran: 464; xml: 200; java: 187; lex: 125; makefile: 82; sh: 28
file content (192 lines) | stat: -rw-r--r-- 6,173 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*******************************************************************/
/*                               XDMF                              */
/*                   eXtensible Data Model and Format              */
/*                                                                 */
/*  Id : $Id: XdmfDiff.h,v 1.2 2009-12-17 18:17:28 kwleiter Exp $  */
/*  Date : $Date: 2009-12-17 18:17:28 $ */
/*  Version : $Revision: 1.2 $ */
/*                                                                 */
/*  Author:                                                        */
/*     Kenneth Leiter                                              */
/*     kenneth.leiter@arl.army.mil                                 */
/*     US Army Research Laboratory                                 */
/*     Aberdeen Proving Ground, MD                                 */
/*                                                                 */
/*     Copyright @ 2009 US Army Research Laboratory                */
/*     All Rights Reserved                                         */
/*     See Copyright.txt or http://www.arl.hpc.mil/ice for details */
/*                                                                 */
/*     This software is distributed WITHOUT ANY WARRANTY; without  */
/*     even the implied warranty of MERCHANTABILITY or FITNESS     */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice   */
/*     for more information.                                       */
/*                                                                 */
/*******************************************************************/

/**
 * Determines whether two XDMF files contain equivalent data.
 *
 * Intended to be used as both a command line utility and a framework for code
 * testing purposes.
 *
 * The XdmfDiff utility can be accessed via python or executed as a compiled command line utility.
 *
 * Command Line:
 *   Write a script to access the swig wrapped diff utility
 *
 *   There are two ways to run the command line utility:
 *
 *     XdmfDiff referenceFile newFile
 *       Compares all information contained in referenceFile to newFile .  Extra grids
 *       contained in newFile that are not in referenceFile are ignored.
 *
 *     XdmfDiff referenceFile newFile settingsFile
 *       Compares information contained in referenceFile to newFile according to settings
 *       specified in the settingsFile.  All settings options are outlined below:
 *
 * Settings Options:
 *   RELATIVE_ERROR .15
 *   ABSOLUTE_ERROR 1
 *   INCLUDE_GRID grid1 grid2
 *   IGNORE_GRID grid1 grid2
 *   IGNORE_GEOMETRY
 *   IGNORE_TOPOLOGY
 *   INCLUDE_ATTRIBUTE attr1 attr2
 *   IGNORE_ATTRIBUTE attr1 attr2
 *   IGNORE_ALL_ATTRIBUTES
 *   DISPLAY_FAILURES_ONLY
 *   VERBOSE_OUTPUT
 *
 * Settings can be commented out with #
 *
 * For code testing purposes run XdmfDiff::AreEquivalent().
 */

#ifndef XDMFDIFF_H_
#define XDMFDIFF_H_

#include <XdmfArray.h>
#include <XdmfGrid.h>
#include <XdmfDOM.h>
#include <XdmfDomain.h>
#include <XdmfRoot.h>

class XdmfDiffInternal;

#if defined(WIN32) && !defined(XDMFSTATIC)

// Windows and DLL configuration
#if defined(XdmfUtils_EXPORTS)
#define XDMF_UTILS_DLL __declspec(dllexport)
#else
#define XDMF_UTILS_DLL __declspec(dllimport)
#endif

#else

// Linux or static configuration
#define XDMF_UTILS_DLL

#endif

class XDMF_UTILS_DLL XdmfDiff
{
public:

  /*
   * Constructs an XdmfDiff object to compare two Xdmf Files
   *
   * @param refFileName the path to an Xdmf file to compare
   * @param newFileName the path to an Xdmf file to compare
   *
   */
  XdmfDiff(XdmfConstString refFileName, XdmfConstString newFileName);

  /*
   * Constructs an XdmfDiff object to compare two Xdmf Files
   *
   * @param refDOM an XdmfDOM to compare
   * @param newDOM an XdmfDOM to compare
   *
   */
  XdmfDiff(XdmfDOM * refDOM, XdmfDOM * newDOM);

  /*
   * Destructor
   *
   */
  ~XdmfDiff();

  /*
   * Get the differences between two Xdmf files
   *
   * @return an XdmfConstString of differences between the files
   */
  std::string
  GetDiffs();

  /*
   * Get the differences between grids in two Xdmf files
   *
   * @param gridName the name of the grid to compare
   *
   * @return an XdmfConstString of differences between the grids
   */
  std::string GetDiffs(XdmfConstString gridName);

  XdmfInt32 SetIgnoreTime(XdmfBoolean value = true);
  XdmfInt32 GetIgnoreTime();
  XdmfInt32 SetIgnoreGeometry(XdmfBoolean value = true);
  XdmfInt32 GetIgnoreGeometry();
  XdmfInt32 SetIgnoreTopology(XdmfBoolean value = true);
  XdmfInt32 GetIgnoreTopology();
  XdmfInt32 SetIgnoreAllAttributes(XdmfBoolean value = true);
  XdmfInt32 GetIgnoreAllAttributes();
  XdmfInt32 SetDisplayFailuresOnly(XdmfBoolean value = true);
  XdmfInt32 GetDisplayFailuresOnly();
  XdmfInt32 SetVerboseOutput(XdmfBoolean value = true);
  XdmfInt32 GetVerboseOutput();
  XdmfInt32 SetCreateDiffFile(XdmfBoolean value = true);
  XdmfInt32 GetCreateDiffFile();
  XdmfInt32 SetDiffFileName(XdmfString value);
  XdmfString GetDiffFileName();

  /*
   * Sets the acceptable relative error between values.  Relative Errors and Absolute Errors
   * can not be used at the same time.
   *
   * @param relativeError the acceptable relative error in decimal form
   *
   */
  XdmfInt32 SetRelativeError(XdmfFloat64 relativeError);
  XdmfFloat64 GetRelativeError();

  /*
   * Sets the acceptable absolute error between values.  Relative Errors and Absolute Errors
   * can not be used at the same time.
   *
   * @param absoluteError the acceptable absolute error
   *
   */
  XdmfInt32 SetAbsoluteError(XdmfFloat64 absoluteError);
  XdmfFloat64 GetAbsoluteError();
  XdmfInt32 IncludeGrid(XdmfString gridName);
  XdmfInt32 IgnoreGrid(XdmfString gridName);
  XdmfInt32 IncludeAttribute(XdmfString attributeName);
  XdmfInt32 IgnoreAttribute(XdmfString attributeName);

  XdmfInt32 ParseSettingsFile(XdmfConstString settingsFile);

  /*
   * Determines whether the two files are equivalent.
   *
   * @return an XdmfBoolean true = equivalent, false = nonequivalent
   *
   */
  XdmfBoolean AreEquivalent();

private:
  XdmfDiffInternal * myInternal;
};

#endif /* XDMFDIFF_H_ */