4#ifndef DUNE_PDELAB_ORDERING_DECORATOR_HH
5#define DUNE_PDELAB_ORDERING_DECORATOR_HH
9#include <dune/typetree/typetree.hh>
26 template<
typename D,
typename U>
27 struct decorated_ordering_tag;
34 template<
typename DecoratedOrderingTag, std::
size_t level>
35 struct basetag_access_provider
40 template<
typename D,
typename U>
41 struct basetag_access_provider<decorated_ordering_tag<D,U>,0>
46 const BaseTag& baseTag()
const
48 return static_cast<decorated_ordering_tag<D,U>&
>(*this);
53 return static_cast<decorated_ordering_tag<D,U>&
>(*this);
58 template<
typename T, T v>
61 typedef std::integral_constant<T,v> type;
67 typedef std::integral_constant<std::size_t,D::level> type;
71 struct decoration_level
72 :
public std::conditional<
73 std::is_base_of<is_decorated, D>::value,
75 lazy_constant<std::size_t,0>
83 template<
typename D,
typename U>
86 , impl::basetag_access_provider<decorated_ordering_tag<D,U>,impl::decoration_level<U>::value>
92 static const std::size_t
level = impl::decoration_level<U>::value + 1;
113 template<
typename Ordering>
114 const Ordering& _unwind_decorators(
const Ordering& ordering, std::integral_constant<std::size_t,0>)
121 template<
typename Ordering, std::
size_t level>
122 auto _unwind_decorators(
const Ordering& ordering, std::integral_constant<std::size_t,level>)
125 ordering.template child<0>(),
126 std::integral_constant<std::size_t,level-1>()
130 return _unwind_decorators(
131 ordering.template child<0>(),
132 std::integral_constant<std::size_t,level-1>()
143 template<
typename GFS>
148 impl::decoration_level<typename GFS::OrderingTag>()
152 return _unwind_decorators(
154 impl::decoration_level<typename GFS::OrderingTag>()
159 template<
typename GFS,
typename Transformation,
typename Undecorated,
typename GlueTag,
typename Tag>
161 :
public TypeTree::meta_function
164 register_gfs_to_decorator_descriptor(
165 TypeTree::declptr<GFS>(),
166 TypeTree::declptr<Transformation>(),
167 TypeTree::declptr<Undecorated>(),
168 TypeTree::declptr<GlueTag>(),
169 TypeTree::declptr<Tag>()
175 template<
typename GFS,
typename Transformation,
typename OrderingTag>
181 typedef typename leaf_gfs_to_ordering_descriptor<
184 typename OrderingTag::Undecorated
194 typename OrderingTag::Decorator
202 return decorator_descriptor::transform(gfs,t,std::make_shared<undecorated_type>(undecorated_descriptor::transform(gfs,t)));
207 return decorator_descriptor::transform(gfs_pointer,t,undecorated_descriptor::transform(gfs_pointer,t));
212 template<
typename GFS,
typename Transformation,
typename D,
typename U>
213 leaf_gfs_to_decorated<GFS,Transformation,decorated_ordering_tag<D,U> >
217 template<
typename GFS,
typename Transformation,
typename OrderingTag>
223 template<
typename TC>
227 typedef typename power_gfs_to_ordering_descriptor<
230 typename OrderingTag::Undecorated
239 typename OrderingTag::Decorator
242 typedef typename decorator_descriptor::transformed_type
type;
243 typedef typename decorator_descriptor::transformed_storage_type
storage_type;
247 template<
typename TC>
248 static typename result<TC>::type transform(
const GFS& gfs,
const Transformation& t,
const std::array<std::shared_ptr<TC>,TypeTree::StaticDegree<GFS>::value>& children)
253 template<
typename TC>
262 template<
typename GFS,
typename Transformation,
typename OrderingTag>
268 typedef typename power_gfs_to_ordering_descriptor<
271 typename OrderingTag::Undecorated
281 typename OrderingTag::Decorator
289 return decorator_descriptor::transform(gfs,t,std::make_shared<undecorated_type>(undecorated_descriptor::transform(gfs,t)));
294 return decorator_descriptor::transform_storage(gfs_pointer,t,undecorated_descriptor::transform_storage(gfs_pointer,t));
300 template<
typename GFS,
typename Transformation,
typename OrderingTag>
302 :
public std::conditional<
303 power_gfs_to_ordering_descriptor<
306 typename OrderingTag::Undecorated
308 recursive_power_gfs_to_decorated<
313 nonrecursive_power_gfs_to_decorated<
320 template<
typename GFS,
typename Transformation,
typename D,
typename U>
333 template<
typename GFS,
typename Transformation,
typename OrderingTag>
339 template<
typename... TC>
343 typedef typename composite_gfs_to_ordering_descriptor<
346 typename OrderingTag::Undecorated
355 typename OrderingTag::Decorator
358 typedef typename decorator_descriptor::transformed_type
type;
359 typedef typename decorator_descriptor::transformed_storage_type
storage_type;
363 template<
typename... TC>
364 static typename result<TC...>::type
transform(
const GFS& gfs,
const Transformation& t, std::shared_ptr<TC>... children)
369 template<
typename... TC>
370 static typename result<TC...>::storage_type
transform_storage(std::shared_ptr<const GFS> gfs_pointer,
const Transformation& t, std::shared_ptr<TC>... children)
378 template<
typename GFS,
typename Transformation,
typename OrderingTag>
384 typedef typename composite_gfs_to_ordering_descriptor<
387 typename OrderingTag::Undecorated
397 typename OrderingTag::Decorator
405 return decorator_descriptor::transform(gfs,t,std::make_shared<undecorated_type>(undecorated_descriptor::transform(gfs,t)));
410 return decorator_descriptor::transform_storage(gfs_pointer,t,undecorated_descriptor::transform(gfs_pointer,t));
416 template<
typename GFS,
typename Transformation,
typename OrderingTag>
418 :
public std::conditional<
419 composite_gfs_to_ordering_descriptor<
422 typename OrderingTag::Undecorated
424 recursive_composite_gfs_to_decorated<
429 nonrecursive_composite_gfs_to_decorated<
437 template<
typename GFS,
typename Transformation,
typename D,
typename U>
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
composite_gfs_to_decorated< GFS, Transformation, decorated_ordering_tag< D, U > > register_composite_gfs_to_ordering_descriptor(GFS *, Transformation *, decorated_ordering_tag< D, U > *)
power_gfs_to_decorated< GFS, Transformation, decorated_ordering_tag< D, U > > register_power_gfs_to_ordering_descriptor(GFS *, Transformation *, decorated_ordering_tag< D, U > *)
leaf_gfs_to_decorated< GFS, Transformation, decorated_ordering_tag< D, U > > register_leaf_gfs_to_ordering_descriptor(GFS *, Transformation *, decorated_ordering_tag< D, U > *)
auto undecorated_ordering(const GFS &gfs) -> decltype(_unwind_decorators(gfs.ordering(), impl::decoration_level< typename GFS::OrderingTag >()))
Unwinds the stack of decorators on top of the base ordering of gfs and returns the base ordering.
Definition: decorator.hh:144
Definition: decorator.hh:87
decorated_ordering_tag()
Definition: decorator.hh:94
U Undecorated
Definition: decorator.hh:90
static const std::size_t level
Definition: decorator.hh:92
D Decorator
Definition: decorator.hh:89
decorated_ordering_tag(Undecorated &&u)
Definition: decorator.hh:101
decorated_ordering_tag(const Undecorated &u)
Definition: decorator.hh:97
Definition: decorator.hh:162
decltype(register_gfs_to_decorator_descriptor(TypeTree::declptr< GFS >(),//the source GridFunctionSpace TypeTree::declptr< Transformation >(),//the full transformation descriptor TypeTree::declptr< Undecorated >(),//the type of the undecorated Ordering to be wrapped in the decorator TypeTree::declptr< GlueTag >(),//the decorated_ordering_tag for the current decoration nesting level TypeTree::declptr< Tag >()//the decorator tag)) type
Definition: decorator.hh:171
Definition: decorator.hh:177
decorator_descriptor::transformed_storage_type transformed_storage_type
Definition: decorator.hh:198
static transformed_storage_type transform(std::shared_ptr< const GFS > &gfs_pointer, const Transformation &t)
Definition: decorator.hh:205
undecorated_descriptor::transformed_type undecorated_type
Definition: decorator.hh:187
decorator_descriptor::transformed_type transformed_type
Definition: decorator.hh:197
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: decorator.hh:200
static const bool recursive
Definition: decorator.hh:179
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typenameOrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:195
leaf_gfs_to_ordering_descriptor< GFS, Transformation, typenameOrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:185
Definition: decorator.hh:219
static const bool recursive
Definition: decorator.hh:221
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const std::array< std::shared_ptr< TC >, TypeTree::StaticDegree< GFS >::value > &children)
Definition: decorator.hh:248
static result< TC >::storage_type transform_storage(std::shared_ptr< const GFS > gfs_pointer, const Transformation &t, const std::array< std::shared_ptr< TC >, TypeTree::StaticDegree< GFS >::value > &children)
Definition: decorator.hh:254
Definition: decorator.hh:225
decorator_descriptor::transformed_type type
Definition: decorator.hh:242
undecorated_descriptor::template result< TC >::type undecorated_type
Definition: decorator.hh:233
decorator_descriptor::transformed_storage_type storage_type
Definition: decorator.hh:243
power_gfs_to_ordering_descriptor< GFS, Transformation, typenameOrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:231
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typenameOrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:240
Definition: decorator.hh:264
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typenameOrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:282
undecorated_descriptor::transformed_type undecorated_type
Definition: decorator.hh:274
decorator_descriptor::transformed_type transformed_type
Definition: decorator.hh:284
static const bool recursive
Definition: decorator.hh:266
decorator_descriptor::transformed_storage_type transformed_storage_type
Definition: decorator.hh:285
static transformed_storage_type transform_storage(std::shared_ptr< const GFS > &gfs_pointer, const Transformation &t)
Definition: decorator.hh:292
power_gfs_to_ordering_descriptor< GFS, Transformation, typenameOrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:272
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: decorator.hh:287
Definition: decorator.hh:318
Definition: decorator.hh:335
static const bool recursive
Definition: decorator.hh:337
static result< TC... >::storage_type transform_storage(std::shared_ptr< const GFS > gfs_pointer, const Transformation &t, std::shared_ptr< TC >... children)
Definition: decorator.hh:370
static result< TC... >::type transform(const GFS &gfs, const Transformation &t, std::shared_ptr< TC >... children)
Definition: decorator.hh:364
Definition: decorator.hh:341
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typenameOrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:356
composite_gfs_to_ordering_descriptor< GFS, Transformation, typenameOrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:347
decorator_descriptor::transformed_storage_type storage_type
Definition: decorator.hh:359
undecorated_descriptor::template result< TC... >::type undecorated_type
Definition: decorator.hh:349
decorator_descriptor::transformed_type type
Definition: decorator.hh:358
Definition: decorator.hh:380
undecorated_descriptor::transformed_type undecorated_type
Definition: decorator.hh:390
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: decorator.hh:403
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typenameOrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:398
composite_gfs_to_ordering_descriptor< GFS, Transformation, typenameOrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:388
static const bool recursive
Definition: decorator.hh:382
decorator_descriptor::transformed_type transformed_type
Definition: decorator.hh:400
decorator_descriptor::transformed_storage_type transformed_storage_type
Definition: decorator.hh:401
static transformed_storage_type transform_storage(std::shared_ptr< const GFS > &gfs_pointer, const Transformation &t)
Definition: decorator.hh:408
Definition: decorator.hh:434