4 #ifndef DUNE_PDELAB_ORDERING_LEXICOGRAPHICORDERING_HH
5 #define DUNE_PDELAB_ORDERING_LEXICOGRAPHICORDERING_HH
11 #include <dune/common/classname.hh>
12 #include <dune/common/exceptions.hh>
13 #include <dune/common/stdstreams.hh>
15 #include <dune/typetree/compositenodemacros.hh>
16 #include <dune/typetree/powernode.hh>
17 #include <dune/typetree/traversal.hh>
18 #include <dune/typetree/visitor.hh>
30 namespace lexicographic_ordering {
32 template<
typename DI,
typename CI,
typename Node>
54 :
BaseT(node,container_blocked,gfs_data,nullptr)
58 template<
typename ItIn,
typename ItOut>
63 for (ItIn in = begin; in != end; ++in, ++out)
64 out->push_back(in->treeIndex().back());
68 for (ItIn in = begin; in != end; ++in, ++out)
69 out->back() += (this->
blockOffset(in->treeIndex().back()));
73 template<
typename CIOutIterator,
typename DIOutIterator = DummyDOFIndexIterator>
77 CIOutIterator ci_out,
const CIOutIterator ci_end)
const
81 for (; ci_out != ci_end; ++ci_out)
83 ci_out->push_back(child_index);
88 for (; ci_out != ci_end; ++ci_out)
103 template<
typename DI,
typename CI,
typename Child, std::
size_t k>
105 :
public TypeTree::PowerNode<Child, k>
108 PowerLexicographicOrdering<DI,CI,Child,k>
111 typedef TypeTree::PowerNode<Child, k> Node;
131 ,
Base(*this,container_blocked,gfs_data)
136 for (std::size_t i = 0; i < Node::CHILDREN; ++i)
138 this->child(i).update();
143 std::string
name()
const {
return "PowerLexicographicOrdering"; }
147 template<
typename GFS,
typename Transformation>
153 template<
typename TC>
158 typename Transformation::DOFIndex,
159 typename Transformation::ContainerIndex,
168 template<
typename TC>
169 static typename result<TC>::type transform(
const GFS& gfs,
const Transformation& t,
const array<shared_ptr<TC>,GFS::CHILDREN>& children)
171 return typename result<TC>::type(gfs.backend().blocked(gfs),children,
const_cast<GFS*
>(&gfs));
174 template<
typename TC>
177 return make_shared<typename result<TC>::type>(gfs->backend().blocked(*gfs),children,
const_cast<GFS*
>(gfs.get()));
182 template<
typename GFS,
typename Transformation>
183 power_gfs_to_lexicographic_ordering_descriptor<GFS,Transformation>
190 template<
typename DI,
typename CI, DUNE_TYPETREE_COMPOSITENODE_TEMPLATE_CHILDREN>
192 public DUNE_TYPETREE_COMPOSITENODE_BASETYPE,
195 CompositeLexicographicOrdering<
198 DUNE_TYPETREE_COMPOSITENODE_CHILDTYPES
202 typedef DUNE_TYPETREE_COMPOSITENODE_BASETYPE Node;
210 DUNE_TYPETREE_COMPOSITENODE_CHILDTYPES
225 : Node(DUNE_TYPETREE_COMPOSITENODE_CHILDVARIABLES)
226 ,
Base(*this,backend_blocked,gfs_data)
229 std::string
name()
const {
return "CompositeLexicographicOrdering"; }
233 TypeTree::applyToTree(*
this,ordering::update_direct_children());
238 #if HAVE_VARIADIC_TEMPLATES
240 template<
typename GFS,
typename Transformation>
241 struct composite_gfs_to_lexicographic_ordering_descriptor
246 template<
typename... TC>
250 typedef CompositeLexicographicOrdering<
251 typename Transformation::DOFIndex,
252 typename Transformation::ContainerIndex,
260 template<
typename... TC>
261 static typename result<TC...>::type
transform(
const GFS& gfs,
const Transformation& t, shared_ptr<TC>... children)
263 return typename result<TC...>::type(gfs.backend().blocked(gfs),
const_cast<GFS*
>(&gfs),children...);
266 template<
typename... TC>
267 static typename result<TC...>::storage_type
transform_storage(shared_ptr<const GFS> gfs,
const Transformation& t, shared_ptr<TC>... children)
269 return make_shared<
typename result<TC...>::type>(gfs->backend().blocked(*gfs),
const_cast<GFS*
>(gfs.get()),children...);
274 #else // HAVE_VARIADIC_TEMPLATES
277 template<
typename GFS,
typename Transformation>
283 template<
typename TC0,
297 TC0,TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8,TC9>
type;
301 template<
typename TC0,
313 const Transformation& t,
325 return typename result<TC0,TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8,TC9>::type(t.asGridFunctionSpace(s),c0,c1,c2,c3,c4,c5,c6,c7,c8,c9);
328 template<
typename TC0,
338 static typename result<TC0,TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8,TC9>::storage_type
340 const Transformation& t,
352 return make_shared<typename result<TC0,TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8,TC9>::type>(t.asGridFunctionSpace(s),c0,c1,c2,c3,c4,c5,c6,c7,c8,c9);
357 #endif // HAVE_VARIADIC_TEMPLATES
359 template<
typename GFS,
typename Transformation>
360 composite_gfs_to_lexicographic_ordering_descriptor<GFS,Transformation>
367 #endif // DUNE_PDELAB_ORDERING_LEXICOGRAPHICORDERING_HH
LexicographicOrderingTag OrderingTag
Definition: lexicographicordering.hh:43
Definition: lexicographicordering.hh:154
std::string name() const
Definition: lexicographicordering.hh:143
Node transformation descriptor for CompositeGridFunctionSpace -> LexicographicOrdering (without varia...
Definition: lexicographicordering.hh:278
Definition: lexicographicordering.hh:293
DI::size_type SizeType
Definition: ordering/utility.hh:201
Definition: lexicographicordering.hh:148
void update()
Definition: lexicographicordering.hh:134
Indicate lexicographic ordering of the unknowns of non-leaf grid function spaces. ...
Definition: gridfunctionspace/tags.hh:59
composite_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_composite_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Definition: lexicographicordering.hh:59
power_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_power_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
Definition: orderingbase.hh:22
Traits::SizeType blockOffset(const typename Traits::SizeType child_index) const
Definition: orderingbase.hh:84
static const bool recursive
Definition: lexicographicordering.hh:281
Base(Node &node, bool container_blocked, typename BaseT::GFSData *gfs_data)
Construct ordering object.
Definition: lexicographicordering.hh:53
Definition: ordering/utility.hh:186
CompositeLexicographicOrdering(bool backend_blocked, typename Base::GFSData *gfs_data, DUNE_TYPETREE_COMPOSITENODE_STORAGE_CONSTRUCTOR_SIGNATURE)
Construct ordering object.
Definition: lexicographicordering.hh:224
Traits::SizeType extract_entity_indices(const typename Traits::DOFIndex::EntityIndex &ei, typename Traits::SizeType child_index, CIOutIterator ci_out, const CIOutIterator ci_end) const
Definition: lexicographicordering.hh:75
CompositeLexicographicOrdering< typename Transformation::GridFunctionSpace::Traits::SizeType, TC0, TC1, TC2, TC3, TC4, TC5, TC6, TC7, TC8, TC9 > type
Definition: lexicographicordering.hh:297
PowerLexicographicOrdering< typename Transformation::DOFIndex, typename Transformation::ContainerIndex, TC, GFS::CHILDREN > type
Definition: lexicographicordering.hh:162
std::string name() const
Definition: lexicographicordering.hh:229
static const bool consume_tree_index
Definition: lexicographicordering.hh:45
void update()
Definition: lexicographicordering.hh:231
Definition: lexicographicordering.hh:104
static result< TC0, TC1, TC2, TC3, TC4, TC5, TC6, TC7, TC8, TC9 >::type transform(const GFSNode &s, const Transformation &t, shared_ptr< TC0 > c0, shared_ptr< TC1 > c1, shared_ptr< TC2 > c2, shared_ptr< TC3 > c3, shared_ptr< TC4 > c4, shared_ptr< TC5 > c5, shared_ptr< TC6 > c6, shared_ptr< TC7 > c7, shared_ptr< TC8 > c8, shared_ptr< TC9 > c9)
Definition: lexicographicordering.hh:312
static const bool recursive
Definition: lexicographicordering.hh:151
static result< TC >::storage_type transform_storage(shared_ptr< const GFS > gfs, const Transformation &t, const array< shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: lexicographicordering.hh:175
void update()
Definition: orderingbase.hh:100
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const array< shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: lexicographicordering.hh:169
static result< TC0, TC1, TC2, TC3, TC4, TC5, TC6, TC7, TC8, TC9 >::storage_type transform_storage(shared_ptr< const GFSNode > s, const Transformation &t, shared_ptr< TC0 > c0, shared_ptr< TC1 > c1, shared_ptr< TC2 > c2, shared_ptr< TC3 > c3, shared_ptr< TC4 > c4, shared_ptr< TC5 > c5, shared_ptr< TC6 > c6, shared_ptr< TC7 > c7, shared_ptr< TC8 > c8, shared_ptr< TC9 > c9)
Definition: lexicographicordering.hh:339
shared_ptr< type > storage_type
Definition: lexicographicordering.hh:164
PowerLexicographicOrdering(bool container_blocked, const typename Node::NodeStorage &children, typename Base::GFSData *gfs_data)
Construct ordering object.
Definition: lexicographicordering.hh:129
OrderingBase< DI, CI >::Traits Traits
Definition: lexicographicordering.hh:41
const bool _container_blocked
Definition: orderingbase.hh:275
Dune::PDELab::impl::GridFunctionSpaceOrderingData< typename Traits::SizeType > GFSData
Definition: orderingbase.hh:35
Interface for merging index spaces.
Definition: lexicographicordering.hh:191
shared_ptr< type > storage_type
Definition: lexicographicordering.hh:298
const std::string s
Definition: function.hh:1103
Definition: lexicographicordering.hh:33