5 #include <dune/grid/utility/hierarchicsearch.hh> 7 #include <amdis/algorithm/Transform.hpp> 8 #include <amdis/functions/Interpolate.hpp> 9 #include <amdis/gridfunctions/GridFunction.hpp> 10 #include <amdis/linearalgebra/VectorFacade.hpp> 15 template <
class C,
class GB,
class TP,
class R>
16 typename DiscreteFunction<C const,GB,TP,R>::Range DiscreteFunction<C const,GB,TP,R>::
17 operator()(Domain
const& x)
const 19 using Grid =
typename GlobalBasis::GridView::Grid;
20 using IS =
typename GlobalBasis::GridView::IndexSet;
22 auto const& gv = this->basis().gridView();
23 Dune::HierarchicSearch<Grid,IS> hsearch{gv.grid(), gv.indexSet()};
25 auto element = hsearch.findEntity(x);
26 auto geometry = element.geometry();
27 auto localFct = localFunction(*
this);
28 localFct.bind(element);
29 return localFct(geometry.local(x));
34 template <
class C,
class GB,
class TP,
class R>
35 template <
class Expr,
class Tag>
39 auto const& basis = this->basis();
40 auto const& treePath = this->treePath();
44 if constexpr(std::is_same_v<Tag, tag::average>) {
45 VectorType_t<short,Coefficients> counter(basis);
46 AMDiS::interpolate(basis, coefficients(), gf, treePath, counter);
48 Recursive::transform(coefficients(),
49 [](
auto const& coeff,
short c) {
return coeff / std::max(
double(c), 1.0); },
50 coefficients(), counter);
53 AMDiS::interpolate(basis, coefficients(), gf, treePath);
59 template <
class C,
class GB,
class TP,
class R>
60 template <
class Expr,
class Tag>
65 Coefficients tmp(coefficients());
67 Self tmpView{tmp, this->basis(), this->treePath()};
71 coefficients() = std::move(tmp);
void interpolate(Expr &&expr, Tag strategy={})
Interpolation of GridFunction to DOFVector.
Definition: DiscreteFunction.inc.hpp:62
decltype(auto) makeGridFunction(PreGridFct const &preGridFct, GridView const &gridView)
Generator for Gridfunctions from Expressions (PreGridfunctions)
Definition: GridFunction.hpp:168
Definition: AdaptBase.hpp:6
A mutable view on the subspace of a DOFVector,.
Definition: DiscreteFunction.hpp:36
void interpolate_noalias(Expr &&expr, Tag strategy={})
Interpolation of GridFunction to DOFVector, assuming that there is no reference to this DOFVector in ...
Definition: DiscreteFunction.inc.hpp:37