24#ifndef DUMUX_IO_GRID_MANAGER_FOAM_HH
25#define DUMUX_IO_GRID_MANAGER_FOAM_HH
29#include <dune/foamgrid/foamgrid.hh>
30#include <dune/foamgrid/dgffoam.hh>
33#ifndef DUMUX_IO_GRID_MANAGER_BASE_HH
55template<
int dim,
int dimworld>
60 using Grid = Dune::FoamGrid<dim, dimworld>;
61 using ParentType = GridManagerBase<Grid>;
66 void init(
const std::string& modelParamGroup =
"")
72 ParentType::maybeRefineGrid(modelParamGroup);
73 ParentType::loadBalance();
81 ParentType::maybeRefineGrid(modelParamGroup);
82 ParentType::loadBalance();
88 const auto prefix = modelParamGroup ==
"" ? modelParamGroup : modelParamGroup +
".";
89 DUNE_THROW(ParameterException,
"Please supply one of the parameters "
90 << prefix +
"Grid.UpperRight"
91 <<
", or a grid file in " << prefix +
"Grid.File");
111template<
int dimworld>
116 using Grid = Dune::FoamGrid<1, dimworld>;
117 using ParentType = GridManagerBase<Grid>;
122 void init(
const std::string& modelParamGroup =
"")
128 ParentType::maybeRefineGrid(modelParamGroup);
129 ParentType::loadBalance();
134 using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dimworld>;
137 using CellArray = std::array<unsigned int, 1>;
141 Dune::GridFactory<Grid> factory;
143 constexpr auto geomType = Dune::GeometryTypes::line;
146 GlobalPosition step = upperRight;
147 step -= lowerLeft, step /= cells[0];
150 GlobalPosition globalPos = lowerLeft;
151 for (
unsigned int vIdx = 0; vIdx <= cells[0]; vIdx++, globalPos += step)
152 factory.insertVertex(globalPos);
155 for(
unsigned int eIdx = 0; eIdx < cells[0]; eIdx++)
156 factory.insertElement(geomType, {eIdx, eIdx+1});
158 ParentType::gridPtr() = std::shared_ptr<Grid>(factory.createGrid());
159 ParentType::maybeRefineGrid(modelParamGroup);
160 ParentType::loadBalance();
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:438
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:454
make the local view function available whenever we use the grid geometry
Definition adapt.hh:29
The grid manager (this is the class used by the user) for all supported grid managers that constructs...
Definition gridmanager_base.hh:312
The grid manager base interface (public) and methods common to most grid manager specializations (pro...
Definition gridmanager_base.hh:65
Grid Grid
Definition gridmanager_base.hh:67
void makeStructuredGrid(CellType cellType, const std::string &modelParamGroup)
Definition gridmanager_base.hh:259
void init(const std::string &modelParamGroup="")
Definition gridmanager_base.hh:73