Added m_groups map to the Schedule container. Contains FIELD by default
This commit is contained in:
parent
a0acac1b4c
commit
176e0af7cc
@ -24,9 +24,10 @@
|
||||
namespace Opm {
|
||||
|
||||
Schedule::Schedule(DeckConstPtr deck) {
|
||||
if (deck->hasKeyword("SCHEDULE"))
|
||||
if (deck->hasKeyword("SCHEDULE")) {
|
||||
addGroup( "FIELD" );
|
||||
initFromDeck(deck);
|
||||
else
|
||||
} else
|
||||
throw std::invalid_argument("Deck does not contain SCHEDULE section.\n");
|
||||
}
|
||||
|
||||
@ -37,7 +38,7 @@ namespace Opm {
|
||||
startDate = TimeMap::dateFromEclipse(startKeyword->getRecord(0));
|
||||
}
|
||||
|
||||
m_timeMap = TimeMapPtr(new TimeMap(startDate));
|
||||
m_timeMap.reset(new TimeMap(startDate));
|
||||
}
|
||||
|
||||
void Schedule::initFromDeck(DeckConstPtr deck) {
|
||||
@ -45,6 +46,7 @@ namespace Opm {
|
||||
iterateScheduleSection(deck);
|
||||
}
|
||||
|
||||
|
||||
void Schedule::iterateScheduleSection(DeckConstPtr deck) {
|
||||
DeckKeywordConstPtr scheduleKeyword = deck->getKeyword("SCHEDULE");
|
||||
size_t deckIndex = scheduleKeyword->getDeckIndex() + 1;
|
||||
@ -194,5 +196,26 @@ namespace Opm {
|
||||
throw std::invalid_argument("Well: " + wellName + " does not exist");
|
||||
}
|
||||
|
||||
void Schedule::addGroup(const std::string& groupName) {
|
||||
GroupPtr group(new Group(groupName, m_timeMap));
|
||||
m_groups[ groupName ] = group;
|
||||
}
|
||||
|
||||
size_t Schedule::numGroups() const {
|
||||
return m_groups.size();
|
||||
}
|
||||
|
||||
bool Schedule::hasGroup(const std::string& groupName) const {
|
||||
return m_groups.find(groupName) != m_groups.end();
|
||||
}
|
||||
|
||||
GroupPtr Schedule::getGroup(const std::string& groupName) const {
|
||||
if (hasGroup(groupName)) {
|
||||
return m_groups.at(groupName);
|
||||
} else
|
||||
throw std::invalid_argument("Group: " + groupName + " does not exist");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@ -43,17 +44,25 @@ namespace Opm
|
||||
size_t numWells() const;
|
||||
bool hasWell(const std::string& wellName) const;
|
||||
WellPtr getWell(const std::string& wellName) const;
|
||||
|
||||
|
||||
size_t numGroups() const;
|
||||
bool hasGroup(const std::string& groupName) const;
|
||||
GroupPtr getGroup(const std::string& groupName) const;
|
||||
|
||||
|
||||
private:
|
||||
TimeMapPtr m_timeMap;
|
||||
std::map<std::string , WellPtr> m_wells;
|
||||
std::map<std::string , GroupPtr> m_groups;
|
||||
|
||||
|
||||
void initFromDeck(DeckConstPtr deck);
|
||||
void createTimeMap(DeckConstPtr deck);
|
||||
void iterateScheduleSection(DeckConstPtr deck);
|
||||
|
||||
void addGroup(const std::string& groupName);
|
||||
void addWell(const std::string& wellName);
|
||||
|
||||
void handleWELSPECS(DeckKeywordConstPtr keyword);
|
||||
void handleWCONProducer(DeckKeywordConstPtr keyword, size_t currentStep, bool isPredictionMode);
|
||||
void handleWCONHIST(DeckKeywordConstPtr keyword , size_t currentStep);
|
||||
|
@ -101,3 +101,14 @@ BOOST_AUTO_TEST_CASE(EmptyScheduleHasNoWells) {
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EmptyScheduleHasFIELDGroup) {
|
||||
DeckPtr deck = createDeck();
|
||||
Schedule schedule(deck);
|
||||
BOOST_CHECK_EQUAL( 1U , schedule.numGroups() );
|
||||
BOOST_CHECK_EQUAL( true , schedule.hasGroup("FIELD") );
|
||||
BOOST_CHECK_EQUAL( false , schedule.hasGroup("GROUP") );
|
||||
BOOST_CHECK_THROW( schedule.getGroup("GROUP") , std::invalid_argument );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -121,3 +121,11 @@ BOOST_AUTO_TEST_CASE( WellTestCOMPDAT ) {
|
||||
BOOST_CHECK_EQUAL( SHUT , completions->get(3)->getState() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//BOOST_AUTO_TEST_CASE( WellTestGroups ) {
|
||||
// ParserPtr parser(new Parser());
|
||||
// boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_GROUPS");
|
||||
// DeckPtr deck = parser->parse(scheduleFile.string());
|
||||
// ScheduleConstPtr sched( new Schedule(deck));
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user