dune-pdelab 2.8
Loading...
Searching...
No Matches
entityblockedlocalordering.hh
Go to the documentation of this file.
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=8 sw=2 sts=2:
3
4#ifndef DUNE_PDELAB_ORDERING_ENTITYBLOCKEDLOCALORDERING_HH
5#define DUNE_PDELAB_ORDERING_ENTITYBLOCKEDLOCALORDERING_HH
6
7#include <cstddef>
8#include <ostream>
9#include <string>
10
17
23
25
26namespace Dune {
27 namespace PDELab {
28
31
32 template<typename ChildOrdering, std::size_t k>
34 : public TypeTree::PowerNode<ChildOrdering,k>
35 , public LocalOrderingBase<typename ChildOrdering::Traits::EntitySet,
36 typename ChildOrdering::Traits::DOFIndex,
37 typename ChildOrdering::Traits::ContainerIndex>
38 {
39
41 typedef LocalOrderingBase<typename ChildOrdering::Traits::EntitySet,
42 typename ChildOrdering::Traits::DOFIndex,
43 typename ChildOrdering::Traits::ContainerIndex> BaseT;
44
45 public:
46
47 static const bool consume_tree_index = true;
48
49 typedef typename BaseT::Traits Traits;
50
51 PowerEntityBlockedLocalOrdering(const typename NodeT::NodeStorage& child_storage, bool container_blocked)
52 : NodeT(child_storage)
53 , BaseT(*this,container_blocked,nullptr)
54 {}
55
56 using BaseT::size;
57
64 typename Traits::SizeType
65 size(const typename Traits::ContainerIndex& suffix,
66 const typename Traits::DOFIndex::EntityIndex &index) const {
67 return this->node_size(*this,suffix,index);
68 }
69 };
70
71
72 template<typename GFS, typename Transformation>
73 struct power_gfs_to_local_ordering_descriptor<GFS,Transformation,EntityBlockedOrderingTag>
74 {
75
76 static const bool recursive = true;
77
78 template<typename TC>
84
85 template<typename TC>
86 static typename result<TC>::type transform(const GFS& gfs, const Transformation& t, const std::array<std::shared_ptr<TC>,TypeTree::StaticDegree<GFS>::value>& children)
87 {
88 return typename result<TC>::type(children,gfs.backend().blocked(gfs));
89 }
90
91 template<typename TC>
93 {
94 return std::make_shared<typename result<TC>::type>(children,gfs->backend().blocked(*gfs));
95 }
96
97 };
98
99
100
101 template<typename GFS, typename Transformation>
103 {
104
105 static const bool recursive = false;
106
109
111
113
114 using EntitySet = typename GFS::Traits::EntitySet;
115
116 static transformed_type transform(const GFS& gfs, const Transformation& t)
117 {
118 // check and extract common entity set on leaf nodes
119 auto es_visitor = impl::common_entity_set<EntitySet>{};
120 TypeTree::applyToTree(gfs, es_visitor);
121 assert(es_visitor._entity_set);
122 auto& es = *es_visitor._entity_set;
123 // build local ordering tree
124 auto local_ordering = std::make_shared<LocalOrdering>(LocalOrderingTransformation::transform(gfs,gfs_to_local_ordering<Transformation>()));
125 bool blocked = gfs.backend().blocked(gfs);
126 // create grid view ordering
127 transformed_type r(make_tuple(std::move(local_ordering)),blocked,const_cast<GFS*>(&gfs),es);
128 return r;
129 }
130
132 {
133 // check and extract common entity set on leaf nodes
134 auto es_visitor = impl::common_entity_set<EntitySet>{};
135 TypeTree::applyToTree(*gfs, es_visitor);
136 assert(es_visitor._entity_set);
137 auto& es = *es_visitor._entity_set;
138 // build local ordering tree
139 auto local_ordering = LocalOrderingTransformation::transform_storage(gfs,gfs_to_local_ordering<Transformation>());
140 bool blocked = gfs->backend().blocked(*gfs);
141 // create grid view ordering
142 transformed_storage_type r(std::make_shared<transformed_type>(make_tuple(std::move(local_ordering)),blocked,const_cast<GFS*>(gfs.get()),es));
143 return r;
144 }
145
146 };
147
148 template<typename GFS, typename Transformation>
149 power_gfs_to_entityblocked_ordering_descriptor<GFS,Transformation>
151
152
153
154 template<typename... Children>
156 : public TypeTree::CompositeNode<Children...>
157 , public LocalOrderingBase<typename first_type<Children...>::type::Traits::EntitySet,
158 typename first_type<Children...>::type::Traits::DOFIndex,
159 typename first_type<Children...>::type::Traits::ContainerIndex>
160 {
161
162 typedef TypeTree::CompositeNode<Children...> Node;
163 typedef LocalOrderingBase<typename first_type<Children...>::type::Traits::EntitySet,
164 typename first_type<Children...>::type::Traits::DOFIndex,
165 typename first_type<Children...>::type::Traits::ContainerIndex> Base;
166
167 public:
168
169 typedef typename Base::Traits Traits;
170
171 static const bool consume_tree_index = true;
172
174 : Node(children...)
175 , Base(*this,container_blocked,nullptr)
176 {}
177
178 using Base::size;
179
189 typename Traits::SizeType
190 size(const typename Traits::ContainerIndex &suffix,
191 const typename Traits::DOFIndex::EntityIndex &index) const {
192 return this->node_size(*this,suffix,index);
193 }
194
195 };
196
197
198 template<typename GFS, typename Transformation>
199 struct composite_gfs_to_local_ordering_descriptor<GFS,Transformation,EntityBlockedOrderingTag>
200 {
201
202 static const bool recursive = true;
203
204 template<typename... TC>
205 struct result
206 {
209 };
210
211 template<typename... TC>
212 static typename result<TC...>::type transform(const GFS& gfs, const Transformation& t, std::shared_ptr<TC>... children)
213 {
214 return typename result<TC...>::type(gfs.backend().blocked(gfs),children...);
215 }
216
217 template<typename... TC>
218 static typename result<TC...>::storage_type transform_storage(std::shared_ptr<const GFS> gfs, const Transformation& t, std::shared_ptr<TC>... children)
219 {
220 return std::make_shared<typename result<TC...>::type>(gfs->backend().blocked(*gfs),children...);
221 }
222
223 };
224
225 template<typename GFS, typename Transformation>
227 {
228 static const bool recursive = false;
229
232
234
236
237 using EntitySet = typename GFS::Traits::EntitySet;
238
239 static transformed_type transform(const GFS& gfs, const Transformation& t)
240 {
241 // check and extract common entity set on leaf nodes
242 auto es_visitor = impl::common_entity_set<EntitySet>{};
243 TypeTree::applyToTree(gfs, es_visitor);
244 assert(es_visitor._entity_set);
245 auto& es = *es_visitor._entity_set;
246 bool blocked = gfs.backend().blocked(gfs);
247 // build local ordering tree
248 auto local_ordering = std::make_shared<LocalOrdering>(LocalOrderingTransformation::transform(gfs,gfs_to_local_ordering<Transformation>()));
249 // create grid view ordering
250 transformed_type r(make_tuple(std::move(local_ordering)),blocked,const_cast<GFS*>(&gfs),es);
251 return r;
252 }
253
255 {
256 // check and extract common entity set on leaf nodes
257 auto es_visitor = impl::common_entity_set<EntitySet>{};
258 TypeTree::applyToTree(*gfs, es_visitor);
259 assert(es_visitor._entity_set);
260 auto& es = *es_visitor._entity_set;
261 bool blocked = gfs->backend().blocked(*gfs);
262 // build local ordering tree
263 auto local_ordering = make_tuple(LocalOrderingTransformation::transform_storage(gfs,gfs_to_local_ordering<Transformation>()));
264 // create grid view ordering
265 transformed_storage_type r(std::make_shared<transformed_type>(std::move(local_ordering),blocked,const_cast<GFS*>(gfs.get()),es));
266 return r;
267 }
268
269 };
270
271 template<typename GFS, typename Transformation>
272 composite_gfs_to_entityblocked_ordering_descriptor<GFS,Transformation>
274
275
277 } // namespace PDELab
278} // namespace Dune
279
280#endif // DUNE_PDELAB_ORDERING_ENTITYBLOCKEDLOCALORDERING_HH
void applyToTree(Tree &&tree, Visitor &&visitor)
decltype(Node::degree()) StaticDegree
std::size_t index
Definition interpolate.hh:97
composite_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_composite_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
power_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_power_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
For backward compatibility – Do not use this!
static transformed_type transform(const SourceTree &s, const Transformation &t=Transformation())
static transformed_storage_type transform_storage(std::shared_ptr< const SourceTree > sp, const Transformation &t=Transformation())
Indicate blocking of the unknowns by grid entity.
Definition gridfunctionspace/tags.hh:53
Definition entityblockedlocalordering.hh:38
BaseT::Traits Traits
Definition entityblockedlocalordering.hh:49
static const bool consume_tree_index
Definition entityblockedlocalordering.hh:47
PowerEntityBlockedLocalOrdering(const typename NodeT::NodeStorage &child_storage, bool container_blocked)
Definition entityblockedlocalordering.hh:51
Traits::SizeType size(const typename Traits::ContainerIndex &suffix, const typename Traits::DOFIndex::EntityIndex &index) const
Returns the size for a given suffix.
Definition entityblockedlocalordering.hh:65
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const std::array< std::shared_ptr< TC >, TypeTree::StaticDegree< GFS >::value > &children)
Definition entityblockedlocalordering.hh:86
static result< TC >::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, const std::array< std::shared_ptr< TC >, TypeTree::StaticDegree< GFS >::value > &children)
Definition entityblockedlocalordering.hh:92
PowerEntityBlockedLocalOrdering< TC, TypeTree::StaticDegree< GFS >::value > type
Definition entityblockedlocalordering.hh:81
Definition entityblockedlocalordering.hh:103
GridViewOrdering< LocalOrdering > transformed_type
Definition entityblockedlocalordering.hh:110
static transformed_storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t)
Definition entityblockedlocalordering.hh:131
TypeTree::TransformTree< GFS, gfs_to_local_ordering< Transformation > > LocalOrderingTransformation
Definition entityblockedlocalordering.hh:107
LocalOrderingTransformation::Type LocalOrdering
Definition entityblockedlocalordering.hh:108
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition entityblockedlocalordering.hh:116
std::shared_ptr< transformed_type > transformed_storage_type
Definition entityblockedlocalordering.hh:112
typename GFS::Traits::EntitySet EntitySet
Definition entityblockedlocalordering.hh:114
static const bool recursive
Definition entityblockedlocalordering.hh:105
Definition entityblockedlocalordering.hh:160
Traits::SizeType size(const typename Traits::ContainerIndex &suffix, const typename Traits::DOFIndex::EntityIndex &index) const
Returns the size for a given suffix.
Definition entityblockedlocalordering.hh:190
static const bool consume_tree_index
Definition entityblockedlocalordering.hh:171
CompositeEntityBlockedLocalOrdering(bool container_blocked, std::shared_ptr< Children >... children)
Definition entityblockedlocalordering.hh:173
Base::Traits Traits
Definition entityblockedlocalordering.hh:169
static result< TC... >::type transform(const GFS &gfs, const Transformation &t, std::shared_ptr< TC >... children)
Definition entityblockedlocalordering.hh:212
static result< TC... >::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, std::shared_ptr< TC >... children)
Definition entityblockedlocalordering.hh:218
CompositeEntityBlockedLocalOrdering< TC... > type
Definition entityblockedlocalordering.hh:207
Definition entityblockedlocalordering.hh:227
GridViewOrdering< LocalOrdering > transformed_type
Definition entityblockedlocalordering.hh:233
typename GFS::Traits::EntitySet EntitySet
Definition entityblockedlocalordering.hh:237
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition entityblockedlocalordering.hh:239
TypeTree::TransformTree< GFS, gfs_to_local_ordering< Transformation > > LocalOrderingTransformation
Definition entityblockedlocalordering.hh:230
static transformed_storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t)
Definition entityblockedlocalordering.hh:254
static const bool recursive
Definition entityblockedlocalordering.hh:228
LocalOrderingTransformation::Type LocalOrdering
Definition entityblockedlocalordering.hh:231
std::shared_ptr< transformed_type > transformed_storage_type
Definition entityblockedlocalordering.hh:235
Transforms a local ordering (entity-wise order) into a global ordering.
Definition gridviewordering.hh:440
Entity-wise orderings.
Definition localorderingbase.hh:30
Traits::SizeType node_size(const Node &node, typename Traits::ContainerIndex suffix, const typename Traits::DOFIndex::EntityIndex &index) const
Gives the size for a given entity and suffix.
Definition localorderingbase.hh:287
Traits::SizeType size(const typename Traits::DOFIndex::EntityIndex &index) const
Definition localorderingbase.hh:229
std::size_t SizeType
Definition ordering/utility.hh:178
CI ContainerIndex
Definition ordering/utility.hh:176
Definition ordering/utility.hh:224
T get(T... args)
T make_shared(T... args)