From 04a44657d60f3f0987129e8a77c54d8f310782b4 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Sat, 4 Sep 2021 19:33:34 +0200 Subject: [PATCH] Add const Runspec& argument to restart loader --- opm/io/eclipse/rst/state.hpp | 2 ++ src/opm/io/eclipse/rst/state.cpp | 1 + tests/msim/test_msim.cpp | 2 +- tests/parser/ScheduleRestartTests.cpp | 4 ++-- tests/parser/ScheduleTests.cpp | 2 +- tests/rst_test.cpp | 2 +- tests/test_AggregateUDQData.cpp | 2 +- tests/test_rst.cpp | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/opm/io/eclipse/rst/state.hpp b/opm/io/eclipse/rst/state.hpp index bebeb9d55..69c132ff6 100644 --- a/opm/io/eclipse/rst/state.hpp +++ b/opm/io/eclipse/rst/state.hpp @@ -32,6 +32,7 @@ #include #include +#include namespace Opm { class EclipseGrid; @@ -48,6 +49,7 @@ struct RstState { const ::Opm::EclipseGrid* grid); static RstState load(std::shared_ptr rstView, + const Runspec& runspec, const ::Opm::EclipseGrid* grid = nullptr); const RstWell& get_well(const std::string& wname) const; diff --git a/src/opm/io/eclipse/rst/state.cpp b/src/opm/io/eclipse/rst/state.cpp index cff33c752..e08be7a54 100644 --- a/src/opm/io/eclipse/rst/state.cpp +++ b/src/opm/io/eclipse/rst/state.cpp @@ -274,6 +274,7 @@ const RstWell& RstState::get_well(const std::string& wname) const { } RstState RstState::load(std::shared_ptr rstView, + const Runspec&, const ::Opm::EclipseGrid* grid) { RstState state(rstView, grid); diff --git a/tests/msim/test_msim.cpp b/tests/msim/test_msim.cpp index 00d82d2aa..64fcf001a 100644 --- a/tests/msim/test_msim.cpp +++ b/tests/msim/test_msim.cpp @@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE(RUN) { const int report_step = 50; auto rst_view = std::make_shared(std::move(rst), report_step); - const auto rst_state = Opm::RestartIO::RstState::load(std::move(rst_view)); + const auto rst_state = Opm::RestartIO::RstState::load(std::move(rst_view), state.runspec()); Schedule sched_rst(deck, state, python, {}, &rst_state); const auto& rfti_well = sched_rst.getWell("RFTI", report_step); const auto& rftp_well = sched_rst.getWell("RFTP", report_step); diff --git a/tests/parser/ScheduleRestartTests.cpp b/tests/parser/ScheduleRestartTests.cpp index e44b41137..fb8c6fdd7 100644 --- a/tests/parser/ScheduleRestartTests.cpp +++ b/tests/parser/ScheduleRestartTests.cpp @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(LoadRST) { auto deck = parser.parseFile("SPE1CASE2.DATA"); auto rst_file = std::make_shared("SPE1CASE2.X0060"); auto rst_view = std::make_shared(std::move(rst_file), 60); - auto rst_state = RestartIO::RstState::load(std::move(rst_view)); + auto rst_state = RestartIO::RstState::load(std::move(rst_view), Runspec{}); BOOST_REQUIRE_THROW( rst_state.get_well("NO_SUCH_WELL"), std::out_of_range); auto python = std::make_shared(); EclipseState ecl_state(deck); @@ -107,7 +107,7 @@ std::pair load_schedule_pair(const std::string& base_deck, auto restart_deck = parser.parseFile(rst_deck); auto rst_file = std::make_shared(rst_fname); auto rst_view = std::make_shared(std::move(rst_file), restart_step); - auto rst_state = RestartIO::RstState::load(std::move(rst_view)); + auto rst_state = RestartIO::RstState::load(std::move(rst_view), ecl_state.runspec()); EclipseState ecl_state_restart(restart_deck); Schedule restart_sched(restart_deck, ecl_state_restart, python, {}, &rst_state); diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index c56cd2155..523786009 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -3618,7 +3618,7 @@ BOOST_AUTO_TEST_CASE(SKIPREST_VFP) { const auto& rst_filename = es.getIOConfig().getRestartFileName( init_config.getRestartRootName(), report_step, false ); auto rst_file = std::make_shared(rst_filename); auto rst_view = std::make_shared(std::move(rst_file), report_step); - const auto rst = Opm::RestartIO::RstState::load(std::move(rst_view)); + const auto rst = Opm::RestartIO::RstState::load(std::move(rst_view), es.runspec()); const auto sched = Schedule{ deck, es, python , {}, &rst }; BOOST_CHECK_NO_THROW( sched[3].vfpprod(5) ); diff --git a/tests/rst_test.cpp b/tests/rst_test.cpp index a0cd20939..65d1c772b 100644 --- a/tests/rst_test.cpp +++ b/tests/rst_test.cpp @@ -79,7 +79,7 @@ std::pair load_schedule(std::shared_ptr(rst_filename); auto rst_view = std::make_shared(std::move(rst_file), report_step); - const auto rst = Opm::RestartIO::RstState::load(std::move(rst_view)); + const auto rst = Opm::RestartIO::RstState::load(std::move(rst_view), state.runspec()); return { std::piecewise_construct, std::forward_as_tuple(state), diff --git a/tests/test_AggregateUDQData.cpp b/tests/test_AggregateUDQData.cpp index 1e2206a10..ef6dea89b 100644 --- a/tests/test_AggregateUDQData.cpp +++ b/tests/test_AggregateUDQData.cpp @@ -749,7 +749,7 @@ BOOST_AUTO_TEST_CASE (Declared_UDQ_data) { auto rst_file = std::make_shared("TEST_UDQRST.UNRST"); auto rst_view = std::make_shared(std::move(rst_file), 1); - auto rst_state = Opm::RestartIO::RstState::load(std::move(rst_view)); + auto rst_state = Opm::RestartIO::RstState::load(std::move(rst_view), es.runspec()); BOOST_CHECK_EQUAL(rst_state.header.nwell_udq, 4); BOOST_CHECK_EQUAL(rst_state.header.ngroup_udq, 1); BOOST_CHECK_EQUAL(rst_state.header.nfield_udq, 39); diff --git a/tests/test_rst.cpp b/tests/test_rst.cpp index 37f850454..1eec3833d 100644 --- a/tests/test_rst.cpp +++ b/tests/test_rst.cpp @@ -348,7 +348,7 @@ BOOST_AUTO_TEST_CASE(State_test) { auto rst_file = std::make_shared("TEST_UDQRST.UNRST"); auto rstView = std::make_shared(std::move(rst_file), rptStep); - auto state = Opm::RestartIO::RstState::load(std::move(rstView)); + auto state = Opm::RestartIO::RstState::load(std::move(rstView), simCase.es.runspec()); const auto& well = state.get_well("OP_3"); BOOST_CHECK_THROW(well.segment(10), std::invalid_argument);