A class for executing a regression test for two ECLIPSE files. More...
#include <EclFilesComparator.hpp>
Public Member Functions | |
RegressionTest (int file_type, const std::string &basename1, const std::string &basename2, double absTolerance, double relTolerance) | |
Sets up the regression test. More... | |
void | setOnlyLastOccurrence (bool onlyLastOccurrenceArg) |
Option to only compare last occurrence. | |
void | gridCompare () const |
Compares grid properties of the two cases. | |
void | results () |
Calculates deviations for all keywords. | |
void | resultsForKeyword (const std::string &keyword) |
Calculates deviations for a specific keyword. More... | |
RegressionTest (const char *basename1, const char *basename2, double relativeTol, double absoluteTol) | |
Constructor, creates an object of RefressionTest class. More... | |
void | getRegressionTest () |
void | getRegressionTest (const char *keyword) |
Regression test for a certain keyword of the files. More... | |
void | setIsRestartFile (bool boolean) |
This function sets the private member variable isRestartFiles. More... | |
![]() | |
SummaryComparator (const char *basename1, const char *basename2, double absoluteTolerance, double relativeTolerance) | |
Creates an SummaryComparator class object. More... | |
~SummaryComparator () | |
Destructor. More... | |
void | setPrintKeywords (bool boolean) |
Sets the private member variable printKeywords. More... | |
void | setPrintSpecificKeyword (bool boolean) |
Sets the private member variable printSpecificKeyword. More... | |
void | throwOnErrors (bool dothrow) |
Set whether to throw on errors or not. | |
![]() | |
ECLFilesComparator (int file_type, const std::string &basename1, const std::string &basename2, double absTolerance, double relTolerance) | |
Open ECLIPSE files and set tolerances and keywords. More... | |
~ECLFilesComparator () | |
Closing the ECLIPSE files. | |
void | throwOnErrors (bool dothrow) |
Set whether to throw on errors or not. | |
size_t | getNoErrors () const |
Returns the number of errors encountered in the performed comparisons. | |
int | getFileType () const |
Returns the ECLIPSE filetype of this. | |
double | getAbsTolerance () const |
Returns the absolute tolerance stored as a private member variable in the class. | |
double | getRelTolerance () const |
Returns the relative tolerance stored as a private member variable in the class. | |
void | printKeywords () const |
Print all keywords and their respective Eclipse type for the two input cases. | |
void | printKeywordsDifference () const |
Print common and uncommon keywords for the two input cases. | |
Additional Inherited Members | |
![]() | |
static Deviation | calculateDeviations (double val1, double val2) |
Calculates the deviation between two values. More... | |
static double | unitStep (double value) |
Unit step function. More... | |
![]() | |
static Deviation | calculateDeviations (double val1, double val2) |
Calculate deviations for two values. More... | |
static double | median (std::vector< double > vec) |
Calculate median of a vector. More... | |
static double | average (const std::vector< double > &vec) |
Calculate average of a vector. More... | |
![]() | |
void | getDeviation (size_t refIndex, size_t &checkIndex, Deviation &dev) |
Calculate deviation between two data values and stores it in a Deviation struct. More... | |
void | setDataSets (const std::vector< double > &timeVec1, const std::vector< double > &timeVec2) |
Figure out which data file contains the most / less timesteps and assign member variable pointers accordingly. More... | |
void | setTimeVecs (std::vector< double > &timeVec1, std::vector< double > &timeVec2) |
Reads in the time values of each time step. More... | |
void | getDataVecs (std::vector< double > &dataVec1, std::vector< double > &dataVec2, const char *keyword) |
Read the data for one specific keyword into two separate vectors. More... | |
void | chooseReference (const std::vector< double > &timeVec1, const std::vector< double > &timeVec2, const std::vector< double > &dataVec1, const std::vector< double > &dataVec2) |
Sets one data set as a basis and the other as values to check against. More... | |
double | getRelTolerance () |
Returns the relative tolerance. | |
double | getAbsTolerance () |
Returns the absolute tolerance. | |
const char * | getUnit (const char *keyword) |
Returns the unit of the values of a keyword. More... | |
void | printUnits () |
Prints the units of the files. | |
void | printKeywords () |
Prints the keywords of the files. More... | |
void | printDataOfSpecificKeyword (const std::vector< double > &timeVec1, const std::vector< double > &timeVec2, const char *keyword) |
Prints the summary vectors from the two files. More... | |
![]() | |
void | keywordValidForComparing (const std::string &keyword) const |
Checks if the keyword exists in both cases. More... | |
unsigned int | getEclKeywordData (ecl_kw_type *&ecl_kw1, ecl_kw_type *&ecl_kw2, const std::string &keyword, int occurrence1, int occurrence2) const |
Stores keyword data for a given occurrence. More... | |
template<typename T > | |
void | printValuesForCell (const std::string &keyword, int occurrence1, int occurrence2, size_t cell, const T &value1, const T &value2) const |
Prints values for a given keyword, occurrence and cell. More... | |
![]() | |
ecl_sum_type * | ecl_sum1 = nullptr |
Struct that contains file1. | |
ecl_sum_type * | ecl_sum2 = nullptr |
Struct that contains file2. | |
ecl_sum_type * | ecl_sum_fileShort = nullptr |
For keeping track of the file with most/fewest timesteps. | |
ecl_sum_type * | ecl_sum_fileLong = nullptr |
For keeping track of the file with most/fewest timesteps. | |
stringlist_type * | keys1 = nullptr |
For storing all the keywords of file1. | |
stringlist_type * | keys2 = nullptr |
For storing all the keywords of file2. | |
stringlist_type * | keysShort = nullptr |
For keeping track of the file with most/fewest keywords. | |
stringlist_type * | keysLong = nullptr |
For keeping track of the file with most/fewest keywords. | |
const std::vector< double > * | referenceVec = nullptr |
For storing the values of each time step for the file containing the fewer time steps. More... | |
const std::vector< double > * | referenceDataVec = nullptr |
For storing the data corresponding to each time step for the file containing the fewer time steps. More... | |
const std::vector< double > * | checkVec = nullptr |
For storing the values of each time step for the file containing the more time steps. More... | |
const std::vector< double > * | checkDataVec = nullptr |
For storing the data values corresponding to each time step for the file containing the more time steps. More... | |
bool | printKeyword = false |
Boolean value for choosing whether to print the keywords or not. | |
bool | printSpecificKeyword = false |
Boolean value for choosing whether to print the vectors of a keyword or not. | |
bool | throwOnError = true |
Throw on first error. | |
![]() | |
ecl_file_type * | ecl_file1 = nullptr |
ecl_grid_type * | ecl_grid1 = nullptr |
ecl_file_type * | ecl_file2 = nullptr |
ecl_grid_type * | ecl_grid2 = nullptr |
std::vector< std::string > | keywords1 |
std::vector< std::string > | keywords2 |
bool | throwOnError = true |
Throw on first error. | |
size_t | num_errors = 0 |
A class for executing a regression test for two ECLIPSE files.
This class inherits from ECLFilesComparator, which opens and closes the input cases and stores keywordnames. The three public functions gridCompare(), results() and resultsForKeyword() can be invoked to compare griddata or keyworddata for all keywords or a given keyword (resultsForKeyword()).
The class inherits from the SummaryComparator class, which takes care of all file reading.
The RegressionTest class compares the values from the two different files and throws exceptions when the deviation is unsatisfying.
|
inline |
Sets up the regression test.
[in] | file_type | Specifies which filetype to be compared, possible inputs are UNRSTFILE, INITFILE and RFTFILE. |
[in] | basename1 | Full path without file extension to the first case. |
[in] | basename2 | Full path without file extension to the second case. |
[in] | absTolerance | Tolerance for absolute deviation. |
[in] | relTolerance | Tolerance for relative deviation. |
This constructor only calls the constructor of the superclass, see the docs for ECLFilesComparator for more information.
|
inline |
Constructor, creates an object of RefressionTest class.
[in] | basename1 | Path to file1 without extension. |
[in] | basename1 | Path to file2 without extension. |
[in] | relativeTol | The relative tolerance which is to be used in the test. |
[in] | absoluteTol | The absolute tolerance which is to be used in the test. |
The constructor calls the constructor of the super class.
void RegressionTest::getRegressionTest | ( | ) |
The function executes a regression test for all the keywords. If the two files do not match in amount of keywords, an exception is thrown.
void RegressionTest::getRegressionTest | ( | const char * | keyword | ) |
Regression test for a certain keyword of the files.
The function executes a regression test for one specific keyword. If one or both of the files do not have the keyword, an exception is thrown.
void RegressionTest::resultsForKeyword | ( | const std::string & | keyword | ) |
Calculates deviations for a specific keyword.
[in] | keyword | Keyword which should be compared, if this keyword is absent in one of the cases, an exception will be thrown. |
This function loops through every report step and every cell and compares the values for the given keyword from the two input cases. If the absolute or relative deviation between the two values for each step exceeds both the absolute tolerance and the relative tolerance (stored in ECLFilesComparator), an exception is thrown. In addition, some keywords are marked for "disallow negative values" – these are SGAS, SWAT and PRESSURE. An exception is thrown if a value of one of these keywords is both negative and has an absolute value larger than the absolute tolerance. If no exceptions are thrown, resultsForKeyword() uses the private member funtion printResultsForKeyword to print the average and median deviations.
|
inline |
This function sets the private member variable isRestartFiles.
[in] | boolean | Boolean value |