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/compositenode.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>
151 static const bool recursive =
true;
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 std::array<std::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 std::make_shared<typename result<TC>::type>(gfs->backend().blocked(*gfs),children,
const_cast<GFS*
>(gfs.get()));
182 template<
typename GFS,
typename Transformation>
190 template<
typename DI,
typename CI,
typename... Children>
192 public TypeTree::CompositeNode<Children...>,
195 CompositeLexicographicOrdering<
202 typedef TypeTree::CompositeNode<Children...> Node;
226 ,
Base(*this,backend_blocked,gfs_data)
229 std::string
name()
const {
return "CompositeLexicographicOrdering"; }
233 TypeTree::applyToTree(*
this,ordering::update_direct_children());
238 template<
typename GFS,
typename Transformation>
242 static const bool recursive =
true;
244 template<
typename... TC>
249 typename Transformation::DOFIndex,
250 typename Transformation::ContainerIndex,
258 template<
typename... TC>
259 static typename result<TC...>::type
transform(
const GFS& gfs,
const Transformation& t, std::shared_ptr<TC>... children)
261 return typename result<TC...>::type(gfs.backend().blocked(gfs),
const_cast<GFS*
>(&gfs),children...);
264 template<
typename... TC>
265 static typename result<TC...>::storage_type
transform_storage(std::shared_ptr<const GFS> gfs,
const Transformation& t, std::shared_ptr<TC>... children)
267 return std::make_shared<
typename result<TC...>::type>(gfs->backend().blocked(*gfs),
const_cast<GFS*
>(gfs.get()),children...);
273 template<
typename GFS,
typename Transformation>
281 #endif // DUNE_PDELAB_ORDERING_LEXICOGRAPHICORDERING_HH
CompositeLexicographicOrdering(bool backend_blocked, typename Base::GFSData *gfs_data, std::shared_ptr< Children >...children)
Construct ordering object.
Definition: lexicographicordering.hh:224
static const bool consume_tree_index
Definition: lexicographicordering.hh:45
std::shared_ptr< type > storage_type
Definition: lexicographicordering.hh:164
Dune::PDELab::impl::GridFunctionSpaceOrderingData< typename Traits::SizeType > GFSData
Definition: orderingbase.hh:32
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const std::array< std::shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: lexicographicordering.hh:169
Definition: lexicographicordering.hh:104
const bool _container_blocked
Definition: orderingbase.hh:270
DI::size_type SizeType
Definition: ordering/utility.hh:201
static result< TC... >::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, std::shared_ptr< TC >...children)
Definition: lexicographicordering.hh:265
composite_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_composite_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
PowerLexicographicOrdering< typename Transformation::DOFIndex, typename Transformation::ContainerIndex, TC, GFS::CHILDREN > type
Definition: lexicographicordering.hh:162
Definition: adaptivity.hh:27
std::string name() const
Definition: lexicographicordering.hh:229
std::shared_ptr< type > storage_type
Definition: lexicographicordering.hh:254
Interface for merging index spaces.
Definition: lexicographicordering.hh:191
OrderingBase< DI, CI >::Traits Traits
Definition: lexicographicordering.hh:41
static result< TC >::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, const std::array< std::shared_ptr< TC >, GFS::CHILDREN > &children)
Definition: lexicographicordering.hh:175
std::string name() const
Definition: lexicographicordering.hh:143
void update()
Definition: lexicographicordering.hh:231
Definition: lexicographicordering.hh:154
LexicographicOrderingTag OrderingTag
Definition: lexicographicordering.hh:43
power_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_power_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Definition: lexicographicordering.hh:59
Definition: lexicographicordering.hh:245
Definition: ordering/utility.hh:186
void update()
Definition: lexicographicordering.hh:134
CompositeLexicographicOrdering< typename Transformation::DOFIndex, typename Transformation::ContainerIndex, TC... > type
Definition: lexicographicordering.hh:252
Definition: lexicographicordering.hh:33
Definition: orderingbase.hh:20
Base(Node &node, bool container_blocked, typename BaseT::GFSData *gfs_data)
Construct ordering object.
Definition: lexicographicordering.hh:53
void update()
Definition: orderingbase.hh:97
Definition: lexicographicordering.hh:239
PowerLexicographicOrdering(bool container_blocked, const typename Node::NodeStorage &children, typename Base::GFSData *gfs_data)
Construct ordering object.
Definition: lexicographicordering.hh:129
Indicate lexicographic ordering of the unknowns of non-leaf grid function spaces. ...
Definition: gridfunctionspace/tags.hh:63
Traits::SizeType blockOffset(const typename Traits::SizeType child_index) const
Definition: orderingbase.hh:81
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
static result< TC... >::type transform(const GFS &gfs, const Transformation &t, std::shared_ptr< TC >...children)
Definition: lexicographicordering.hh:259
Definition: lexicographicordering.hh:148