12#ifndef DUMUX_IO_GRID_MANAGER_MMESH_HH
13#define DUMUX_IO_GRID_MANAGER_MMESH_HH
16#include <dune/mmesh/mmesh.hh>
19#ifndef DUMUX_IO_GRID_MANAGER_BASE_HH
43class GridManager<
Dune::MovingMesh<dim>>
44:
public GridManagerBase<Dune::MovingMesh<dim>>
47 using Grid = Dune::MovingMesh<dim>;
48 using ParentType = GridManagerBase<Grid>;
53 void init(
const std::string& modelParamGroup =
"")
59 ParentType::maybeRefineGrid(modelParamGroup);
60 ParentType::loadBalance();
67 using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dim>;
71 using CellArray = std::array<unsigned int, dim>;
72 CellArray numCells; numCells.fill(1);
76 std::array<unsigned int, dim> numVertices = numCells;
77 for (
int i = 0; i < dim; ++i)
80 Dune::MMeshImplicitGridFactory<Grid> factory;
83 Dune::FactoryUtilities::MultiIndex<dim> index(numVertices);
84 for (
int i = 0; i < index.cycle(); ++i, ++index)
86 GlobalPosition pos(0);
87 for (
int j=0; j<dim; j++)
88 pos[j] = lowerLeft[j] + index[j] * (upperRight[j]-lowerLeft[j])/(numVertices[j]-1);
90 factory.insertVertex(pos);
93 this->
gridPtr() = std::unique_ptr<Grid>(factory.createGrid());
94 ParentType::maybeRefineGrid(modelParamGroup);
95 ParentType::loadBalance();
101 const auto prefix = modelParamGroup.empty() ? modelParamGroup : modelParamGroup +
".";
102 DUNE_THROW(ParameterException,
"Please supply one of the parameters "
103 << prefix +
"Grid.UpperRight"
104 <<
", or a grid file in " << prefix +
"Grid.File");
Grid Grid
Definition gridmanager_base.hh:57
std::shared_ptr< Grid > & gridPtr()
Definition gridmanager_base.hh:145
void init(const std::string &modelParamGroup="")
Definition gridmanager_base.hh:63
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:149
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:165
Definition common/pdesolver.hh:24