2#ifndef DUNE_PDELAB_FUNCTION_LOCALFUNCTION_HH
3#define DUNE_PDELAB_FUNCTION_LOCALFUNCTION_HH
11#include <dune/functions/common/signature.hh>
12#include <dune/functions/gridfunctions/gridviewfunction.hh>
17 template<
class F, std::
size_t k>
19 :
public TypeTree::PowerNode<F,k>
21 typedef TypeTree::PowerNode<F,k> NodeType;
26 template <
typename TT>
29 TypeTree::applyToTree(*
this,visitor);
32 template <
typename Entity>
33 void bind(
const Entity & e){
34 Imp::PowerCompositeBindVisitor<Entity> visitor(e);
35 TypeTree::applyToTree(*
this,visitor);
39 Imp::PowerCompositeUnbindVisitor visitor;
40 TypeTree::applyToTree(*
this,visitor);
57 template<
typename C0,
typename C1,
typename... Children>
59 : NodeType(
std::forward(c0),
std::forward(c1),
std::forward(children)...)
70 template<
typename... Children>
72 :
public TypeTree::CompositeNode<Children...>
74 typedef TypeTree::CompositeNode<Children...> NodeType;
79 template <
typename TT>
82 TypeTree::applyToTree(*
this,visitor);
85 template <
typename Entity>
86 void bind(
const Entity & e){
87 Imp::PowerCompositeBindVisitor<Entity> visitor(e);
88 TypeTree::applyToTree(*
this,visitor);
92 Imp::PowerCompositeUnbindVisitor visitor;
93 TypeTree::applyToTree(*
this,visitor);
101 template<
typename... Args,
typename =
typename std::enable_if<(
sizeof...(Args) ==
sizeof...(Children))>::type>
103 : NodeType(std::forward<Args>(args)...)
119 template<
class F,
class GV,
120 typename std::enable_if<
122 models< Dune::Functions::Imp::HasFreeLocalFunction, F>()
124 not(TypeTree::has_node_tag<typename
std::decay<F>::type>::
value),
int>::type = 0>
126 -> Imp::LocalFunctionLeafNodeWrapper< decltype(localFunction(f)) >
128 return Imp::LocalFunctionLeafNodeWrapper< decltype(localFunction(f)) >(localFunction(f));
131 template<
class F,
class GV,
133 typename std::enable_if<
134 Dune::Functions::Concept::isCallable<F, typename GV::template Codim<0>::Entity::Geometry::GlobalCoordinate>()
136 not(models< Dune::Functions::Imp::HasFreeLocalFunction, F>())
138 not(TypeTree::has_node_tag<
typename std::decay<F>::type>
::value),
int>::type = 0>
145 template<
class F,
class GV,
146 typename std::enable_if<
148 models< Dune::Functions::Imp::HasFreeLocalFunction, F>()
150 TypeTree::has_node_tag<typename
std::decay<F>::type>::
value,
int>::type = 0>
152 -> decltype(localView(f))
154 return localView(std::forward(f));
159 template<
typename LeafNode>
160 Dune::TypeTree::GenericLeafNodeTransformation<LeafNode,GridFunctionToLocalViewTransformation, Imp::LocalGridViewFunctionAdapter<LeafNode> >
163 template<
typename PowerNode>
164 Dune::TypeTree::SimplePowerNodeTransformation<PowerNode,GridFunctionToLocalViewTransformation,PowerLocalFunction>
167 template<
typename CompositeNode>
168 Dune::TypeTree::SimpleCompositeNodeTransformation<CompositeNode,GridFunctionToLocalViewTransformation,CompositeLocalFunction>
171 template<
class F,
class GV,
172 typename std::enable_if<
176 ->
typename Dune::TypeTree::TransformTree<typename std::decay<F>::type,
180 return Dune::TypeTree::TransformTree<typename std::decay<F>::type,
184 template<
class F,
class GV,
185 typename std::enable_if<
187 not(IsGridFunction<F>::value)
189 std::is_same<TypeTree::NodeTag<F>,TypeTree::LeafNodeTag>
::value,
int>::type = 0>
191 -> Imp::LocalGridViewFunctionAdapter<F>
194 return Imp::LocalGridViewFunctionAdapter<F>(
static_cast<const F&
>(f));
const P & p
Definition constraints.hh:148
For backward compatibility – Do not use this!
Definition adaptivity.hh:28
std::integral_constant< bool, impl::IsGridFunction< std::decay_t< T > >::value > IsGridFunction
Definition typetraits.hh:45
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
Dune::TypeTree::GenericLeafNodeTransformation< LeafNode, GridFunctionToLocalViewTransformation, Imp::LocalGridViewFunctionAdapter< LeafNode > > registerNodeTransformation(LeafNode *l, GridFunctionToLocalViewTransformation *t, GridFunctionTag *tag)
a GridFunction maps x in DomainType to y in RangeType
Definition function.hh:190
Definition function.hh:288
Visitor for Power- and CompositeGridFunctions calling the setTime() method on the leafs of the corres...
Definition function.hh:346
Definition function.hh:357
Definition function.hh:525
Definition localfunction.hh:20
PowerDifferentiableFunctionLocalViewTag ImplementationTag
Definition localfunction.hh:23
void unbind()
Definition localfunction.hh:38
PowerLocalFunction(const std::array< std::shared_ptr< F >, k > &children)
Transformation Constructor, taking the set of new children.
Definition localfunction.hh:64
PowerLocalFunction()
Default Constructor.
Definition localfunction.hh:44
void bind(const Entity &e)
Definition localfunction.hh:33
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition localfunction.hh:27
PowerLocalFunction(F &f)
Construct a PowerGridFunction with k clones of the function t.
Definition localfunction.hh:48
PowerLocalFunction(C0 &&c0, C1 &&c1, Children &&... children)
Initialize all children with different function objects.
Definition localfunction.hh:58
Definition localfunction.hh:73
CompositeLocalFunction()
Default Constructor.
Definition localfunction.hh:97
CompositeDifferentiableFunctionLocalViewTag ImplementationTag
Definition localfunction.hh:76
void setTime(TT time)
Set the time in all leaf nodes of this function tree.
Definition localfunction.hh:80
void unbind()
Definition localfunction.hh:91
void bind(const Entity &e)
Definition localfunction.hh:86
CompositeLocalFunction(Args &&... args)
Initialize all children with the passed-in objects.
Definition localfunction.hh:102
Definition localfunction.hh:157
Definition function/tags.hh:15
Definition function/tags.hh:18
static const unsigned int value
Definition gridfunctionspace/tags.hh:139