dune-pdelab  2.0.0
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/compositenodemacros.hh>
18 #include <dune/typetree/powernode.hh>
19 #include <dune/typetree/traversal.hh>
20 #include <dune/typetree/visitor.hh>
21 
23 
24 namespace Dune {
25  namespace PDELab {
26 
29 
30  template<typename ChildOrdering, std::size_t k>
32  : public TypeTree::PowerNode<ChildOrdering,k>
33  , public LocalOrderingBase<typename ChildOrdering::Traits::GridView,
34  typename ChildOrdering::Traits::DOFIndex,
35  typename ChildOrdering::Traits::ContainerIndex>
36  {
37 
38  typedef TypeTree::PowerNode<ChildOrdering,k> NodeT;
39  typedef LocalOrderingBase<typename ChildOrdering::Traits::GridView,
40  typename ChildOrdering::Traits::DOFIndex,
41  typename ChildOrdering::Traits::ContainerIndex> BaseT;
42 
43  public:
44 
45  static const bool consume_tree_index = true;
46 
47  typedef typename BaseT::Traits Traits;
48 
49  PowerEntityBlockedLocalOrdering(const typename NodeT::NodeStorage& child_storage, bool container_blocked)
50  : NodeT(child_storage)
51  , BaseT(*this,container_blocked,nullptr)
52  {}
53 
54  const typename Traits::GridView& gridView() const
55  {
56  return this->child(0).gridView();
57  }
58 
59  };
60 
61  template<typename GFS, typename Transformation>
62  struct power_gfs_to_local_ordering_descriptor<GFS,Transformation,EntityBlockedOrderingTag>
63  {
64 
65  static const bool recursive = true;
66 
67  template<typename TC>
68  struct result
69  {
71  typedef shared_ptr<type> storage_type;
72  };
73 
74  template<typename TC>
75  static typename result<TC>::type transform(const GFS& gfs, const Transformation& t, const array<shared_ptr<TC>,GFS::CHILDREN>& children)
76  {
77  return typename result<TC>::type(children,gfs.backend().blocked(gfs));
78  }
79 
80  template<typename TC>
81  static typename result<TC>::storage_type transform_storage(shared_ptr<const GFS> gfs, const Transformation& t, const array<shared_ptr<TC>,GFS::CHILDREN>& children)
82  {
83  return make_shared<typename result<TC>::type>(children,gfs->backend().blocked(*gfs));
84  }
85 
86  };
87 
88 
89 
90  template<typename GFS, typename Transformation>
92  {
93 
94  static const bool recursive = false;
95 
96  typedef TypeTree::TransformTree<GFS,gfs_to_local_ordering<Transformation> > LocalOrderingTransformation;
97  typedef typename LocalOrderingTransformation::Type LocalOrdering;
98 
100 
101  typedef shared_ptr<transformed_type> transformed_storage_type;
102 
103  static transformed_type transform(const GFS& gfs, const Transformation& t)
104  {
105  transformed_type r(make_tuple(make_shared<LocalOrdering>(LocalOrderingTransformation::transform(gfs,gfs_to_local_ordering<Transformation>()))),gfs.backend().blocked(gfs),const_cast<GFS*>(&gfs));
106  return std::move(r);
107  }
108 
109  static transformed_storage_type transform_storage(shared_ptr<const GFS> gfs, const Transformation& t)
110  {
111  transformed_storage_type r(make_shared<transformed_type>(make_tuple(LocalOrderingTransformation::transform_storage(gfs,gfs_to_local_ordering<Transformation>())),gfs->backend().blocked(*gfs),const_cast<GFS*>(gfs.get())));
112  return std::move(r);
113  }
114 
115  };
116 
117  template<typename GFS, typename Transformation>
118  power_gfs_to_entityblocked_ordering_descriptor<GFS,Transformation>
119  register_power_gfs_to_ordering_descriptor(GFS*,Transformation*,EntityBlockedOrderingTag*);
120 
121 
122 
123  template<DUNE_TYPETREE_COMPOSITENODE_TEMPLATE_CHILDREN>
125  : public DUNE_TYPETREE_COMPOSITENODE_BASETYPE
126  , public LocalOrderingBase<typename DUNE_TYPETREE_COMPOSITENODE_FIRST_CHILD::Traits::GridView,
127  typename DUNE_TYPETREE_COMPOSITENODE_FIRST_CHILD::Traits::DOFIndex,
128  typename DUNE_TYPETREE_COMPOSITENODE_FIRST_CHILD::Traits::ContainerIndex>
129  {
130 
131  typedef DUNE_TYPETREE_COMPOSITENODE_BASETYPE Node;
132  typedef LocalOrderingBase<typename DUNE_TYPETREE_COMPOSITENODE_FIRST_CHILD::Traits::GridView,
133  typename DUNE_TYPETREE_COMPOSITENODE_FIRST_CHILD::Traits::DOFIndex,
134  typename DUNE_TYPETREE_COMPOSITENODE_FIRST_CHILD::Traits::ContainerIndex> Base;
135 
136  public:
137 
138  typedef typename Base::Traits Traits;
139 
140  static const bool consume_tree_index = true;
141 
142  CompositeEntityBlockedLocalOrdering(bool container_blocked, DUNE_TYPETREE_COMPOSITENODE_STORAGE_CONSTRUCTOR_SIGNATURE)
143  : Node(DUNE_TYPETREE_COMPOSITENODE_CHILDVARIABLES)
144  , Base(*this,container_blocked,nullptr)
145  {}
146 
147  const typename Traits::GridView& gridView() const
148  {
149  return this->template child<0>().gridView();
150  }
151 
152  };
153 
154 
155  template<typename GFS, typename Transformation>
157  {
158 
159  static const bool recursive = true;
160 
161  template<typename... TC>
162  struct result
163  {
165  typedef shared_ptr<type> storage_type;
166  };
167 
168  template<typename... TC>
169  static typename result<TC...>::type transform(const GFS& gfs, const Transformation& t, shared_ptr<TC>... children)
170  {
171  return typename result<TC...>::type(gfs.backend().blocked(gfs),children...);
172  }
173 
174  template<typename... TC>
175  static typename result<TC...>::storage_type transform_storage(shared_ptr<const GFS> gfs, const Transformation& t, shared_ptr<TC>... children)
176  {
177  return make_shared<typename result<TC...>::type>(gfs.backend().blocked(*gfs),children...);
178  }
179 
180  };
181 
182  template<typename GFS, typename Transformation>
184  {
185 
186  static const bool recursive = false;
187 
188  typedef TypeTree::TransformTree<GFS,gfs_to_local_ordering<Transformation> > LocalOrderingTransformation;
189  typedef typename LocalOrderingTransformation::Type LocalOrdering;
190 
192 
193  typedef shared_ptr<transformed_type> transformed_storage_type;
194 
195  static transformed_type transform(const GFS& gfs, const Transformation& t)
196  {
197  transformed_type r(make_tuple(make_shared<LocalOrdering>(LocalOrderingTransformation::transform(gfs,gfs_to_local_ordering<Transformation>()))),gfs.backend().blocked(gfs),const_cast<GFS*>(&gfs));
198  return std::move(r);
199  }
200 
201  static transformed_storage_type transform_storage(shared_ptr<const GFS> gfs, const Transformation& t)
202  {
203  transformed_storage_type r(make_shared<transformed_type>(make_tuple(LocalOrderingTransformation::transform_storage(gfs,gfs_to_local_ordering<Transformation>())),gfs->backend().blocked(*gfs)),const_cast<GFS*>(gfs.get()));
204  return std::move(r);
205  }
206 
207  };
208 
209  template<typename GFS, typename Transformation>
210  composite_gfs_to_entityblocked_ordering_descriptor<GFS,Transformation>
211  register_composite_gfs_to_ordering_descriptor(GFS*,Transformation*,EntityBlockedOrderingTag*);
212 
213 
215  } // namespace PDELab
216 } // namespace Dune
217 
218 #endif // DUNE_PDELAB_ORDERING_ENTITYBLOCKEDORDERING_HH
Indicate blocking of the unknowns by grid entity.
Definition: gridfunctionspace/tags.hh:49
LocalOrderingTransformation::Type LocalOrdering
Definition: entityblockedlocalordering.hh:189
static result< TC >::storage_type transform_storage(shared_ptr< const GFS > gfs, const Transformation &t, const array< shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: entityblockedlocalordering.hh:81
static const bool recursive
Definition: entityblockedlocalordering.hh:94
const Traits::GridView & gridView() const
Definition: entityblockedlocalordering.hh:54
static result< TC...>::type transform(const GFS &gfs, const Transformation &t, shared_ptr< TC >...children)
Definition: entityblockedlocalordering.hh:169
LocalOrderingTransformation::Type LocalOrdering
Definition: entityblockedlocalordering.hh:97
Definition: ordering/utility.hh:208
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 *)
TypeTree::TransformTree< GFS, gfs_to_local_ordering< Transformation > > LocalOrderingTransformation
Definition: entityblockedlocalordering.hh:188
const Traits::GridView & gridView() const
Definition: entityblockedlocalordering.hh:147
shared_ptr< transformed_type > transformed_storage_type
Definition: entityblockedlocalordering.hh:193
Definition: localorderingbase.hh:20
CompositeEntityBlockedLocalOrdering(bool container_blocked, DUNE_TYPETREE_COMPOSITENODE_STORAGE_CONSTRUCTOR_SIGNATURE)
Definition: entityblockedlocalordering.hh:142
Definition: entityblockedlocalordering.hh:124
Definition: entityblockedlocalordering.hh:31
PowerEntityBlockedLocalOrdering< TC, GFS::CHILDREN > type
Definition: entityblockedlocalordering.hh:70
CompositeEntityBlockedLocalOrdering< TC...> type
Definition: entityblockedlocalordering.hh:164
GV GridView
Definition: ordering/utility.hh:214
static const bool consume_tree_index
Definition: entityblockedlocalordering.hh:45
TypeTree::TransformTree< GFS, gfs_to_local_ordering< Transformation > > LocalOrderingTransformation
Definition: entityblockedlocalordering.hh:96
BaseT::Traits Traits
Definition: entityblockedlocalordering.hh:47
static transformed_storage_type transform_storage(shared_ptr< const GFS > gfs, const Transformation &t)
Definition: entityblockedlocalordering.hh:109
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: entityblockedlocalordering.hh:195
Definition: entityblockedlocalordering.hh:183
Base::Traits Traits
Definition: entityblockedlocalordering.hh:138
static transformed_type transform(const GFS &gfs, const Transformation &t)
Definition: entityblockedlocalordering.hh:103
Definition: entityblockedlocalordering.hh:91
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const array< shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: entityblockedlocalordering.hh:75
GridViewOrdering< LocalOrdering > transformed_type
Definition: entityblockedlocalordering.hh:191
static const bool consume_tree_index
Definition: entityblockedlocalordering.hh:140
static const bool recursive
Definition: entityblockedlocalordering.hh:186
PowerEntityBlockedLocalOrdering(const typename NodeT::NodeStorage &child_storage, bool container_blocked)
Definition: entityblockedlocalordering.hh:49
shared_ptr< transformed_type > transformed_storage_type
Definition: entityblockedlocalordering.hh:101
Definition: gridviewordering.hh:420
GridViewOrdering< LocalOrdering > transformed_type
Definition: entityblockedlocalordering.hh:99
static result< TC...>::storage_type transform_storage(shared_ptr< const GFS > gfs, const Transformation &t, shared_ptr< TC >...children)
Definition: entityblockedlocalordering.hh:175
static transformed_storage_type transform_storage(shared_ptr< const GFS > gfs, const Transformation &t)
Definition: entityblockedlocalordering.hh:201