12#ifndef DUMUX_IO_GRID_MANAGER_ONED_HH
13#define DUMUX_IO_GRID_MANAGER_ONED_HH
15#include <dune/grid/onedgrid.hh>
16#include <dune/grid/io/file/dgfparser/dgfoned.hh>
18#ifndef DUMUX_IO_GRID_MANAGER_BASE_HH
43 using Grid = Dune::OneDGrid;
49 void init(
const std::string& modelParamGroup =
"")
55 ParentType::makeGridFromDgfFile(getParamFromGroup<std::string>(modelParamGroup,
"Grid.File"));
56 postProcessing_(modelParamGroup);
64 using CoordinateType =
typename Grid::ctype;
65 const auto leftBoundary = getParamFromGroup<CoordinateType>(modelParamGroup,
"Grid.LeftBoundary", 0.0);
66 const auto rightBoundary = getParamFromGroup<CoordinateType>(modelParamGroup,
"Grid.RightBoundary");
67 const int cells = getParamFromGroup<int>(modelParamGroup,
"Grid.Cells", 1);
69 ParentType::gridPtr() = std::make_shared<Grid>(cells, leftBoundary, rightBoundary);
70 postProcessing_(modelParamGroup);
77 const auto coordinates = getParamFromGroup<std::vector<typename Grid::ctype>>(modelParamGroup,
"Grid.Coordinates");
78 ParentType::gridPtr() = std::make_shared<Grid>(coordinates);
79 postProcessing_(modelParamGroup);
85 const auto prefix = modelParamGroup.empty() ? modelParamGroup : modelParamGroup +
".";
87 << prefix +
"Grid.RightBoundary"
88 <<
", or " << prefix +
"Grid.Coordinates"
89 <<
", or a grid file in " << prefix +
"Grid.File");
102 void postProcessing_(
const std::string& modelParamGroup)
105 const auto refType = getParamFromGroup<std::string>(modelParamGroup,
"Grid.RefinementType",
"Local");
106 if (refType ==
"Local")
107 ParentType::grid().setRefinementType(Dune::OneDGrid::RefinementType::LOCAL);
108 else if (refType ==
"Copy")
109 ParentType::grid().setRefinementType(Dune::OneDGrid::RefinementType::COPY);
111 DUNE_THROW(Dune::IOError,
"OneGrid only supports 'Local' or 'Copy' as refinement type. Not '"<< refType<<
"'!");
114 ParentType::maybeRefineGrid(modelParamGroup);
void init(const std::string &modelParamGroup="")
Make the grid. This is implemented by specializations of this method.
Definition: gridmanager_oned.hh:49
void loadBalance()
Call loadBalance() function of the grid. OneDGrid is not parallel an thus cannot communicate.
Definition: gridmanager_oned.hh:96
Dune::OneDGrid Grid
Definition: gridmanager_oned.hh:43
The grid manager base interface (public) and methods common to most grid manager specializations (pro...
Definition: gridmanager_base.hh:55
void loadBalance()
Call loadBalance() function of the grid.
Definition: gridmanager_base.hh:97
The grid manager (this is the class used by the user) for all supported grid managers that constructs...
Definition: gridmanager_base.hh:323
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....
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