DUNE PDELab (2.7)

entityblockedlocalordering.hh
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
16
17#include <dune/typetree/compositenode.hh>
18#include <dune/typetree/powernode.hh>
19#include <dune/typetree/traversal.hh>
20#include <dune/typetree/visitor.hh>
21#include <dune/typetree/typetraits.hh>
22
23#include <dune/pdelab/ordering/gridviewordering.hh>
24
25namespace Dune {
26 namespace PDELab {
27
30
31 template<typename ChildOrdering, std::size_t k>
32 class PowerEntityBlockedLocalOrdering
33 : public TypeTree::PowerNode<ChildOrdering,k>
34 , public LocalOrderingBase<typename ChildOrdering::Traits::EntitySet,
35 typename ChildOrdering::Traits::DOFIndex,
36 typename ChildOrdering::Traits::ContainerIndex>
37 {
38
39 typedef TypeTree::PowerNode<ChildOrdering,k> NodeT;
40 typedef LocalOrderingBase<typename ChildOrdering::Traits::EntitySet,
41 typename ChildOrdering::Traits::DOFIndex,
42 typename ChildOrdering::Traits::ContainerIndex> BaseT;
43
44 public:
45
46 static const bool consume_tree_index = true;
47
48 typedef typename BaseT::Traits Traits;
49
50 PowerEntityBlockedLocalOrdering(const typename NodeT::NodeStorage& child_storage, bool container_blocked)
51 : NodeT(child_storage)
52 , BaseT(*this,container_blocked,nullptr)
53 {}
54
55 const typename Traits::EntitySet& entitySet() const
56 {
57 return this->child(0).entitySet();
58 }
59
60 };
61
62 template<typename GFS, typename Transformation>
63 struct power_gfs_to_local_ordering_descriptor<GFS,Transformation,EntityBlockedOrderingTag>
64 {
65
66 static const bool recursive = true;
67
68 template<typename TC>
69 struct result
70 {
71 typedef PowerEntityBlockedLocalOrdering<TC,TypeTree::StaticDegree<GFS>::value> type;
72 typedef std::shared_ptr<type> storage_type;
73 };
74
75 template<typename TC>
76 static typename result<TC>::type transform(const GFS& gfs, const Transformation& t, const std::array<std::shared_ptr<TC>,TypeTree::StaticDegree<GFS>::value>& children)
77 {
78 return typename result<TC>::type(children,gfs.backend().blocked(gfs));
79 }
80
81 template<typename TC>
82 static typename 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)
83 {
84 return std::make_shared<typename result<TC>::type>(children,gfs->backend().blocked(*gfs));
85 }
86
87 };
88
89
90
91 template<typename GFS, typename Transformation>
92 struct power_gfs_to_entityblocked_ordering_descriptor
93 {
94
95 static const bool recursive = false;
96
97 typedef TypeTree::TransformTree<GFS,gfs_to_local_ordering<Transformation> > LocalOrderingTransformation;
98 typedef typename LocalOrderingTransformation::Type LocalOrdering;
99
100 typedef GridViewOrdering<LocalOrdering> transformed_type;
101
102 typedef std::shared_ptr<transformed_type> transformed_storage_type;
103
104 static transformed_type transform(const GFS& gfs, const Transformation& t)
105 {
106 transformed_type r(make_tuple(std::make_shared<LocalOrdering>(LocalOrderingTransformation::transform(gfs,gfs_to_local_ordering<Transformation>()))),gfs.backend().blocked(gfs),const_cast<GFS*>(&gfs));
107 return r;
108 }
109
110 static transformed_storage_type transform_storage(std::shared_ptr<const GFS> gfs, const Transformation& t)
111 {
112 transformed_storage_type r(std::make_shared<transformed_type>(make_tuple(LocalOrderingTransformation::transform_storage(gfs,gfs_to_local_ordering<Transformation>())),gfs->backend().blocked(*gfs),const_cast<GFS*>(gfs.get())));
113 return r;
114 }
115
116 };
117
118 template<typename GFS, typename Transformation>
119 power_gfs_to_entityblocked_ordering_descriptor<GFS,Transformation>
120 register_power_gfs_to_ordering_descriptor(GFS*,Transformation*,EntityBlockedOrderingTag*);
121
122
123
124 template<typename... Children>
125 class CompositeEntityBlockedLocalOrdering
126 : public TypeTree::CompositeNode<Children...>
127 , public LocalOrderingBase<typename first_type<Children...>::type::Traits::EntitySet,
128 typename first_type<Children...>::type::Traits::DOFIndex,
129 typename first_type<Children...>::type::Traits::ContainerIndex>
130 {
131
132 typedef TypeTree::CompositeNode<Children...> Node;
133 typedef LocalOrderingBase<typename first_type<Children...>::type::Traits::EntitySet,
134 typename first_type<Children...>::type::Traits::DOFIndex,
135 typename first_type<Children...>::type::Traits::ContainerIndex> Base;
136
137 public:
138
139 typedef typename Base::Traits Traits;
140
141 static const bool consume_tree_index = true;
142
143 CompositeEntityBlockedLocalOrdering(bool container_blocked, std::shared_ptr<Children>... children)
144 : Node(children...)
145 , Base(*this,container_blocked,nullptr)
146 {}
147
148 const typename Traits::EntitySet& entitySet() const
149 {
150 return this->template child<0>().entitySet();
151 }
152
153 };
154
155
156 template<typename GFS, typename Transformation>
157 struct composite_gfs_to_local_ordering_descriptor<GFS,Transformation,EntityBlockedOrderingTag>
158 {
159
160 static const bool recursive = true;
161
162 template<typename... TC>
163 struct result
164 {
165 typedef CompositeEntityBlockedLocalOrdering<TC...> type;
166 typedef std::shared_ptr<type> storage_type;
167 };
168
169 template<typename... TC>
170 static typename result<TC...>::type transform(const GFS& gfs, const Transformation& t, std::shared_ptr<TC>... children)
171 {
172 return typename result<TC...>::type(gfs.backend().blocked(gfs),children...);
173 }
174
175 template<typename... TC>
176 static typename result<TC...>::storage_type transform_storage(std::shared_ptr<const GFS> gfs, const Transformation& t, std::shared_ptr<TC>... children)
177 {
178 return std::make_shared<typename result<TC...>::type>(gfs->backend().blocked(*gfs),children...);
179 }
180
181 };
182
183 template<typename GFS, typename Transformation>
184 struct composite_gfs_to_entityblocked_ordering_descriptor
185 {
186
187 static const bool recursive = false;
188
189 typedef TypeTree::TransformTree<GFS,gfs_to_local_ordering<Transformation> > LocalOrderingTransformation;
190 typedef typename LocalOrderingTransformation::Type LocalOrdering;
191
192 typedef GridViewOrdering<LocalOrdering> transformed_type;
193
194 typedef std::shared_ptr<transformed_type> transformed_storage_type;
195
196 static transformed_type transform(const GFS& gfs, const Transformation& t)
197 {
198 transformed_type r(make_tuple(std::make_shared<LocalOrdering>(LocalOrderingTransformation::transform(gfs,gfs_to_local_ordering<Transformation>()))),gfs.backend().blocked(gfs),const_cast<GFS*>(&gfs));
199 return r;
200 }
201
202 static transformed_storage_type transform_storage(std::shared_ptr<const GFS> gfs, const Transformation& t)
203 {
204 transformed_storage_type r(std::make_shared<transformed_type>(make_tuple(LocalOrderingTransformation::transform_storage(gfs,gfs_to_local_ordering<Transformation>())),gfs->backend().blocked(*gfs),const_cast<GFS*>(gfs.get())));
205 return r;
206 }
207
208 };
209
210 template<typename GFS, typename Transformation>
211 composite_gfs_to_entityblocked_ordering_descriptor<GFS,Transformation>
212 register_composite_gfs_to_ordering_descriptor(GFS*,Transformation*,EntityBlockedOrderingTag*);
213
214
216 } // namespace PDELab
217} // namespace Dune
218
219#endif // DUNE_PDELAB_ORDERING_ENTITYBLOCKEDLOCALORDERING_HH
std::array< ChildStorageType, k > NodeStorage
The type used for storing the children.
Definition: powernode.hh:84
A free function to provide the demangled class name of a given object or type as a string.
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
A few common exception classes.
Traits for type conversions and type information.
ImplementationDefined child(Node &&node, Indices... indices)
Extracts the child of a node given by a sequence of compile-time and run-time indices.
Definition: childextraction.hh:179
Dune namespace.
Definition: alignedallocator.hh:14
Standard Dune debug streams.
static transformed_type transform(const SourceTree &s, const Transformation &t=Transformation())
Apply transformation to an existing tree s.
Definition: transformation.hh:113
static transformed_storage_type transform_storage(std::shared_ptr< const SourceTree > sp, const Transformation &t=Transformation())
Definition: transformation.hh:138
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)