19#ifndef DUMUX_VARIABLECLASS_ADAPTIVE_HH
20#define DUMUX_VARIABLECLASS_ADAPTIVE_HH
22#include <dune/grid/common/partitionset.hh>
23#include <dune/grid/utility/persistentcontainer.hh>
45template<
class TypeTag>
54 using AdaptedValues =
typename CellData::AdaptedValues;
56 using Grid =
typename GridView::Grid;
57 using LevelGridView =
typename Grid::LevelGridView;
58 using PersistentContainer = Dune::PersistentContainer<Grid, AdaptedValues>;
62 PersistentContainer adaptationMap_;
90 adaptationMap_.resize();
93 for (
int level = grid_.maxLevel(); level >= 0; level--)
96 LevelGridView levelView = grid_.levelGridView(level);
98 for (
const auto& element : elements(levelView))
101 AdaptedValues &adaptedValues = adaptationMap_[element];
104 if (element.isLeaf())
107 int indexI = this->
index(element);
111 cellData.storeAdaptionValues(adaptedValues, element);
113 adaptedValues.count = 1;
116 if (element.level() > 0)
118 auto father = element.father();
119 AdaptedValues& adaptedValuesFather = adaptationMap_[father];
120 adaptedValuesFather.count += 1;
121 CellData::storeAdaptionValues(adaptedValues, adaptedValuesFather, father);
142 adaptationMap_.resize();
144 for (
int level = 0; level <= grid_.maxLevel(); level++)
146 LevelGridView levelView = grid_.levelGridView(level);
148 for (
const auto& element : elements(levelView))
151 if (element.partitionType() == Dune::GhostEntity)
154 if (!element.isNew())
157 if (element.isLeaf())
159 AdaptedValues &adaptedValues = adaptationMap_[element];
160 int newIdxI = this->
index(element);
164 cellData.setAdaptionValues(adaptedValues, element);
170 if (element.level() > 0)
174 CellData::reconstructAdaptionValues(adaptationMap_, element.father(), element, problem);
177 AdaptedValues& adaptedValues = adaptationMap_[element];
178 adaptedValues.count = 1;
181 if (element.isLeaf())
184 int newIdxI = this->
index(element);
187 cellData.setAdaptionValues(adaptedValues, element);
195 adaptationMap_.resize(
typename PersistentContainer::Value() );
196 adaptationMap_.shrinkToFit();
197 adaptationMap_.fill(
typename PersistentContainer::Value() );
202 using ElementMapper =
typename SolutionTypes::ElementMapper;
204 DataHandle dataHandle(problem.elementMapper(), this->cellDataGlobal());
205 problem.gridView().template communicate<DataHandle>(dataHandle,
206 Dune::InteriorBorder_All_Interface,
207 Dune::ForwardCommunication);
Contains a class to exchange entries of a vector.
Base class holding the variables for sequential models.
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property
Definition: propertysystem.hh:141
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
A data handle class to exchange entries of a vector.
Definition: vectorcommdatahandle.hh:78
Base class holding the variables and discretized data for sequential models.
Definition: variableclass.hh:49
CellData & cellData(const int idx)
Return the cell data of a specific cell.
Definition: variableclass.hh:129
int index(const Element &element) const
Get index of element (codim 0 entity)
Definition: variableclass.hh:148
const GridView & gridView() const
Return gridView.
Definition: variableclass.hh:164
Base class holding the variables and discretized data for sequential models.
Definition: sequential/variableclassadaptive.hh:47
void storePrimVars(const Problem &problem)
Definition: sequential/variableclassadaptive.hh:88
void reconstructPrimVars(const Problem &problem)
Definition: sequential/variableclassadaptive.hh:140
VariableClassAdaptive(const GridView &gridView)
Constructs an adaptive VariableClass object.
Definition: sequential/variableclassadaptive.hh:72