4#ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_INTERPOLATE_HH
5#define DUNE_PDELAB_GRIDFUNCTIONSPACE_INTERPOLATE_HH
30 template<
typename LF,
typename XG>
31 struct InterpolateLeafFromScalarVisitor
32 :
public TypeTree::TreeVisitor
33 ,
public TypeTree::DynamicTraversal
36 template<
typename LFS,
typename TreePath>
37 void leaf(
const LFS& lfs, TreePath treePath)
const
46 xg.write_sub_container(lfs,xl);
49 InterpolateLeafFromScalarVisitor(
const LF& lf_, XG& xg_)
59 template<
typename LF,
typename XG>
60 struct InterpolateLeafFromVectorVisitor
61 :
public TypeTree::TreeVisitor
62 ,
public TypeTree::DynamicTraversal
64 using Domain =
typename Functions::SignatureTraits<LF>::Domain;
65 using Range =
typename Functions::SignatureTraits<LF>::Range;
68 template<
typename LFS,
typename TreePath>
73 using LFSRange =
typename LFS::Traits::FiniteElement::Traits::LocalBasisType::Traits::RangeType;
75 "only interpolation into scalar leaf function spaces is implemented");
78 auto f = [&](
const Domain& x) -> RangeField {
return lf(x)[
index]; };
84 xg.write_sub_container(lfs,xl);
90 InterpolateLeafFromVectorVisitor(
const LF& lf_, XG& xg_)
102 template<
typename E,
typename XG>
103 struct InterpolateVisitor
104 :
public TypeTree::TreePairVisitor
105 ,
public TypeTree::DynamicTraversal
108 template<
typename F,
typename LFS,
typename TreePath>
121 xg.write_sub_container(lfs, xl);
125 template<
typename F,
typename LFS,
typename TreePath,
126 typename Range =
typename Functions::SignatureTraits<F>::Range>
129 (!LFS::isLeaf)>::type
130 leaf(
const F& f,
const LFS& lfs, TreePath treePath)
const
137 template<
typename F,
typename LFS,
typename TreePath,
138 typename Range =
typename Functions::SignatureTraits<F>::Range>
141 (!LFS::isLeaf)>::type
142 leaf(
const F& f,
const LFS& lfs, TreePath treePath)
const
145 "Number of leaves and dimension of range type " \
146 "must match for automatic interpolation of " \
147 "vector-valued function");
152 InterpolateVisitor(
const E& e_, XG& xg_)
176 template<
typename F,
typename GFS,
typename XG>
182 using EntitySet =
typename GFS::Traits::EntitySet;
183 using Element =
typename EntitySet::Element;
185 auto entity_set = gfs.entitySet();
194 LFSCache lfs_cache(lfs);
195 typedef typename XG::template LocalView<LFSCache> XView;
200 for (
const auto& element : elements(entity_set))
206 x_view.bind(lfs_cache);
void applyToTreePair(Tree1 &&tree1, Tree2 &&tree2, Visitor &&visitor)
void applyToTree(Tree &&tree, Visitor &&visitor)
const LF & lf
Definition interpolate.hh:54
XG & xg
Definition interpolate.hh:55
std::size_t index
Definition interpolate.hh:97
Dune::HybridMultiIndex< T... > TreePath
constexpr auto treePath(const T &... t)
void interpolate(const F &f, const GFS &gfs, XG &xg)
interpolation from a given grid function
Definition interpolate.hh:177
auto makeLocalFunctionTree(const F &f, const GV &gv) -> Imp::LocalFunctionLeafNodeWrapper< decltype(localFunction(f)) >
turn a given function tree into a local function tree
Definition localfunction.hh:125
For backward compatibility – Do not use this!
static const std::size_t leafCount
static const Interpolation & interpolation(const FiniteElement &fe)
Definition lfsindexcache.hh:979
Create a local function space from a global function space.
Definition localfunctionspace.hh:754
static const unsigned int value
Definition gridfunctionspace/tags.hh:139