adapt to the change of the API due to using compressed instead of cartesian indices

This commit is contained in:
Andreas Lauser 2015-08-03 16:22:20 +02:00
parent a394af6734
commit 0e5d8da66b
3 changed files with 68 additions and 1 deletions

View File

@ -251,9 +251,21 @@ try
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck);
Opm::BlackoilOutputWriter outputWriter(grid, param, eclipseState, pu );
int numCells = Opm::UgGridHelpers::numCells(grid);
const auto& globalCell = Opm::UgGridHelpers::globalCell(grid);
std::vector<int> compressedToCartesianIdx(numCells);
for (unsigned cellIdx = 0; cellIdx < numCells; ++cellIdx) {
if (globalCell) {
compressedToCartesianIdx[cellIdx] = globalCell[cellIdx];
}
else {
compressedToCartesianIdx[cellIdx] = cellIdx;
}
}
typedef BlackoilPropsAdFromDeck::MaterialLawManager MaterialLawManager;
auto materialLawManager = std::make_shared<MaterialLawManager>();
materialLawManager->initFromDeck(deck, eclipseState);
materialLawManager->initFromDeck(deck, eclipseState, compressedToCartesianIdx);
// Rock and fluid init
BlackoilPropertiesFromDeck props( deck, eclipseState, materialLawManager,

View File

@ -58,6 +58,47 @@ namespace Opm
grid.cell_centroids, grid.dimensions, init_rock);
}
#ifdef HAVE_DUNE_CORNERPOINT
/// Constructor wrapping an opm-core black oil interface.
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
const Dune::CpGrid& grid,
const bool init_rock )
{
auto materialLawManager = std::make_shared<MaterialLawManager>();
unsigned number_of_cells = grid.size(0);
std::vector<int> compressedToCartesianIdx(number_of_cells);
for (unsigned cellIdx = 0; cellIdx < number_of_cells; ++cellIdx) {
compressedToCartesianIdx[cellIdx] = grid.globalCell()[cellIdx];
}
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
init(deck, eclState, materialLawManager, grid.numCells(), static_cast<const int*>(&grid.globalCell()[0]),
static_cast<const int*>(&grid.logicalCartesianSize()[0]),
grid.beginCellCentroids(), Dune::CpGrid::dimension, init_rock);
}
#endif
/// Constructor wrapping an opm-core black oil interface.
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
const UnstructuredGrid& grid,
const bool init_rock)
{
auto materialLawManager = std::make_shared<MaterialLawManager>();
std::vector<int> compressedToCartesianIdx(grid.number_of_cells);
for (unsigned cellIdx = 0; cellIdx < grid.number_of_cells; ++cellIdx) {
if (grid.global_cell) {
compressedToCartesianIdx[cellIdx] = grid.global_cell[cellIdx];
}
else {
compressedToCartesianIdx[cellIdx] = cellIdx;
}
}
materialLawManager->initFromDeck(deck, eclState, compressedToCartesianIdx);
init(deck, eclState, materialLawManager, 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(Opm::DeckConstPtr deck,

View File

@ -77,6 +77,20 @@ namespace Opm
const bool init_rock = true );
#endif
/// Constructor wrapping an opm-core black oil interface.
BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
const UnstructuredGrid& grid,
const bool init_rock = true );
#ifdef HAVE_DUNE_CORNERPOINT
/// Constructor wrapping an opm-core black oil interface.
BlackoilPropsAdFromDeck(Opm::DeckConstPtr deck,
Opm::EclipseStateConstPtr eclState,
const Dune::CpGrid& grid,
const bool init_rock = true );
#endif
/// \brief Constructor to create properties for a subgrid
///
/// This copies all properties that are not dependant on the