Chaste Release::3.1
|
#include <NumericFileComparison.hpp>
Public Member Functions | |
NumericFileComparison (std::string fileName1, std::string fileName2, bool calledCollectively=true, bool suppressOutput=false) | |
NumericFileComparison (const FileFinder &rFileName1, const FileFinder &rFileName2, bool calledCollectively=true, bool suppressOutput=false) | |
bool | CompareFiles (double absTol=DBL_EPSILON, unsigned ignoreFirstFewLines=0, double relTol=DBL_EPSILON, bool doTsAssert=true) |
Compare files of numbers to see if they match to within a given tolerance.
Definition at line 49 of file NumericFileComparison.hpp.
NumericFileComparison::NumericFileComparison | ( | std::string | fileName1, |
std::string | fileName2, | ||
bool | calledCollectively = true , |
||
bool | suppressOutput = false |
||
) | [inline] |
Specify two files to compare, and open them for reading. Actual comparison is done by calling CompareFiles.
fileName1 | first file |
fileName2 | second file |
calledCollectively | If true there will be a barrier before opening files, and only master compares contents. |
suppressOutput | If true then no errors will go to TS_TRACE(). Should only be set for the test of this class. |
Definition at line 62 of file NumericFileComparison.hpp.
NumericFileComparison::NumericFileComparison | ( | const FileFinder & | rFileName1, |
const FileFinder & | rFileName2, | ||
bool | calledCollectively = true , |
||
bool | suppressOutput = false |
||
) | [inline] |
Specify two files to compare, and open them for reading. Actual comparison is done by calling CompareFiles.
rFileName1 | first file |
rFileName2 | second file |
calledCollectively | If true there will be a barrier before opening files, and only master compares contents. |
suppressOutput | If true then no errors will go to TS_TRACE(). Should only be set for the test of this class. |
Definition at line 76 of file NumericFileComparison.hpp.
bool NumericFileComparison::CompareFiles | ( | double | absTol = DBL_EPSILON , |
unsigned | ignoreFirstFewLines = 0 , |
||
double | relTol = DBL_EPSILON , |
||
bool | doTsAssert = true |
||
) | [inline] |
Compare the files under both relative and absolute tolerances. The comparison only fails if neither tolerance holds. The default settings effectively require numbers to match exactly.
absTol | absolute tolerance on difference between numbers |
ignoreFirstFewLines | how many lines to ignore from the comparison |
relTol | relative tolerance on difference between numbers |
doTsAssert | Whether to throw a TS_ASSERT internally (switched off for testing only) |
Definition at line 92 of file NumericFileComparison.hpp.
References PetscTools::AmMaster(), AbstractFileComparison::mCalledCollectively, AbstractFileComparison::mFilename1, AbstractFileComparison::mFilename2, AbstractFileComparison::mpFile1, AbstractFileComparison::mpFile2, AbstractFileComparison::mSuppressOutput, AbstractFileComparison::ResetFiles(), AbstractFileComparison::SkipHeaderLines(), and CompareDoubles::WithinAnyTolerance().