13#ifndef DUMUX_IO_GRID_MANAGER_MMESH_HH
14#define DUMUX_IO_GRID_MANAGER_MMESH_HH
17#include <dune/mmesh/mmesh.hh>
20#ifndef DUMUX_IO_GRID_MANAGER_BASE_HH
52 using Grid = Dune::MovingMesh<dim>;
58 void init(
const std::string& modelParamGroup =
"")
72 using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dim>;
76 using CellArray = std::array<unsigned int, dim>;
77 CellArray numCells; numCells.fill(1);
81 std::array<unsigned int, dim> numVertices = numCells;
82 for (
int i = 0; i < dim; ++i)
85 Dune::MMeshImplicitGridFactory<Grid> factory;
88 Dune::FactoryUtilities::MultiIndex<dim> index(numVertices);
89 for (
int i = 0; i < index.cycle(); ++i, ++index)
91 GlobalPosition pos(0);
92 for (
int j=0; j<dim; j++)
93 pos[j] = lowerLeft[j] + index[j] * (upperRight[j]-lowerLeft[j])/(numVertices[j]-1);
95 factory.insertVertex(pos);
98 this->
gridPtr() = std::unique_ptr<Grid>(factory.createGrid());
106 const auto prefix = modelParamGroup.empty() ? modelParamGroup : modelParamGroup +
".";
108 << prefix +
"Grid.UpperRight"
109 <<
", or a grid file in " << prefix +
"Grid.File");
void init(const std::string &modelParamGroup="")
Make the grid. This is implemented by specializations of this method.
Definition gridmanager_mmesh.hh:58
GridManagerBase< Grid > ParentType
Definition gridmanager_mmesh.hh:53
Dune::MovingMesh< dim > Grid
Definition gridmanager_mmesh.hh:52
The grid manager base interface (public) and methods common to most grid manager specializations (pro...
Definition gridmanager_base.hh:56
void maybeRefineGrid(const std::string &modelParamGroup)
Definition gridmanager_base.hh:315
void makeGridFromFile(const std::string &fileName, const std::string &modelParamGroup)
Definition gridmanager_base.hh:205
void loadBalance()
Definition gridmanager_base.hh:98
std::shared_ptr< Grid > & gridPtr()
Definition gridmanager_base.hh:163
The grid manager (this is the class used by the user) for all supported grid managers that constructs...
Definition gridmanager_base.hh:344
Exception thrown if a run-time parameter is not specified correctly.
Definition exceptions.hh:48
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