dune-pdelab  2.4-dev
transformations.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_PDELAB_ORDERING_TRANSFORMATIONS_HH
4 #define DUNE_PDELAB_ORDERING_TRANSFORMATIONS_HH
5 
6 #include <cstddef>
7 
8 #include <dune/typetree/traversal.hh>
9 #include <dune/typetree/accumulate_static.hh>
10 
15 
25 namespace Dune {
26  namespace PDELab {
27 
30 
31 #ifndef DOXYGEN
32 
33  struct extract_max_container_depth
34  {
35 
36  typedef std::size_t result_type;
37 
38  template<typename Node, typename TreePath>
39  struct doVisit
40  {
41  static const bool value = true;
42  };
43 
44  template<typename Node, typename TreePath>
45  struct visit
46  {
47  static const std::size_t result = Node::Traits::Backend::Traits::max_blocking_depth;
48  };
49 
50  };
51 
52 
54  template<typename RootGFS>
55  struct gfs_to_ordering
56  {
57  static const std::size_t ci_depth =
58  TypeTree::AccumulateValue<RootGFS,
59  extract_max_container_depth,
60  TypeTree::max<std::size_t>,
61  0,
62  TypeTree::plus<std::size_t>
63  >::result + 1;
64 
65  typedef typename gfs_to_lfs<RootGFS>::DOFIndex DOFIndex;
66  typedef MultiIndex<std::size_t,ci_depth> ContainerIndex;
67  };
68 
70  template<typename GlobalTransformation>
71  struct gfs_to_local_ordering
72  {
73  typedef typename GlobalTransformation::DOFIndex DOFIndex;
74  typedef typename GlobalTransformation::ContainerIndex ContainerIndex;
75  };
76 
77 
78  // Declare PowerGFS to ordering descriptor and register transformation
79 
80  template<typename GFS, typename Transformation, typename OrderingTag>
81  struct power_gfs_to_ordering_descriptor
82  : public TypeTree::meta_function
83  {
84  typedef DUNE_DECLTYPE(
86  TypeTree::declptr<GFS>(),
87  TypeTree::declptr<Transformation>(),
88  TypeTree::declptr<OrderingTag>()
89  )
90  ) type;
91  };
92 
93  template<typename GridFunctionSpace, typename Params>
94  power_gfs_to_ordering_descriptor<
95  GridFunctionSpace,
96  gfs_to_ordering<Params>,
97  typename GridFunctionSpace::OrderingTag
98  >
99  registerNodeTransformation(GridFunctionSpace*, gfs_to_ordering<Params>*, PowerGridFunctionSpaceTag*);
100 
101 
102  // Declare LeafGFS to ordering descriptor and register transformation
103 
104  template<typename GFS, typename Transformation, typename OrderingTag>
105  struct leaf_gfs_to_ordering_descriptor
106  : public TypeTree::meta_function
107  {
108  typedef DUNE_DECLTYPE(
110  TypeTree::declptr<GFS>(),
111  TypeTree::declptr<Transformation>(),
112  TypeTree::declptr<OrderingTag>()
113  )
114  ) type;
115  };
116 
117  template<typename GridFunctionSpace, typename Params>
118  leaf_gfs_to_ordering_descriptor<
119  GridFunctionSpace,
120  gfs_to_ordering<Params>,
121  typename GridFunctionSpace::Traits::OrderingTag
122  >
123  registerNodeTransformation(GridFunctionSpace*, gfs_to_ordering<Params>*, LeafGridFunctionSpaceTag*);
124 
125 
126  // Declare CompositeGFS to ordering descriptor and register transformation
127 
128  template<typename GFS, typename Transformation, typename OrderingTag>
129  struct composite_gfs_to_ordering_descriptor
130  : public TypeTree::meta_function
131  {
132  typedef DUNE_DECLTYPE(
134  TypeTree::declptr<GFS>(),
135  TypeTree::declptr<Transformation>(),
136  TypeTree::declptr<OrderingTag>()
137  )
138  ) type;
139  };
140 
141  template<typename GridFunctionSpace, typename Params>
142  composite_gfs_to_ordering_descriptor<
143  GridFunctionSpace,
144  gfs_to_ordering<Params>,
145  typename GridFunctionSpace::OrderingTag
146  >
147  registerNodeTransformation(GridFunctionSpace*, gfs_to_ordering<Params>*, CompositeGridFunctionSpaceTag*);
148 
149 
150  // Declare PowerGFS to local ordering descriptor and register transformation
151 
152  template<typename GFS, typename Transformation, typename OrderingTag>
153  struct power_gfs_to_local_ordering_descriptor;
154 
155  template<typename GFS, typename Params>
156  power_gfs_to_local_ordering_descriptor<
157  GFS,
158  gfs_to_local_ordering<Params>,
159  typename GFS::OrderingTag
160  >
161  registerNodeTransformation(GFS*, gfs_to_local_ordering<Params>*, PowerGridFunctionSpaceTag*);
162 
163 
164  // Declare LeafGFS to local ordering descriptor and register transformation
165 
166  template<typename GFS, typename Transformation, typename OrderingTag>
167  struct leaf_gfs_to_local_ordering_descriptor;
168 
169  template<typename GFS, typename Params>
170  leaf_gfs_to_local_ordering_descriptor<
171  GFS,
172  gfs_to_local_ordering<Params>,
173  typename GFS::Traits::OrderingTag
174  >
175  registerNodeTransformation(GFS*, gfs_to_local_ordering<Params>*, LeafGridFunctionSpaceTag*);
176 
177 
178  // Declare CompositeGFS to ordering descriptor and register transformation
179 
180  template<typename GFS, typename Transformation, typename OrderingTag>
181  struct composite_gfs_to_local_ordering_descriptor;
182 
183  template<typename GFS, typename Params>
184  composite_gfs_to_local_ordering_descriptor<
185  GFS,
186  gfs_to_local_ordering<Params>,
187  typename GFS::OrderingTag
188  >
189  registerNodeTransformation(GFS*, gfs_to_local_ordering<Params>*, CompositeGridFunctionSpaceTag*);
190 
191 
192 #endif // DOXYGEN
193 
195 
196  } // namespace PDELab
197 } // namespace Dune
198 
199 #endif // DUNE_PDELAB_ORDERING_TRANSFORMATIONS_HH
direct_leaf_gfs_to_gridview_ordering_descriptor< GFS, Transformation > register_leaf_gfs_to_ordering_descriptor(GFS *, Transformation *, LeafOrderingTag< Params > *)
composite_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_composite_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
static const unsigned int value
Definition: gridfunctionspace/tags.hh:175
Definition: adaptivity.hh:27
TypeTree::TemplatizedGenericPowerNodeTransformation< PowerGridFunctionSpace, gfs_to_lfs< Params >, power_gfs_to_lfs_template< PowerGridFunctionSpace, gfs_to_lfs< Params > >::template result > registerNodeTransformation(PowerGridFunctionSpace *pgfs, gfs_to_lfs< Params > *t, PowerGridFunctionSpaceTag *tag)
power_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_power_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)