20 #ifndef OPM_GRIDINIT_HEADER_INCLUDED
21 #define OPM_GRIDINIT_HEADER_INCLUDED
23 #include <opm/parser/eclipse/Deck/Deck.hpp>
24 #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
25 #include <opm/core/grid/GridManager.hpp>
28 #include <dune/grid/polyhedralgrid.hh>
29 #include <dune/grid/CpGrid.hpp>
44 GridInit(
const EclipseState&,
const std::vector<double>&)
46 OPM_THROW(std::logic_error,
"Found no specialization for GridInit for the requested Grid class.");
57 GridInit(
const EclipseState& eclipse_state,
const std::vector<double>& porv)
58 : grid_manager_(eclipse_state.getInputGrid(), porv)
62 const UnstructuredGrid&
grid()
64 return *grid_manager_.c_grid();
67 GridManager grid_manager_;
72 template <
int dim,
int dimworld >
74 class GridInit< Dune::PolyhedralGrid< dim, dimworld > >
77 typedef Dune::PolyhedralGrid< dim, dimworld > Grid;
79 GridInit(
const EclipseState& eclipse_state,
const std::vector<double>& porv)
80 : grid_manager_(eclipse_state.getInputGrid(), porv),
81 grid_( *grid_manager_.c_grid() )
91 GridManager grid_manager_;
98 class GridInit<Dune::CpGrid>
103 gridSelfManaged_ =
false;
107 GridInit(
const EclipseState& eclipse_state,
const std::vector<double>& porv)
109 gridSelfManaged_ =
true;
111 grid_ =
new Dune::CpGrid;
112 grid_->processEclipseFormat(eclipse_state.getInputGrid(),
false,
false,
false, porv);
117 if (gridSelfManaged_)
128 void setGrid(Dune::CpGrid& newGrid)
130 gridSelfManaged_ =
false;
136 bool gridSelfManaged_;
138 #endif // HAVE_OPM_GRID
143 #endif // OPM_GRIDINIT_HEADER_INCLUDED
const UnstructuredGrid & grid()
Access the created grid.
Definition: GridInit.hpp:62
GridInit(const EclipseState &, const std::vector< double > &)
Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes...
Definition: GridInit.hpp:44
A class intended to give a generic interface to initializing and accessing UnstructuredGrid and CpGri...
Definition: GridInit.hpp:40
GridInit(const EclipseState &eclipse_state, const std::vector< double > &porv)
Initialize from a deck and/or an eclipse state and (logical cartesian) specified pore volumes...
Definition: GridInit.hpp:57