Chaste
Release::3.4
|
#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) |
Public Member Functions inherited from AbstractFileComparison | |
AbstractFileComparison (const FileFinder &rFileFinder1, const FileFinder &rFileFinder2, bool calledCollectively, bool suppressOutput) | |
AbstractFileComparison (std::string fileName1, std::string fileName2, bool calledCollectively, bool suppressOutput) | |
virtual | ~AbstractFileComparison () |
Private Member Functions | |
void | ReadNextToken (std::ifstream *pFile, double &rData) |
Additional Inherited Members | |
Protected Member Functions inherited from AbstractFileComparison | |
void | ResetFiles () |
void | SkipHeaderLines (unsigned numLinesToSkip) |
Protected Attributes inherited from AbstractFileComparison | |
std::string | mFilename1 |
std::string | mFilename2 |
std::ifstream * | mpFile1 |
std::ifstream * | mpFile2 |
unsigned | mLineNum |
bool | mCalledCollectively |
bool | mSuppressOutput |
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.
|
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.
|
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.
|
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().
|
inlineprivate |
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().