12#ifndef DUMUX_IO_GRID_MANAGER_UG_HH
13#define DUMUX_IO_GRID_MANAGER_UG_HH
16#include <dune/grid/uggrid.hh>
17#include <dune/grid/io/file/dgfparser/dgfug.hh>
20#ifndef DUMUX_IO_GRID_MANAGER_BASE_HH
53 using Grid =
typename Dune::UGGrid<dim>;
54 using ParentType = GridManagerBase<Grid>;
55 using Element =
typename Grid::template Codim<0>::Entity;
60 void init(
const std::string& modelParamGroup =
"")
66 preProcessing_(modelParamGroup);
68 postProcessing_(modelParamGroup);
75 preProcessing_(modelParamGroup);
78 if (cellType ==
"Cube")
80 else if (cellType ==
"Simplex")
83 DUNE_THROW(Dune::IOError,
"UGGrid only supports 'Cube' or 'Simplex' as cell type. Not '"<< cellType<<
"'!");
84 postProcessing_(modelParamGroup);
90 const auto prefix = modelParamGroup.empty() ? modelParamGroup : modelParamGroup +
".";
91 DUNE_THROW(ParameterException,
"Please supply one of the parameters "
92 << prefix +
"Grid.UpperRight"
93 <<
", or a grid file in " << prefix +
"Grid.File");
107 if (Dune::MPIHelper::getCommunication().size() > 1)
110 if(ParentType::enableDgfGridPointer_)
112 ParentType::dgfGridPtr().loadBalance();
114 ParentType::gridData_ = std::make_shared<typename ParentType::GridData>(ParentType::dgfGridPtr());
118 else if (ParentType::enableGmshDomainMarkers_)
121 auto dh = ParentType::gridData_->createGmshDataHandle();
122 ParentType::gridPtr()->loadBalance(dh.interface());
128 else if (ParentType::enableVtkData_)
131 auto dh = ParentType::gridData_->createVtkDataHandle();
132 ParentType::gridPtr()->loadBalance(dh.interface());
138 ParentType::gridPtr()->loadBalance();
146 void preProcessing_(
const std::string& modelParamGroup)
152 void postProcessing_(
const std::string& modelParamGroup)
156 if (refType ==
"Local")
157 ParentType::grid().setRefinementType(Dune::UGGrid<dim>::RefinementType::LOCAL);
158 else if (refType ==
"Copy")
159 ParentType::grid().setRefinementType(Dune::UGGrid<dim>::RefinementType::COPY);
161 DUNE_THROW(Dune::IOError,
"UGGrid only supports 'Local' or 'Copy' as refinement type. Not '"<< refType<<
"'!");
165 if (closureType ==
"Green")
166 ParentType::grid().setClosureType(Dune::UGGrid<dim>::ClosureType::GREEN);
167 else if (closureType ==
"None")
168 ParentType::grid().setClosureType(Dune::UGGrid<dim>::ClosureType::NONE);
170 DUNE_THROW(Dune::IOError,
"UGGrid only supports 'Green' or 'None' as closure type. Not '"<< closureType<<
"'!");
173 ParentType::maybeRefineGrid(modelParamGroup);
187 static bool eval(
const GV& gv)
188 {
return gv.comm().size() <= 1; }
The grid manager base interface (public) and methods common to most grid manager specializations (pro...
Definition gridmanager_base.hh:55
Grid Grid
Definition gridmanager_base.hh:57
void makeStructuredGrid(CellType cellType, const std::string &modelParamGroup)
Definition gridmanager_base.hh:278
void loadBalance()
Definition gridmanager_base.hh:97
void init(const std::string &modelParamGroup="")
Definition gridmanager_base.hh:63
The grid manager (this is the class used by the user) for all supported grid managers that constructs...
Definition gridmanager_base.hh:336
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:149
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 gridcapabilities.hh:57
Definition gridcapabilities.hh:67
static bool eval(const GV &)
Definition gridcapabilities.hh:69