mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Make unique_ptr instantiation exception safe for the kids in readDeck.
This commit is contained in:
parent
322bc8d9cc
commit
2b557a42ff
@ -186,7 +186,7 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
|
|||||||
if (!deck)
|
if (!deck)
|
||||||
{
|
{
|
||||||
Opm::Parser parser;
|
Opm::Parser parser;
|
||||||
deck.reset( new Opm::Deck( parser.parseFile(deckFilename , *parseContext, *errorGuard)));
|
deck = std::make_unique<Opm::Deck>( parser.parseFile(deckFilename , *parseContext, *errorGuard));
|
||||||
Opm::MissingFeatures::checkKeywords(*deck, *parseContext, *errorGuard);
|
Opm::MissingFeatures::checkKeywords(*deck, *parseContext, *errorGuard);
|
||||||
if ( checkDeck )
|
if ( checkDeck )
|
||||||
Opm::checkDeck(*deck, parser, *parseContext, *errorGuard);
|
Opm::checkDeck(*deck, parser, *parseContext, *errorGuard);
|
||||||
@ -194,9 +194,9 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
|
|||||||
|
|
||||||
if (!eclipseState) {
|
if (!eclipseState) {
|
||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
eclipseState.reset(new Opm::ParallelEclipseState(*deck));
|
eclipseState = std::make_unique<Opm::ParallelEclipseState>(*deck);
|
||||||
#else
|
#else
|
||||||
eclipseState.reset(new Opm::EclipseState(*deck));
|
eclipseState = std::make_unique<Opm::EclipseState>(*deck);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -211,15 +211,15 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
|
|||||||
Opm::EclIO::ERst rst_file(rst_filename);
|
Opm::EclIO::ERst rst_file(rst_filename);
|
||||||
const auto& rst_state = Opm::RestartIO::RstState::load(rst_file, report_step);
|
const auto& rst_state = Opm::RestartIO::RstState::load(rst_file, report_step);
|
||||||
if (!schedule)
|
if (!schedule)
|
||||||
schedule.reset(new Opm::Schedule(*deck, *eclipseState, *parseContext, *errorGuard, python, &rst_state) );
|
schedule = std::make_unique<Opm::Schedule>(*deck, *eclipseState, *parseContext, *errorGuard, python, &rst_state);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!schedule)
|
if (!schedule)
|
||||||
schedule.reset(new Opm::Schedule(*deck, *eclipseState, *parseContext, *errorGuard, python));
|
schedule = std::make_unique<Opm::Schedule>(*deck, *eclipseState, *parseContext, *errorGuard, python);
|
||||||
}
|
}
|
||||||
setupMessageLimiter(schedule->getMessageLimits(), "STDOUT_LOGGER");
|
setupMessageLimiter(schedule->getMessageLimits(), "STDOUT_LOGGER");
|
||||||
if (!summaryConfig)
|
if (!summaryConfig)
|
||||||
summaryConfig.reset( new Opm::SummaryConfig(*deck, *schedule, eclipseState->getTableManager(), *parseContext, *errorGuard));
|
summaryConfig = std::make_unique<Opm::SummaryConfig>(*deck, *schedule, eclipseState->getTableManager(), *parseContext, *errorGuard);
|
||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
parseSuccess = 1;
|
parseSuccess = 1;
|
||||||
#endif
|
#endif
|
||||||
@ -232,11 +232,11 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
|
|||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
else {
|
else {
|
||||||
if (!summaryConfig)
|
if (!summaryConfig)
|
||||||
summaryConfig.reset(new Opm::SummaryConfig);
|
summaryConfig = std::make_unique<Opm::SummaryConfig>();
|
||||||
if (!schedule)
|
if (!schedule)
|
||||||
schedule.reset(new Opm::Schedule(python));
|
schedule = std::make_unique<Opm::Schedule>(python);
|
||||||
if (!eclipseState)
|
if (!eclipseState)
|
||||||
eclipseState.reset(new Opm::ParallelEclipseState);
|
eclipseState = std::make_unique<Opm::ParallelEclipseState>();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto comm = Dune::MPIHelper::getCollectiveCommunication();
|
auto comm = Dune::MPIHelper::getCollectiveCommunication();
|
||||||
|
Loading…
Reference in New Issue
Block a user