Dune TypeTree (unstable)
transformation.hh
    3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
   72      typedef decltype(registerNodeTransformation(declptr<S>(),declptr<T>(),declptr<Tag>())) lookup_type;
   78      static_assert((!std::is_same<type,void>::value), "Unable to find valid transformation descriptor");
   94    template<typename SourceTree, typename Transformation, typename Tag = StartTag, bool recursive = true>
  100      typedef typename LookupNodeTransformation<SourceTree,Transformation,typename SourceTree::ImplementationTag>::type NodeTransformation;
  103      typedef typename TransformTree<SourceTree,Transformation,NodeTag<SourceTree>,NodeTransformation::recursive>::transformed_type transformed_type;
  106      typedef typename TransformTree<SourceTree,Transformation,NodeTag<SourceTree>,NodeTransformation::recursive>::transformed_storage_type transformed_storage_type;
  116      static transformed_type transform(const SourceTree& s, const Transformation& t = Transformation())
  118        return TransformTree<SourceTree,Transformation,NodeTag<SourceTree>,NodeTransformation::recursive>::transform(s,t);
  124        return TransformTree<SourceTree,Transformation,NodeTag<SourceTree>,NodeTransformation::recursive>::transform(s,t);
  128      static transformed_type transform(std::shared_ptr<const SourceTree> sp, const Transformation& t = Transformation())
  130        return TransformTree<SourceTree,Transformation,NodeTag<SourceTree>,NodeTransformation::recursive>::transform(sp,t);
  136        return TransformTree<SourceTree,Transformation,NodeTag<SourceTree>,NodeTransformation::recursive>::transform(sp,t);
  141      static transformed_storage_type transform_storage(std::shared_ptr<const SourceTree> sp, const Transformation& t = Transformation())
  143        return TransformTree<SourceTree,Transformation,NodeTag<SourceTree>,NodeTransformation::recursive>::transform_storage(sp,t);
  148      static transformed_storage_type transform_storage(std::shared_ptr<const SourceTree> sp, Transformation& t)
  150        return TransformTree<SourceTree,Transformation,NodeTag<SourceTree>,NodeTransformation::recursive>::transform_storage(sp,t);
  281        // The problem is that the transformed power node must be parameterized on the transformed child
  283        // template of the node transformation struct called result (see example of such a specification
  285        using NodeTransformation = typename LookupNodeTransformation<Source,Transformation,ImplementationTag<Source>>::type;
  286        using ChildNodeTransformation = typename LookupNodeTransformation<ChildType,Transformation,ImplementationTag<ChildType>>::type;
  297        using transformed_child_storage_type = typename ChildTreeTransformation::transformed_storage_type;
  300        using transformed_type = typename NodeTransformation::template result<transformed_child_type>::type;
  301        using transformed_storage_type = typename NodeTransformation::template result<transformed_child_type>::storage_type;
  306          auto children_storage = node_storage_provider<std::shared_ptr<transformed_child_type>>(source.degree());
  308            children_storage[k] = ChildTreeTransformation::transform_storage(source.childStorage(k),transformation);
  316          auto children_storage = node_storage_provider<std::shared_ptr<transformed_child_type>>(source.degree());
  318            children_storage[k] = ChildTreeTransformation::transform_storage(source.childStorage(k),transformation);
  324        static transformed_type transform(std::shared_ptr<const Source> source_ptr, Transformation& transformation)
  326          auto children_storage = node_storage_provider<std::shared_ptr<transformed_child_type>>(source_ptr->degree());
  328            children_storage[k] = ChildTreeTransformation::transform_storage(source_ptr->childStorage(k),transformation);
  334        static transformed_type transform(std::shared_ptr<const Source> source_ptr, const Transformation& transformation)
  336          auto children_storage = node_storage_provider<std::shared_ptr<transformed_child_type>>(source_ptr->degree());
  338            children_storage[k] = ChildTreeTransformation::transform_storage(source_ptr->childStorage(k),transformation);
  344        static transformed_storage_type transform_storage(std::shared_ptr<const Source> source_ptr, Transformation& transformation)
  346          auto children_storage = node_storage_provider<transformed_child_storage_type>(source_ptr->degree());
  348            children_storage[k] = ChildTreeTransformation::transform_storage(source_ptr->childStorage(k),transformation);
  354        static transformed_storage_type transform_storage(std::shared_ptr<const Source> source_ptr, const Transformation& transformation)
  356          auto children_storage = node_storage_provider<transformed_child_storage_type>(source_ptr->degree());
  358            children_storage[k] = ChildTreeTransformation::transform_storage(source_ptr->childStorage(k),transformation);
  390    // helper struct that does the actual transformation for a composite node. We need this additional struct
  391    // to extract the template argument list with the types of all children from the node, which we cannot do
  392    // directly in the transformation<> template, as the type passed to transformation<> will usually be a
  393    // derived type and will normally have more template arguments than just the children. This declaration
  394    // just introduces the type of the helper struct, we always instantiate the specialization defined below;
  398    // specialized version of the helper struct which extracts the template argument list with the children from
  399    // its second template parameter, which has to be CompositeNode::ChildTypes. Apart from that, the struct is
  400    // similar to the one for a PowerNode, but it obviously delegates transformation of the children to the TMP.
  448        Dune::Hybrid::Impl::evaluateFoldExpression<int>({(setElement<i>(storage, ChildTransformation<i>::transform_storage(s.template childStorage<i>(), std::forward<Trafo>(t))),0)...});
  453      static transformed_storage_type transform_storage(std::shared_ptr<const S> sp, Trafo&& t, std::index_sequence<i...> indices)
  456        Dune::Hybrid::Impl::evaluateFoldExpression<int>({(setElement<i>(storage, ChildTransformation<i>::transform_storage(sp->template childStorage<i>(), std::forward<Trafo>(t))),0)...});
  457        return NodeTransformation::transform_storage(sp, std::forward<Trafo>(t), std::get<i>(storage)...);
  480      typedef typename transform_composite_node<S,ChildTypes,T>::transformed_storage_type transformed_storage_type;
std::size_t degree(const Node &node)
Returns the degree of node as run time information.
Definition: nodeinterface.hh:79
void registerNodeTransformation(SourceNode *, Transformation *, Tag *)
Register transformation descriptor to transform SourceNode with Transformation.
STL namespace.
static transformed_type transform(std::shared_ptr< const SourceTree > sp, Transformation &t)
Apply transformation to an existing tree s.
Definition: transformation.hh:134
static transformed_type transform(std::shared_ptr< const SourceTree > sp, const Transformation &t=Transformation())
Apply transformation to an existing tree s.
Definition: transformation.hh:128
static transformed_type transform(const SourceTree &s, Transformation &t)
Apply transformation to an existing tree s.
Definition: transformation.hh:122
transformed_type type
The type of the transformed tree.
Definition: transformation.hh:111
static transformed_type transform(const SourceTree &s, const Transformation &t=Transformation())
Apply transformation to an existing tree s.
Definition: transformation.hh:116
static transformed_storage_type transform_storage(std::shared_ptr< const SourceTree > sp, const Transformation &t=Transformation())
Definition: transformation.hh:141
static transformed_storage_type transform_storage(std::shared_ptr< const SourceTree > sp, Transformation &t)
Definition: transformation.hh:148
Meta function that evaluates its argument iff it inherits from meta_function.
Definition: typetraits.hh:142
   | 
                                Legal Statements / Impressum  | 
                                Hosted by  TU Dresden & Uni Heidelberg  | 
				  generated with Hugo v0.111.3
								(Nov 2, 23:43, 2025)