From 9a12c4566c3af17e3f2f26bd3db616514d0113d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Spjelkavik?= Date: Tue, 3 Jan 2012 09:57:41 +0100 Subject: [PATCH] Use flat vector for TSTEP, implement convertToSI(). --- opm/core/eclipse/SpecialEclipseFields.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/opm/core/eclipse/SpecialEclipseFields.hpp b/opm/core/eclipse/SpecialEclipseFields.hpp index 387310ec..1990f824 100644 --- a/opm/core/eclipse/SpecialEclipseFields.hpp +++ b/opm/core/eclipse/SpecialEclipseFields.hpp @@ -1410,7 +1410,7 @@ struct PVCDO : public SpecialBase struct TSTEP : public SpecialBase { - std::vector > tstep_; + std::vector tstep_; virtual std::string name() const {return std::string("TSTEP");} @@ -1419,22 +1419,24 @@ struct TSTEP : public SpecialBase std::vector tstep; readVectorData(is, tstep); if (!tstep.empty()) { - tstep_.push_back(tstep); + tstep_.insert(tstep_.end(), tstep.begin(), tstep.end()); } } virtual void write(std::ostream& os) const { os << name() << '\n'; - for (int i=0; i<(int)tstep_.size(); ++i) { - copy(tstep_[i].begin(), tstep_[i].end(), - std::ostream_iterator(os, " ")); - os << '\n'; - } + copy(tstep_.begin(), tstep_.end(), + std::ostream_iterator(os, " ")); + os << '\n'; } virtual void convertToSI(const EclipseUnits& units) { + int num_steps = tstep_.size(); + for (int i = 0; i < num_steps; ++i) { + tstep_[i] *= units.time; + } } };