Chase Restart Loading API Change

This commit is contained in:
Bård Skaflestad 2021-06-25 09:11:09 +02:00
parent 0dcd91ac93
commit 704c33f08f

View File

@ -36,6 +36,8 @@
#include <opm/io/eclipse/EclIOdata.hpp> #include <opm/io/eclipse/EclIOdata.hpp>
#include <opm/output/eclipse/RestartIO.hpp> #include <opm/output/eclipse/RestartIO.hpp>
#include <opm/io/eclipse/ERst.hpp>
#include <opm/io/eclipse/RestartFileView.hpp>
#include <opm/io/eclipse/rst/state.hpp> #include <opm/io/eclipse/rst/state.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
@ -58,6 +60,8 @@
#include <fmt/format.h> #include <fmt/format.h>
#include <cstdlib> #include <cstdlib>
#include <memory>
#include <utility>
namespace Opm namespace Opm
{ {
@ -232,10 +236,11 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
*/ */
const auto& init_config = eclipseState->getInitConfig(); const auto& init_config = eclipseState->getInitConfig();
if (init_config.restartRequested() && initFromRestart) { if (init_config.restartRequested() && initFromRestart) {
int report_step = init_config.getRestartStep(); const int report_step = init_config.getRestartStep();
const auto& rst_filename = eclipseState->getIOConfig().getRestartFileName( init_config.getRestartRootName(), report_step, false ); const auto rst_filename = eclipseState->getIOConfig().getRestartFileName( init_config.getRestartRootName(), report_step, false );
Opm::EclIO::ERst rst_file(rst_filename); auto rst_file = std::make_shared<EclIO::ERst>(rst_filename);
const auto& rst_state = Opm::RestartIO::RstState::load(rst_file, report_step); auto rst_view = std::make_shared<EclIO::RestartFileView>(std::move(rst_file), report_step);
const auto rst_state = Opm::RestartIO::RstState::load(std::move(rst_view));
if (!schedule) if (!schedule)
schedule = std::make_unique<Opm::Schedule>(*deck, *eclipseState, *parseContext, *errorGuard, python, outputInterval, &rst_state); schedule = std::make_unique<Opm::Schedule>(*deck, *eclipseState, *parseContext, *errorGuard, python, outputInterval, &rst_state);
} }