From c8546eb7e7d95b43c5874b8068ac198313a78e61 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Jan 2018 08:44:30 +0100 Subject: [PATCH 1/3] #2241 : Improve robustness when reading report numbers from libecl --- ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index f9e0714f78..3bfababb90 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -2108,6 +2108,9 @@ std::vector RifReaderEclipseOutput::createFilteredTimeSt m_dynamicResultsAccess->timeSteps(&timeStepsOnFile, &daysSinceSimulationStartOnFile); reportNumbersOnFile = m_dynamicResultsAccess->reportNumbers(); + if (timeStepsOnFile.size() != daysSinceSimulationStartOnFile.size()) return timeStepInfos; + if (timeStepsOnFile.size() != reportNumbersOnFile.size()) return timeStepInfos; + for (size_t i = 0; i < timeStepsOnFile.size(); i++) { if (this->isTimeStepIncludedByFilter(i)) From 9cc090256d568ac1c1d3c28b81657367cefc4e1c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Jan 2018 08:46:28 +0100 Subject: [PATCH 2/3] #2241 : Do not skip report numbers with -1 --- .../FileInterface/RifEclipseRestartFilesetAccess.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index ae372b569d..02265f0c5a 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -321,10 +321,7 @@ std::vector RifEclipseRestartFilesetAccess::reportNumbers() { const char* fileName = ecl_file_get_src_file(m_ecl_files[i]); int reportNumber = ecl_util_filename_report_nr(fileName); - if (reportNumber != -1) - { - reportNr.push_back(reportNumber); - } + reportNr.push_back(reportNumber); } } From b59734160c4abb464aec21dc16583c8b1bd0e2b3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Jan 2018 08:47:23 +0100 Subject: [PATCH 3/3] Use range based for --- .../FileInterface/RifEclipseRestartFilesetAccess.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp index 02265f0c5a..84fbe522ec 100644 --- a/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp +++ b/ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp @@ -315,11 +315,11 @@ std::vector RifEclipseRestartFilesetAccess::reportNumbers() { std::vector reportNr; - for (size_t i = 0; i < m_ecl_files.size(); i++) + for (const auto* ecl_file : m_ecl_files) { - if (m_ecl_files[i]) + if (ecl_file) { - const char* fileName = ecl_file_get_src_file(m_ecl_files[i]); + const char* fileName = ecl_file_get_src_file(ecl_file); int reportNumber = ecl_util_filename_report_nr(fileName); reportNr.push_back(reportNumber); }