dune-pdelab  2.5-dev
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 
11 #include <dune/common/classname.hh>
12 #include <dune/common/exceptions.hh>
13 #include <dune/common/stdstreams.hh>
14 #include <dune/common/typetraits.hh>
15 #include <dune/common/deprecated.hh>
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 
24 
25 namespace Dune {
26  namespace PDELab {
27 
30 
31  template<typename ChildOrdering, std::size_t k>
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  {
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>
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 
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 std::move(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 std::move(r);
114  }
115 
116  };
117 
118  template<typename GFS, typename Transformation>
121 
122 
123 
124  template<typename... Children>
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>
158  {
159 
160  static const bool recursive = true;
161 
162  template<typename... TC>
163  struct result
164  {
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>
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 
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 std::move(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 std::move(r);
206  }
207 
208  };
209 
210  template<typename GFS, typename Transformation>
213 
214 
216  } // namespace PDELab
217 } // namespace Dune
218 
219 #endif // DUNE_PDELAB_ORDERING_ENTITYBLOCKEDLOCALORDERING_HH
Definition: ordering/utility.hh:208
Definition: entityblockedlocalordering.hh:32
CompositeEntityBlockedLocalOrdering< TC... > type
Definition: entityblockedlocalordering.hh:165
BaseT::Traits Traits
Definition: entityblockedlocalordering.hh:48
LocalOrderingTransformation::Type LocalOrdering
Definition: entityblockedlocalordering.hh:98
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: entityblockedlocalordering.hh:196
const Traits::EntitySet & entitySet() const
Definition: entityblockedlocalordering.hh:55
TypeTree::TransformTree< GFS, gfs_to_local_ordering< Transformation > > LocalOrderingTransformation
Definition: entityblockedlocalordering.hh:97
TypeTree::TransformTree< GFS, gfs_to_local_ordering< Transformation > > LocalOrderingTransformation
Definition: entityblockedlocalordering.hh:189
Indicate blocking of the unknowns by grid entity.
Definition: gridfunctionspace/tags.hh:53
static result< TC... >::type transform(const GFS &gfs, const Transformation &t, std::shared_ptr< TC >... children)
Definition: entityblockedlocalordering.hh:170
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:76
static const bool consume_tree_index
Definition: entityblockedlocalordering.hh:46
static transformed_storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t)
Definition: entityblockedlocalordering.hh:110
static result< TC... >::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, std::shared_ptr< TC >... children)
Definition: entityblockedlocalordering.hh:176
LocalOrderingTransformation::Type LocalOrdering
Definition: entityblockedlocalordering.hh:190
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:82
power_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_power_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: entityblockedlocalordering.hh:104
PowerEntityBlockedLocalOrdering(const typename NodeT::NodeStorage &child_storage, bool container_blocked)
Definition: entityblockedlocalordering.hh:50
Definition: localorderingbase.hh:19
const Traits::EntitySet & entitySet() const
Definition: entityblockedlocalordering.hh:148
std::shared_ptr< transformed_type > transformed_storage_type
Definition: entityblockedlocalordering.hh:194
Definition: entityblockedlocalordering.hh:184
GridViewOrdering< LocalOrdering > transformed_type
Definition: entityblockedlocalordering.hh:192
Definition: gridviewordering.hh:430
Definition: entityblockedlocalordering.hh:125
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
static transformed_storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t)
Definition: entityblockedlocalordering.hh:202
composite_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_composite_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
std::shared_ptr< transformed_type > transformed_storage_type
Definition: entityblockedlocalordering.hh:102
GridViewOrdering< LocalOrdering > transformed_type
Definition: entityblockedlocalordering.hh:100
Base::Traits Traits
Definition: entityblockedlocalordering.hh:139
PowerEntityBlockedLocalOrdering< TC, TypeTree::StaticDegree< GFS >::value > type
Definition: entityblockedlocalordering.hh:71
ES EntitySet
Definition: ordering/utility.hh:214
CompositeEntityBlockedLocalOrdering(bool container_blocked, std::shared_ptr< Children >... children)
Definition: entityblockedlocalordering.hh:143
Definition: entityblockedlocalordering.hh:92