24#ifndef DUMUX_IO_GRID_MANAGER_UG_HH
25#define DUMUX_IO_GRID_MANAGER_UG_HH
28#include <dune/grid/uggrid.hh>
29#include <dune/grid/io/file/dgfparser/dgfug.hh>
32#ifndef DUMUX_IO_GRID_MANAGER_BASE_HH
59class GridManager<
Dune::UGGrid<dim>>
60:
public GridManagerBase<Dune::UGGrid<dim>>
63 using Grid =
typename Dune::UGGrid<dim>;
64 using ParentType = GridManagerBase<Grid>;
65 using Element =
typename Grid::template Codim<0>::Entity;
70 void init(
const std::string& modelParamGroup =
"")
76 preProcessing_(modelParamGroup);
77 ParentType::makeGridFromFile(getParamFromGroup<std::string>(modelParamGroup,
"Grid.File"), modelParamGroup);
78 postProcessing_(modelParamGroup);
85 preProcessing_(modelParamGroup);
87 const auto cellType = getParamFromGroup<std::string>(modelParamGroup,
"Grid.CellType",
"Cube");
88 if (cellType ==
"Cube")
89 ParentType::template makeStructuredGrid<dim, dim>(ParentType::CellType::Cube, modelParamGroup);
90 else if (cellType ==
"Simplex")
91 ParentType::template makeStructuredGrid<dim, dim>(ParentType::CellType::Simplex, modelParamGroup);
93 DUNE_THROW(Dune::IOError,
"UGGrid only supports 'Cube' or 'Simplex' as cell type. Not '"<< cellType<<
"'!");
94 postProcessing_(modelParamGroup);
100 const auto prefix = modelParamGroup.empty() ? modelParamGroup : modelParamGroup +
".";
101 DUNE_THROW(ParameterException,
"Please supply one of the parameters "
102 << prefix +
"Grid.UpperRight"
103 <<
", or a grid file in " << prefix +
"Grid.File");
117 if (Dune::MPIHelper::getCommunication().size() > 1)
120 if(ParentType::enableDgfGridPointer_)
122 ParentType::dgfGridPtr().loadBalance();
124 ParentType::gridData_ = std::make_shared<typename ParentType::GridData>(ParentType::dgfGridPtr());
128 else if (ParentType::enableGmshDomainMarkers_)
131 auto dh = ParentType::gridData_->createGmshDataHandle();
132 ParentType::gridPtr()->loadBalance(dh.interface());
137 ParentType::gridPtr()->loadBalance();
145 void preProcessing_(
const std::string& modelParamGroup)
151 void postProcessing_(
const std::string& modelParamGroup)
154 const auto refType = getParamFromGroup<std::string>(modelParamGroup,
"Grid.RefinementType",
"Local");
155 if (refType ==
"Local")
156 ParentType::grid().setRefinementType(Dune::UGGrid<dim>::RefinementType::LOCAL);
157 else if (refType ==
"Copy")
158 ParentType::grid().setRefinementType(Dune::UGGrid<dim>::RefinementType::COPY);
160 DUNE_THROW(Dune::IOError,
"UGGrid only supports 'Local' or 'Copy' as refinment type. Not '"<< refType<<
"'!");
163 const auto closureType = getParamFromGroup<std::string>(modelParamGroup,
"Grid.ClosureType",
"Green");
164 if (closureType ==
"Green")
165 ParentType::grid().setClosureType(Dune::UGGrid<dim>::ClosureType::GREEN);
166 else if (closureType ==
"None")
167 ParentType::grid().setClosureType(Dune::UGGrid<dim>::ClosureType::NONE);
169 DUNE_THROW(Dune::IOError,
"UGGrid only supports 'Green' or 'None' as closure type. Not '"<< closureType<<
"'!");
172 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:177
Definition: common/pdesolver.hh:36
Grid Grid
Definition: gridmanager_base.hh:69
void loadBalance()
Call loadBalance() function of the grid.
Definition: gridmanager_base.hh:98
void init(const std::string &modelParamGroup="")
Make the grid. Implement this method in the specialization of this class for a grid type.
Definition: gridmanager_base.hh:75