4#ifndef ERROR_FRACTION_MARKING_HH
5#define ERROR_FRACTION_MARKING_HH
31template <
class Gr
idType>
37 enum {dim = GridType::dimension};
40 struct AllCodimLayout {
67template <
class Gr
idType>
74 refinementIndicatorInVector[0] = &refinementIndicator;
77 gridInVector[0] = &grid;
79 mark(refinementIndicatorInVector, gridInVector, fraction);
82template <
class Gr
idType>
91 if (grids.
size() != refinementIndicators.size())
103 double totalError = 0.0;
105 for (
size_t i=0; i<grids.
size(); ++i)
108 AllCodimMapper mapper(*grids[i], AllCodimLayout());
111 refineIndex[i].
resize(mapper.size(),
false);
116 for (
const auto& e : elements(grids[i]->leafGridView()))
120 = Dune::ReferenceElements<double, dim>::general(e.type());
123 for (
int codim=0; codim<=
dim; ++codim)
125 for (
int entity=0; entity<refElement.size(codim); ++entity)
127 int entityIndex = mapper.subIndex(e, entity, codim);
128 if (not(entityProcessed[entityIndex][0]))
131 double errorIndicator = (*refinementIndicators[i]).value(e, codim, entity);
132 totalError += errorIndicator;
134 entityProcessed[entityIndex][0] =
true;
146 double refinedError = 0.0;
147 for (
const auto& e : errorMap)
149 refineIndex[e.second.first][e.second.second][0] =
true;
150 refinedError += e.first;
151 if (refinedError >= totalError*fraction)
156 for (
size_t i=0; i<grids.
size(); ++i)
158 AllCodimMapper mapper(*grids[i], AllCodimLayout());
160 for (
const auto& e : elements(grids[i]->leafGridView()))
164 = Dune::ReferenceElements<double, dim>::general(e.type());
167 bool refineElement =
false;
168 for (
int codim=0; (codim<=
dim) and not(refineElement); ++codim)
170 for (
int entity=0; (entity<refElement.size(codim)) and not(refineElement); ++entity)
172 int entityIndex = mapper.subIndex(e, entity, codim);
173 if (refineIndex[i][entityIndex][0])
174 refineElement =
true;
virtual void operator()()=0
#define DUNE_THROW(E,...)
This marking strategy marks local indicators providing a given fraction of the global error in descen...
Definition errorfractionmarking.hh:33
static void mark(RefinementIndicator< GridType > &refinementIndicator, GridType &grid, double fraction)
Definition errorfractionmarking.hh:69
Holds refinement indicators for a hierarchical grid.
Definition refinementindicator.hh:22