Chaste Release::3.1
NumericFileComparison Class Reference

#include <NumericFileComparison.hpp>

Inheritance diagram for NumericFileComparison:
Collaboration diagram for NumericFileComparison:

List of all members.

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)

Detailed Description

Compare files of numbers to see if they match to within a given tolerance.

Definition at line 49 of file NumericFileComparison.hpp.


Constructor & Destructor Documentation

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.

Parameters:
fileName1first file
fileName2second file
calledCollectivelyIf true there will be a barrier before opening files, and only master compares contents.
suppressOutputIf 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.

Parameters:
rFileName1first file
rFileName2second file
calledCollectivelyIf true there will be a barrier before opening files, and only master compares contents.
suppressOutputIf 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.


Member Function Documentation

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.

Parameters:
absTolabsolute tolerance on difference between numbers
ignoreFirstFewLineshow many lines to ignore from the comparison
relTolrelative tolerance on difference between numbers
doTsAssertWhether 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().


The documentation for this class was generated from the following file: