24#ifndef DUMUX_IO_GRID_MANAGER_ONED_HH
25#define DUMUX_IO_GRID_MANAGER_ONED_HH
27#include <dune/grid/onedgrid.hh>
28#include <dune/grid/io/file/dgfparser/dgfoned.hh>
30#ifndef DUMUX_IO_GRID_MANAGER_BASE_HH
54 using Grid = Dune::OneDGrid;
60 void init(
const std::string& modelParamGroup =
"")
66 ParentType::makeGridFromDgfFile(getParamFromGroup<std::string>(modelParamGroup,
"Grid.File"));
67 postProcessing_(modelParamGroup);
75 using CoordinateType =
typename Grid::ctype;
76 const auto leftBoundary = getParamFromGroup<CoordinateType>(modelParamGroup,
"Grid.LeftBoundary", 0.0);
77 const auto rightBoundary = getParamFromGroup<CoordinateType>(modelParamGroup,
"Grid.RightBoundary");
78 const int cells = getParamFromGroup<int>(modelParamGroup,
"Grid.Cells", 1);
80 ParentType::gridPtr() = std::make_shared<Grid>(cells, leftBoundary, rightBoundary);
81 postProcessing_(modelParamGroup);
88 const auto coordinates = getParamFromGroup<std::vector<typename Grid::ctype>>(modelParamGroup,
"Grid.Coordinates");
89 ParentType::gridPtr() = std::make_shared<Grid>(coordinates);
90 postProcessing_(modelParamGroup);
96 const auto prefix = modelParamGroup ==
"" ? modelParamGroup : modelParamGroup +
".";
98 << prefix +
"Grid.RightBoundary"
99 <<
", or " << prefix +
"Grid.Coordinates"
100 <<
", or a grid file in " << prefix +
"Grid.File");
113 void postProcessing_(
const std::string& modelParamGroup)
116 const auto refType = getParamFromGroup<std::string>(modelParamGroup,
"Grid.RefinementType",
"Local");
117 if (refType ==
"Local")
118 ParentType::grid().setRefinementType(Dune::OneDGrid::RefinementType::LOCAL);
119 else if (refType ==
"Copy")
120 ParentType::grid().setRefinementType(Dune::OneDGrid::RefinementType::COPY);
122 DUNE_THROW(Dune::IOError,
"OneGrid only supports 'Local' or 'Copy' as refinment type. Not '"<< refType<<
"'!");
125 ParentType::maybeRefineGrid(modelParamGroup);
Provides a grid manager for all supported grid managers with input file interfaces....
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
Definition: common/properties/model.hh:34
Exception thrown if a run-time parameter is not specified correctly.
Definition: exceptions.hh:60
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
void loadBalance()
Call loadBalance() function of the grid.
Definition: gridmanager_base.hh:95
void init(const std::string &modelParamGroup="")
Make the grid. This is implemented by specializations of this method.
Definition: gridmanager_oned.hh:60
void loadBalance()
Call loadBalance() function of the grid. OneDGrid is not parallel an thus cannot communicate.
Definition: gridmanager_oned.hh:107
Dune::OneDGrid Grid
Definition: gridmanager_oned.hh:54