Using OrderedMap as container for groups
This commit is contained in:
@@ -120,7 +120,7 @@ namespace Opm
|
||||
private:
|
||||
TimeMap m_timeMap;
|
||||
OrderedMap< Well > m_wells;
|
||||
std::map<std::string, Group > m_groups;
|
||||
OrderedMap< Group > m_groups;
|
||||
DynamicState< GroupTree > m_rootGroupTree;
|
||||
DynamicState< OilVaporizationProperties > m_oilvaporizationproperties;
|
||||
Events m_events;
|
||||
|
||||
@@ -1542,7 +1542,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
void Schedule::addGroup(const std::string& groupName, size_t timeStep) {
|
||||
m_groups.emplace( groupName, Group { groupName, m_timeMap, timeStep } );
|
||||
m_groups.insert( groupName, Group { groupName, m_timeMap, timeStep } );
|
||||
m_events.addEvent( ScheduleEvents::NEW_GROUP , timeStep );
|
||||
}
|
||||
|
||||
@@ -1551,7 +1551,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
bool Schedule::hasGroup(const std::string& groupName) const {
|
||||
return m_groups.find(groupName) != m_groups.end();
|
||||
return m_groups.hasKey(groupName);
|
||||
}
|
||||
|
||||
|
||||
@@ -1565,8 +1565,8 @@ namespace Opm {
|
||||
std::vector< const Group* > Schedule::getGroups() const {
|
||||
std::vector< const Group* > groups;
|
||||
|
||||
for( const auto& itr : m_groups )
|
||||
groups.push_back( &itr.second );
|
||||
for( const auto& group : m_groups )
|
||||
groups.push_back( &group );
|
||||
|
||||
return groups;
|
||||
}
|
||||
|
||||
@@ -153,9 +153,9 @@ static Deck createDeckWithWellsOrdered() {
|
||||
"10 MAI 2007 / \n"
|
||||
"SCHEDULE\n"
|
||||
"WELSPECS\n"
|
||||
" \'CW_1\' \'OP\' 30 37 3.33 \'OIL\' 7* / \n"
|
||||
" \'BW_2\' \'OP\' 30 37 3.33 \'OIL\' 7* / \n"
|
||||
" \'AW_3\' \'OP\' 20 51 3.92 \'OIL\' 7* / \n"
|
||||
" \'CW_1\' \'CG\' 30 37 3.33 \'OIL\' 7* / \n"
|
||||
" \'BW_2\' \'BG\' 30 37 3.33 \'OIL\' 7* / \n"
|
||||
" \'AW_3\' \'AG\' 20 51 3.92 \'OIL\' 7* / \n"
|
||||
"/\n";
|
||||
|
||||
return parser.parseString(input, ParseContext());
|
||||
@@ -238,6 +238,12 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrdered) {
|
||||
BOOST_CHECK_EQUAL( "CW_1" , wells[0]->name());
|
||||
BOOST_CHECK_EQUAL( "BW_2" , wells[1]->name());
|
||||
BOOST_CHECK_EQUAL( "AW_3" , wells[2]->name());
|
||||
|
||||
auto groups = schedule.getGroups();
|
||||
// groups[0] is 'FIELD'
|
||||
BOOST_CHECK_EQUAL( "CG", groups[1]->name());
|
||||
BOOST_CHECK_EQUAL( "BG", groups[2]->name());
|
||||
BOOST_CHECK_EQUAL( "AG", groups[3]->name());
|
||||
}
|
||||
|
||||
bool has_well( const std::vector<const Well*> wells, const std::string& well_name);
|
||||
|
||||
Reference in New Issue
Block a user