diff --git a/opm/parser/eclipse/EclipseState/Schedule/ScheduleState.hpp b/opm/parser/eclipse/EclipseState/Schedule/ScheduleState.hpp index 225efa1a6..fbad38bb6 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/ScheduleState.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/ScheduleState.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -134,6 +135,10 @@ namespace Opm { const UDQActive& udq_active() const; void udq_active(UDQActive udq_active); + const WellOrder& well_order() const; + void well_order(const std::string& well); + void well_order(WellOrder well_order); + template void serializeOp(Serializer& serializer) { serializer(m_start_time); @@ -146,6 +151,7 @@ namespace Opm { m_wellgroup_events.serializeOp(serializer); serializer.vector(m_geo_keywords); m_message_limits.serializeOp(serializer); + serializer(m_well_order); serializer(m_whistctl_mode); serializer(m_wtest_config); serializer(m_gconsale); @@ -173,6 +179,7 @@ namespace Opm { std::vector m_geo_keywords; MessageLimits m_message_limits; Well::ProducerCMode m_whistctl_mode = Well::ProducerCMode::CMODE_UNDEFINED; + std::shared_ptr m_well_order; std::shared_ptr m_wtest_config; std::shared_ptr m_gconsale; std::shared_ptr m_gconsump; diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/WellOrder.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/WellOrder.hpp index 6b6b5ea5f..ef26295a9 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/WellOrder.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/WellOrder.hpp @@ -35,7 +35,6 @@ namespace Opm { class WellOrder { public: using Map = std::unordered_map; - using Vector = std::vector; WellOrder() = default; explicit WellOrder(const std::vector& wells); void add(const std::string& well); @@ -43,16 +42,21 @@ public: const std::vector& wells() const; bool has(const std::string& wname) const; + template + void serializeOp(Serializer& serializer) { + serializer.template map(m_wells1); + serializer(m_wells2); + } static WellOrder serializeObject(); bool operator==(const WellOrder& other) const; - Vector::const_iterator begin() const; - Vector::const_iterator end() const; + std::vector::const_iterator begin() const; + std::vector::const_iterator end() const; private: Map m_wells1; - Vector m_wells2; + std::vector m_wells2; }; } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 43e78f4a7..70d6c41d2 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -1884,6 +1884,7 @@ void Schedule::create_first(const std::chrono::system_clock::time_point& start_t sched_state.rpt_config( RPTConfig() ); sched_state.actions( Action::Actions() ); sched_state.udq_active( UDQActive() ); + sched_state.well_order( WellOrder() ); this->addGroup("FIELD", 0); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleState.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleState.cpp index 6d0de1ca2..076c2a6d0 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleState.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/ScheduleState.cpp @@ -355,4 +355,18 @@ void ScheduleState::udq_active(UDQActive udq_active) { this->m_udq_active = std::make_shared( std::move(udq_active) ); } +const WellOrder& ScheduleState::well_order() const { + return *this->m_well_order; +} + +void ScheduleState::well_order(WellOrder well_order) { + this->m_well_order = std::make_shared( std::move(well_order) ); +} + +void ScheduleState::well_order(const std::string& well) { + auto well_order = *this->m_well_order; + well_order.add( well ); + this->m_well_order = std::make_shared( std::move(well_order) ); +} + }