From 11f36de73e9955653772f737e416d60f2d945404 Mon Sep 17 00:00:00 2001 From: Robert Kloefkorn Date: Wed, 30 Nov 2016 11:41:24 +0100 Subject: [PATCH 1/2] [bugfix] Use AutoDiffGrid in unspecialized version of ParallelDebugOutput. --- opm/autodiff/ParallelDebugOutput.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/autodiff/ParallelDebugOutput.hpp b/opm/autodiff/ParallelDebugOutput.hpp index 805587f33..e70a96874 100644 --- a/opm/autodiff/ParallelDebugOutput.hpp +++ b/opm/autodiff/ParallelDebugOutput.hpp @@ -105,8 +105,8 @@ namespace Opm virtual const WellStateFullyImplicitBlackoil& globalWellState() const { return *wellState_; } virtual bool isIORank () const { return true; } virtual bool isParallel () const { return false; } - virtual int numCells() const { return grid_.number_of_cells; } - virtual const int* globalCell() const { return grid_.global_cell; } + virtual int numCells() const { return Opm::AutoDiffGrid::numCells(grid_); } + virtual const int* globalCell() const { return Opm::AutoDiffGrid::globalCell(grid_); } }; #if HAVE_OPM_GRID From 8a7141fa88d298b270fdd26c43bf50556ed5844c Mon Sep 17 00:00:00 2001 From: Robert Kloefkorn Date: Wed, 5 Apr 2017 13:54:12 +0200 Subject: [PATCH 2/2] [feature] Add GridInit for PolyhedralGrid. --- opm/autodiff/GridInit.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/opm/autodiff/GridInit.hpp b/opm/autodiff/GridInit.hpp index 1cbed0a49..e88044963 100644 --- a/opm/autodiff/GridInit.hpp +++ b/opm/autodiff/GridInit.hpp @@ -25,6 +25,7 @@ #include #if HAVE_OPM_GRID +#include #include #endif @@ -68,6 +69,30 @@ namespace Opm #if HAVE_OPM_GRID + /// Specialization for PolyhedralGrid. + template < int dim, int dimworld > + class GridInit< Dune::PolyhedralGrid< dim, dimworld > > + { + public: + typedef Dune::PolyhedralGrid< dim, dimworld > Grid; + /// Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes. + GridInit(const EclipseState& eclipse_state, const std::vector& porv) + : grid_manager_(eclipse_state.getInputGrid(), porv), + grid_( *grid_manager_.c_grid() ) + { + } + + /// Access the created grid. + const Grid& grid() + { + return grid_; + } + private: + GridManager grid_manager_; + Grid grid_; + }; + + /// Specialization for CpGrid. template <> class GridInit