DUNE PDELab (git)

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
11#include <dune/pdelab/common/typetraits.hh>
12#include <dune/pdelab/common/multiindex.hh>
13#include <dune/pdelab/gridfunctionspace/tags.hh>
14#include <dune/pdelab/gridfunctionspace/tags.hh>
15
25namespace 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 decltype(
85 register_power_gfs_to_ordering_descriptor(
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 decltype(
109 register_leaf_gfs_to_ordering_descriptor(
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>,
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 decltype(
133 register_composite_gfs_to_ordering_descriptor(
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
O OrderingTag
tag describing the ordering.
Definition: gridfunctionspace.hh:164
void registerNodeTransformation(SourceNode *, Transformation *, Tag *)
Register transformation descriptor to transform SourceNode with Transformation.
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)