From dbb19403fc1ac616aaaf14eec662c948ec48d1a3 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 11 Apr 2014 11:54:16 +0200 Subject: [PATCH] completely remove the EclipseGridParser from the module --- examples/sim_2p_comp_ad.cpp | 60 +++----- examples/sim_2p_incomp_ad.cpp | 66 +++------ examples/sim_fibo_ad.cpp | 2 +- opm/autodiff/BlackoilPropsAdFromDeck.cpp | 176 ++++------------------- opm/autodiff/BlackoilPropsAdFromDeck.hpp | 53 +------ tests/test_boprops_ad.cpp | 18 +-- 6 files changed, 85 insertions(+), 290 deletions(-) diff --git a/examples/sim_2p_comp_ad.cpp b/examples/sim_2p_comp_ad.cpp index c7dfe8bfb..956409d32 100644 --- a/examples/sim_2p_comp_ad.cpp +++ b/examples/sim_2p_comp_ad.cpp @@ -92,7 +92,7 @@ try // The current code for the non-deck case fails for unknown reasons. OPM_THROW(std::runtime_error, "This simulator cannot run without a deck with wells. Use deck_filename to specify deck."); } - boost::scoped_ptr deck; + Opm::DeckConstPtr newParserDeck; boost::scoped_ptr grid; boost::scoped_ptr props; boost::scoped_ptr rock_comp; @@ -103,11 +103,9 @@ try double gravity[3] = { 0.0 }; if (use_deck) { std::string deck_filename = param.get("deck_filename"); - deck.reset(new EclipseGridParser(deck_filename)); - Opm::ParserPtr newParser(new Opm::Parser() ); - Opm::DeckConstPtr newParserDeck = newParser->parseFile( deck_filename ); - eclipseState.reset( new EclipseState(newParserDeck )); - + Opm::ParserPtr parser(new Opm::Parser()); + Opm::DeckConstPtr newParserDeck = parser->parseFile( deck_filename ); + eclipseState.reset(new EclipseState(newParserDeck)); // Grid init grid.reset(new GridManager(newParserDeck)); @@ -118,12 +116,12 @@ try // Rock compressibility. rock_comp.reset(new RockCompressibility(newParserDeck)); // Gravity. - gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity; + gravity[2] = newParserDeck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity; // Init state variables (saturation and pressure). if (param.has("init_saturation")) { initStateBasic(*grid->c_grid(), *props, param, gravity[2], state); } else { - initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], state); + initStateFromDeck(*grid->c_grid(), *props, newParserDeck, gravity[2], state); } initBlackoilSurfvol(*grid->c_grid(), *props, state); } else { @@ -207,10 +205,7 @@ try param.writeParam(output_dir + "/simulation.param"); } - - std::cout << "\n\n================ Starting main simulation loop ===============\n" - << " (number of epochs: " - << (use_deck ? deck->numberOfEpochs() : 1) << ")\n\n" << std::flush; + std::cout << "\n\n================ Starting main simulation loop ===============\n"; SimulatorReport rep; if (!use_deck) { @@ -232,42 +227,26 @@ try } else { // With a deck, we may have more epochs etc. WellState well_state; - int step = 0; + Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck)); SimulatorTimer simtimer; - // Use timer for last epoch to obtain total time. - deck->setCurrentEpoch(deck->numberOfEpochs() - 1); - simtimer.init(*deck); - const double total_time = simtimer.totalTime(); - for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) { - // Set epoch index. - deck->setCurrentEpoch(epoch); - // Update the timer. - if (deck->hasField("TSTEP")) { - simtimer.init(*deck); - } else { - if (epoch != 0) { - OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch); - } - simtimer.init(param); - } - simtimer.setCurrentStepNum(step); - simtimer.setTotalTime(total_time); - - // Report on start of epoch. - std::cout << "\n\n-------------- Starting epoch " << epoch << " --------------" - << "\n (number of steps: " - << simtimer.numSteps() - step << ")\n\n" << std::flush; + for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) { + // Report on start of report step. + std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------" + << "\n (number of steps left: " + << timeMap->numTimesteps() - reportStepIdx << ")\n\n" << std::flush; // Create new wells, well_state - WellsManager wells(eclipseState , epoch , *grid->c_grid(), props->permeability()); + WellsManager wells(eclipseState, reportStepIdx, *grid->c_grid(), props->permeability()); // @@@ HACK: we should really make a new well state and - // properly transfer old well state to it every epoch, + // properly transfer old well state to it every report step, // since number of wells may change etc. - if (epoch == 0) { + if (reportStepIdx == 0) { well_state.init(wells.c_wells(), state); } + simtimer.setCurrentStepNum(reportStepIdx); + // Create and run simulator. SimulatorCompressibleAd simulator(param, *grid->c_grid(), @@ -276,7 +255,7 @@ try wells, linsolver, grav); - if (epoch == 0) { + if (reportStepIdx == 0) { warnIfUnusedParams(param); } SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state); @@ -285,7 +264,6 @@ try } // Update total timing report and remember step number. rep += epoch_rep; - step = simtimer.currentStepNum(); } } diff --git a/examples/sim_2p_incomp_ad.cpp b/examples/sim_2p_incomp_ad.cpp index e0c417c14..c7e87163f 100644 --- a/examples/sim_2p_incomp_ad.cpp +++ b/examples/sim_2p_incomp_ad.cpp @@ -99,7 +99,8 @@ try // If we have a "deck_filename", grid and props will be read from that. bool use_deck = param.has("deck_filename"); - boost::scoped_ptr deck; + Opm::ParserPtr parser(new Opm::Parser()); + Opm::DeckConstPtr newParserDeck; boost::scoped_ptr grid; boost::scoped_ptr props; boost::scoped_ptr rock_comp; @@ -110,25 +111,24 @@ try double gravity[3] = { 0.0 }; if (use_deck) { std::string deck_filename = param.get("deck_filename"); - ParserPtr parser(new Opm::Parser()); - eclipseState.reset( new EclipseState(parser->parseFile(deck_filename))); + newParserDeck = parser->parseFile(deck_filename); + eclipseState.reset(new EclipseState(newParserDeck)); - deck.reset(new EclipseGridParser(deck_filename)); // Grid init - grid.reset(new GridManager(*deck)); + grid.reset(new GridManager(newParserDeck)); // Rock and fluid init - props.reset(new IncompPropertiesFromDeck(*deck, *grid->c_grid())); + props.reset(new IncompPropertiesFromDeck(newParserDeck, *grid->c_grid())); // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); // Rock compressibility. - rock_comp.reset(new RockCompressibility(*deck)); + rock_comp.reset(new RockCompressibility(newParserDeck)); // Gravity. - gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity; + gravity[2] = newParserDeck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity; // Init state variables (saturation and pressure). if (param.has("init_saturation")) { initStateBasic(*grid->c_grid(), *props, param, gravity[2], state); } else { - initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], state); + initStateFromDeck(*grid->c_grid(), *props, newParserDeck, gravity[2], state); } } else { // Grid init. @@ -215,9 +215,7 @@ try } - std::cout << "\n\n================ Starting main simulation loop ===============\n" - << " (number of epochs: " - << (use_deck ? deck->numberOfEpochs() : 1) << ")\n\n" << std::flush; + std::cout << "\n\n================ Starting main simulation loop ===============\n"; SimulatorReport rep; if (!use_deck) { @@ -239,44 +237,27 @@ try well_state.init(0, state); rep = simulator.run(simtimer, state, well_state); } else { - // With a deck, we may have more epochs etc. + // With a deck, we may have more report steps etc. WellState well_state; - int step = 0; + Opm::TimeMapPtr timeMap(new Opm::TimeMap(newParserDeck)); SimulatorTimer simtimer; - // Use timer for last epoch to obtain total time. - deck->setCurrentEpoch(deck->numberOfEpochs() - 1); - simtimer.init(*deck); - const double total_time = simtimer.totalTime(); - for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) { - // Set epoch index. - deck->setCurrentEpoch(epoch); - - // Update the timer. - if (deck->hasField("TSTEP")) { - simtimer.init(*deck); - } else { - if (epoch != 0) { - OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch); - } - simtimer.init(param); - } - simtimer.setCurrentStepNum(step); - simtimer.setTotalTime(total_time); - - // Report on start of epoch. - std::cout << "\n\n-------------- Starting epoch " << epoch << " --------------" - << "\n (number of steps: " - << simtimer.numSteps() - step << ")\n\n" << std::flush; + for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) { + // Report on start of report step. + std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------" + << "\n (number of steps left: " + << timeMap->numTimesteps() - reportStepIdx << ")\n\n" << std::flush; // Create new wells, well_state - WellsManager wells(eclipseState , epoch , *grid->c_grid(), props->permeability()); + WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability()); // @@@ HACK: we should really make a new well state and - // properly transfer old well state to it every epoch, + // properly transfer old well state to it every report step, // since number of wells may change etc. - if (epoch == 0) { + if (reportStepIdx == 0) { well_state.init(wells.c_wells(), state); } + simtimer.setCurrentStepNum(reportStepIdx); + // Create and run simulator. SimulatorIncompTwophaseAd simulator(param, *grid->c_grid(), @@ -287,7 +268,7 @@ try bcs.c_bcs(), linsolver, grav); - if (epoch == 0) { + if (reportStepIdx == 0) { warnIfUnusedParams(param); } SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state); @@ -296,7 +277,6 @@ try } // Update total timing report and remember step number. rep += epoch_rep; - step = simtimer.currentStepNum(); } } diff --git a/examples/sim_fibo_ad.cpp b/examples/sim_fibo_ad.cpp index e27cd5d53..e05ed5f02 100644 --- a/examples/sim_fibo_ad.cpp +++ b/examples/sim_fibo_ad.cpp @@ -102,7 +102,7 @@ try Opm::ParserPtr newParser(new Opm::Parser() ); Opm::DeckConstPtr newParserDeck = newParser->parseFile( deck_filename ); - std::shared_ptr eclipseState(new EclipseState(newParserDeck)); + std::shared_ptr eclipseState(new EclipseState(deck)); // Grid init grid.reset(new GridManager(eclipseState->getEclipseGrid())); diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.cpp b/opm/autodiff/BlackoilPropsAdFromDeck.cpp index c3cac4ce8..554ef8305 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.cpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.cpp @@ -33,8 +33,10 @@ #include #include -#include +#include #include +#include +#include #include namespace Opm @@ -48,7 +50,7 @@ namespace Opm Vapour = BlackoilPhases::Vapour }; /// Constructor wrapping an opm-core black oil interface. - BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const EclipseGridParser& deck, + BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck, const UnstructuredGrid& grid, const bool init_rock) { @@ -56,19 +58,9 @@ namespace Opm grid.cell_centroids, grid.dimensions, init_rock); } - /// Constructor wrapping an opm-core black oil interface. - BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck, - const UnstructuredGrid& grid, - const bool init_rock) - { - init(newParserDeck, grid.number_of_cells, grid.global_cell, grid.cartdims, - grid.cell_centroids, grid.dimensions, init_rock); - } - #ifdef HAVE_DUNE_CORNERPOINT - /// Constructor wrapping an opm-core black oil interface. - BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const EclipseGridParser& deck, + BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck, const Dune::CpGrid& grid, const bool init_rock ) { @@ -76,141 +68,30 @@ namespace Opm static_cast(&grid.logicalCartesianSize()[0]), grid.beginCellCentroids(), Dune::CpGrid::dimension, init_rock); } - - /// Constructor wrapping an opm-core black oil interface. - BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck, - const Dune::CpGrid& grid, - const bool init_rock ) - { - init(newParserDeck, grid.numCells(), static_cast(&grid.globalCell()[0]), - static_cast(&grid.logicalCartesianSize()[0]), - grid.beginCellCentroids(), Dune::CpGrid::dimension, init_rock); - } #endif - /// Constructor wrapping an opm-core black oil interface. - template - BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck, - int number_of_cells, - const int* global_cell, - const int* cart_dims, - T begin_cell_centroids, - int dimensions, - const bool init_rock) - { - init(newParserDeck, number_of_cells, global_cell, cart_dims, begin_cell_centroids, - dimensions, init_rock); - } - - template - void BlackoilPropsAdFromDeck::init(const EclipseGridParser& deck, + /// Initializes the properties. + template + void BlackoilPropsAdFromDeck::init(Opm::DeckConstPtr deck, int number_of_cells, const int* global_cell, const int* cart_dims, - T begin_cell_centroids, - int dimensions, + const CentroidIterator& begin_cell_centroids, + int dimension, const bool init_rock) { if (init_rock){ rock_.init(deck, number_of_cells, global_cell, cart_dims); } + const int samples = 0; const int region_number = 0; phase_usage_ = phaseUsageFromDeck(deck); // Surface densities. Accounting for different orders in eclipse and our code. - if (deck.hasField("DENSITY")) { - const std::vector& d = deck.getDENSITY().densities_[region_number]; - enum { ECL_oil = 0, ECL_water = 1, ECL_gas = 2 }; - if (phase_usage_.phase_used[Aqua]) { - densities_[phase_usage_.phase_pos[Aqua]] = d[ECL_water]; - } - if (phase_usage_.phase_used[Vapour]) { - densities_[phase_usage_.phase_pos[Vapour]] = d[ECL_gas]; - } - if (phase_usage_.phase_used[Liquid]) { - densities_[phase_usage_.phase_pos[Liquid]] = d[ECL_oil]; - } - } else { - OPM_THROW(std::runtime_error, "Input is missing DENSITY\n"); - } - - // Set the properties. - props_.resize(phase_usage_.num_phases); - // Water PVT - if (phase_usage_.phase_used[Aqua]) { - if (deck.hasField("PVTW")) { - props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(deck.getPVTW().pvtw_)); - } else { - // Eclipse 100 default. - props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(0.5*Opm::prefix::centi*Opm::unit::Poise)); - } - } - // Oil PVT - if (phase_usage_.phase_used[Liquid]) { - if (deck.hasField("PVDO")) { - if (samples > 0) { - props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(deck.getPVDO().pvdo_, samples)); - } else { - props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDead(deck.getPVDO().pvdo_)); - } - } else if (deck.hasField("PVTO")) { - props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtLiveOil(deck.getPVTO().pvto_)); - } else if (deck.hasField("PVCDO")) { - props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(deck.getPVCDO().pvcdo_)); - } else { - OPM_THROW(std::runtime_error, "Input is missing PVDO, PVTO or PVCDO\n"); - } - } - // Gas PVT - if (phase_usage_.phase_used[Vapour]) { - if (deck.hasField("PVDG")) { - if (samples > 0) { - props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(deck.getPVDG().pvdg_, samples)); - } else { - props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDead(deck.getPVDG().pvdg_)); - } - } else if (deck.hasField("PVTG")) { - props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(deck.getPVTG().pvtg_)); - } else { - OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n"); - } - } - - SaturationPropsFromDeck* ptr - = new SaturationPropsFromDeck(); - satprops_.reset(ptr); - ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimensions, -1); - - if (phase_usage_.num_phases != satprops_->numPhases()) { - OPM_THROW(std::runtime_error, "BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck() - " - "Inconsistent number of phases in pvt data (" << phase_usage_.num_phases - << ") and saturation-dependent function data (" << satprops_->numPhases() << ")."); - } - } - - template - void BlackoilPropsAdFromDeck::init(Opm::DeckConstPtr newParserDeck, - int number_of_cells, - const int* global_cell, - const int* cart_dims, - T begin_cell_centroids, - int dimensions, - const bool init_rock) - { - if (init_rock){ - rock_.init(newParserDeck, number_of_cells, global_cell, cart_dims); - } - - const int samples = 0; - const int region_number = 0; - - phase_usage_ = phaseUsageFromDeck(newParserDeck); - - // Surface densities. Accounting for different orders in eclipse and our code. - if (newParserDeck->hasKeyword("DENSITY")) { - const auto keyword = newParserDeck->getKeyword("DENSITY"); + if (deck->hasKeyword("DENSITY")) { + const auto keyword = deck->getKeyword("DENSITY"); const auto record = keyword->getRecord(region_number); enum { ECL_oil = 0, ECL_water = 1, ECL_gas = 2 }; if (phase_usage_.phase_used[Aqua]) { @@ -230,8 +111,8 @@ namespace Opm props_.resize(phase_usage_.num_phases); // Water PVT if (phase_usage_.phase_used[Aqua]) { - if (newParserDeck->hasKeyword("PVTW")) { - Opm::PvtwTable pvtwTable(newParserDeck->getKeyword("PVTW"), region_number); + if (deck->hasKeyword("PVTW")) { + Opm::PvtwTable pvtwTable(deck->getKeyword("PVTW"), region_number); props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(pvtwTable)); } else { // Eclipse 100 default. @@ -241,19 +122,19 @@ namespace Opm // Oil PVT if (phase_usage_.phase_used[Liquid]) { - if (newParserDeck->hasKeyword("PVDO")) { - Opm::PvdoTable pvdoTable(newParserDeck->getKeyword("PVDO"), region_number); + if (deck->hasKeyword("PVDO")) { + Opm::PvdoTable pvdoTable(deck->getKeyword("PVDO"), region_number); if (samples > 0) { props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(pvdoTable, samples)); } else { props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDead(pvdoTable)); } } - else if (newParserDeck->hasKeyword("PVTO")) { - Opm::PvtoTable pvtoTable(newParserDeck->getKeyword("PVTO"), /*tableIdx=*/0); + else if (deck->hasKeyword("PVTO")) { + Opm::PvtoTable pvtoTable(deck->getKeyword("PVTO"), /*tableIdx=*/0); props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtLiveOil(pvtoTable)); - } else if (newParserDeck->hasKeyword("PVCDO")) { - Opm::PvcdoTable pvdcoTable(newParserDeck->getKeyword("PVCDO"), region_number); + } else if (deck->hasKeyword("PVCDO")) { + Opm::PvcdoTable pvdcoTable(deck->getKeyword("PVCDO"), region_number); props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(pvdcoTable)); } else { OPM_THROW(std::runtime_error, "Input is missing PVDO, PVTO or PVCDO\n"); @@ -262,15 +143,15 @@ namespace Opm // Gas PVT if (phase_usage_.phase_used[Vapour]) { - if (newParserDeck->hasKeyword("PVDG")) { - Opm::PvdoTable pvdgTable(newParserDeck->getKeyword("PVDG"), region_number); + if (deck->hasKeyword("PVDG")) { + Opm::PvdoTable pvdgTable(deck->getKeyword("PVDG"), region_number); if (samples > 0) { props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(pvdgTable, samples)); } else { props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDead(pvdgTable)); } - } else if (newParserDeck->hasKeyword("PVTG")) { - Opm::PvtgTable pvtgTable(newParserDeck->getKeyword("PVTG"), /*tableIdx=*/0); + } else if (deck->hasKeyword("PVTG")) { + Opm::PvtgTable pvtgTable(deck->getKeyword("PVTG"), /*tableIdx=*/0); props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(pvtgTable)); } else { OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n"); @@ -280,16 +161,15 @@ namespace Opm SaturationPropsFromDeck* ptr = new SaturationPropsFromDeck(); satprops_.reset(ptr); - ptr->init(newParserDeck, number_of_cells, global_cell, begin_cell_centroids, dimensions, -1); + ptr->init(deck, number_of_cells, global_cell, begin_cell_centroids, dimension, -1); if (phase_usage_.num_phases != satprops_->numPhases()) { OPM_THROW(std::runtime_error, "BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck() - " - "Inconsistent number of phases in pvt data (" << phase_usage_.num_phases - << ") and saturation-dependent function data (" << satprops_->numPhases() << ")."); + "Inconsistent number of phases in pvt data (" << phase_usage_.num_phases + << ") and saturation-dependent function data (" << satprops_->numPhases() << ")."); } } - //////////////////////////// // Rock interface // //////////////////////////// diff --git a/opm/autodiff/BlackoilPropsAdFromDeck.hpp b/opm/autodiff/BlackoilPropsAdFromDeck.hpp index 22195064b..7f4d0d6bd 100644 --- a/opm/autodiff/BlackoilPropsAdFromDeck.hpp +++ b/opm/autodiff/BlackoilPropsAdFromDeck.hpp @@ -23,15 +23,12 @@ #include #include -#include #include -#include #include #include -#include -#include +#include #ifdef HAVE_DUNE_CORNERPOINT #include "disable_warning_pragmas.h" @@ -56,50 +53,18 @@ namespace Opm class BlackoilPropsAdFromDeck : public BlackoilPropsAdInterface { public: - /// Constructor wrapping an opm-core black oil interface. - BlackoilPropsAdFromDeck(const EclipseGridParser& deck, - const UnstructuredGrid& grid, - const bool init_rock = true ); - /// Constructor wrapping an opm-core black oil interface. BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck, const UnstructuredGrid& grid, const bool init_rock = true ); #ifdef HAVE_DUNE_CORNERPOINT - - /// Constructor wrapping an opm-core black oil interface. - BlackoilPropsAdFromDeck(const EclipseGridParser& deck, - const Dune::CpGrid& grid, - const bool init_rock = true ); - /// Constructor wrapping an opm-core black oil interface. BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck, const Dune::CpGrid& grid, const bool init_rock = true ); - - #endif - /// Constructor taking not a grid but only the needed information - template - BlackoilPropsAdFromDeck(Opm::DeckConstPtr newParserDeck, - int number_of_cells, - const int* global_cell, - const int* cart_dims, - T begin_cell_centroids, - int dimensions, - const bool init_rock); - - /// Constructor taking not a grid but only the needed information - template - BlackoilPropsAdFromDeck(const EclipseGridParser& deck, - int number_of_cells, - const int* global_cell, - const int* cart_dims, - T begin_cell_centroids, - int dimensions, - const bool init_rock); //////////////////////////// // Rock interface // @@ -371,25 +336,17 @@ namespace Opm private: /// Initializes the properties. - template - void init(const EclipseGridParser& deck, - int number_of_cells, - const int* global_cell, - const int* cart_dims, - T begin_cell_centroids, - int dimension, - const bool init_rock); - /// Initializes the properties. - template + template void init(Opm::DeckConstPtr deck, int number_of_cells, const int* global_cell, const int* cart_dims, - T begin_cell_centroids, + const CentroidIterator& begin_cell_centroids, int dimension, const bool init_rock); + RockFromDeck rock_; - boost::scoped_ptr satprops_; + std::unique_ptr satprops_; PhaseUsage phase_usage_; std::vector > props_; double densities_[BlackoilPhases::MaxNumPhases]; diff --git a/tests/test_boprops_ad.cpp b/tests/test_boprops_ad.cpp index 5231a7ac5..731801f43 100644 --- a/tests/test_boprops_ad.cpp +++ b/tests/test_boprops_ad.cpp @@ -30,23 +30,23 @@ #include -#include #include #include #include #include +#include +#include + #include #include struct SetupSimple { SetupSimple() - : param() - , deck() { - std::ifstream str("fluid.data"); - deck.read(str); + Opm::ParserPtr parser(new Opm::Parser()); + newParserDeck = parser->parseFile("fluid.data"); param.disableOutput(); param.insertParameter("init_rock" , "false" ); @@ -56,7 +56,7 @@ struct SetupSimple { } Opm::parameter::ParameterGroup param; - Opm::EclipseGridParser deck; + Opm::DeckConstPtr newParserDeck; }; @@ -65,14 +65,14 @@ struct TestFixture : public Setup { TestFixture() : Setup() - , grid (deck) - , props(deck, *grid.c_grid(), param, + , grid (newParserDeck) + , props(newParserDeck, *grid.c_grid(), param, param.getDefault("init_rock", false)) { } using Setup::param; - using Setup::deck; + using Setup::newParserDeck; Opm::GridManager grid; Opm::BlackoilPropertiesFromDeck props;