│ │ │ │
│ │ │ │
│ │ │ │ -
4#ifndef DUNE_TYPETREE_PROXYNODE_HH
│ │ │ │ -
5#define DUNE_TYPETREE_PROXYNODE_HH
│ │ │ │ +
4#ifndef DUNE_TYPETREE_TRANSFORMATION_HH
│ │ │ │ +
5#define DUNE_TYPETREE_TRANSFORMATION_HH
│ │ │ │
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
10#include <dune/common/shared_ptr.hh>
│ │ │ │ -
11#include <dune/common/indices.hh>
│ │ │ │ -
12#include <dune/common/std/type_traits.hh>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
22 template<
typename Node>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
26 template<
typename ProxiedNode>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
30 static const bool proxiedNodeIsConst = std::is_const<typename std::remove_reference<ProxiedNode>::type>::value;
│ │ │ │ -
│ │ │ │ -
32 template<std::
size_t k>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
35 static const bool value = !proxiedNodeIsConst;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
40 template<
bool enabled = !proxiedNodeIsConst>
│ │ │ │ -
41 typename std::enable_if<enabled,Node&>::type
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
44 return static_cast<Node&
>(*this);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
47 const Node& node ()
const
│ │ │ │ -
│ │ │ │ -
49 return static_cast<const Node&
>(*this);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
12#include <dune/common/hybridutilities.hh>
│ │ │ │ +
13#include <dune/common/exceptions.hh>
│ │ │ │ +
14#include <dune/common/typetraits.hh>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
51 template<
typename SourceNode,
typename Transformation,
typename Tag>
│ │ │ │ +
│ │ │ │
│ │ │ │ -
55 template<std::
size_t k>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
57 :
public ProxiedNode::template
Child<k>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
67 template<std::size_t k,
│ │ │ │ -
68 typename std::enable_if<lazy_enabled<k>::value,
int>::type = 0>
│ │ │ │ -
│ │ │ │ -
69 auto&
child (index_constant<k> = {})
│ │ │ │ -
│ │ │ │ -
71 return node().proxiedNode().template child<k>();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
66 template<
typename S,
typename T,
typename Tag>
│ │ │ │ +
67 struct LookupNodeTransformation
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ -
78 template<std::
size_t k>
│ │ │ │ -
│ │ │ │ -
79 const auto&
child (index_constant<k> = {})
const
│ │ │ │ -
│ │ │ │ -
81 return node().proxiedNode().template child<k>();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
76 static_assert((!std::is_same<type,void>::value),
"Unable to find valid transformation descriptor");
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ -
│ │ │ │ -
88 template<std::size_t k,
│ │ │ │ -
89 typename std::enable_if<lazy_enabled<k>::value,
int>::type = 0>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
92 return node().proxiedNode().template childStorage<k>();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
102 template<std::
size_t k>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
105 return node().proxiedNode().template childStorage<k>();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
92 template<
typename SourceTree,
typename Transformation,
typename Tag = StartTag,
bool recursive = true>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
98 typedef typename LookupNodeTransformation<SourceTree,Transformation,typename SourceTree::ImplementationTag>::type NodeTransformation;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ -
109 template<std::
size_t k,
class ProxyChild>
│ │ │ │ -
│ │ │ │ -
110 void setChild (ProxyChild&&
child,
typename std::enable_if<lazy_enabled<k>::value,
void*>::type = 0)
│ │ │ │ -
│ │ │ │ -
112 node().proxiedNode().template setChild<k>(std::forward<ProxyChild>(
child));
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
117 return node().proxiedNode().nodeStorage();
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
128 template<
typename ProxiedNode>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
135 static const bool proxiedNodeIsConst = std::is_const<typename std::remove_reference<ProxiedNode>::type>::value;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
114 static transformed_type
transform(
const SourceTree& s,
const Transformation& t = Transformation())
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
120 static transformed_type
transform(
const SourceTree& s, Transformation& t)
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
126 static transformed_type
transform(std::shared_ptr<const SourceTree> sp,
const Transformation& t = Transformation())
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
132 static transformed_type
transform(std::shared_ptr<const SourceTree> sp, Transformation& t)
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ -
137 template<
bool enabled = !proxiedNodeIsConst>
│ │ │ │ -
138 typename std::enable_if<enabled,Node&>::type
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
139 static transformed_storage_type
transform_storage(std::shared_ptr<const SourceTree> sp,
const Transformation& t = Transformation())
│ │ │ │
│ │ │ │ -
141 return static_cast<Node&
>(*this);
│ │ │ │ +
│ │ │ │
│ │ │ │ +
│ │ │ │
│ │ │ │ -
144 const Node& node ()
const
│ │ │ │ -
│ │ │ │ -
146 return static_cast<const Node&
>(*this);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
146 static transformed_storage_type
transform_storage(std::shared_ptr<const SourceTree> sp, Transformation& t)
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ +
│ │ │ │
│ │ │ │ -
158 template<
bool enabled = !proxiedNodeIsConst,
│ │ │ │ -
159 typename std::enable_if<enabled, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
162 return node().proxiedNode().child(i);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
169 const auto&
child (std::size_t i)
const
│ │ │ │ -
│ │ │ │ -
171 return node().proxiedNode().child(i);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
178 template<
bool enabled = !proxiedNodeIsConst,
│ │ │ │ -
179 typename std::enable_if<enabled, int>::type = 0>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
182 return node().proxiedNode().childStorage(i);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
194 return node().proxiedNode().childStorage(i);
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
198 template<
class ProxyChild,
bool enabled = !proxiedNodeIsConst>
│ │ │ │ -
│ │ │ │ -
199 void setChild (std::size_t i, ProxyChild&&
child,
typename std::enable_if<enabled,void*>::type = 0)
│ │ │ │ -
│ │ │ │ -
201 node().proxiedNode().setChild(i, std::forward<ProxyChild>(
child));
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
207 template<
typename Node,
typename NodeTag>
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
157 template<
typename S,
typename T,
bool recursive>
│ │ │ │ +
158 struct TransformTree<S,T,LeafNodeTag,recursive>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
161 typedef typename LookupNodeTransformation<S,T,ImplementationTag<S>>
::type NodeTransformation;
│ │ │ │ +
│ │ │ │ +
163 typedef typename NodeTransformation::transformed_type transformed_type;
│ │ │ │ +
164 typedef typename NodeTransformation::transformed_storage_type transformed_storage_type;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
167 static transformed_type
transform(
const S& s, T& t)
│ │ │ │ +
│ │ │ │ +
169 return NodeTransformation::transform(s,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
173 static transformed_type
transform(
const S& s,
const T& t)
│ │ │ │ +
│ │ │ │ +
175 return NodeTransformation::transform(s,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
179 static transformed_type
transform(std::shared_ptr<const S> sp, T& t)
│ │ │ │ +
│ │ │ │ +
181 return NodeTransformation::transform(sp,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
185 static transformed_type
transform(std::shared_ptr<const S> sp,
const T& t)
│ │ │ │ +
│ │ │ │ +
187 return NodeTransformation::transform(sp,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
190 static transformed_storage_type
transform_storage(std::shared_ptr<const S> sp, T& t)
│ │ │ │ +
│ │ │ │ +
192 return NodeTransformation::transform_storage(sp,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
195 static transformed_storage_type
transform_storage(std::shared_ptr<const S> sp,
const T& t)
│ │ │ │ +
│ │ │ │ +
197 return NodeTransformation::transform_storage(sp,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
204 template<
typename S,
typename T>
│ │ │ │ +
205 struct TransformTreeNonRecursive
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
208 typedef typename LookupNodeTransformation<S,T,ImplementationTag<S>>::type NodeTransformation;
│ │ │ │
│ │ │ │ -
211 template<
typename Node>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
217 template<
typename Node>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
210 typedef typename NodeTransformation::transformed_type transformed_type;
│ │ │ │ +
211 typedef typename NodeTransformation::transformed_storage_type transformed_storage_type;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
214 static transformed_type transform(
const S& s, T& t)
│ │ │ │ +
│ │ │ │ +
216 return NodeTransformation::transform(s,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
220 static transformed_type transform(
const S& s,
const T& t)
│ │ │ │ +
│ │ │ │ +
222 return NodeTransformation::transform(s,t);
│ │ │ │ +
│ │ │ │
│ │ │ │ -
226 template<
typename Node>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
235 template<
typename Node>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
250 template<
typename Node>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
254 static const bool proxiedNodeIsConst = std::is_const<typename std::remove_reference<Node>::type>::value;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
257 using HasStaticDegree = index_constant<N::degree()>;
│ │ │ │ +
│ │ │ │ +
226 static transformed_type transform(std::shared_ptr<const S> sp, T& t)
│ │ │ │ +
│ │ │ │ +
228 return NodeTransformation::transform(sp,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
232 static transformed_type transform(std::shared_ptr<const S> sp,
const T& t)
│ │ │ │ +
│ │ │ │ +
234 return NodeTransformation::transform(sp,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
237 static transformed_storage_type transform_storage(std::shared_ptr<const S> sp, T& t)
│ │ │ │ +
│ │ │ │ +
239 return NodeTransformation::transform_storage(sp,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
242 static transformed_storage_type transform_storage(std::shared_ptr<const S> sp,
const T& t)
│ │ │ │ +
│ │ │ │ +
244 return NodeTransformation::transform_storage(sp,t);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
253 template<
class Source,
class Transformation,
class Tag>
│ │ │ │ +
254 class RecursivePowerTransformTree
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
257 static_assert(std::is_same_v<Tag,PowerNodeTag> or std::is_same_v<Tag,DynamicPowerNodeTag>);
│ │ │ │
│ │ │ │ -
│ │ │ │ -
260 static constexpr bool hasStaticDegree = Std::is_detected<HasStaticDegree, N>::value;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
259 using ChildType =
typename Source::ChildType;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
262 template<
class NodeStorage>
│ │ │ │ +
263 static auto node_storage_provider(
const std::size_t& degree)
│ │ │ │ +
│ │ │ │ +
265 return std::vector<NodeStorage>(degree);
│ │ │ │ +
│ │ │ │
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
269 template<
class NodeStorage,
class StaticIndex>
│ │ │ │ +
270 static auto node_storage_provider(StaticIndex)
│ │ │ │ +
│ │ │ │ +
272 return std::array<NodeStorage,std::size_t(StaticIndex{})>();
│ │ │ │ +
│ │ │ │
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
282 [[deprecated(
"Will be removed after release 2.9. Use degree()")]]
│ │ │ │ -
283 static const std::size_t
CHILDREN = Dune::Std::detected_or_t<
│ │ │ │ -
284 std::integral_constant<std::size_t,std::numeric_limits<std::size_t>::max()>,
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
289 template <
class N = Node,
│ │ │ │ -
290 std::enable_if_t<hasStaticDegree<N>,
int> = 0>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
296 template <
class N = Node,
│ │ │ │ -
297 std::enable_if_t<not hasStaticDegree<N>,
int> = 0>
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
310 template<
bool enabled = !proxiedNodeIsConst>
│ │ │ │ -
311 typename std::enable_if<enabled,Node&>::type
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
324 template<
bool enabled = !proxiedNodeIsConst>
│ │ │ │ -
325 typename std::enable_if<enabled,std::shared_ptr<Node> >::type
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
283 using NodeTransformation =
typename LookupNodeTransformation<Source,Transformation,ImplementationTag<Source>>::type;
│ │ │ │ +
284 using ChildNodeTransformation =
typename LookupNodeTransformation<ChildType,Transformation,ImplementationTag<ChildType>>::type;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
288 using ChildTreeTransformation = TransformTree<ChildType,
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
291 ChildNodeTransformation::recursive>;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
294 using transformed_child_type =
typename ChildTreeTransformation::transformed_type;
│ │ │ │ +
295 using transformed_child_storage_type =
typename ChildTreeTransformation::transformed_storage_type;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
298 using transformed_type =
typename NodeTransformation::template result<transformed_child_type>::type;
│ │ │ │ +
299 using transformed_storage_type =
typename NodeTransformation::template result<transformed_child_type>::storage_type;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
302 static transformed_type transform(
const Source& source, Transformation& transformation)
│ │ │ │ +
│ │ │ │ +
304 auto children_storage = node_storage_provider<std::shared_ptr<transformed_child_type>>(source.degree());
│ │ │ │ +
305 for (std::size_t k = 0; k < source.degree(); ++k) {
│ │ │ │ +
306 children_storage[k] = ChildTreeTransformation::transform_storage(source.childStorage(k),transformation);
│ │ │ │ +
│ │ │ │ +
308 return NodeTransformation::transform(source,transformation,children_storage);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
312 static transformed_type transform(
const Source& source,
const Transformation& transformation)
│ │ │ │ +
│ │ │ │ +
314 auto children_storage = node_storage_provider<std::shared_ptr<transformed_child_type>>(source.degree());
│ │ │ │ +
315 for (std::size_t k = 0; k < source.degree(); ++k) {
│ │ │ │ +
316 children_storage[k] = ChildTreeTransformation::transform_storage(source.childStorage(k),transformation);
│ │ │ │ +
│ │ │ │ +
318 return NodeTransformation::transform(source,transformation,children_storage);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
322 static transformed_type transform(std::shared_ptr<const Source> source_ptr, Transformation& transformation)
│ │ │ │ +
│ │ │ │ +
324 auto children_storage = node_storage_provider<std::shared_ptr<transformed_child_type>>(source_ptr->degree());
│ │ │ │ +
325 for (std::size_t k = 0; k < source_ptr->degree(); ++k) {
│ │ │ │ +
326 children_storage[k] = ChildTreeTransformation::transform_storage(source_ptr->childStorage(k),transformation);
│ │ │ │ +
│ │ │ │ +
328 return NodeTransformation::transform(source_ptr,transformation,children_storage);
│ │ │ │ +
│ │ │ │
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
343 : _node(stackobject_to_shared_ptr(node))
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
347 : _node(std::move(node))
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
354 std::shared_ptr<Node> _node;
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
typename std::decay_t< Node >::NodeTag NodeTag
Returns the node tag of the given Node.
Definition nodeinterface.hh:76
│ │ │ │ -
decltype(Node::degree()) StaticDegree
Returns the statically known degree of the given Node type as a std::integral_constant.
Definition nodeinterface.hh:113
│ │ │ │ +
│ │ │ │ +
332 static transformed_type transform(std::shared_ptr<const Source> source_ptr,
const Transformation& transformation)
│ │ │ │ +
│ │ │ │ +
334 auto children_storage = node_storage_provider<std::shared_ptr<transformed_child_type>>(source_ptr->degree());
│ │ │ │ +
335 for (std::size_t k = 0; k < source_ptr->degree(); ++k) {
│ │ │ │ +
336 children_storage[k] = ChildTreeTransformation::transform_storage(source_ptr->childStorage(k),transformation);
│ │ │ │ +
│ │ │ │ +
338 return NodeTransformation::transform(source_ptr,transformation,children_storage);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
342 static transformed_storage_type transform_storage(std::shared_ptr<const Source> source_ptr, Transformation& transformation)
│ │ │ │ +
│ │ │ │ +
344 auto children_storage = node_storage_provider<transformed_child_storage_type>(source_ptr->degree());
│ │ │ │ +
345 for (std::size_t k = 0; k < source_ptr->degree(); ++k) {
│ │ │ │ +
346 children_storage[k] = ChildTreeTransformation::transform_storage(source_ptr->childStorage(k),transformation);
│ │ │ │ +
│ │ │ │ +
348 return NodeTransformation::transform_storage(source_ptr,transformation,children_storage);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
352 static transformed_storage_type transform_storage(std::shared_ptr<const Source> source_ptr,
const Transformation& transformation)
│ │ │ │ +
│ │ │ │ +
354 auto children_storage = node_storage_provider<transformed_child_storage_type>(source_ptr->degree());
│ │ │ │ +
355 for (std::size_t k = 0; k < source_ptr->degree(); ++k) {
│ │ │ │ +
356 children_storage[k] = ChildTreeTransformation::transform_storage(source_ptr->childStorage(k),transformation);
│ │ │ │ +
│ │ │ │ +
358 return NodeTransformation::transform_storage(source_ptr,transformation,children_storage);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
365 template<
typename Source,
typename Transformation>
│ │ │ │ +
366 struct TransformTree<Source,Transformation,PowerNodeTag,true>
│ │ │ │ +
367 :
public Impl::RecursivePowerTransformTree<Source,Transformation,PowerNodeTag>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
371 template<
typename Source,
typename Transformation>
│ │ │ │ +
372 struct TransformTree<Source,Transformation,DynamicPowerNodeTag,true>
│ │ │ │ +
373 :
public Impl::RecursivePowerTransformTree<Source,Transformation,DynamicPowerNodeTag>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
377 template<
typename S,
typename T>
│ │ │ │ +
378 struct TransformTree<S,T,PowerNodeTag,false>
│ │ │ │ +
379 :
public TransformTreeNonRecursive<S,T>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
383 template<
typename S,
typename T>
│ │ │ │ +
384 struct TransformTree<S,T,DynamicPowerNodeTag,false>
│ │ │ │ +
385 :
public TransformTreeNonRecursive<S,T>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
393 template<
typename S,
typename Children,
typename T>
│ │ │ │ +
394 struct transform_composite_node;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
399 template<
typename S,
typename T,
typename... C>
│ │ │ │ +
400 struct transform_composite_node<S,std::tuple<C...>,T>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
404 typedef ImplementationTag<S> Tag;
│ │ │ │ +
405 typedef typename LookupNodeTransformation<S,T,Tag>::type NodeTransformation;
│ │ │ │ +
406 typedef typename NodeTransformation::template
result<
typename TransformTree<C,
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
409 LookupNodeTransformation<C,T,ImplementationTag<C>>::type::recursive
│ │ │ │ +
410 >::transformed_type...
│ │ │ │ +
411 >::type transformed_type;
│ │ │ │ +
│ │ │ │ +
413 typedef typename NodeTransformation::template
result<
typename TransformTree<C,
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
416 LookupNodeTransformation<C,T,ImplementationTag<C>>::type::recursive
│ │ │ │ +
417 >::transformed_type...
│ │ │ │ +
418 >::storage_type transformed_storage_type;
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
423 template<std::
size_t i>
│ │ │ │ +
424 struct ChildTransformation
│ │ │ │ +
425 :
public TransformTree<typename S::template Child<i>::Type,
│ │ │ │ +
│ │ │ │ +
427 NodeTag<typename S::template Child<i>::Type>,
│ │ │ │ +
428 LookupNodeTransformation<
│ │ │ │ +
429 typename S::template Child<i>::Type,
│ │ │ │ +
│ │ │ │ +
431 ImplementationTag<typename S::template Child<i>::Type>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
436 template<std::
size_t i,
typename Tuple,
typename Value>
│ │ │ │ +
437 static void setElement(Tuple& tuple, Value&& value)
│ │ │ │ +
│ │ │ │ +
439 std::get<i>(tuple) = std::forward<Value>(value);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
442 template<
typename Trafo, std::size_t... i>
│ │ │ │ +
443 static transformed_type transform(
const S& s, Trafo&& t, std::index_sequence<i...> indices)
│ │ │ │ +
│ │ │ │ +
445 std::tuple<typename ChildTransformation<i>::transformed_storage_type...> storage;
│ │ │ │ +
446 Dune::Hybrid::Impl::evaluateFoldExpression<int>({(setElement<i>(storage, ChildTransformation<i>::transform_storage(s.template childStorage<i>(), std::forward<Trafo>(t))),0)...});
│ │ │ │ +
447 return NodeTransformation::transform(s, std::forward<Trafo>(t), std::get<i>(storage)...);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
450 template<
typename Trafo, std::size_t... i>
│ │ │ │ +
451 static transformed_storage_type transform_storage(std::shared_ptr<const S> sp, Trafo&& t, std::index_sequence<i...> indices)
│ │ │ │ +
│ │ │ │ +
453 std::tuple<typename ChildTransformation<i>::transformed_storage_type...> storage;
│ │ │ │ +
454 Dune::Hybrid::Impl::evaluateFoldExpression<int>({(setElement<i>(storage, ChildTransformation<i>::transform_storage(sp->template childStorage<i>(), std::forward<Trafo>(t))),0)...});
│ │ │ │ +
455 return NodeTransformation::transform_storage(sp, std::forward<Trafo>(t), std::get<i>(storage)...);
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
462 template<
typename S,
typename T>
│ │ │ │ +
463 struct TransformTree<S,T,CompositeNodeTag,true>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
468 typedef typename S::ChildTypes ChildTypes;
│ │ │ │ +
│ │ │ │ +
470 static auto child_indices()
│ │ │ │ +
│ │ │ │ +
472 return std::make_index_sequence<S::degree()>();
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
477 typedef typename transform_composite_node<S,ChildTypes,T>::transformed_type transformed_type;
│ │ │ │ +
478 typedef typename transform_composite_node<S,ChildTypes,T>::transformed_storage_type transformed_storage_type;
│ │ │ │ +
│ │ │ │ +
480 static transformed_type
transform(
const S& s, T& t)
│ │ │ │ +
│ │ │ │ +
482 return transform_composite_node<S,ChildTypes,T>::transform(s,t,child_indices());
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
485 static transformed_type
transform(
const S& s,
const T& t)
│ │ │ │ +
│ │ │ │ +
487 return transform_composite_node<S,ChildTypes,T>::transform(s,t,child_indices());
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
490 static transformed_storage_type
transform_storage(std::shared_ptr<const S> sp, T& t)
│ │ │ │ +
│ │ │ │ +
492 return transform_composite_node<S,ChildTypes,T>::transform_storage(sp,t,child_indices());
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
495 static transformed_storage_type
transform_storage(std::shared_ptr<const S> sp,
const T& t)
│ │ │ │ +
│ │ │ │ +
497 return transform_composite_node<S,ChildTypes,T>::transform_storage(sp,t,child_indices());
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
503 template<
typename S,
typename T>
│ │ │ │ +
504 struct TransformTree<S,T,CompositeNodeTag,false>
│ │ │ │ +
505 :
public TransformTreeNonRecursive<S,T>
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
static const result_type result
Definition accumulate_static.hh:110
│ │ │ │ +
void registerNodeTransformation(SourceNode *, Transformation *, Tag *)
Register transformation descriptor to transform SourceNode with Transformation.
│ │ │ │
Definition accumulate_static.hh:13
│ │ │ │ -
Tag designating a leaf node.
Definition nodetags.hh:16
│ │ │ │ -
Tag designating a power node.
Definition nodetags.hh:19
│ │ │ │ -
Tag designating a power node with runtime degree.
Definition nodetags.hh:22
│ │ │ │ -
Tag designating a composite node.
Definition nodetags.hh:25
│ │ │ │ -
Base class for nodes acting as a proxy for an existing node.
Definition proxynode.hh:253
│ │ │ │ -
ProxyNode(Node &node)
Definition proxynode.hh:342
│ │ │ │ -
Dune::TypeTree::NodeTag< Node > NodeTag
Definition proxynode.hh:270
│ │ │ │ -
static const bool isComposite
Mark this class as a composite in the dune-typetree.
Definition proxynode.hh:279
│ │ │ │ -
static const bool isLeaf
Mark this class as non leaf in the dune-typetree.
Definition proxynode.hh:273
│ │ │ │ -
static const bool isPower
Mark this class as a non power in the dune-typetree.
Definition proxynode.hh:276
│ │ │ │ -
auto degree() const
Definition proxynode.hh:298
│ │ │ │ -
std::enable_if< enabled, Node & >::type proxiedNode()
Returns the proxied node.
Definition proxynode.hh:312
│ │ │ │ -
static const std::size_t CHILDREN
The number of children.
Definition proxynode.hh:283
│ │ │ │ -
std::shared_ptr< const Node > proxiedNodeStorage() const
Returns the storage of the proxied node (const version).
Definition proxynode.hh:332
│ │ │ │ -
Node ProxiedNode
Definition proxynode.hh:268
│ │ │ │ -
std::enable_if< enabled, std::shared_ptr< Node > >::type proxiedNodeStorage()
Returns the storage of the proxied node.
Definition proxynode.hh:326
│ │ │ │ -
static constexpr auto degree()
Definition proxynode.hh:291
│ │ │ │ -
ProxyNode(std::shared_ptr< Node > node)
Definition proxynode.hh:346
│ │ │ │ -
const Node & proxiedNode() const
Returns the proxied node (const version).
Definition proxynode.hh:318
│ │ │ │ -
Mixin class providing methods for child access with compile-time parameter.
Definition proxynode.hh:28
│ │ │ │ -
auto & child(index_constant< k >={})
Returns the i-th child.
Definition proxynode.hh:69
│ │ │ │ -
void setChild(ProxyChild &&child, typename std::enable_if< lazy_enabled< k >::value, void * >::type=0)
Sets the i-th child to the passed-in value.
Definition proxynode.hh:110
│ │ │ │ -
const ProxiedNode::NodeStorage & nodeStorage() const
Definition proxynode.hh:115
│ │ │ │ -
auto childStorage(index_constant< k >={})
Returns the storage of the i-th child.
Definition proxynode.hh:90
│ │ │ │ -
const auto & child(index_constant< k >={}) const
Returns the i-th child (const version).
Definition proxynode.hh:79
│ │ │ │ -
auto childStorage(index_constant< k >={}) const
Returns the storage of the i-th child (const version).
Definition proxynode.hh:103
│ │ │ │ -
Access to the type and storage type of the i-th child.
Definition proxynode.hh:58
│ │ │ │ -
Mixin class providing methods for child access with run-time parameter.
Definition proxynode.hh:131
│ │ │ │ -
auto & child(std::size_t i)
Returns the i-th child.
Definition proxynode.hh:160
│ │ │ │ -
auto childStorage(std::size_t i) const
Returns the storage of the i-th child (const version).
Definition proxynode.hh:192
│ │ │ │ -
void setChild(std::size_t i, ProxyChild &&child, typename std::enable_if< enabled, void * >::type=0)
Sets the i-th child to the passed-in value.
Definition proxynode.hh:199
│ │ │ │ -
const auto & child(std::size_t i) const
Returns the i-th child (const version).
Definition proxynode.hh:169
│ │ │ │ -
auto childStorage(std::size_t i)
Returns the storage of the i-th child.
Definition proxynode.hh:180
│ │ │ │ -
Tag-based dispatch to appropriate base class that provides necessary functionality.
Definition proxynode.hh:208
│ │ │ │ -
Node::NodeStorage NodeStorage
Definition proxynode.hh:222
│ │ │ │ -
Node::ChildTypes ChildTypes
Definition proxynode.hh:221
│ │ │ │ -
Node::NodeStorage NodeStorage
Definition proxynode.hh:231
│ │ │ │ -
Node::ChildType ChildType
Definition proxynode.hh:230
│ │ │ │ -
Node::NodeStorage NodeStorage
Definition proxynode.hh:240
│ │ │ │ -
Node::ChildType ChildType
Definition proxynode.hh:239
│ │ │ │ +
Transform a TypeTree.
Definition transformation.hh:94
│ │ │ │ +
type Type
Definition transformation.hh:111
│ │ │ │ +
static transformed_type transform(std::shared_ptr< const SourceTree > sp, Transformation &t)
Apply transformation to an existing tree s.
Definition transformation.hh:132
│ │ │ │ +
static transformed_type transform(std::shared_ptr< const SourceTree > sp, const Transformation &t=Transformation())
Apply transformation to an existing tree s.
Definition transformation.hh:126
│ │ │ │ +
static transformed_type transform(const SourceTree &s, Transformation &t)
Apply transformation to an existing tree s.
Definition transformation.hh:120
│ │ │ │ +
transformed_type type
The type of the transformed tree.
Definition transformation.hh:109
│ │ │ │ +
static transformed_type transform(const SourceTree &s, const Transformation &t=Transformation())
Apply transformation to an existing tree s.
Definition transformation.hh:114
│ │ │ │ +
static transformed_storage_type transform_storage(std::shared_ptr< const SourceTree > sp, const Transformation &t=Transformation())
Definition transformation.hh:139
│ │ │ │ +
static transformed_storage_type transform_storage(std::shared_ptr< const SourceTree > sp, Transformation &t)
Definition transformation.hh:146
│ │ │ │ +
Meta function that evaluates its argument iff it inherits from meta_function.
Definition typetraits.hh:140
│ │ │ │