diff --git a/opm/simulators/utils/readDeck.cpp b/opm/simulators/utils/readDeck.cpp index 21e87dd64..2b188cc08 100644 --- a/opm/simulators/utils/readDeck.cpp +++ b/opm/simulators/utils/readDeck.cpp @@ -36,6 +36,8 @@ #include #include +#include +#include #include #include @@ -58,6 +60,8 @@ #include #include +#include +#include namespace Opm { @@ -232,10 +236,11 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr& d */ const auto& init_config = eclipseState->getInitConfig(); if (init_config.restartRequested() && initFromRestart) { - int report_step = init_config.getRestartStep(); - const auto& rst_filename = eclipseState->getIOConfig().getRestartFileName( init_config.getRestartRootName(), report_step, false ); - Opm::EclIO::ERst rst_file(rst_filename); - const auto& rst_state = Opm::RestartIO::RstState::load(rst_file, report_step); + const int report_step = init_config.getRestartStep(); + const auto rst_filename = eclipseState->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_state = Opm::RestartIO::RstState::load(std::move(rst_view)); if (!schedule) schedule = std::make_unique(*deck, *eclipseState, *parseContext, *errorGuard, python, outputInterval, &rst_state); }