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/compositenode.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>
56 Base(Node& node,
bool container_blocked,
const OrderingTag& ordering_tag)
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<std::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 std::make_shared<typename result<TC>::type>(gfs->backend().blocked(*gfs),gfs->orderingTag(),children);
210 template<
typename DI,
typename CI,
typename... Children>
212 public TypeTree::CompositeNode<Children...>,
215 CompositePermutationOrdering<
222 typedef TypeTree::CompositeNode<Children...> Node;
245 std::shared_ptr<Children>... children)
247 ,
Base(*this,backend_blocked,ordering_tag)
250 std::string
name()
const {
return "CompositePermutationOrdering"; }
254 TypeTree::applyToTree(*
this,ordering::update_direct_children());
259 template<
typename GFS,
typename Transformation>
263 static const bool recursive =
true;
265 template<
typename... TC>
270 typename Transformation::DOFIndex,
271 typename Transformation::ContainerIndex,
279 template<
typename... TC>
280 static typename result<TC...>::type
transform(
const GFS& gfs,
const Transformation& t, std::shared_ptr<TC>... children)
282 return typename result<TC...>::type(gfs.backend().blocked(gfs),gfs.orderingTag(),children...);
285 template<
typename... TC>
286 static typename result<TC...>::storage_type
transform_storage(std::shared_ptr<const GFS> gfs,
const Transformation& t, std::shared_ptr<TC>... children)
288 return std::make_shared<
typename result<TC...>::type>(gfs->backend().blocked(*gfs),gfs.orderingTag(),children...);
299 #endif // DUNE_PDELAB_ORDERING_PERMUTATIONORDERING_HH
void _mapIndex(typename Traits::DOFIndexView di, typename Traits::ContainerIndex &ci) const
Definition: orderingbase.hh:233
Definition: lexicographicordering.hh:104
PowerPermutationOrdering(bool container_blocked, const PermutationOrderingTag &ordering_tag, const typename Node::NodeStorage &children)
Construct ordering object.
Definition: permutationordering.hh:153
virtual void map_index_dynamic(typename Traits::DOFIndexView di, typename Traits::ContainerIndex &ci) const
Definition: permutationordering.hh:112
DI::size_type SizeType
Definition: ordering/utility.hh:201
PowerPermutationOrdering< typename Transformation::DOFIndex, typename Transformation::ContainerIndex, TC, GFS::CHILDREN > type
Definition: permutationordering.hh:186
Interface for merging index spaces.
Definition: permutationordering.hh:128
PermutationOrderingTag OrderingTag
Definition: permutationordering.hh:46
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
Base(const This &other)
Copy constructor.
Definition: permutationordering.hh:66
CI ContainerIndex
Definition: ordering/utility.hh:160
CompositePermutationOrdering< typename Transformation::DOFIndex, typename Transformation::ContainerIndex, TC... > type
Definition: permutationordering.hh:273
std::string name() const
Definition: permutationordering.hh:167
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Definition: lexicographicordering.hh:59
static result< TC...>::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, std::shared_ptr< TC >...children)
Definition: permutationordering.hh:286
std::shared_ptr< type > storage_type
Definition: permutationordering.hh:188
BaseT::Traits Traits
Definition: permutationordering.hh:44
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Definition: permutationordering.hh:85
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
std::shared_ptr< type > storage_type
Definition: permutationordering.hh:275
DI::View DOFIndexView
Definition: ordering/utility.hh:198
Definition: lexicographicordering.hh:33
static const bool consume_tree_index
Definition: permutationordering.hh:48
Definition: adaptivity.hh:27
void update()
Definition: permutationordering.hh:252
Base(Node &node, bool container_blocked, const OrderingTag &ordering_tag)
Construct ordering object.
Definition: permutationordering.hh:56
std::string name() const
Definition: permutationordering.hh:250
CompositePermutationOrdering(bool backend_blocked, const PermutationOrderingTag &ordering_tag, std::shared_ptr< Children >...children)
Construct ordering object.
Definition: permutationordering.hh:244
void setDelegate(const VirtualOrderingBase< DI, CI > *delegate)
Set the delegate called in mapIndex().
Definition: orderingbase.hh:228
lexicographic_ordering::Base< DI, CI, Node > BaseT
Definition: permutationordering.hh:43
Interface for merging index spaces.
Definition: permutationordering.hh:35
void update()
Definition: permutationordering.hh:158
Definition: ordering/utility.hh:230
Base(This &&other)
Definition: permutationordering.hh:75
Definition: ordering/utility.hh:186
Interface for merging index spaces.
Definition: permutationordering.hh:211
Indicate permuted ordering of the unknowns of non-leaf grid function spaces according to a given perm...
Definition: gridfunctionspace/tags.hh:134
void update()
Definition: orderingbase.hh:99
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const array< std::shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: permutationordering.hh:193
Base< DI, CI, Node > This
Definition: permutationordering.hh:42
static result< TC...>::type transform(const GFS &gfs, const Transformation &t, std::shared_ptr< TC >...children)
Definition: permutationordering.hh:280
static result< TC >::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, const array< std::shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: permutationordering.hh:199