diff --git a/opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp b/opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp index f75a80dc5..ce24736a9 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp @@ -34,6 +34,11 @@ namespace Opm { +namespace RestartIO { +class RstGroup; +} + + class SummaryState; class UDQConfig; class UDQActive; @@ -215,6 +220,7 @@ struct ProductionControls { Group(); Group(const std::string& group_name, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system); + Group(const RestartIO::RstGroup& rst_group, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system); static Group serializeObject(); diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 8e6e63936..cbb938f24 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -400,6 +400,7 @@ namespace Opm void addGroupToGroup( const std::string& parent_group, const std::string& child_group, std::size_t timeStep); void addGroupToGroup( const std::string& parent_group, const Group& child_group, std::size_t timeStep); void addGroup(const std::string& groupName , std::size_t timeStep, const UnitSystem& unit_system); + void addGroup(const Group& group, std::size_t timeStep); void addWell(const std::string& wellName, const DeckRecord& record, std::size_t timeStep, Connection::Order connection_order, const UnitSystem& unit_system); void checkUnhandledKeywords( const SCHEDULESection& ) const; void checkIfAllConnectionsIsShut(std::size_t currentStep); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp index 1fcd1f6ea..ac79b32f5 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "../eval_uda.hpp" @@ -49,6 +50,12 @@ Group::Group(const std::string& name, std::size_t insert_index_arg, std::size_t this->parent_group = "FIELD"; } +Group::Group(const RestartIO::RstGroup& rst_group, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system_arg) : + Group(rst_group.name, insert_index_arg, init_step_arg, udq_undefined_arg, unit_system_arg) +{ +} + + Group Group::serializeObject() { Group result; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 40c9169c5..e938b9bd0 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -1117,24 +1117,30 @@ namespace { } - void Schedule::addGroup(const std::string& groupName, std::size_t timeStep, const UnitSystem& unit_system) { - const std::size_t insert_index = this->groups.size(); - - groups.insert( std::make_pair( groupName, DynamicState>(this->m_timeMap, nullptr))); - auto group_ptr = std::make_shared(groupName, insert_index, timeStep, this->getUDQConfig(timeStep).params().undefinedValue(), unit_system); - auto& dynamic_state = this->groups.at(groupName); + void Schedule::addGroup(const Group& group, std::size_t timeStep) { + this->groups.insert( std::make_pair( group.name(), DynamicState>(this->m_timeMap, nullptr))); + auto group_ptr = std::make_shared(group); + auto& dynamic_state = this->groups.at(group.name()); dynamic_state.update(timeStep, group_ptr); - m_events.addEvent( ScheduleEvents::NEW_GROUP , timeStep ); - wellgroup_events.insert( std::make_pair(groupName, Events(this->m_timeMap))); - this->addWellGroupEvent(groupName, ScheduleEvents::NEW_GROUP, timeStep); + this->m_events.addEvent( ScheduleEvents::NEW_GROUP , timeStep ); + this->wellgroup_events.insert( std::make_pair(group.name(), Events(this->m_timeMap))); + this->addWellGroupEvent(group.name(), ScheduleEvents::NEW_GROUP, timeStep); // All newly created groups are attached to the field group, // can then be relocated with the GRUPTREE keyword. - if (groupName != "FIELD") + if (group.name() != "FIELD") this->addGroupToGroup("FIELD", *group_ptr, timeStep); } + + void Schedule::addGroup(const std::string& groupName, std::size_t timeStep, const UnitSystem& unit_system) { + const std::size_t insert_index = this->groups.size(); + auto udq_undefined = this->getUDQConfig(timeStep).params().undefinedValue(); + auto group = Group{ groupName, insert_index, timeStep, udq_undefined, unit_system }; + this->addGroup(group, timeStep); + } + std::size_t Schedule::numGroups() const { return groups.size(); }