A class for comparing ECLIPSE files.
More...
#include <EclFilesComparator.hpp>
|
| 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.
|
|
|
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_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 comparing ECLIPSE files.
ECLFilesComparator opens ECLIPSE files (unified restart, initial and RFT in addition to grid file) from two simulations. This class has only the functions printKeywords() and printKeywordsDifference(), in addition to a couple of get-functions: the comparison logic is implemented in the subclasses RegressionTest and IntegrationTest.
◆ ECLFilesComparator()
ECLFilesComparator::ECLFilesComparator |
( |
int |
file_type, |
|
|
const std::string & |
basename1, |
|
|
const std::string & |
basename2, |
|
|
double |
absTolerance, |
|
|
double |
relTolerance |
|
) |
| |
Open ECLIPSE files and set tolerances and keywords.
- Parameters
-
[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. |
The content of the ECLIPSE files specified in the input is stored in the ecl_file_type and ecl_grid_type member variables. In addition the keywords and absolute and relative tolerances (member variables) are set. If the constructor is unable to open one of the ECLIPSE files, an exception will be thrown.
◆ average()
double ECLFilesComparator::average |
( |
const std::vector< double > & |
vec | ) |
|
|
static |
Calculate average of a vector.
Returning the average of the input vector, i.e. the sum of all values divided by the number of elements.
◆ calculateDeviations()
Deviation ECLFilesComparator::calculateDeviations |
( |
double |
val1, |
|
|
double |
val2 |
|
) |
| |
|
static |
Calculate deviations for two values.
Using absolute values of the input arguments: If one of the values are non-zero, the Deviation::abs returned is the difference between the two input values. In addition, if both values are non-zero, the Deviation::rel returned is the absolute deviation divided by the largest value.
◆ getEclKeywordData()
unsigned int ECLFilesComparator::getEclKeywordData |
( |
ecl_kw_type *& |
ecl_kw1, |
|
|
ecl_kw_type *& |
ecl_kw2, |
|
|
const std::string & |
keyword, |
|
|
int |
occurrence1, |
|
|
int |
occurrence2 |
|
) |
| const |
|
protected |
Stores keyword data for a given occurrence.
- Parameters
-
[out] | ecl_kw1 | Pointer to a ecl_kw_type, which stores keyword data for first case given the occurrence. |
[out] | ecl_kw2 | Pointer to a ecl_kw_type, which stores keyword data for second case given the occurrence. |
[in] | keyword | Which keyword to consider. |
[in] | occurrence | Which keyword occurrence to consider. |
This function stores keyword data for the given keyword and occurrence in #ecl_kw1 and #ecl_kw2, and returns the number of cells (for which the keyword has a value at the occurrence). If the number of cells differ for the two cases, an exception is thrown.
◆ keywordValidForComparing()
void ECLFilesComparator::keywordValidForComparing |
( |
const std::string & |
keyword | ) |
const |
|
protected |
Checks if the keyword exists in both cases.
- Parameters
-
[in] | keyword | Keyword to check. |
If the keyword does not exist in one of the cases, the function throws an exception.
◆ median()
double ECLFilesComparator::median |
( |
std::vector< double > |
vec | ) |
|
|
static |
Calculate median of a vector.
Returning the median of the input vector, i.e. the middle value of the sorted vector if the number of elements is odd or the mean of the two middle values if the number of elements are even.
◆ printValuesForCell()
template<typename T >
template void ECLFilesComparator::printValuesForCell< double > |
( |
const std::string & |
keyword, |
|
|
int |
occurrence1, |
|
|
int |
occurrence2, |
|
|
size_t |
cell, |
|
|
const T & |
value1, |
|
|
const T & |
value2 |
|
) |
| const |
|
protected |
Prints values for a given keyword, occurrence and cell.
- Parameters
-
[in] | keyword | Which keyword to consider. |
[in] | occurrence | Which keyword occurrence to consider. |
[in] | cell | Which cell occurrence to consider (numbered by global index). |
[in] | value1 | Value for first file, the data type can be bool, int, double or std::string. |
[in] | value2 | Value for second file, the data type can be bool, int, double or std::string. |
Templatefunction for printing values when exceptions are thrown. The function is defined for bool, int, double and std::string.
The documentation for this class was generated from the following files: