From 9fc34430501c55daa781e67cc3d68e6467f571a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 3 Oct 2017 16:03:34 +0200 Subject: [PATCH] #1960 Use set<> to check if a timestep is already present instead of linear search --- .../FileInterface/RifEclipseOutputFileTools.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp index 9a8c669959..cd6902760c 100644 --- a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -122,7 +122,10 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vectorclear(); + daysSinceSimulationStart->clear(); // Get the number of occurrences of the INTEHEAD keyword int numINTEHEAD = ecl_file_get_num_named_kw(ecl_file, INTEHEAD_KW); @@ -145,6 +148,8 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector existingTimesteps; + for (int i = 0; i < numINTEHEAD; i++) { ecl_kw_type* kwINTEHEAD = ecl_file_iget_named_kw(ecl_file, INTEHEAD_KW, i); @@ -162,8 +167,7 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vectorbegin(), timeSteps->end(), reportDateTime) == timeSteps->end()) + if (existingTimesteps.insert(reportDateTime).second) { timeSteps->push_back(reportDateTime); daysSinceSimulationStart->push_back(dayValue);