Use std::shared_ptr for Python handle to Schedule

This commit is contained in:
Joakim Hove 2020-03-31 10:40:03 +02:00
parent 4a6814d6bc
commit d6a1d3029e
7 changed files with 9 additions and 7 deletions

View File

@ -630,7 +630,7 @@ private:
Opm::EclipseState* eclState_;
Opm::Schedule* eclSchedule_;
Opm::SummaryConfig* eclSummaryConfig_;
Opm::Python python;
std::shared_ptr<Opm::Python> python = std::make_shared<Opm::Python>();
Dune::EdgeWeightMethod edgeWeightsMethod_;
bool ownersFirst_;

View File

@ -326,7 +326,7 @@ int main(int argc, char** argv)
std::cout << "Reading deck file '" << deckFilename << "'\n";
std::cout.flush();
}
Opm::Python python;
auto python = std::make_shared<Opm::Python>();
std::shared_ptr<Opm::Deck> deck;
std::shared_ptr<Opm::EclipseState> eclipseState;
std::shared_ptr<Opm::Schedule> schedule;

View File

@ -355,7 +355,7 @@ int mainFlow(int argc, char** argv)
std::cout << "Reading deck file '" << deckFilename << "'\n";
std::cout.flush();
}
Opm::Python python;
std::shared_ptr<Opm::Python> python = std::make_shared<Opm::Python>();
std::shared_ptr<Opm::Deck> deck;
std::shared_ptr<Opm::EclipseState> eclipseState;
std::shared_ptr<Opm::Schedule> schedule;

View File

@ -277,7 +277,7 @@ BOOST_AUTO_TEST_CASE( Test_Norne_PVT) {
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
Opm::ErrorGuard errorGuard;
Opm::Parser parser;
Opm::Python python;
auto python = std::make_shared<Opm::Python>();
auto deck = parser.parseFile("norne_pvt.data", parseContext, errorGuard);

View File

@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE(TestStoppedWells)
Opm::Parser parser;
Opm::Deck deck(parser.parseFile(filename));
Opm::EclipseState eclipseState(deck);
Opm::Python python;
auto python = std::make_shared<Opm::Python>();
const Schedule sched(deck, eclipseState, python);
// Both wells are open in the first schedule step

View File

@ -71,14 +71,15 @@ struct SetupTest {
{
const Opm::TableManager table ( deck );
const Opm::Runspec runspec (deck);
python = std::make_shared<Opm::Python>();
schedule.reset( new Opm::Schedule(deck, *ecl_state, python));
summaryState.reset( new Opm::SummaryState(std::chrono::system_clock::from_time_t(schedule->getStartTime())));
}
current_timestep = 0;
};
Opm::Python python;
std::unique_ptr<const Opm::EclipseState> ecl_state;
std::shared_ptr<Opm::Python> python;
std::unique_ptr<const Opm::Schedule> schedule;
std::unique_ptr<Opm::SummaryState> summaryState;
std::vector<std::vector<Opm::PerforationData>> well_perf_data;

View File

@ -52,6 +52,7 @@ struct Setup
: es (deck)
, pu (Opm::phaseUsageFromDeck(es))
, grid (es.getInputGrid())
, python( std::make_shared<Opm::Python>() )
, sched(deck, es, python)
, st(std::chrono::system_clock::from_time_t(sched.getStartTime()))
{
@ -102,10 +103,10 @@ struct Setup
}
}
Opm::Python python;
Opm::EclipseState es;
Opm::PhaseUsage pu;
Opm::GridManager grid;
std::shared_ptr<Opm::Python> python;
Opm::Schedule sched;
Opm::SummaryState st;
std::vector<std::vector<Opm::PerforationData>> well_perf_data;