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
58template<
int dim,
int dimworld>
63 using Grid = Dune::FoamGrid<dim, dimworld>;
64 using ParentType = GridManagerBase<Grid>;
69 void init(
const std::string& modelParamGroup =
"")
75 ParentType::maybeRefineGrid(modelParamGroup);
76 ParentType::loadBalance();
84 ParentType::maybeRefineGrid(modelParamGroup);
85 ParentType::loadBalance();
91 const auto prefix = modelParamGroup.empty() ? modelParamGroup : modelParamGroup +
".";
92 DUNE_THROW(ParameterException,
"Please supply one of the parameters "
93 << prefix +
"Grid.UpperRight"
94 <<
", or a grid file in " << prefix +
"Grid.File");
115template<
int dimworld>
120 using Grid = Dune::FoamGrid<1, dimworld>;
121 using ParentType = GridManagerBase<Grid>;
126 void init(
const std::string& modelParamGroup =
"")
132 ParentType::maybeRefineGrid(modelParamGroup);
133 ParentType::loadBalance();
138 using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dimworld>;
141 using CellArray = std::array<unsigned int, 1>;
145 Dune::GridFactory<Grid> factory;
147 constexpr auto geomType = Dune::GeometryTypes::line;
150 GlobalPosition step = upperRight;
151 step -= lowerLeft, step /= cells[0];
154 GlobalPosition globalPos = lowerLeft;
155 for (
unsigned int vIdx = 0; vIdx <= cells[0]; vIdx++, globalPos += step)
156 factory.insertVertex(globalPos);
159 for(
unsigned int eIdx = 0; eIdx < cells[0]; eIdx++)
160 factory.insertElement(geomType, {eIdx, eIdx+1});
162 ParentType::gridPtr() = std::shared_ptr<Grid>(factory.createGrid());
163 ParentType::maybeRefineGrid(modelParamGroup);
164 ParentType::loadBalance();
172template<
int dim,
int dimworld>
176 static bool eval(
const GV&)
dune-grid capabilities compatibility layer
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:161
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:177
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition adapt.hh:29
Definition gridcapabilities.hh:69
Definition gridcapabilities.hh:79
static bool eval(const GV &)
Definition gridcapabilities.hh:81
The grid manager (this is the class used by the user) for all supported grid managers that constructs...
Definition gridmanager_base.hh:324
The grid manager base interface (public) and methods common to most grid manager specializations (pro...
Definition gridmanager_base.hh:67
Grid Grid
Definition gridmanager_base.hh:69
void makeStructuredGrid(CellType cellType, const std::string &modelParamGroup)
Definition gridmanager_base.hh:271
void init(const std::string &modelParamGroup="")
Definition gridmanager_base.hh:75