Implemented keyword TSTEP

This commit is contained in:
Bjørn Spjelkavik
2012-01-03 09:38:38 +01:00
parent f6146bd8bf
commit 79ba5608c5
3 changed files with 47 additions and 8 deletions

View File

@@ -95,7 +95,7 @@ namespace EclipseKeywords
string("SGOF"), string("SWOF"), string("ROCK"),
string("ROCKTAB"), string("WELSPECS"), string("COMPDAT"),
string("WCONINJE"), string("WCONPROD"), string("WELTARG"),
string("EQUIL"), string("PVCDO"),
string("EQUIL"), string("PVCDO"), string("TSTEP"),
// The following fields only have a dummy implementation
// that allows us to ignore them.
"SWFN",
@@ -111,7 +111,7 @@ namespace EclipseKeywords
string("NSTACK"), string("SATNUM"),
string("RPTRST"), string("ROIP"), string("RWIP"),
string("RWSAT"), string("RPR"), string("WBHP"),
string("WOIR"), string("TSTEP"), string("BOX"),
string("WOIR"), string("BOX"),
string("COORDSYS"), string("PBVD")
};
const int num_ignore_with_data = sizeof(ignore_with_data) / sizeof(ignore_with_data[0]);
@@ -249,12 +249,20 @@ void EclipseGridParser::readImpl(istream& is)
readVectorData(is, floatmap[keyword]);
break;
case SpecialField: {
std::tr1::shared_ptr<SpecialBase> sb_ptr = createSpecialField(is, keyword);
if (sb_ptr) {
specialmap[keyword] = sb_ptr;
} else {
THROW("Could not create field " << keyword);
}
map<string, std::tr1::shared_ptr<SpecialBase> >::iterator pos =
specialmap.find(keyword);
if (pos == specialmap.end()) {
std::tr1::shared_ptr<SpecialBase> sb_ptr =
createSpecialField(is, keyword);
if (sb_ptr) {
specialmap[keyword] = sb_ptr;
} else {
THROW("Could not create field " << keyword);
}
} else {
std::tr1::shared_ptr<SpecialBase> sb_ptr = pos->second;
sb_ptr->read(is);
}
break;
}
case IgnoreWithData: {

View File

@@ -142,6 +142,7 @@ public:
SPECIAL_FIELD(WELTARG);
SPECIAL_FIELD(EQUIL);
SPECIAL_FIELD(PVCDO);
SPECIAL_FIELD(TSTEP);
// The following fields only have a dummy implementation
// that allows us to ignore them.

View File

@@ -1408,6 +1408,36 @@ struct PVCDO : public SpecialBase
}
};
struct TSTEP : public SpecialBase
{
std::vector<std::vector<double> > tstep_;
virtual std::string name() const {return std::string("TSTEP");}
virtual void read(std::istream& is)
{
std::vector<double> tstep;
readVectorData(is, tstep);
if (!tstep.empty()) {
tstep_.push_back(tstep);
}
}
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<double>(os, " "));
os << '\n';
}
}
virtual void convertToSI(const EclipseUnits& units)
{
}
};
struct MultRec : public SpecialBase
{
virtual void read(std::istream& is)