Go to the documentation of this file.
3 #ifndef DUNE_PDELAB_ORDERING_INTERLEAVEDORDERING_HH
4 #define DUNE_PDELAB_ORDERING_INTERLEAVEDORDERING_HH
9 #include <dune/typetree/compositenode.hh>
10 #include <dune/typetree/powernode.hh>
24 namespace interleaved_ordering {
27 template<
typename DI,
typename CI,
typename Node>
49 :
BaseT(node,container_blocked,ordering_tag.offsets(),gfs_data,nullptr)
54 if (node.CHILDREN != ordering_tag.
offsets().size() - 1)
56 "Invalid block structure for InterleavedOrdering: "
57 << node.CHILDREN <<
" children, but "
58 << (ordering_tag.
offsets().size() - 1) <<
" block sizes.");
61 template<
typename ItIn,
typename ItOut>
67 for (ItIn in = begin; in != end; ++in, ++out)
69 size_type child_index = in->treeIndex().back();
72 size_type
index = out->back();
73 size_type block_index =
index / child_block_size;
75 out->back() = child_block_offset +
offset;
76 out->push_back(block_index);
81 for (ItIn in = begin; in != end; ++in, ++out)
83 size_type child_index = in->treeIndex().back();
87 size_type
index = out->back();
88 size_type block_index =
index / child_block_size;
90 out->back() = block_index * block_size + child_block_offset +
offset;
95 template<
typename CIOutIterator,
typename DIOutIterator = DummyDOFIndexIterator>
99 CIOutIterator ci_out,
const CIOutIterator ci_end)
const
104 for (; ci_out != ci_end; ++ci_out)
108 size_type
index = ci_out->back();
109 size_type block_index =
index / child_block_size;
111 ci_out->back() = child_block_offset +
offset;
112 ci_out->push_back(block_index);
117 for (; ci_out != ci_end; ++ci_out)
122 size_type
index = ci_out->back();
123 size_type block_index =
index / child_block_size;
125 ci_out->back() = block_index * block_size + child_block_offset +
offset;
138 template<
typename DI,
typename CI,
typename Child, std::
size_t k>
140 :
public TypeTree::PowerNode<Child, k>
143 PowerInterleavedOrdering<DI,CI,Child,k>
146 typedef TypeTree::PowerNode<Child, k> Node;
166 ,
Base(*this,container_blocked,ordering_tag,gfs_data)
171 for (std::size_t i = 0; i < k; ++i)
173 this->child(i).update();
178 std::string
name()
const {
return "PowerInterleavedOrdering"; }
182 template<
typename GFS,
typename Transformation>
188 template<
typename TC>
193 typename Transformation::DOFIndex,
194 typename Transformation::ContainerIndex,
203 template<
typename TC>
206 return typename result<TC>::type(gfs.backend().blocked(gfs),gfs.orderingTag(),children,
const_cast<GFS*
>(&gfs));
209 template<
typename TC>
212 return std::make_shared<typename result<TC>::type>(gfs->backend().blocked(*gfs),gfs->orderingTag(),children,
const_cast<GFS*
>(gfs.get()));
217 template<
typename GFS,
typename Transformation>
218 power_gfs_to_interleaved_ordering_descriptor<GFS,Transformation>
223 template<
typename DI,
typename CI,
typename... Children>
225 public TypeTree::CompositeNode<Children...>,
228 CompositeInterleavedOrdering<
235 typedef TypeTree::CompositeNode<Children...> Node;
259 ,
Base(*this,backend_blocked,ordering_tag,gfs_data)
262 std::string
name()
const {
return "CompositeInterleavedOrdering"; }
266 TypeTree::applyToTree(*
this,ordering::update_direct_children());
271 template<
typename GFS,
typename Transformation>
277 template<
typename... TC>
282 typename Transformation::DOFIndex,
283 typename Transformation::ContainerIndex,
291 template<
typename... TC>
292 static typename result<TC...>::type
transform(
const GFS& gfs,
const Transformation& t, std::shared_ptr<TC>... children)
294 return typename result<TC...>::type(gfs.backend().blocked(gfs),gfs.orderingTag(),
const_cast<GFS*
>(&gfs),children...);
297 template<
typename... TC>
298 static typename result<TC...>::storage_type
transform_storage(std::shared_ptr<const GFS> gfs,
const Transformation& t, std::shared_ptr<TC>... children)
300 return std::make_shared<
typename result<TC...>::type>(gfs->backend().blocked(*gfs),gfs.orderingTag(),
const_cast<GFS*
>(gfs.get()),children...);
305 template<
typename GFS,
typename Transformation>
306 composite_gfs_to_interleaved_ordering_descriptor<GFS,Transformation>
313 #endif // DUNE_PDELAB_ORDERING_INTERLEAVEDORDERING_HH
Definition: orderingbase.hh:20
PDELab-specific exceptions.
static const bool recursive
Definition: interleavedordering.hh:275
static const bool recursive
Definition: interleavedordering.hh:186
std::size_t index
Definition: interpolate.hh:118
static const bool consume_tree_index
Definition: interleavedordering.hh:40
power_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_power_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
Dune::PDELab::impl::GridFunctionSpaceOrderingData< typename Traits::SizeType > GFSData
Definition: orderingbase.hh:32
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
static result< TC... >::type transform(const GFS &gfs, const Transformation &t, std::shared_ptr< TC >... children)
Definition: interleavedordering.hh:292
std::shared_ptr< type > storage_type
Definition: interleavedordering.hh:287
CompositeInterleavedOrdering< typename Transformation::DOFIndex, typename Transformation::ContainerIndex, TC... > type
Definition: interleavedordering.hh:285
PowerInterleavedOrdering< typename Transformation::DOFIndex, typename Transformation::ContainerIndex, TC, TypeTree::StaticDegree< GFS >::value > type
Definition: interleavedordering.hh:197
Definition: interleavedordering.hh:183
const std::size_t offset
Definition: localfunctionspace.hh:74
const std::vector< std::size_t > & offsets() const
Returns a list of offsets for the child blocks.
Definition: gridfunctionspace/tags.hh:115
Base(Node &node, bool container_blocked, const OrderingTag &ordering_tag, typename BaseT::GFSData *gfs_data)
Construct ordering object.
Definition: interleavedordering.hh:48
Definition: interleavedordering.hh:224
CompositeInterleavedOrdering(bool backend_blocked, const InterleavedOrderingTag &ordering_tag, typename Base::GFSData *gfs_data, std::shared_ptr< Children >... children)
Construct ordering object.
Definition: interleavedordering.hh:257
InterleavedOrderingTag OrderingTag
Definition: interleavedordering.hh:38
const bool _container_blocked
Definition: orderingbase.hh:270
std::shared_ptr< type > storage_type
Definition: interleavedordering.hh:199
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: interleavedordering.hh:97
std::string name() const
Definition: interleavedordering.hh:262
void update()
Definition: interleavedordering.hh:264
Definition: ordering/utility.hh:186
void update()
Definition: orderingbase.hh:97
Indicate interleaved ordering of the unknowns of non-leaf grid function spaces according to a given b...
Definition: gridfunctionspace/tags.hh:78
DI::size_type SizeType
Definition: ordering/utility.hh:201
std::string name() const
Definition: interleavedordering.hh:178
Definition: interleavedordering.hh:278
static result< TC >::type transform(const GFS &gfs, const Transformation &t, const std::array< std::shared_ptr< TC >, TypeTree::StaticDegree< GFS >::value > &children)
Definition: interleavedordering.hh:204
void update()
Definition: interleavedordering.hh:169
composite_gfs_to_entityblocked_ordering_descriptor< GFS, Transformation > register_composite_gfs_to_ordering_descriptor(GFS *, Transformation *, EntityBlockedOrderingTag *)
static result< TC... >::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, std::shared_ptr< TC >... children)
Definition: interleavedordering.hh:298
Definition: interleavedordering.hh:189
Definition: interleavedordering.hh:139
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
OrderingBase< DI, CI >::Traits Traits
Definition: interleavedordering.hh:36
Definition: interleavedordering.hh:272
Error related to the logical structure of an Ordering.
Definition: exceptions.hh:44
PowerInterleavedOrdering(bool container_blocked, const InterleavedOrderingTag &ordering_tag, const typename Node::NodeStorage &children, typename Base::GFSData *gfs_data)
Construct ordering object.
Definition: interleavedordering.hh:164
std::vector< typename Traits::SizeType > _child_block_merge_offsets
Definition: orderingbase.hh:278
Interface for merging index spaces.
Definition: interleavedordering.hh:28
static result< TC >::storage_type transform_storage(std::shared_ptr< const GFS > gfs, const Transformation &t, const std::array< std::shared_ptr< TC >, TypeTree::StaticDegree< GFS >::value > &children)
Definition: interleavedordering.hh:210
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Definition: interleavedordering.hh:62