Merge pull request #1838 from joakim-hove/schedule-restart-group
Schedule restart group
This commit is contained in:
commit
c07aec9c68
@ -202,6 +202,7 @@ namespace Opm
|
||||
std::vector<std::string> groupNames(size_t timeStep) const;
|
||||
std::vector<std::string> groupNames(const std::string& pattern) const;
|
||||
std::vector<std::string> groupNames() const;
|
||||
std::vector<const Group*> restart_groups(size_t timeStep) const;
|
||||
|
||||
void updateWell(std::shared_ptr<Well> well, size_t reportStep);
|
||||
std::vector<std::string> changed_wells(size_t reportStep) const;
|
||||
|
@ -2681,6 +2681,19 @@ void Schedule::invalidNamePattern( const std::string& namePattern, std::size_t
|
||||
return names;
|
||||
}
|
||||
|
||||
std::vector<const Group*> Schedule::restart_groups(std::size_t timeStep) const {
|
||||
std::vector<const Group*> rst_groups( this->numGroups(timeStep), nullptr );
|
||||
for (const auto& group_name : this->groupNames(timeStep)) {
|
||||
const auto& group = this->getGroup(group_name, timeStep);
|
||||
|
||||
if (group.name() == "FIELD")
|
||||
rst_groups.back() = &group;
|
||||
else
|
||||
rst_groups[group.insert_index() - 1] = &group;
|
||||
}
|
||||
return rst_groups;
|
||||
}
|
||||
|
||||
|
||||
void Schedule::addGroup(const std::string& groupName, size_t timeStep, const UnitSystem& unit_system) {
|
||||
const size_t gseqIndex = this->groups.size();
|
||||
|
@ -391,6 +391,16 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrdered) {
|
||||
BOOST_CHECK_EQUAL( "CG", group_names[1]);
|
||||
BOOST_CHECK_EQUAL( "BG", group_names[2]);
|
||||
BOOST_CHECK_EQUAL( "AG", group_names[3]);
|
||||
|
||||
auto restart_groups = schedule.restart_groups(0);
|
||||
BOOST_REQUIRE_EQUAL(restart_groups.size(), 4);
|
||||
for (std::size_t group_index = 0; group_index < restart_groups.size() - 1; group_index++) {
|
||||
const auto& group_ptr = restart_groups[group_index];
|
||||
BOOST_CHECK_EQUAL(group_ptr->insert_index(), group_index + 1);
|
||||
}
|
||||
const auto& field_ptr = restart_groups.back();
|
||||
BOOST_CHECK_EQUAL(field_ptr->insert_index(), 0);
|
||||
BOOST_CHECK_EQUAL(field_ptr->name(), "FIELD");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user