From cc6769c1a28f9b0470e477ea58ce1b3e23abc59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B8rn=20Skille?= Date: Tue, 4 Oct 2022 08:51:22 +0200 Subject: [PATCH] adding new file type RSM to compareECL When using -t SMRY the RSM file is not checked When using -t RSM the SMRY files is not checked when running without -t option both RSM and SMRY files are checked together with restart, grid, init and rft file. --- test_util/EclRegressionTest.cpp | 29 +++++++++++++++++++++++------ test_util/EclRegressionTest.hpp | 1 + test_util/compareECL.cpp | 4 ++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/test_util/EclRegressionTest.cpp b/test_util/EclRegressionTest.cpp index c266fb45f..8b09bdd63 100644 --- a/test_util/EclRegressionTest.cpp +++ b/test_util/EclRegressionTest.cpp @@ -889,7 +889,7 @@ void ECLRegressionTest::results_smry() ESmry smry2(fileName2, loadBaseRunData); smry2.loadData(); - std::cout << "\nLoading summary file " << fileName2 << " .... done" << std::endl; + std::cout << "Loading summary file " << fileName2 << " .... done" << std::endl; deviations.clear(); @@ -999,25 +999,42 @@ void ECLRegressionTest::results_smry() } } + } else { + std::cout << "\n!Warning, summary files not found, hence not compared. \n" << std::endl; + } + +} + +void ECLRegressionTest::results_rsm() +{ + std::string fileName1,fileName2; + bool foundRsm2 = checkFileName(rootName2, "RSM", fileName2); + bool foundSmspec1 = checkFileName(rootName1, "SMSPEC", fileName1); + + if ((foundRsm2) && (foundSmspec1)) { + + ESmry smry2(fileName1, loadBaseRunData); + smry2.loadData(); + std::cout << "\nLoading summary file " << fileName1 << " .... done" << std::endl; + namespace fs = std::filesystem; std::string rsm_file = rootName2 + ".RSM"; if (fs::is_regular_file(fs::path(rsm_file))) { std::cout << "\nLoading RSM file " << rsm_file << " .... " << std::flush; auto rsm = ERsm(rsm_file); std::cout << " done " << std::endl << std::flush;; - + std::cout << "\nComparing RSM file against SMRY file .... " << std::flush; - + if (!cmp(smry2, rsm)) HANDLE_ERROR(std::runtime_error, "The RSM file did not compare equal to the summary file"); - + std::cout << " done " << std::endl << std::flush;; } } else { - std::cout << "\n!Warning, summary files not found, hence not compared. \n" << std::endl; + std::cout << "\n!Warning, summary and/or RSM - file not found, hence not compared. \n" << std::endl; } - } diff --git a/test_util/EclRegressionTest.hpp b/test_util/EclRegressionTest.hpp index 69d388314..5b93f938e 100644 --- a/test_util/EclRegressionTest.hpp +++ b/test_util/EclRegressionTest.hpp @@ -98,6 +98,7 @@ public: void results_rst(); void results_init(); void results_smry(); + void results_rsm(); void results_rft(); private: diff --git a/test_util/compareECL.cpp b/test_util/compareECL.cpp index 14a185fcb..ed5247515 100644 --- a/test_util/compareECL.cpp +++ b/test_util/compareECL.cpp @@ -49,6 +49,7 @@ static void printHelp() { << " -t INIT \t Compare two initial files (.INIT).\n" << " -t RFT \t Compare two RFT files (.RFT).\n" << " -t SMRY \t Compare two cases consistent of (unified) summary files.\n" + << " -t RSM \t Compare RSM file agaist a summary file.\n" << "-x Allow extra keywords in case number 2. These additional keywords (not found in case number1) will be ignored in the comparison.\n" << "\nExample usage of the program: \n\n" << "compareECL -k PRESSURE 1e-3 1e-5\n" @@ -229,6 +230,8 @@ int main(int argc, char** argv) { comparator.results_rst(); } else if (fileTypeString == "SMRY") { comparator.results_smry(); + } else if (fileTypeString == "RSM") { + comparator.results_rsm(); } else if (fileTypeString == "RFT") { comparator.results_rft(); } else { @@ -244,6 +247,7 @@ int main(int argc, char** argv) { comparator.results_init(); comparator.results_rst(); comparator.results_smry(); + comparator.results_rsm(); comparator.results_rft(); }