#include <NumericFileComparison.hpp>
Inherits AbstractFileComparison.

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) |
Private Member Functions | |
| void | ReadNextToken (std::ifstream *pFile, double &rData) |
Compare files of numbers to see if they match to within a given tolerance.
Any differences in words are ignored, as are comment lines starting with '#' or '!'.
Definition at line 52 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 100 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 114 of file NumericFileComparison.hpp.
| bool NumericFileComparison::CompareFiles | ( | double | absTol = DBL_EPSILON, |
|
| unsigned | ignoreFirstFewLines = 0, |
|||
| double | relTol = DBL_EPSILON, |
|||
| bool | doTsAssert = true | |||
| ) | [inline] |
| 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 131 of file NumericFileComparison.hpp.
References PetscTools::AmMaster(), AbstractFileComparison::mCalledCollectively, AbstractFileComparison::mFilename1, AbstractFileComparison::mFilename2, AbstractFileComparison::mpFile1, AbstractFileComparison::mpFile2, AbstractFileComparison::mSuppressOutput, ReadNextToken(), AbstractFileComparison::ResetFiles(), AbstractFileComparison::SkipHeaderLines(), and CompareDoubles::WithinAnyTolerance().
| void NumericFileComparison::ReadNextToken | ( | std::ifstream * | pFile, | |
| double & | rData | |||
| ) | [inline, private] |
Read the next token in the file as a double.
If we detect a comment skip the line. If we detect a word assign the value A_WORD. If we find nothing to read assign NOTHING_TO_READ.
| pFile | The file from which to attempt to read a double. | |
| rData | The double to assign a value to. |
Definition at line 65 of file NumericFileComparison.hpp.
Referenced by CompareFiles().
1.6.2