24#ifndef EWOMS_UNSTRUCTURED_GRID_VANGUARD_HH
25#define EWOMS_UNSTRUCTURED_GRID_VANGUARD_HH
32#include "opm/grid/UnstructuredGrid.h"
40template <
class TypeTag>
47 using GridPointer = Dune::GridPtr< Grid >;
55 Parameters::Register<Parameters::GridGlobalRefinements>
56 (
"The number of global refinements of the grid "
57 "executed after it was loaded");
58 Parameters::Register<Parameters::GridFile>,
59 (
"The file name of the file to load");
67 const std::string gridFileName = Parameters::Get<Parameters::GridFile>();
68 unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
70 const char* c_str = gridFileName.c_str();
72 UnstructuredGrid*
grid = read_grid(c_str);
73 if (
grid ==
nullptr) {
75 "RuntimeError: UnstructuredGridVanguard could not read grid file: " +
76 gridFileName +
". Are you sure the filename is correct?";
77 throw std::runtime_error(msg);
79 ugPtr_.reset(std::move(
grid ));
81 gridPtr_ =
new Grid(*ugPtr_);
82 if (numRefinments > 0) {
83 gridPtr_->globalRefine(
static_cast<int>(numRefinments));
92 Grid&
grid() {
return *gridPtr_; }
98 const Grid&
grid()
const {
return *gridPtr_; }
101 GridPointer gridPtr_;
102 typename Grid::UnstructuredGridPtr ugPtr_;
Provides the base class for most (all?) simulator vanguards.
Definition: basevanguard.hh:49
void finalizeInit_()
Definition: basevanguard.hh:115
Provides a simulator vanguard which creates a grid by parsing an unstructured grid file.
Definition: unstructuredgridvanguard.hh:41
static void registerParameters()
Register all run-time parameters for the unstructured grid simulator vanguard.
Definition: unstructuredgridvanguard.hh:54
const Grid & grid() const
Return a constant reference to the grid object.
Definition: unstructuredgridvanguard.hh:98
UnstructuredGridVanguard(Simulator &simulator)
Load the grid from the file.
Definition: unstructuredgridvanguard.hh:65
Grid & grid()
Return a reference to the grid object.
Definition: unstructuredgridvanguard.hh:92
Definition: blackoilboundaryratevector.hh:37
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:235
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.