18#include <boost/fusion/include/for_each.hpp>
19#include <boost/utility.hpp>
20#include <boost/multi_array.hpp>
22#include "grid/common/rangegenerators.hh"
42 std::vector<double>
threshold(boost::multi_array<double,2>
const& normalizedErrors)
const;
45 virtual double computeThreshold(std::vector<double>& normalizedErrors,
double totalError,
int j)
const = 0;
52 template <
class Gr
idManager,
class Gr
idView>
54 std::vector<double>
const& threshold)
56 for (
auto const& cell: Dune::elements(gridView))
58 auto idx = gridView.indexSet().index(cell);
59 for (
int j=0; j<threshold.size(); ++j)
60 if (normalizedErrors[idx][j] >= threshold[j])
62 gridManager.
mark(1,cell);
87 virtual double computeThreshold(std::vector<double>& normalizedErrors,
double totalError,
int j)
const;
105 virtual double computeThreshold(std::vector<double>& normalizedErrors,
double totalError,
int j)
const;
121 virtual double computeThreshold(std::vector<double>& normalizedErrors,
double totalError,
int j)
const;
140 std::vector<int> order;
141 virtual double computeThreshold(std::vector<double>& normalizedErrors,
double totalError,
int j)
const;
146 namespace ErrorestDetail
154 template <
class GroupByCell>
161 template <
class Cell>
164 return shapeFunctionOrder;
171 auto shape = c.
sums.shape();
173 sums.resize(boost::extents[shape[0]][shape[1]]);
180 template <
class Cell,
class Index,
class LocalPosition,
class Sequence>
185 if (
sums.num_elements()==0)
186 sums.resize(boost::extents[group.nGroups][boost::fusion::size(x)]);
188 boost::fusion::for_each(x,Add(
sums,group[idx],i,weight));
193 auto shape = c.
sums.shape();
194 auto myshape =
sums.shape();
196 if(c.
sums.num_elements()==0)
199 if (
sums.num_elements()==0 || myshape[0]!=shape[0] || myshape[1]!=shape[1])
201 sums.resize(boost::extents[shape[0]][shape[1]]);
205 for (
size_t i=0; i<shape[0]; ++i)
206 for (
size_t j=0; j<shape[1]; ++j)
210 boost::multi_array<double,2>
sums;
217 Add(boost::multi_array<double,2>& sums_,
int idx_,
int& i_,
double w_):
218 sums(sums_), idx(idx_), i(i_) , w(w_)
225 boost::multi_array<double,2>&
sums;
Babuska-Rheinboldt refinement criterion. Determines the refinement thresholds such that all cells wit...
BabuskaRheinboldtCriterion(std::vector< int > const &order)
Bulk refinement criterion. Determines the refinement thresholds such that approximately the specified...
BulkCriterion(double fraction=0.2)
Fixed fraction refinement criterion. Determines the refinement thresholds such that at least the spec...
FixedFractionCriterion(double fraction=0.2)
bool adaptAtOnce()
DEPRECATED Performs grid refinement without prolongating registered FE functions.
bool mark(int refCount, typename Grid::template Codim< 0 >::Entity const &cell)
Marks the given cell for refinement or coarsening.
Class that takes care of the transfer of data (of each FunctionSpaceElement) after modification of th...
Max value refinement criterion. Determines the refinement thresholds such that all cells with an erro...
MaxValueCriterion(double fraction=0.2)
Base class for refinement criteria.
std::vector< double > threshold(boost::multi_array< double, 2 > const &normalizedErrors) const
Computes the thresholds for refinement.
typename GridView::template Codim< 0 >::Entity Cell
The type of cells (entities of codimension 0) in the grid view.
void markAndRefine(GridManager &gridManager, GridView const &gridView, boost::multi_array< double, 2 > const &normalizedErrors, std::vector< double > const &threshold)
Refines the grid according to the normalized errors and the given thresholds.
A Collector coalescing the information of multi-variable functions on cell groups.
void join(GroupedSummationCollector< GroupByCell > const &c)
GroupedSummationCollector(GroupByCell const &group_)
boost::multi_array< double, 2 > sums
int integrationOrder(Cell const &, int shapeFunctionOrder) const
void operator()(Cell const &, Index idx, LocalPosition const &, double weight, Sequence const &x)
GroupedSummationCollector< GroupByCell > & operator=(GroupedSummationCollector< GroupByCell > const &c)