shared_ptr<EclipseGrid> -> const EclipseGrid&
This commit is contained in:
parent
9615f0e9d7
commit
b7bb01b77e
@ -92,7 +92,7 @@ try
|
||||
Opm::DeckConstPtr deck = parser->parseFile(deck_filename , parseContext);
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
|
||||
const double grav = param.getDefault("gravity", unit::gravity);
|
||||
GridManager gm(eclipseState->getInputGrid());
|
||||
GridManager gm(*eclipseState->getInputGrid());
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
BlackoilPropertiesFromDeck props(deck, eclipseState, grid, param);
|
||||
warnIfUnusedParams(param);
|
||||
|
@ -177,7 +177,7 @@ try
|
||||
EclipseStateConstPtr eclipseState = std::make_shared<EclipseState>(*deck , parseContext);
|
||||
|
||||
// Grid init
|
||||
GridManager grid_manager(eclipseState->getInputGrid());
|
||||
GridManager grid_manager(*eclipseState->getInputGrid());
|
||||
const UnstructuredGrid& grid = *grid_manager.c_grid();
|
||||
// Rock and fluid init
|
||||
IncompPropertiesSinglePhase props(deck, eclipseState, grid);
|
||||
|
@ -78,7 +78,7 @@ try
|
||||
Opm::DeckConstPtr deck(parser->parseFile(eclipseFilename, parseContext));
|
||||
eclState.reset(new EclipseState(*deck, parseContext));
|
||||
|
||||
GridManager gm(eclState->getInputGrid());
|
||||
GridManager gm(*eclState->getInputGrid());
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
using boost::filesystem::path;
|
||||
path fpath(eclipseFilename);
|
||||
|
@ -42,7 +42,7 @@ try
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
// Setup grid
|
||||
GridManager grid(eclipseState->getInputGrid());
|
||||
GridManager grid(*eclipseState->getInputGrid());
|
||||
|
||||
// Define rock and fluid properties
|
||||
IncompPropertiesFromDeck incomp_properties(deck, eclipseState, *grid.c_grid());
|
||||
|
@ -38,18 +38,18 @@ namespace Opm
|
||||
{
|
||||
|
||||
/// Construct a 3d corner-point grid from a deck.
|
||||
GridManager::GridManager(Opm::EclipseGridConstPtr eclipseGrid)
|
||||
GridManager::GridManager(const Opm::EclipseGrid& inputGrid)
|
||||
: ug_(0)
|
||||
{
|
||||
initFromEclipseGrid(eclipseGrid, std::vector<double>());
|
||||
initFromEclipseGrid(inputGrid, std::vector<double>());
|
||||
}
|
||||
|
||||
|
||||
GridManager::GridManager(Opm::EclipseGridConstPtr eclipseGrid,
|
||||
GridManager::GridManager(const Opm::EclipseGrid& inputGrid,
|
||||
const std::vector<double>& poreVolumes)
|
||||
: ug_(0)
|
||||
{
|
||||
initFromEclipseGrid(eclipseGrid, poreVolumes);
|
||||
initFromEclipseGrid(inputGrid, poreVolumes);
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@ namespace Opm
|
||||
|
||||
|
||||
// Construct corner-point grid from EclipseGrid.
|
||||
void GridManager::initFromEclipseGrid(Opm::EclipseGridConstPtr eclipseGrid,
|
||||
void GridManager::initFromEclipseGrid(const Opm::EclipseGrid& inputGrid,
|
||||
const std::vector<double>& poreVolumes)
|
||||
{
|
||||
struct grdecl g;
|
||||
@ -137,31 +137,30 @@ namespace Opm
|
||||
std::vector<double> zcorn;
|
||||
std::vector<double> mapaxes;
|
||||
|
||||
g.dims[0] = eclipseGrid->getNX();
|
||||
g.dims[1] = eclipseGrid->getNY();
|
||||
g.dims[2] = eclipseGrid->getNZ();
|
||||
g.dims[0] = inputGrid.getNX();
|
||||
g.dims[1] = inputGrid.getNY();
|
||||
g.dims[2] = inputGrid.getNZ();
|
||||
|
||||
eclipseGrid->exportMAPAXES( mapaxes );
|
||||
eclipseGrid->exportCOORD( coord );
|
||||
eclipseGrid->exportZCORN( zcorn );
|
||||
eclipseGrid->exportACTNUM( actnum );
|
||||
inputGrid.exportMAPAXES( mapaxes );
|
||||
inputGrid.exportCOORD( coord );
|
||||
inputGrid.exportZCORN( zcorn );
|
||||
inputGrid.exportACTNUM( actnum );
|
||||
|
||||
g.coord = coord.data();
|
||||
g.zcorn = zcorn.data();
|
||||
g.actnum = actnum.data();
|
||||
g.mapaxes = mapaxes.data();
|
||||
|
||||
if (!poreVolumes.empty() && (eclipseGrid->getMinpvMode() != MinpvMode::ModeEnum::Inactive)) {
|
||||
if (!poreVolumes.empty() && (inputGrid.getMinpvMode() != MinpvMode::ModeEnum::Inactive)) {
|
||||
MinpvProcessor mp(g.dims[0], g.dims[1], g.dims[2]);
|
||||
const double minpv_value = eclipseGrid->getMinpvValue();
|
||||
const double minpv_value = inputGrid.getMinpvValue();
|
||||
// Currently the pinchProcessor is not used and only opmfil is supported
|
||||
//bool opmfil = eclipseGrid->getMinpvMode() == MinpvMode::OpmFIL;
|
||||
//bool opmfil = inputGrid.getMinpvMode() == MinpvMode::OpmFIL;
|
||||
bool opmfil = true;
|
||||
mp.process(poreVolumes, minpv_value, actnum, opmfil, zcorn.data());
|
||||
}
|
||||
|
||||
const double z_tolerance = eclipseGrid->isPinchActive() ?
|
||||
eclipseGrid->getPinchThresholdThickness() : 0.0;
|
||||
const double z_tolerance = inputGrid.isPinchActive() ? inputGrid.getPinchThresholdThickness() : 0.0;
|
||||
ug_ = create_grid_cornerpoint(&g, z_tolerance);
|
||||
if (!ug_) {
|
||||
OPM_THROW(std::runtime_error, "Failed to construct grid.");
|
||||
|
@ -42,14 +42,14 @@ namespace Opm
|
||||
{
|
||||
public:
|
||||
/// Construct a grid from an EclipseState::EclipseGrid instance.
|
||||
explicit GridManager(Opm::EclipseGridConstPtr eclipseGrid);
|
||||
explicit GridManager(const Opm::EclipseGrid& inputGrid);
|
||||
|
||||
/// Construct a grid from an EclipseState::EclipseGrid instance,
|
||||
/// giving an explicit set of pore volumes to be used for MINPV
|
||||
/// considerations.
|
||||
/// \input[in] eclipseGrid encapsulates a corner-point grid given from a deck
|
||||
/// \input[in] poreVolumes one element per logical cartesian grid element
|
||||
GridManager(Opm::EclipseGridConstPtr eclipseGrid,
|
||||
GridManager(const Opm::EclipseGrid& inputGrid,
|
||||
const std::vector<double>& poreVolumes);
|
||||
|
||||
/// Construct a 2d cartesian grid with cells of unit size.
|
||||
@ -86,7 +86,7 @@ namespace Opm
|
||||
GridManager& operator=(const GridManager& other);
|
||||
|
||||
// Construct corner-point grid from EclipseGrid.
|
||||
void initFromEclipseGrid(Opm::EclipseGridConstPtr eclipseGrid,
|
||||
void initFromEclipseGrid(const Opm::EclipseGrid& inputGrid,
|
||||
const std::vector<double>& poreVolumes);
|
||||
|
||||
// The managed UnstructuredGrid.
|
||||
|
@ -48,10 +48,10 @@ BOOST_AUTO_TEST_CASE(EqualsDifferentDeckReturnFalse) {
|
||||
const auto es2 = Opm::Parser::parse(filename2);
|
||||
auto eg2 = es2.getInputGrid();
|
||||
|
||||
GridManager gridManager1(eg1);
|
||||
GridManager gridManager1(*eg1);
|
||||
const UnstructuredGrid& grid1 = *gridManager1.c_grid();
|
||||
|
||||
GridManager gridManager2(eg2);
|
||||
GridManager gridManager2(*eg2);
|
||||
const UnstructuredGrid& grid2 = *gridManager2.c_grid();
|
||||
|
||||
BlackoilState state1( UgGridHelpers::numCells( grid1 ) , UgGridHelpers::numFaces( grid1 ) , 3);
|
||||
@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(EqualsNumericalDifferenceReturnFalse) {
|
||||
std::vector<int> actnum = get_testBlackoilStateActnum();
|
||||
eg->resetACTNUM(actnum.data());
|
||||
|
||||
GridManager gridManager(eg);
|
||||
GridManager gridManager(*eg);
|
||||
const UnstructuredGrid& grid = *gridManager.c_grid();
|
||||
|
||||
BlackoilState state1( UgGridHelpers::numCells( grid ) , UgGridHelpers::numFaces( grid ) , 3);
|
||||
|
@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(DisjointColumn)
|
||||
for (size_t i = 1; i <= (3 * 3 * 3); i++)
|
||||
actnum.push_back(i != 14); // ACTNUM 13*1 0 13* 1
|
||||
ep->resetACTNUM(actnum.data());
|
||||
Opm::GridManager manager(ep);
|
||||
Opm::GridManager manager(*ep);
|
||||
|
||||
VVI columns;
|
||||
Opm::extractColumn(*manager.c_grid(), columns);
|
||||
|
@ -60,7 +60,7 @@ struct TestFixture : public Setup
|
||||
{
|
||||
TestFixture()
|
||||
: Setup ()
|
||||
, grid (ecl->getInputGrid())
|
||||
, grid (*ecl->getInputGrid())
|
||||
, reltol(1.0e-10)
|
||||
{
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(Processing)
|
||||
|
||||
const int nc_initial = eclgrid->getNumActive();
|
||||
|
||||
Opm::GridManager gridM(eclgrid, porv);
|
||||
Opm::GridManager gridM(*eclgrid, porv);
|
||||
typedef UnstructuredGrid Grid;
|
||||
const Grid& grid = *(gridM.c_grid());
|
||||
const int* global_cell = Opm::UgGridHelpers::globalCell(grid);
|
||||
|
@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(diagnosis)
|
||||
});
|
||||
Opm::DeckConstPtr deck(parser->parseFile("../tests/relpermDiagnostics.DATA", parseContext));
|
||||
eclState.reset(new EclipseState(*deck, parseContext));
|
||||
GridManager gm(eclState->getInputGrid());
|
||||
GridManager gm(*eclState->getInputGrid());
|
||||
const UnstructuredGrid& grid = *gm.c_grid();
|
||||
std::shared_ptr<CounterLog> counterLog = std::make_shared<CounterLog>(Log::DefaultMessageTypes);
|
||||
OpmLog::addBackend( "COUNTERLOG" , counterLog );
|
||||
|
@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(TestStoppedWells)
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename , parseContext));
|
||||
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck , parseContext));
|
||||
Opm::GridManager gridManager(eclipseState->getInputGrid());
|
||||
Opm::GridManager gridManager(*eclipseState->getInputGrid());
|
||||
|
||||
double target_surfacerate_inj;
|
||||
double target_surfacerate_prod;
|
||||
|
@ -65,8 +65,8 @@ BOOST_AUTO_TEST_CASE(Equal) {
|
||||
BOOST_CHECK( deck1->hasKeyword("ZCORN") );
|
||||
BOOST_CHECK( deck1->hasKeyword("COORD") );
|
||||
|
||||
Opm::GridManager grid1(es1.getInputGrid());
|
||||
Opm::GridManager grid2(es2.getInputGrid());
|
||||
Opm::GridManager grid1(*es1.getInputGrid());
|
||||
Opm::GridManager grid2(*es2.getInputGrid());
|
||||
|
||||
const UnstructuredGrid* cgrid1 = grid1.c_grid();
|
||||
const UnstructuredGrid* cgrid2 = grid2.c_grid();
|
||||
@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(EqualEclipseGrid) {
|
||||
Opm::EclipseState es(*deck, parseContext);
|
||||
auto grid = es.getInputGrid();
|
||||
|
||||
Opm::GridManager gridM(es.getInputGrid());
|
||||
Opm::GridManager gridM(*es.getInputGrid());
|
||||
const UnstructuredGrid* cgrid1 = gridM.c_grid();
|
||||
struct UnstructuredGrid * cgrid2;
|
||||
{
|
||||
@ -164,11 +164,13 @@ BOOST_AUTO_TEST_CASE(TOPS_Fully_Specified) {
|
||||
Opm::EclipseState es1(*deck1, parseContext);
|
||||
Opm::EclipseState es2(*deck2, parseContext);
|
||||
|
||||
Opm::GridManager gridM1(es1.getInputGrid());
|
||||
Opm::GridManager gridM2(es2.getInputGrid());
|
||||
Opm::GridManager gridM1(*es1.getInputGrid());
|
||||
Opm::GridManager gridM2(*es2.getInputGrid());
|
||||
|
||||
const UnstructuredGrid* cgrid1 = gridM1.c_grid();
|
||||
const UnstructuredGrid* cgrid2 = gridM2.c_grid();
|
||||
|
||||
BOOST_CHECK(grid_equal(cgrid1, cgrid2));
|
||||
|
||||
Opm::EclipseGrid grid = gridM1.createEclipseGrid( *es1.getInputGrid( ) );
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works) {
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
|
||||
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
|
||||
Opm::GridManager gridManager(eclipseState->getInputGrid());
|
||||
Opm::GridManager gridManager(*eclipseState->getInputGrid());
|
||||
|
||||
{
|
||||
Opm::WellsManager wellsManager(eclipseState, 0, *gridManager.c_grid(), NULL);
|
||||
@ -219,7 +219,7 @@ BOOST_AUTO_TEST_CASE(WellsEqual) {
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
|
||||
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
|
||||
Opm::GridManager gridManager(eclipseState->getInputGrid());
|
||||
Opm::GridManager gridManager(*eclipseState->getInputGrid());
|
||||
|
||||
Opm::WellsManager wellsManager0(eclipseState, 0, *gridManager.c_grid(), NULL);
|
||||
Opm::WellsManager wellsManager1(eclipseState, 1, *gridManager.c_grid(), NULL);
|
||||
@ -235,7 +235,7 @@ BOOST_AUTO_TEST_CASE(ControlsEqual) {
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
|
||||
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
|
||||
Opm::GridManager gridManager(eclipseState->getInputGrid());
|
||||
Opm::GridManager gridManager(*eclipseState->getInputGrid());
|
||||
|
||||
Opm::WellsManager wellsManager0(eclipseState, 0, *gridManager.c_grid(), NULL);
|
||||
Opm::WellsManager wellsManager1(eclipseState, 1, *gridManager.c_grid(), NULL);
|
||||
@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(WellShutOK) {
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
|
||||
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
|
||||
Opm::GridManager gridManager(eclipseState->getInputGrid());
|
||||
Opm::GridManager gridManager(*eclipseState->getInputGrid());
|
||||
|
||||
Opm::WellsManager wellsManager2(eclipseState, 2, *gridManager.c_grid(), NULL);
|
||||
|
||||
@ -275,7 +275,7 @@ BOOST_AUTO_TEST_CASE(WellSTOPOK) {
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
|
||||
|
||||
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(*deck, parseContext));
|
||||
Opm::GridManager gridManager(eclipseState->getInputGrid());
|
||||
Opm::GridManager gridManager(*eclipseState->getInputGrid());
|
||||
|
||||
Opm::WellsManager wellsManager(eclipseState, 0, *gridManager.c_grid(), NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user