diff --git a/opm/io/eclipse/ESmry.hpp b/opm/io/eclipse/ESmry.hpp index de033cd79..54eb709a5 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; @@ -91,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 6203ee2f0..7d9af0213 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); } @@ -568,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