From 3082281bc8bc4ea2e8003ba1f83ca7cb31b00f32 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 1 Aug 2018 13:02:18 +0200 Subject: [PATCH] changed: avoid use of the assignment operator for the Deck class --- examples/sim_poly2p_comp_reorder.cpp | 22 +++++++++++----------- examples/sim_poly2p_incomp_reorder.cpp | 18 +++++++++--------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/sim_poly2p_comp_reorder.cpp b/examples/sim_poly2p_comp_reorder.cpp index dee32a9fa..ac54e29ea 100644 --- a/examples/sim_poly2p_comp_reorder.cpp +++ b/examples/sim_poly2p_comp_reorder.cpp @@ -95,7 +95,7 @@ try boost::scoped_ptr rock_comp; std::unique_ptr state; Opm::PolymerProperties poly_props; - Opm::Deck deck; + std::unique_ptr deck; std::unique_ptr< EclipseState > eclipseState; std::unique_ptr< Schedule> schedule; // bool check_well_controls = false; @@ -105,16 +105,16 @@ try std::string deck_filename = param.get("deck_filename"); Parser parser; Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }}); - deck = parser.parseFile(deck_filename , parseContext); - eclipseState.reset( new EclipseState(deck , parseContext) ); - schedule.reset( new Schedule(deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext )); + deck.reset(new Deck(parser.parseFile(deck_filename , parseContext))); + eclipseState.reset( new EclipseState(*deck , parseContext) ); + schedule.reset( new Schedule(*deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext )); // Grid init grid.reset(new GridManager(eclipseState->getInputGrid())); { const UnstructuredGrid& ug_grid = *(grid->c_grid()); // Rock and fluid init - props.reset(new BlackoilPropertiesFromDeck(deck, *eclipseState, ug_grid)); + props.reset(new BlackoilPropertiesFromDeck(*deck, *eclipseState, ug_grid)); // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); @@ -122,16 +122,16 @@ try // Rock compressibility. rock_comp.reset(new RockCompressibility(*eclipseState)); // Gravity. - gravity[2] = deck.hasKeyword("NOGRAV") ? 0.0 : unit::gravity; + gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity; // Init state variables (saturation and pressure). if (param.has("init_saturation")) { initStateBasic(ug_grid, *props, param, gravity[2], *state); } else { - initStateFromDeck(ug_grid, *props, deck, gravity[2], *state); + initStateFromDeck(ug_grid, *props, *deck, gravity[2], *state); } initBlackoilSurfvol(ug_grid, *props, *state); // Init polymer properties. - poly_props.readFromDeck(deck, *eclipseState); + poly_props.readFromDeck(*deck, *eclipseState); } } else { // Grid init. @@ -262,12 +262,12 @@ try // With a deck, we may have more epochs etc. WellState well_state; int step = 0; - Opm::TimeMap timeMap(deck); + Opm::TimeMap timeMap(*deck); SimulatorTimer simtimer; simtimer.init(timeMap); // Check for WPOLYMER presence in last report step to decide // polymer injection control type. - const bool use_wpolymer = deck.hasKeyword("WPOLYMER"); + const bool use_wpolymer = deck->hasKeyword("WPOLYMER"); if (use_wpolymer) { if (param.has("poly_start_days")) { OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. " @@ -283,7 +283,7 @@ try << simtimer.numSteps() - step << ")\n\n" << std::flush; // Create new wells, polymer inflow controls. - eclipseState.reset( new EclipseState( deck ) ); + eclipseState.reset( new EclipseState( *deck ) ); WellsManager wells(*eclipseState , *schedule, reportStepIdx , *grid->c_grid()); boost::scoped_ptr polymer_inflow; if (use_wpolymer) { diff --git a/examples/sim_poly2p_incomp_reorder.cpp b/examples/sim_poly2p_incomp_reorder.cpp index 28a951ce5..23d0e301c 100644 --- a/examples/sim_poly2p_incomp_reorder.cpp +++ b/examples/sim_poly2p_incomp_reorder.cpp @@ -90,7 +90,7 @@ try // If we have a "deck_filename", grid and props will be read from that. bool use_deck = param.has("deck_filename"); - Deck deck; + std::unique_ptr deck; boost::scoped_ptr grid; boost::scoped_ptr props; boost::scoped_ptr rock_comp; @@ -105,16 +105,16 @@ try std::string deck_filename = param.get("deck_filename"); Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }}); Parser parser; - deck = parser.parseFile(deck_filename , parseContext); + deck.reset(new Deck(parser.parseFile(deck_filename , parseContext))); - eclipseState.reset(new Opm::EclipseState(deck , parseContext)); - schedule.reset( new Opm::Schedule(deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext)); + eclipseState.reset(new Opm::EclipseState(*deck , parseContext)); + schedule.reset( new Opm::Schedule(*deck, eclipseState->getInputGrid(), eclipseState->get3DProperties(), eclipseState->runspec().phases(), parseContext)); // Grid init grid.reset(new GridManager(eclipseState->getInputGrid())); { const UnstructuredGrid& ug_grid = *(grid->c_grid()); // Rock and fluid init - props.reset(new IncompPropertiesFromDeck(deck, *eclipseState, ug_grid )); + props.reset(new IncompPropertiesFromDeck(*deck, *eclipseState, ug_grid )); // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); state.reset( new PolymerState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ), 2)); @@ -122,15 +122,15 @@ try // Rock compressibility. rock_comp.reset(new RockCompressibility(*eclipseState)); // Gravity. - gravity[2] = deck.hasKeyword("NOGRAV") ? 0.0 : unit::gravity; + gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity; // Init state variables (saturation and pressure). if (param.has("init_saturation")) { initStateBasic(ug_grid, *props, param, gravity[2], *state); } else { - initStateFromDeck(ug_grid, *props, deck, gravity[2], *state); + initStateFromDeck(ug_grid, *props, *deck, gravity[2], *state); } // Init polymer properties. - poly_props.readFromDeck(deck, *eclipseState); + poly_props.readFromDeck(*deck, *eclipseState); } } else { // Grid init. @@ -302,7 +302,7 @@ try simtimer.init(timeMap); // Check for WPOLYMER presence in last epoch to decide // polymer injection control type. - const bool use_wpolymer = deck.hasKeyword("WPOLYMER"); + const bool use_wpolymer = deck->hasKeyword("WPOLYMER"); if (use_wpolymer) { if (param.has("poly_start_days")) { OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. "