ESmry: use templated function rstep_vector()

This commit is contained in:
Joakim Hove 2020-04-02 09:35:59 +02:00
parent f8e793a21a
commit 33ecf4215d
2 changed files with 14 additions and 10 deletions

View File

@ -88,6 +88,19 @@ private:
std::string lookupKey(const SummaryNode&) const;
void write_block(std::ostream &, const std::vector<SummaryNode>&) const;
template <typename T>
std::vector<T> rstep_vector(const std::vector<T>& full_vector) const {
std::vector<T> 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

View File

@ -565,16 +565,7 @@ const std::vector<float>& ESmry::get(const std::string& name) const
std::vector<float> ESmry::get_at_rstep(const std::string& name) const
{
const std::vector<float> full_vector= this->get(name);
std::vector<float> 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