NumericFileComparison Class Reference

#include <NumericFileComparison.hpp>

Collaboration diagram for NumericFileComparison:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 NumericFileComparison (std::string fileName1, std::string fileName2)
 ~NumericFileComparison ()
bool CompareFiles (double absTol=DBL_EPSILON, unsigned ignoreFirstFewLines=0, double relTol=DBL_EPSILON)

Private Attributes

std::string mFilename1
std::string mFilename2
std::ifstream * mpFile1
std::ifstream * mpFile2

Detailed Description

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

Definition at line 43 of file NumericFileComparison.hpp.


Constructor & Destructor Documentation

NumericFileComparison::NumericFileComparison ( std::string  fileName1,
std::string  fileName2 
) [inline]

Specify two files to compare, and open them for reading. Actual comparison is done by calling CompareFiles.

Parameters:
fileName1 first file
fileName2 second file

Definition at line 62 of file NumericFileComparison.hpp.

References EXCEPTION, mpFile1, and mpFile2.

NumericFileComparison::~NumericFileComparison (  )  [inline]

Close the files being compared.

Definition at line 93 of file NumericFileComparison.hpp.

References mpFile1, and mpFile2.


Member Function Documentation

bool NumericFileComparison::CompareFiles ( double  absTol = DBL_EPSILON,
unsigned  ignoreFirstFewLines = 0,
double  relTol = DBL_EPSILON 
) [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:
absTol absolute tolerance on difference between numbers
ignoreFirstFewLines how many lines to ignore from the comparison
relTol relative tolerance on difference between numbers

Definition at line 116 of file NumericFileComparison.hpp.

References mFilename1, mFilename2, mpFile1, mpFile2, and CompareDoubles::WithinAnyTolerance().


Member Data Documentation

std::string NumericFileComparison::mFilename1 [private]

First filename

Definition at line 47 of file NumericFileComparison.hpp.

Referenced by CompareFiles().

std::string NumericFileComparison::mFilename2 [private]

Second filename

Definition at line 48 of file NumericFileComparison.hpp.

Referenced by CompareFiles().

std::ifstream* NumericFileComparison::mpFile1 [private]

First file

Definition at line 50 of file NumericFileComparison.hpp.

Referenced by CompareFiles(), NumericFileComparison(), and ~NumericFileComparison().

std::ifstream* NumericFileComparison::mpFile2 [private]

Second file

Definition at line 51 of file NumericFileComparison.hpp.

Referenced by CompareFiles(), NumericFileComparison(), and ~NumericFileComparison().


The documentation for this class was generated from the following file:
Generated on Thu Dec 22 13:06:54 2011 for Chaste by  doxygen 1.6.3