24#ifndef DUMUX_IO_GRID_MANAGER_MMESH_HH
25#define DUMUX_IO_GRID_MANAGER_MMESH_HH
28#include <dune/mmesh/mmesh.hh>
31#ifndef DUMUX_IO_GRID_MANAGER_BASE_HH
59 using Grid = Dune::MovingMesh<dim>;
60 using ParentType = GridManagerBase<Grid>;
65 void init(
const std::string& modelParamGroup =
"")
71 ParentType::maybeRefineGrid(modelParamGroup);
72 ParentType::loadBalance();
79 using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dim>;
83 using CellArray = std::array<unsigned int, dim>;
84 CellArray numCells; numCells.fill(1);
88 std::array<unsigned int, dim> numVertices = numCells;
89 for (
int i = 0; i < dim; ++i)
92 Dune::MMeshImplicitGridFactory<Grid> factory;
95 Dune::FactoryUtilities::MultiIndex<dim> index(numVertices);
96 for (
int i = 0; i < index.cycle(); ++i, ++index)
98 GlobalPosition pos(0);
99 for (
int j=0; j<dim; j++)
100 pos[j] = lowerLeft[j] + index[j] * (upperRight[j]-lowerLeft[j])/(numVertices[j]-1);
102 factory.insertVertex(pos);
105 this->
gridPtr() = std::unique_ptr<Grid>(factory.createGrid());
106 ParentType::maybeRefineGrid(modelParamGroup);
107 ParentType::loadBalance();
113 const auto prefix = modelParamGroup.empty() ? modelParamGroup : modelParamGroup +
".";
114 DUNE_THROW(ParameterException,
"Please supply one of the parameters "
115 << prefix +
"Grid.UpperRight"
116 <<
", or a grid file in " << prefix +
"Grid.File");
Provides a grid manager for all supported grid managers with input file interfaces....
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:375
bool hasParamInGroup(const std::string ¶mGroup, const std::string ¶m)
Check whether a key exists in the parameter tree with a model group prefix.
Definition parameters.hh:391
The grid manager (this is the class used by the user) for all supported grid managers that constructs...
Definition gridmanager_base.hh:320
The grid manager base interface (public) and methods common to most grid manager specializations (pro...
Definition gridmanager_base.hh:73
Grid Grid
Definition gridmanager_base.hh:75
std::shared_ptr< Grid > & gridPtr()
Definition gridmanager_base.hh:142
void init(const std::string &modelParamGroup="")
Definition gridmanager_base.hh:81