4 #ifndef DUNE_PDELAB_ORDERING_DECORATOR_HH 5 #define DUNE_PDELAB_ORDERING_DECORATOR_HH 7 #include <dune/typetree/typetree.hh> 24 template<
typename D,
typename U>
25 struct decorated_ordering_tag;
32 template<
typename DecoratedOrderingTag, std::
size_t level>
33 struct basetag_access_provider
38 template<
typename D,
typename U>
39 struct basetag_access_provider<decorated_ordering_tag<D,U>,0>
44 const BaseTag& baseTag()
const 46 return static_cast<decorated_ordering_tag<D,U>&
>(*this);
51 return static_cast<decorated_ordering_tag<D,U>&
>(*this);
56 template<
typename T, T v>
59 typedef std::integral_constant<T,v> type;
65 typedef std::integral_constant<std::size_t,D::level> type;
69 struct decoration_level
70 :
public std::conditional<
71 std::is_base_of<is_decorated, D>::value,
73 lazy_constant<std::size_t,0>
81 template<
typename D,
typename U>
84 , impl::basetag_access_provider<decorated_ordering_tag<D,U>,impl::decoration_level<U>::value>
100 : Undecorated(
std::move(u))
111 template<
typename Ordering>
112 const Ordering& _unwind_decorators(
const Ordering& ordering, std::integral_constant<std::size_t,0>)
119 template<
typename Ordering, std::
size_t level>
120 auto _unwind_decorators(
const Ordering& ordering, std::integral_constant<std::size_t,level>)
123 ordering.template child<0>(),
124 std::integral_constant<std::size_t,level-1>()
128 return _unwind_decorators(
129 ordering.template child<0>(),
130 std::integral_constant<std::size_t,level-1>()
141 template<
typename GFS>
146 impl::decoration_level<typename GFS::OrderingTag>()
150 return _unwind_decorators(
152 impl::decoration_level<typename GFS::OrderingTag>()
157 template<
typename GFS,
typename Transformation,
typename Undecorated,
typename GlueTag,
typename Tag>
159 :
public TypeTree::meta_function
163 TypeTree::declptr<GFS>(),
164 TypeTree::declptr<Transformation>(),
165 TypeTree::declptr<Undecorated>(),
166 TypeTree::declptr<GlueTag>(),
167 TypeTree::declptr<Tag>()
173 template<typename GFS, typename Transformation, typename OrderingTag>
177 static const bool recursive =
false;
179 typedef typename leaf_gfs_to_ordering_descriptor<
182 typename OrderingTag::Undecorated
192 typename OrderingTag::Decorator
198 static transformed_type
transform(
const GFS& gfs,
const Transformation& t)
200 return decorator_descriptor::transform(gfs,t,std::make_shared<undecorated_type>(undecorated_descriptor::transform(gfs,t)));
203 static transformed_storage_type
transform(std::shared_ptr<const GFS>& gfs_pointer,
const Transformation& t)
205 return decorator_descriptor::transform(gfs_pointer,t,undecorated_descriptor::transform(gfs_pointer,t));
210 template<
typename GFS,
typename Transformation,
typename D,
typename U>
215 template<
typename GFS,
typename Transformation,
typename OrderingTag>
219 static const bool recursive =
true;
221 template<
typename TC>
225 typedef typename power_gfs_to_ordering_descriptor<
228 typename OrderingTag::Undecorated
237 typename OrderingTag::Decorator
240 typedef typename decorator_descriptor::transformed_type
type;
241 typedef typename decorator_descriptor::transformed_storage_type
storage_type;
245 template<
typename TC>
251 template<
typename TC>
260 template<
typename GFS,
typename Transformation,
typename OrderingTag>
264 static const bool recursive =
false;
266 typedef typename power_gfs_to_ordering_descriptor<
269 typename OrderingTag::Undecorated
279 typename OrderingTag::Decorator
285 static transformed_type
transform(
const GFS& gfs,
const Transformation& t)
287 return decorator_descriptor::transform(gfs,t,std::make_shared<undecorated_type>(undecorated_descriptor::transform(gfs,t)));
290 static transformed_storage_type
transform_storage(std::shared_ptr<const GFS>& gfs_pointer,
const Transformation& t)
292 return decorator_descriptor::transform_storage(gfs_pointer,t,undecorated_descriptor::transform_storage(gfs_pointer,t));
298 template<
typename GFS,
typename Transformation,
typename OrderingTag>
300 :
public std::conditional<
301 power_gfs_to_ordering_descriptor<
304 typename OrderingTag::Undecorated
306 recursive_power_gfs_to_decorated<
311 nonrecursive_power_gfs_to_decorated<
318 template<
typename GFS,
typename Transformation,
typename D,
typename U>
331 template<
typename GFS,
typename Transformation,
typename OrderingTag>
335 static const bool recursive =
true;
337 template<
typename... TC>
341 typedef typename composite_gfs_to_ordering_descriptor<
344 typename OrderingTag::Undecorated
353 typename OrderingTag::Decorator
356 typedef typename decorator_descriptor::transformed_type
type;
357 typedef typename decorator_descriptor::transformed_storage_type
storage_type;
361 template<
typename... TC>
362 static typename result<TC...>::type
transform(
const GFS& gfs,
const Transformation& t, std::shared_ptr<TC>... children)
367 template<
typename... TC>
368 static typename result<TC...>::storage_type
transform_storage(std::shared_ptr<const GFS> gfs_pointer,
const Transformation& t, std::shared_ptr<TC>... children)
376 template<
typename GFS,
typename Transformation,
typename OrderingTag>
380 static const bool recursive =
false;
382 typedef typename composite_gfs_to_ordering_descriptor<
385 typename OrderingTag::Undecorated
395 typename OrderingTag::Decorator
401 static transformed_type
transform(
const GFS& gfs,
const Transformation& t)
403 return decorator_descriptor::transform(gfs,t,std::make_shared<undecorated_type>(undecorated_descriptor::transform(gfs,t)));
406 static transformed_storage_type
transform_storage(std::shared_ptr<const GFS>& gfs_pointer,
const Transformation& t)
408 return decorator_descriptor::transform_storage(gfs_pointer,t,undecorated_descriptor::transform(gfs_pointer,t));
414 template<
typename GFS,
typename Transformation,
typename OrderingTag>
416 :
public std::conditional<
417 composite_gfs_to_ordering_descriptor<
420 typename OrderingTag::Undecorated
422 recursive_composite_gfs_to_decorated<
427 nonrecursive_composite_gfs_to_decorated<
435 template<
typename GFS,
typename Transformation,
typename D,
typename U>
446 #endif // DUNE_PDELAB_ORDERING_DECORATOR_HH static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: decorator.hh:285
decorator_descriptor::transformed_type type
Definition: decorator.hh:356
D Decorator
Definition: decorator.hh:87
decorator_descriptor::transformed_storage_type transformed_storage_type
Definition: decorator.hh:283
undecorated_descriptor::transformed_type undecorated_type
Definition: decorator.hh:272
decorator_descriptor::transformed_storage_type transformed_storage_type
Definition: decorator.hh:196
Definition: decorator.hh:216
gfs_to_chunked< GFS, Transformation, Undecorated, GlueTag > register_gfs_to_decorator_descriptor(GFS *, Transformation *, Undecorated *, GlueTag *, Chunked< UndecoratedTag > *)
power_gfs_to_decorated< GFS, Transformation, decorated_ordering_tag< D, U > > register_power_gfs_to_ordering_descriptor(GFS *, Transformation *, decorated_ordering_tag< D, U > *)
Definition: decorator.hh:338
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typename OrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:193
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: decorator.hh:401
undecorated_descriptor::transformed_type undecorated_type
Definition: decorator.hh:185
static transformed_storage_type transform_storage(std::shared_ptr< const GFS > &gfs_pointer, const Transformation &t)
Definition: decorator.hh:290
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typename OrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:354
undecorated_descriptor::template result< TC >::type undecorated_type
Definition: decorator.hh:231
Definition: decorator.hh:82
static result< TC >::storage_type transform_storage(std::shared_ptr< const GFS > gfs_pointer, const Transformation &t, const array< std::shared_ptr< TC >, TypeTree::StaticDegree< GFS >::value > &children)
Definition: decorator.hh:252
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typename OrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:396
Definition: decorator.hh:261
leaf_gfs_to_decorated< GFS, Transformation, decorated_ordering_tag< D, U > > register_leaf_gfs_to_ordering_descriptor(GFS *, Transformation *, decorated_ordering_tag< D, U > *)
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
Definition: decorator.hh:174
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const array< std::shared_ptr< TC >, TypeTree::StaticDegree< GFS >::value > &children)
Definition: decorator.hh:246
power_gfs_to_ordering_descriptor< GFS, Transformation, typename OrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:270
static transformed_storage_type transform_storage(std::shared_ptr< const GFS > &gfs_pointer, const Transformation &t)
Definition: decorator.hh:406
composite_gfs_to_ordering_descriptor< GFS, Transformation, typename OrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:386
Definition: decorator.hh:415
composite_gfs_to_decorated< GFS, Transformation, decorated_ordering_tag< D, U > > register_composite_gfs_to_ordering_descriptor(GFS *, Transformation *, decorated_ordering_tag< D, U > *)
U Undecorated
Definition: decorator.hh:88
Definition: decorator.hh:332
decorated_ordering_tag()
Definition: decorator.hh:92
Definition: decorator.hh:222
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:368
leaf_gfs_to_ordering_descriptor< GFS, Transformation, typename OrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:183
decorated_ordering_tag(Undecorated &&u)
Definition: decorator.hh:99
Definition: decorator.hh:158
power_gfs_to_ordering_descriptor< GFS, Transformation, typename OrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:229
undecorated_descriptor::transformed_type undecorated_type
Definition: decorator.hh:388
Definition: decorator.hh:377
decorator_descriptor::transformed_type transformed_type
Definition: decorator.hh:282
Definition: decorator.hh:299
decorator_descriptor::transformed_type type
Definition: decorator.hh:240
decorated_ordering_tag(const Undecorated &u)
Definition: decorator.hh:95
undecorated_descriptor::template result< TC... >::type undecorated_type
Definition: decorator.hh:347
static result< TC... >::type transform(const GFS &gfs, const Transformation &t, std::shared_ptr< TC >... children)
Definition: decorator.hh:362
decorator_descriptor::transformed_storage_type storage_type
Definition: decorator.hh:357
decorator_descriptor::transformed_storage_type storage_type
Definition: decorator.hh:241
decorator_descriptor::transformed_storage_type transformed_storage_type
Definition: decorator.hh:399
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: decorator.hh:198
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:142
decorator_descriptor::transformed_type transformed_type
Definition: decorator.hh:398
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
composite_gfs_to_ordering_descriptor< GFS, Transformation, typename OrderingTag::Undecorated >::type undecorated_descriptor
Definition: decorator.hh:345
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typename OrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:238
decorator_descriptor::transformed_type transformed_type
Definition: decorator.hh:195
gfs_to_decorator_descriptor< GFS, Transformation, undecorated_type, OrderingTag, typename OrderingTag::Decorator >::type decorator_descriptor
Definition: decorator.hh:280
static transformed_storage_type transform(std::shared_ptr< const GFS > &gfs_pointer, const Transformation &t)
Definition: decorator.hh:203