diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index c68be31c6..51887b6ef 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -73,7 +73,7 @@ namespace Opm { m_rootGroupTree( this->m_timeMap, GroupTree{} ), m_oilvaporizationproperties( this->m_timeMap, OilVaporizationProperties{} ), m_events( this->m_timeMap ), - m_modifierDeck( this->m_timeMap, nullptr ), + m_modifierDeck( this->m_timeMap, Deck{} ), m_tuning( this->m_timeMap ), m_messageLimits( this->m_timeMap ), m_phases(phases) @@ -237,18 +237,8 @@ namespace Opm { else if (geoModifiers.find( keyword.name() ) != geoModifiers.end()) { bool supported = geoModifiers.at( keyword.name() ); if (supported) { - /* - If the deck stored at currentStep is a null pointer (i.e. evaluates - to false) we must first create a new deck and install that under - index currentstep; then we fetch the deck (newly created - or old) - from the container and add the keyword. - */ - if (!m_modifierDeck.iget(currentStep)) - m_modifierDeck.iset( currentStep , std::make_shared( )); - - m_modifierDeck.iget( currentStep )->addKeyword( keyword ); + this->m_modifierDeck[ currentStep ].addKeyword( keyword ); m_events.addEvent( ScheduleEvents::GEO_MODIFIER , currentStep); - } else { std::string msg = "OPM does not support grid property modifier " + keyword.name() + " in the Schedule section. Error at report: " + std::to_string( currentStep ); parseContext.handleError( ParseContext::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , m_messages, msg ); @@ -1577,7 +1567,7 @@ namespace Opm { return this->m_tuning; } - std::shared_ptr Schedule::getModifierDeck(size_t timeStep) const { + const Deck& Schedule::getModifierDeck(size_t timeStep) const { return m_modifierDeck.iget( timeStep ); } diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index e27e6e387..a9b5ddc32 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -87,7 +87,7 @@ namespace Opm const Events& getEvents() const; bool hasOilVaporizationProperties(); - std::shared_ptr getModifierDeck(size_t timeStep) const; + const Deck& getModifierDeck(size_t timeStep) const; const MessageContainer& getMessageContainer() const; MessageContainer& getMessageContainer(); @@ -99,7 +99,7 @@ namespace Opm DynamicState< GroupTree > m_rootGroupTree; DynamicState< OilVaporizationProperties > m_oilvaporizationproperties; Events m_events; - DynamicVector > m_modifierDeck; + DynamicVector< Deck > m_modifierDeck; Tuning m_tuning; MessageLimits m_messageLimits; Phases m_phases; diff --git a/opm/parser/eclipse/EclipseState/Schedule/tests/GeomodifierTests.cpp b/opm/parser/eclipse/EclipseState/Schedule/tests/GeomodifierTests.cpp index 743d64b9c..0648d136c 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/tests/GeomodifierTests.cpp +++ b/opm/parser/eclipse/EclipseState/Schedule/tests/GeomodifierTests.cpp @@ -84,21 +84,21 @@ BOOST_AUTO_TEST_CASE( CheckUnsoppertedInSCHEDULE ) { BOOST_CHECK_EQUAL( false , events.hasEvent( ScheduleEvents::GEO_MODIFIER , 3 )); - BOOST_CHECK( !schedule.getModifierDeck(1) ); - BOOST_CHECK( !schedule.getModifierDeck(3) ); + BOOST_CHECK_EQUAL( 0U, schedule.getModifierDeck(1).size() ); + BOOST_CHECK_EQUAL( 0U, schedule.getModifierDeck(3).size() ); - std::shared_ptr multflt_deck = schedule.getModifierDeck(2); - BOOST_CHECK_EQUAL( 2U , multflt_deck->size()); - BOOST_CHECK( multflt_deck->hasKeyword() ); + const Deck& multflt_deck = schedule.getModifierDeck(2); + BOOST_CHECK_EQUAL( 2U , multflt_deck.size()); + BOOST_CHECK( multflt_deck.hasKeyword() ); - const auto& multflt1 = multflt_deck->getKeyword(0); + const auto& multflt1 = multflt_deck.getKeyword(0); BOOST_CHECK_EQUAL( 1U , multflt1.size( ) ); const auto& record0 = multflt1.getRecord( 0 ); BOOST_CHECK_EQUAL( 100.0 , record0.getItem().get< double >(0)); BOOST_CHECK_EQUAL( "F1" , record0.getItem().get< std::string >(0)); - const auto& multflt2 = multflt_deck->getKeyword(1); + const auto& multflt2 = multflt_deck.getKeyword(1); BOOST_CHECK_EQUAL( 1U , multflt2.size( ) ); const auto& record1 = multflt2.getRecord( 0 ); diff --git a/opm/parser/eclipse/IntegrationTests/TransMultIntegrationTests.cpp b/opm/parser/eclipse/IntegrationTests/TransMultIntegrationTests.cpp index 60600b1db..8c3653198 100644 --- a/opm/parser/eclipse/IntegrationTests/TransMultIntegrationTests.cpp +++ b/opm/parser/eclipse/IntegrationTests/TransMultIntegrationTests.cpp @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(MULTFLT_IN_SCHEDULE) { BOOST_CHECK( events.hasEvent( ScheduleEvents::GEO_MODIFIER , 3 ) ); { const auto& mini_deck = schedule.getModifierDeck(3); - state.applyModifierDeck( *mini_deck ); + state.applyModifierDeck( mini_deck ); } BOOST_CHECK_EQUAL( 2.00 , trans.getMultiplier( 2,2,0,FaceDir::XPlus )); BOOST_CHECK_EQUAL( 0.10 , trans.getMultiplier( 3,2,0,FaceDir::XPlus ));