20 #ifndef SUMMARYCOMPARATOR_HPP 21 #define SUMMARYCOMPARATOR_HPP 31 #define HANDLE_ERROR(type, message) \ 34 OPM_THROW(type, message); \ 36 std::cerr << message << std::endl; \ 41 struct stringlist_struct;
42 typedef struct stringlist_struct stringlist_type;
45 struct ecl_sum_struct;
46 typedef struct ecl_sum_struct ecl_sum_type;
58 double absoluteTolerance = 0;
59 double relativeTolerance = 0;
65 stringlist_type*
keys1 =
nullptr;
66 stringlist_type*
keys2 =
nullptr;
71 const std::vector<double> *
checkVec =
nullptr;
88 void setDataSets(
const std::vector<double>& timeVec1,
89 const std::vector<double>& timeVec2);
94 void setTimeVecs(std::vector<double> &timeVec1,std::vector<double> &timeVec2);
101 std::vector<double> &dataVec2,
const char* keyword);
110 const std::vector<double> &timeVec2,
111 const std::vector<double> &dataVec1,
112 const std::vector<double> &dataVec2);
123 const char*
getUnit(
const char* keyword);
135 const std::vector<double>& timeVec2,
136 const char* keyword);
145 SummaryComparator(
const char* basename1,
const char* basename2,
double absoluteTolerance,
double relativeTolerance);
174 static double unitStep(
double value){
return value;}
~SummaryComparator()
Destructor.
Definition: summaryComparator.cpp:53
bool printSpecificKeyword
Boolean value for choosing whether to print the vectors of a keyword or not.
Definition: summaryComparator.hpp:74
void getDeviation(size_t refIndex, size_t &checkIndex, Deviation &dev)
Calculate deviation between two data values and stores it in a Deviation struct.
Definition: summaryComparator.cpp:133
static double unitStep(double value)
Unit step function.
Definition: summaryComparator.hpp:174
double getAbsTolerance()
Returns the absolute tolerance.
Definition: summaryComparator.hpp:118
const char * getUnit(const char *keyword)
Returns the unit of the values of a keyword.
Definition: summaryComparator.cpp:169
void setPrintKeywords(bool boolean)
Sets the private member variable printKeywords.
Definition: summaryComparator.hpp:161
double getRelTolerance()
Returns the relative tolerance.
Definition: summaryComparator.hpp:115
ecl_sum_type * ecl_sum_fileShort
For keeping track of the file with most/fewest timesteps.
Definition: summaryComparator.hpp:63
void printKeywords()
Prints the keywords of the files.
Definition: summaryComparator.cpp:174
void setPrintSpecificKeyword(bool boolean)
Sets the private member variable printSpecificKeyword.
Definition: summaryComparator.hpp:166
const std::vector< double > * referenceVec
For storing the values of each time step for the file containing the fewer time steps.
Definition: summaryComparator.hpp:69
double rel
Relative deviation.
Definition: EclFilesComparator.hpp:41
Deviation struct.
Definition: EclFilesComparator.hpp:39
double abs
Absolute deviation.
Definition: EclFilesComparator.hpp:40
void throwOnErrors(bool dothrow)
Set whether to throw on errors or not.
Definition: summaryComparator.hpp:177
void printUnits()
Prints the units of the files.
Definition: summaryComparator.cpp:158
ecl_sum_type * ecl_sum1
Struct that contains file1.
Definition: summaryComparator.hpp:61
stringlist_type * keys2
For storing all the keywords of file2.
Definition: summaryComparator.hpp:66
bool throwOnError
Throw on first error.
Definition: summaryComparator.hpp:75
Definition: summaryComparator.hpp:56
ecl_sum_type * ecl_sum2
Struct that contains file2.
Definition: summaryComparator.hpp:62
stringlist_type * keysShort
For keeping track of the file with most/fewest keywords.
Definition: summaryComparator.hpp:67
void setTimeVecs(std::vector< double > &timeVec1, std::vector< double > &timeVec2)
Reads in the time values of each time step.
Definition: summaryComparator.cpp:73
static Deviation calculateDeviations(double val1, double val2)
Calculates the deviation between two values.
Definition: summaryComparator.cpp:61
stringlist_type * keysLong
For keeping track of the file with most/fewest keywords.
Definition: summaryComparator.hpp:68
bool printKeyword
Boolean value for choosing whether to print the keywords or not.
Definition: summaryComparator.hpp:73
ecl_sum_type * ecl_sum_fileLong
For keeping track of the file with most/fewest timesteps.
Definition: summaryComparator.hpp:64
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 acc...
Definition: summaryComparator.cpp:101
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.
Definition: summaryComparator.cpp:114
const std::vector< double > * checkDataVec
For storing the data values corresponding to each time step for the file containing the more time ste...
Definition: summaryComparator.hpp:72
void getDataVecs(std::vector< double > &dataVec1, std::vector< double > &dataVec2, const char *keyword)
Read the data for one specific keyword into two separate vectors.
Definition: summaryComparator.cpp:86
const std::vector< double > * referenceDataVec
For storing the data corresponding to each time step for the file containing the fewer time steps...
Definition: summaryComparator.hpp:70
void printDataOfSpecificKeyword(const std::vector< double > &timeVec1, const std::vector< double > &timeVec2, const char *keyword)
Prints the summary vectors from the two files.
Definition: summaryComparator.cpp:200
stringlist_type * keys1
For storing all the keywords of file1.
Definition: summaryComparator.hpp:65
SummaryComparator(const char *basename1, const char *basename2, double absoluteTolerance, double relativeTolerance)
Creates an SummaryComparator class object.
Definition: summaryComparator.cpp:28
const std::vector< double > * checkVec
For storing the values of each time step for the file containing the more time steps.
Definition: summaryComparator.hpp:71