Merge pull request #876 from tskille/compareECL2
Update of compareECL - check output files for reference case
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <getopt.h>
|
||||
#include <fstream>
|
||||
|
||||
static void printHelp() {
|
||||
std::cout << "\ncompareECL compares ECLIPSE files (restart (.RST), unified restart (.UNRST), initial (.INIT), summary (.SMRY), unified summary (.UNSMRY) or .RFT) and gridsizes (from .EGRID or .GRID file) from two simulations.\n"
|
||||
@@ -62,6 +63,20 @@ static void printHelp() {
|
||||
|
||||
|
||||
|
||||
static bool has_result_files(const std::string& rootName)
|
||||
{
|
||||
std::vector<std::string> extList = { "EGRID", "INIT", "UNRST", "SMSPEC", "RFT" };
|
||||
|
||||
for (const auto& ext : extList) {
|
||||
std::ifstream is(rootName + '.' + ext);
|
||||
if (is) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------//
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@@ -155,6 +170,11 @@ int main(int argc, char** argv) {
|
||||
|
||||
std::cout << "Comparing '" << basename1 << "' to '" << basename2 << "'." << std::endl;
|
||||
|
||||
if (!has_result_files(basename1)){
|
||||
std::cerr << "No files found for reference case." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
try {
|
||||
ECLRegressionTest comparator(basename1, basename2, absTolerance, relTolerance);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user