Merge pull request #657 from pgdr/eclipsegrid-is-input

Using getInputGrid API from Parser
This commit is contained in:
Joakim Hove 2016-04-20 15:50:33 +02:00
commit 1f64f79f6d
14 changed files with 29 additions and 29 deletions

View File

@ -208,7 +208,7 @@ public:
/*****************************************************************/ /*****************************************************************/
void initOPMTrans(TransGraph& opmTrans, DeckConstPtr deck, std::shared_ptr<const EclipseState> eclipseState) { void initOPMTrans(TransGraph& opmTrans, DeckConstPtr deck, std::shared_ptr<const EclipseState> eclipseState) {
std::shared_ptr<GridManager> grid = std::make_shared<GridManager>( eclipseState->getEclipseGrid(), std::shared_ptr<GridManager> grid = std::make_shared<GridManager>( eclipseState->getInputGrid(),
eclipseState->get3DProperties().getDoubleGridProperty( "PORV" ).getData() ); eclipseState->get3DProperties().getDoubleGridProperty( "PORV" ).getData() );
const struct UnstructuredGrid * cGrid = grid->c_grid(); const struct UnstructuredGrid * cGrid = grid->c_grid();
std::shared_ptr<BlackoilPropsAdInterface> props; std::shared_ptr<BlackoilPropsAdInterface> props;

View File

@ -106,7 +106,7 @@ try
eclipseState.reset(new EclipseState(deck, parseContext)); eclipseState.reset(new EclipseState(deck, parseContext));
// Grid init // Grid init
grid.reset(new GridManager(deck)); grid.reset(new GridManager(eclipseState->getInputGrid()));
{ {
const UnstructuredGrid& ug_grid = *(grid->c_grid()); const UnstructuredGrid& ug_grid = *(grid->c_grid());
state.reset( new BlackoilState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ) ,2)); state.reset( new BlackoilState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ) ,2));

View File

@ -117,7 +117,7 @@ try
deck = parser->parseFile(deck_filename , parseContext); deck = parser->parseFile(deck_filename , parseContext);
eclipseState.reset( new EclipseState(deck, parseContext)); eclipseState.reset( new EclipseState(deck, parseContext));
// Grid init // Grid init
grid.reset(new GridManager(deck)); grid.reset(new GridManager(eclipseState->getInputGrid()));
{ {
const UnstructuredGrid& ug_grid = *(grid->c_grid()); const UnstructuredGrid& ug_grid = *(grid->c_grid());
// Rock and fluid init // Rock and fluid init

View File

@ -118,7 +118,7 @@ try
eclipseState.reset(new EclipseState(deck , parseContext)); eclipseState.reset(new EclipseState(deck , parseContext));
// Grid init // Grid init
grid.reset(new GridManager(deck)); grid.reset(new GridManager(eclipseState->getInputGrid()));
{ {
const UnstructuredGrid& ug_grid = *(grid->c_grid()); const UnstructuredGrid& ug_grid = *(grid->c_grid());

View File

@ -105,7 +105,7 @@ try
eclipseState.reset(new Opm::EclipseState(deck , parseContext)); eclipseState.reset(new Opm::EclipseState(deck , parseContext));
// Grid init // Grid init
grid.reset(new GridManager(deck)); grid.reset(new GridManager(eclipseState->getInputGrid()));
{ {
const UnstructuredGrid& ug_grid = *(grid->c_grid()); const UnstructuredGrid& ug_grid = *(grid->c_grid());

View File

@ -105,7 +105,7 @@ try
eclipseState.reset(new Opm::EclipseState(deck , parseContext)); eclipseState.reset(new Opm::EclipseState(deck , parseContext));
// Grid init // Grid init
grid.reset(new GridManager(deck)); grid.reset(new GridManager(eclipseState->getInputGrid()));
{ {
const UnstructuredGrid& ug_grid = *(grid->c_grid()); const UnstructuredGrid& ug_grid = *(grid->c_grid());
// Rock and fluid init // Rock and fluid init

View File

@ -168,9 +168,9 @@ try
if (eclipseState->get3DProperties().hasDeckDoubleGridProperty("PORV")) { if (eclipseState->get3DProperties().hasDeckDoubleGridProperty("PORV")) {
const auto& porv = eclipseState->get3DProperties().getDoubleGridProperty("PORV").getData(); const auto& porv = eclipseState->get3DProperties().getDoubleGridProperty("PORV").getData();
grid.reset(new GridManager(eclipseState->getEclipseGrid(), porv)); grid.reset(new GridManager(eclipseState->getInputGrid(), porv));
} else { } else {
grid.reset(new GridManager(eclipseState->getEclipseGrid())); grid.reset(new GridManager(eclipseState->getInputGrid()));
} }
auto &cGrid = *grid->c_grid(); auto &cGrid = *grid->c_grid();
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck); const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);

View File

@ -424,7 +424,7 @@ namespace Opm
// Create grid. // Create grid.
const std::vector<double>& porv = const std::vector<double>& porv =
eclipse_state_->get3DProperties().getDoubleGridProperty("PORV").getData(); eclipse_state_->get3DProperties().getDoubleGridProperty("PORV").getData();
grid_init_.reset(new GridInit<Grid>(deck_, eclipse_state_, porv)); grid_init_.reset(new GridInit<Grid>(eclipse_state_, porv));
const Grid& grid = grid_init_->grid(); const Grid& grid = grid_init_->grid();
// Create material law manager. // Create material law manager.

View File

@ -107,7 +107,7 @@ namespace Opm
} }
// Get grid from parser. // Get grid from parser.
EclipseGridConstPtr eclgrid = eclState->getEclipseGrid(); EclipseGridConstPtr eclgrid = eclState->getInputGrid();
// Pore volume. // Pore volume.
// New keywords MINPVF will add some PV due to OPM cpgrid process algorithm. // New keywords MINPVF will add some PV due to OPM cpgrid process algorithm.
@ -277,7 +277,7 @@ namespace Opm
int numCells = Opm::AutoDiffGrid::numCells(grid); int numCells = Opm::AutoDiffGrid::numCells(grid);
const int* global_cell = Opm::UgGridHelpers::globalCell(grid); const int* global_cell = Opm::UgGridHelpers::globalCell(grid);
const int* cartdims = Opm::UgGridHelpers::cartDims(grid); const int* cartdims = Opm::UgGridHelpers::cartDims(grid);
EclipseGridConstPtr eclgrid = eclState->getEclipseGrid(); EclipseGridConstPtr eclgrid = eclState->getInputGrid();
const auto& porv = eclState->get3DProperties().getDoubleGridProperty("PORV").getData(); const auto& porv = eclState->get3DProperties().getDoubleGridProperty("PORV").getData();
for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) { for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) {
const int nx = cartdims[0]; const int nx = cartdims[0];

View File

@ -40,7 +40,7 @@ namespace Opm
{ {
public: public:
/// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes. /// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes.
GridInit(DeckConstPtr, EclipseStateConstPtr, const std::vector<double>&) GridInit(EclipseStateConstPtr, const std::vector<double>&)
{ {
OPM_THROW(std::logic_error, "Found no specialization for GridInit for the requested Grid class."); OPM_THROW(std::logic_error, "Found no specialization for GridInit for the requested Grid class.");
} }
@ -53,8 +53,8 @@ namespace Opm
{ {
public: public:
/// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes. /// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes.
GridInit(DeckConstPtr, EclipseStateConstPtr eclipse_state, const std::vector<double>& porv) GridInit(EclipseStateConstPtr eclipse_state, const std::vector<double>& porv)
: grid_manager_(eclipse_state->getEclipseGrid(), porv) : grid_manager_(eclipse_state->getInputGrid(), porv)
{ {
} }
/// Access the created grid. /// Access the created grid.
@ -74,9 +74,9 @@ namespace Opm
{ {
public: public:
/// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes. /// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes.
GridInit(DeckConstPtr deck, EclipseStateConstPtr, const std::vector<double>& porv) GridInit(EclipseStateConstPtr eclipse_state, const std::vector<double>& porv)
{ {
grid_.processEclipseFormat(deck, false, false, false, porv); grid_.processEclipseFormat(eclipse_state->getInputGrid(), false, false, false, porv);
} }
/// Access the created grid. Note that mutable access may be required for load balancing. /// Access the created grid. Note that mutable access may be required for load balancing.
Dune::CpGrid& grid() Dune::CpGrid& grid()

View File

@ -71,7 +71,7 @@ struct TestFixture : public Setup
{ {
TestFixture() TestFixture()
: Setup() : Setup()
, grid (deck) , grid (eclState->getInputGrid())
, boprops_ad(deck, eclState, *grid.c_grid(), param.getDefault("init_rock", false)) , boprops_ad(deck, eclState, *grid.c_grid(), param.getDefault("init_rock", false))
{ {
} }
@ -89,7 +89,7 @@ struct TestFixtureAd : public Setup
{ {
TestFixtureAd() TestFixtureAd()
: Setup() : Setup()
, grid (deck) , grid (eclState->getInputGrid())
, props(deck, eclState, *grid.c_grid(), , props(deck, eclState, *grid.c_grid(),
param.getDefault("init_rock", false)) param.getDefault("init_rock", false))
{ {

View File

@ -71,7 +71,7 @@ struct TestFixture : public Setup
{ {
TestFixture() TestFixture()
: Setup() : Setup()
, grid (deck) , grid (eclState->getInputGrid())
, ad_props(deck, eclState, *grid.c_grid(), param.getDefault("init_rock", false)) , ad_props(deck, eclState, *grid.c_grid(), param.getDefault("init_rock", false))
{ {
} }

View File

@ -46,9 +46,9 @@ BOOST_AUTO_TEST_CASE(CreateSimulationConfig) {
typedef UnstructuredGrid Grid; typedef UnstructuredGrid Grid;
DeckPtr deck = createDeckSimConfig(); DeckPtr deck = createDeckSimConfig();
EclipseState state(deck, parseContext); EclipseState state(deck, parseContext);
EclipseGridConstPtr eclipseGrid = state.getEclipseGrid(); EclipseGridConstPtr eclipseGrid = state.getInputGrid();
std::vector<double> porv = eclipseState->getDoubleGridProperty("PORV")->getData(); std::vector<double> porv = eclipseState->getDoubleGridProperty("PORV")->getData();
GridManager gridManager( eclipseState->getEclipseGrid(), porv ); GridManager gridManager( eclipseState->getInputGrid(), porv );
const Grid& grid = *(gridManager.c_grid()); const Grid& grid = *(gridManager.c_grid());
std::vector<double> threshold_pressures = thresholdPressures(parseContext, eclipseState, grid); std::vector<double> threshold_pressures = thresholdPressures(parseContext, eclipseState, grid);

View File

@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
Opm::DeckConstPtr origDeck = parser->parseString(origDeckString, parseContext); Opm::DeckConstPtr origDeck = parser->parseString(origDeckString, parseContext);
Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(origDeck , parseContext)); Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(origDeck , parseContext));
auto origGridManager = std::make_shared<Opm::GridManager>(origEclipseState->getEclipseGrid()); auto origGridManager = std::make_shared<Opm::GridManager>(origEclipseState->getInputGrid());
auto origProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(origDeck, origEclipseState, *(origGridManager->c_grid())); auto origProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(origDeck, origEclipseState, *(origGridManager->c_grid()));
Opm::DerivedGeology origGeology(*(origGridManager->c_grid()), *origProps, origEclipseState, false); Opm::DerivedGeology origGeology(*(origGridManager->c_grid()), *origProps, origEclipseState, false);
@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
Opm::DeckConstPtr multDeck = parser->parseString(multDeckString, parseContext); Opm::DeckConstPtr multDeck = parser->parseString(multDeckString, parseContext);
Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(multDeck, parseContext)); Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(multDeck, parseContext));
auto multGridManager = std::make_shared<Opm::GridManager>(multEclipseState->getEclipseGrid()); auto multGridManager = std::make_shared<Opm::GridManager>(multEclipseState->getInputGrid());
auto multProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multDeck, multEclipseState, *(multGridManager->c_grid())); auto multProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multDeck, multEclipseState, *(multGridManager->c_grid()));
Opm::DerivedGeology multGeology(*(multGridManager->c_grid()), *multProps, multEclipseState, false); Opm::DerivedGeology multGeology(*(multGridManager->c_grid()), *multProps, multEclipseState, false);
@ -188,7 +188,7 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
Opm::DeckConstPtr multMinusDeck = parser->parseString(multMinusDeckString, parseContext); Opm::DeckConstPtr multMinusDeck = parser->parseString(multMinusDeckString, parseContext);
Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(multMinusDeck , parseContext)); Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(multMinusDeck , parseContext));
auto multMinusGridManager = std::make_shared<Opm::GridManager>(multMinusEclipseState->getEclipseGrid()); auto multMinusGridManager = std::make_shared<Opm::GridManager>(multMinusEclipseState->getInputGrid());
auto multMinusProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multMinusDeck, multMinusEclipseState, *(multMinusGridManager->c_grid())); auto multMinusProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multMinusDeck, multMinusEclipseState, *(multMinusGridManager->c_grid()));
Opm::DerivedGeology multMinusGeology(*(multMinusGridManager->c_grid()), *multMinusProps, multMinusEclipseState, false); Opm::DerivedGeology multMinusGeology(*(multMinusGridManager->c_grid()), *multMinusProps, multMinusEclipseState, false);
@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersLegacyGridInterface)
Opm::DeckConstPtr ntgDeck = parser->parseString(ntgDeckString, parseContext); Opm::DeckConstPtr ntgDeck = parser->parseString(ntgDeckString, parseContext);
Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(ntgDeck, parseContext)); Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(ntgDeck, parseContext));
auto ntgGridManager = std::make_shared<Opm::GridManager>(ntgEclipseState->getEclipseGrid()); auto ntgGridManager = std::make_shared<Opm::GridManager>(ntgEclipseState->getInputGrid());
auto ntgProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(ntgDeck, ntgEclipseState, *(ntgGridManager->c_grid())); auto ntgProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(ntgDeck, ntgEclipseState, *(ntgGridManager->c_grid()));
Opm::DerivedGeology ntgGeology(*(ntgGridManager->c_grid()), *ntgProps, ntgEclipseState, false); Opm::DerivedGeology ntgGeology(*(ntgGridManager->c_grid()), *ntgProps, ntgEclipseState, false);
@ -281,7 +281,7 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(origDeck , parseContext)); Opm::EclipseStateConstPtr origEclipseState(new Opm::EclipseState(origDeck , parseContext));
auto origGrid = std::make_shared<Dune::CpGrid>(); auto origGrid = std::make_shared<Dune::CpGrid>();
origGrid->processEclipseFormat(origEclipseState->getEclipseGrid(), 0.0, false); origGrid->processEclipseFormat(origEclipseState->getInputGrid(), 0.0, false);
auto origProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(origDeck, auto origProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(origDeck,
origEclipseState, origEclipseState,
@ -296,7 +296,7 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(multDeck, parseContext)); Opm::EclipseStateConstPtr multEclipseState(new Opm::EclipseState(multDeck, parseContext));
auto multGrid = std::make_shared<Dune::CpGrid>(); auto multGrid = std::make_shared<Dune::CpGrid>();
multGrid->processEclipseFormat(multEclipseState->getEclipseGrid(), 0.0, false); multGrid->processEclipseFormat(multEclipseState->getInputGrid(), 0.0, false);
auto multProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multDeck, multEclipseState, *multGrid); auto multProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multDeck, multEclipseState, *multGrid);
@ -310,7 +310,7 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(multMinusDeck, parseContext)); Opm::EclipseStateConstPtr multMinusEclipseState(new Opm::EclipseState(multMinusDeck, parseContext));
auto multMinusGrid = std::make_shared<Dune::CpGrid>(); auto multMinusGrid = std::make_shared<Dune::CpGrid>();
multMinusGrid->processEclipseFormat(multMinusEclipseState->getEclipseGrid(), 0.0, false); multMinusGrid->processEclipseFormat(multMinusEclipseState->getInputGrid(), 0.0, false);
auto multMinusProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multMinusDeck, multMinusEclipseState, *multMinusGrid); auto multMinusProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(multMinusDeck, multMinusEclipseState, *multMinusGrid);
@ -324,7 +324,7 @@ BOOST_AUTO_TEST_CASE(TransmissibilityMultipliersCpGrid)
Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(ntgDeck, parseContext)); Opm::EclipseStateConstPtr ntgEclipseState(new Opm::EclipseState(ntgDeck, parseContext));
auto ntgGrid = std::make_shared<Dune::CpGrid>(); auto ntgGrid = std::make_shared<Dune::CpGrid>();
ntgGrid->processEclipseFormat(ntgEclipseState->getEclipseGrid(), 0.0, false); ntgGrid->processEclipseFormat(ntgEclipseState->getInputGrid(), 0.0, false);
auto ntgProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(ntgDeck, ntgEclipseState, *ntgGrid); auto ntgProps = std::make_shared<Opm::BlackoilPropsAdFromDeck>(ntgDeck, ntgEclipseState, *ntgGrid);