4 #ifndef DUNE_PDELAB_ORDERING_PERMUTATIONORDERING_HH
5 #define DUNE_PDELAB_ORDERING_PERMUTATIONORDERING_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>
31 namespace permutation_ordering {
34 template<
typename DI,
typename CI,
typename Node>
57 :
BaseT(node,container_blocked),
58 _perm(ordering_tag.permutation())
76 :
BaseT(std::move(other)),
77 _perm(std::move(other._perm))
84 template<
typename ItIn,
typename ItOut>
90 for (ItIn in = begin; in != end; ++in, ++out)
91 out->back() = _perm[out->back()];
94 template<
typename CIOutIterator,
typename DIOutIterator = DummyDOFIndexIterator>
98 CIOutIterator ci_out,
const CIOutIterator ci_end)
const
103 for (; ci_out != ci_end; ++ci_out)
105 ci_out->back() = _perm[ci_out->back()];
117 ci.back() = _perm[ci.back()];
121 const std::vector<std::size_t>& _perm;
127 template<
typename DI,
typename CI,
typename Child, std::
size_t k>
129 :
public TypeTree::PowerNode<Child, k>
132 PowerLexicographicOrdering<DI,CI,Child,k>
135 typedef TypeTree::PowerNode<Child, k> Node;
155 ,
Base(*this,container_blocked,ordering_tag)
160 for (std::size_t i = 0; i < Node::CHILDREN; ++i)
162 this->child(i).update();
167 std::string
name()
const {
return "PowerPermutationOrdering"; }
171 template<
typename GFS,
typename Transformation>
175 static const bool recursive =
true;
177 template<
typename TC>
182 typename Transformation::DOFIndex,
183 typename Transformation::ContainerIndex,
192 template<
typename TC>
193 static typename result<TC>::type transform(
const GFS& gfs,
const Transformation& t,
const array<shared_ptr<TC>,GFS::CHILDREN>& children)
195 return typename result<TC>::type(gfs.backend().blocked(gfs),gfs->orderingTag(),children);
198 template<
typename TC>
201 return make_shared<typename result<TC>::type>(gfs->backend().blocked(*gfs),gfs->orderingTag(),children);
210 template<
typename DI,
typename CI, DUNE_TYPETREE_COMPOSITENODE_TEMPLATE_CHILDREN>
212 public DUNE_TYPETREE_COMPOSITENODE_BASETYPE,
215 CompositePermutationOrdering<
218 DUNE_TYPETREE_COMPOSITENODE_CHILDTYPES
222 typedef DUNE_TYPETREE_COMPOSITENODE_BASETYPE Node;
230 DUNE_TYPETREE_COMPOSITENODE_CHILDTYPES
245 DUNE_TYPETREE_COMPOSITENODE_STORAGE_CONSTRUCTOR_SIGNATURE)
246 : Node(DUNE_TYPETREE_COMPOSITENODE_CHILDVARIABLES)
247 ,
Base(*this,backend_blocked,ordering_tag)
250 std::string
name()
const {
return "CompositePermutationOrdering"; }
254 TypeTree::applyToTree(*
this,ordering::update_direct_children());
259 #if HAVE_VARIADIC_TEMPLATES
261 template<
typename GFS,
typename Transformation>
262 struct composite_gfs_to_ordering_descriptor<GFS,Transformation,PermutationOrderingTag>
265 static const bool recursive =
true;
267 template<
typename... TC>
271 typedef CompositePermutationOrdering<
272 typename Transformation::DOFIndex,
273 typename Transformation::ContainerIndex,
277 typedef shared_ptr<type> storage_type;
281 template<
typename... TC>
282 static typename result<TC...>::type transform(
const GFS& gfs,
const Transformation& t, shared_ptr<TC>... children)
284 return typename result<TC...>::type(gfs.backend().blocked(gfs),gfs.orderingTag(),children...);
287 template<
typename... TC>
288 static typename result<TC...>::storage_type transform_storage(shared_ptr<const GFS> gfs,
const Transformation& t, shared_ptr<TC>... children)
290 return make_shared<
typename result<TC...>::type>(gfs->backend().blocked(*gfs),gfs.orderingTag(),children...);
295 #else // HAVE_VARIADIC_TEMPLATES
298 template<
typename GFS,
typename Transformation>
302 static const bool recursive =
true;
304 template<
typename TC0,
318 TC0,TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8,TC9>
type;
322 template<
typename TC0,
334 const Transformation& t,
346 return typename result<TC0,TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8,TC9>::type(t.asGridFunctionSpace(s),t.asGridFunctionSpace(s).orderingTag(),c0,c1,c2,c3,c4,c5,c6,c7,c8,c9);
349 template<
typename TC0,
359 static typename result<TC0,TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8,TC9>::storage_type
361 const Transformation& t,
373 return make_shared<typename result<TC0,TC1,TC2,TC3,TC4,TC5,TC6,TC7,TC8,TC9>::type>(t.asGridFunctionSpace(s),t.asGridFunctionSpace(s).orderingTag(),c0,c1,c2,c3,c4,c5,c6,c7,c8,c9);
378 #endif // HAVE_VARIADIC_TEMPLATES
386 #endif // DUNE_PDELAB_ORDERING_PERMUTATIONORDERING_HH
CompositePermutationOrdering< typename Transformation::GridFunctionSpace::Traits::SizeType, TC0, TC1, TC2, TC3, TC4, TC5, TC6, TC7, TC8, TC9 > type
Definition: permutationordering.hh:318
BaseT::Traits Traits
Definition: permutationordering.hh:44
Base(Node &node, bool container_blocked, const OrderingTag &ordering_tag)
Construct ordering object.
Definition: permutationordering.hh:56
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Definition: permutationordering.hh:85
lexicographic_ordering::Base< DI, CI, Node > BaseT
Definition: permutationordering.hh:43
CompositePermutationOrdering(bool backend_blocked, const PermutationOrderingTag &ordering_tag, DUNE_TYPETREE_COMPOSITENODE_STORAGE_CONSTRUCTOR_SIGNATURE)
Construct ordering object.
Definition: permutationordering.hh:244
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: permutationordering.hh:96
DI::size_type SizeType
Definition: ordering/utility.hh:201
Indicate lexicographic ordering of the unknowns of non-leaf grid function spaces. ...
Definition: gridfunctionspace/tags.hh:59
Base(This &&other)
Definition: permutationordering.hh:75
void _mapIndex(typename Traits::DOFIndexView di, typename Traits::ContainerIndex &ci) const
Definition: orderingbase.hh:232
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Definition: lexicographicordering.hh:59
CI ContainerIndex
Definition: ordering/utility.hh:160
Definition: orderingbase.hh:22
void update()
Definition: permutationordering.hh:158
Definition: ordering/utility.hh:230
void update()
Definition: permutationordering.hh:252
Definition: ordering/utility.hh:186
shared_ptr< type > storage_type
Definition: permutationordering.hh:188
Indicate permuted ordering of the unknowns of non-leaf grid function spaces according to a given perm...
Definition: gridfunctionspace/tags.hh:134
PowerPermutationOrdering(bool container_blocked, const PermutationOrderingTag &ordering_tag, const typename Node::NodeStorage &children)
Construct ordering object.
Definition: permutationordering.hh:153
PermutationOrderingTag OrderingTag
Definition: permutationordering.hh:46
Interface for merging index spaces.
Definition: permutationordering.hh:211
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
shared_ptr< type > storage_type
Definition: permutationordering.hh:319
Base< DI, CI, Node > This
Definition: permutationordering.hh:42
Interface for merging index spaces.
Definition: permutationordering.hh:35
Definition: lexicographicordering.hh:104
static result< TC >::storage_type transform_storage(shared_ptr< const GFS > gfs, const Transformation &t, const array< shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: permutationordering.hh:199
Interface for merging index spaces.
Definition: permutationordering.hh:128
void update()
Definition: orderingbase.hh:100
virtual void map_index_dynamic(typename Traits::DOFIndexView di, typename Traits::ContainerIndex &ci) const
Definition: permutationordering.hh:112
std::string name() const
Definition: permutationordering.hh:250
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: permutationordering.hh:360
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const array< shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: permutationordering.hh:193
DI::View DOFIndexView
Definition: ordering/utility.hh:198
std::string name() const
Definition: permutationordering.hh:167
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: permutationordering.hh:333
PowerPermutationOrdering< typename Transformation::DOFIndex, typename Transformation::ContainerIndex, TC, GFS::CHILDREN > type
Definition: permutationordering.hh:186
Base(const This &other)
Copy constructor.
Definition: permutationordering.hh:66
static const bool consume_tree_index
Definition: permutationordering.hh:48
const std::string s
Definition: function.hh:1103
Definition: lexicographicordering.hh:33
void setDelegate(const VirtualOrderingBase< DI, CI > *delegate)
Set the delegate called in mapIndex().
Definition: orderingbase.hh:227