From f8e793a21a2dc548b7e45158bc4d318c81fce652 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 2 Apr 2020 09:26:13 +0200 Subject: [PATCH 1/2] ESmry: remove unused member seqTime --- opm/io/eclipse/ESmry.hpp | 3 --- src/opm/io/eclipse/ESmry.cpp | 3 --- 2 files changed, 6 deletions(-) diff --git a/opm/io/eclipse/ESmry.hpp b/opm/io/eclipse/ESmry.hpp index de033cd79..768e9f92c 100644 --- a/opm/io/eclipse/ESmry.hpp +++ b/opm/io/eclipse/ESmry.hpp @@ -72,9 +72,6 @@ private: std::unordered_map kwunits; std::vector seqIndex; - std::vector seqTime; - - // start of simulation year, month, day, hr, min, microsec*1000000 std::vector startdat; std::vector checkForMultipleResultFiles(const Opm::filesystem::path& rootN, bool formatted) const; diff --git a/src/opm/io/eclipse/ESmry.cpp b/src/opm/io/eclipse/ESmry.cpp index 6203ee2f0..17e101f03 100644 --- a/src/opm/io/eclipse/ESmry.cpp +++ b/src/opm/io/eclipse/ESmry.cpp @@ -346,7 +346,6 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) : time = tmpData[0]; if (time == 0.0) { - seqTime.push_back(time); seqIndex.push_back(step); } @@ -356,12 +355,10 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData) : if (std::get<0>(arraySourceList[i]) == "SEQHDR") { i++; reportStepNumber++; - seqTime.push_back(time); seqIndex.push_back(step); } } else { reportStepNumber++; - seqTime.push_back(time); seqIndex.push_back(step); } From 33ecf4215d92ccb1e91e58bf9a4e16c2852d3db2 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 2 Apr 2020 09:35:59 +0200 Subject: [PATCH 2/2] ESmry: use templated function rstep_vector() --- opm/io/eclipse/ESmry.hpp | 13 +++++++++++++ src/opm/io/eclipse/ESmry.cpp | 11 +---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/opm/io/eclipse/ESmry.hpp b/opm/io/eclipse/ESmry.hpp index 768e9f92c..54eb709a5 100644 --- a/opm/io/eclipse/ESmry.hpp +++ b/opm/io/eclipse/ESmry.hpp @@ -88,6 +88,19 @@ private: std::string lookupKey(const SummaryNode&) const; void write_block(std::ostream &, const std::vector&) const; + + + template + std::vector rstep_vector(const std::vector& full_vector) const { + std::vector rstep_vector; + rstep_vector.reserve(seqIndex.size()); + + for (const auto& ind : seqIndex){ + rstep_vector.push_back(full_vector[ind]); + } + + return rstep_vector; + } }; }} // namespace Opm::EclIO diff --git a/src/opm/io/eclipse/ESmry.cpp b/src/opm/io/eclipse/ESmry.cpp index 17e101f03..7d9af0213 100644 --- a/src/opm/io/eclipse/ESmry.cpp +++ b/src/opm/io/eclipse/ESmry.cpp @@ -565,16 +565,7 @@ const std::vector& ESmry::get(const std::string& name) const std::vector ESmry::get_at_rstep(const std::string& name) const { - const std::vector full_vector= this->get(name); - - std::vector rstep_vector; - rstep_vector.reserve(seqIndex.size()); - - for (const auto& ind : seqIndex){ - rstep_vector.push_back(full_vector[ind]); - } - - return rstep_vector; + return this->rstep_vector( this->get(name) ); } int ESmry::timestepIdxAtReportstepStart(const int reportStep) const