24 #ifndef EWOMS_UNSTRUCTURED_GRID_VANGUARD_HH 25 #define EWOMS_UNSTRUCTURED_GRID_VANGUARD_HH 27 #include <dune/grid/io/file/dgfparser/gridptr.hh> 33 #include <opm/grid/UnstructuredGrid.h> 42 template <
class TypeTag>
50 using GridPointer = Dune::GridPtr<Grid>;
58 Parameters::Register<Parameters::GridGlobalRefinements>
59 (
"The number of global refinements of the grid " 60 "executed after it was loaded");
61 Parameters::Register<Parameters::GridFile>
62 (
"The file name of the file to load");
71 const std::string gridFileName = Parameters::Get<Parameters::GridFile>();
72 const int numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
74 UnstructuredGrid* ugrid = read_grid(gridFileName.c_str());
75 if (ugrid ==
nullptr) {
76 throw std::runtime_error(
"RuntimeError: UnstructuredGridVanguard could not read grid file: " +
77 gridFileName +
". Are you sure the filename is correct?");
79 ugPtr_.reset(std::move(ugrid));
81 gridPtr_ =
new Grid(*ugPtr_);
82 if (numRefinments > 0) {
83 gridPtr_->globalRefine(numRefinments);
85 this->finalizeInit_();
102 GridPointer gridPtr_;
103 typename Grid::UnstructuredGridPtr ugPtr_;
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(...))
Definition: propertysystem.hh:233
This file provides the infrastructure to retrieve run-time parameters.
Provides the base class for most (all?) simulator vanguards.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Grid & grid()
Return a reference to the grid object.
Definition: unstructuredgridvanguard.hh:91
The Opm property system, traits with inheritance.
UnstructuredGridVanguard(Simulator &simulator)
Load the grid from the file.
Definition: unstructuredgridvanguard.hh:68
const Grid & grid() const
Return a constant reference to the grid object.
Definition: unstructuredgridvanguard.hh:98
Provides a simulator vanguard which creates a grid by parsing an unstructured grid file...
Definition: unstructuredgridvanguard.hh:43
Provides the base class for most (all?) simulator vanguards.
Definition: basevanguard.hh:49
static void registerParameters()
Register all run-time parameters for the unstructured grid simulator vanguard.
Definition: unstructuredgridvanguard.hh:57