4#ifndef DUNE_PDELAB_ORDERING_UTILITY_HH
5#define DUNE_PDELAB_ORDERING_UTILITY_HH
45 struct update_direct_children
46 :
public TypeTree::DirectChildrenVisitor
47 ,
public TypeTree::DynamicTraversal
50 template<
typename GFS,
typename Child,
typename TreePath,
typename ChildIndex>
51 void afterChild(
const GFS& gfs, Child& child, TreePath tp, ChildIndex childIndex)
const
66 template<
typename DOFIndex,
typename SizeType,
typename IndexType>
67 static typename std::enable_if<
68 std::is_integral<IndexType>::value
70 store(
DOFIndex& dof_index,
const GeometryType& gt, SizeType entity_index, IndexType tree_index)
73 dof_index.
entityIndex()[0] = GlobalGeometryTypeIndex::index(gt);
75 dof_index.
treeIndex().push_back(tree_index);
78 template<
typename DOFIndex,
typename SizeType,
typename IndexType>
79 static typename std::enable_if<
80 !std::is_integral<IndexType>::value
82 store(
DOFIndex& dof_index,
const GeometryType& gt, SizeType entity_index, IndexType tree_index)
84 dof_index.
entityIndex()[0] = GlobalGeometryTypeIndex::index(gt);
89 template<
typename DOFIndex,
typename SizeType,
typename IndexType>
90 static typename std::enable_if<
91 std::is_integral<IndexType>::value
93 store(
DOFIndex& dof_index, SizeType gt_index, SizeType entity_index, IndexType tree_index)
98 dof_index.
treeIndex().push_back(tree_index);
101 template<
typename DOFIndex,
typename SizeType,
typename IndexType>
102 static typename std::enable_if<
103 !std::is_integral<IndexType>::value
105 store(
DOFIndex& dof_index, SizeType gt_index, SizeType entity_index, IndexType tree_index)
116 template<
typename Index>
119 return geometry_index[0];
122 template<
typename Index>
125 return geometry_index[1];
128 template<
typename Index,
typename SizeType>
129 static void store(Index&
index,
const GeometryType& gt, SizeType entity_index)
131 index[0] = GlobalGeometryTypeIndex::index(gt);
132 index[1] = entity_index;
135 template<
typename Index,
typename SizeType>
136 static void store(Index&
index, SizeType geometry_index, SizeType entity_index)
138 index[0] = geometry_index;
139 index[1] = entity_index;
144 template<
typename DOFIndex>
150 template<
typename DOFIndex>
161 template<
typename DOFIndex,
typename SizeType>
162 static void store(
DOFIndex& dof_index,
const GeometryType& gt, SizeType entity_index, SizeType tree_index)
164 dof_index = entity_index;
170 template<
typename DI,
typename CI, MultiIndexOrder CIOrder = MultiIndexOrder::Inner2Outer>
187 template<
typename SizeType_,
typename CI, MultiIndexOrder CIOrder>
203 template <
typename DI,
typename CI,
222 template <
typename ES,
typename DI,
typename CI,
230 template<
typename ES,
typename DI,
typename CI>
241 template<
typename DI,
typename CI>
255 template<
typename child_type>
257 :
public TypeTree::DirectChildrenVisitor
258 ,
public TypeTree::DynamicTraversal
261 template<
typename Node,
typename Child,
typename TreePath,
typename ChildIndex>
262 void afterChild(
const Node& node, Child& child, TreePath tp, ChildIndex child_index)
267 template<
typename Node,
typename Child,
typename ChildIndex>
268 typename std::enable_if<Node::has_dynamic_ordering_children>::type
271 _children[child_index] = &child;
274 template<
typename Node,
typename Child,
typename ChildIndex>
275 typename std::enable_if<!Node::has_dynamic_ordering_children>::type
281 : _children(children)
285 std::vector<child_type*>& _children;
362 template <
class Size,
class ContainerIndex_, MultiIndexOrder OriginOrder>
371 template <
class Ordering>
373 : _size_provider([=](const ContainerIndex_ &partial_multiindex) {
374 return ordering->size(partial_multiindex);
376 static_assert(Ordering::Traits::ContainerIndexOrder == OriginOrder);
400 suffix.resize(prefix.size());
401 std::reverse_copy(prefix.begin(), prefix.end(),suffix.begin());
403 return _size_provider(suffix);
406 return _size_provider(prefix);
416 template<
class Ordering>
419 typename Ordering::Traits::ContainerIndex,
420 Ordering::Traits::ContainerIndexOrder>;
Define and register ordering related transformations. This header defines the two transformations gfs...
std::size_t index
Definition: interpolate.hh:97
MultiIndexOrder
Information about order semantics on multi-indices.
Definition: ordering/utility.hh:32
@ Inner2Outer
indices are ordered from inner to outer container: {inner,...,outer}
@ Outer2Inner
indices are ordered from outer to inner container: {outer,...,inner}
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
A multi-index representing a degree of freedom in a GridFunctionSpace.
Definition: dofindex.hh:148
EntityIndex & entityIndex()
Returns the index of the grid entity associated with the DOF.
Definition: dofindex.hh:258
void clear()
Definition: dofindex.hh:251
TreeIndex & treeIndex()
Returns the tuple of entity-local indices associated with the DOF.
Definition: dofindex.hh:270
Definition: simpledofindex.hh:16
Index merging algorithm for global orderings.
Definition: ordering/utility.hh:22
type
Definition: ordering/utility.hh:24
@ interleaved
Indices are interleaved according to a user-supplied pattern ([i1,i2],[j1,j2] -> [i1,...
Definition: ordering/utility.hh:26
@ lexicographic
Lexicographically ordered ([i1,i2],[j1,j2] -> [i1,i2,j1,j2]).
Definition: ordering/utility.hh:25
Definition: ordering/utility.hh:64
static std::enable_if< std::is_integral< IndexType >::value >::type store(DOFIndex &dof_index, SizeType gt_index, SizeType entity_index, IndexType tree_index)
Definition: ordering/utility.hh:93
static std::size_t entityIndex(const DOFIndex &dof_index)
Definition: ordering/utility.hh:151
static std::enable_if<!std::is_integral< IndexType >::value >::type store(DOFIndex &dof_index, const GeometryType >, SizeType entity_index, IndexType tree_index)
Definition: ordering/utility.hh:82
static std::enable_if< std::is_integral< IndexType >::value >::type store(DOFIndex &dof_index, const GeometryType >, SizeType entity_index, IndexType tree_index)
Definition: ordering/utility.hh:70
static std::enable_if<!std::is_integral< IndexType >::value >::type store(DOFIndex &dof_index, SizeType gt_index, SizeType entity_index, IndexType tree_index)
Definition: ordering/utility.hh:105
static std::size_t geometryType(const DOFIndex &dof_index)
Definition: ordering/utility.hh:145
Definition: ordering/utility.hh:114
static std::size_t entityIndex(const Index &geometry_index)
Definition: ordering/utility.hh:123
static void store(Index &index, const GeometryType >, SizeType entity_index)
Definition: ordering/utility.hh:129
static std::size_t geometryType(const Index &geometry_index)
Definition: ordering/utility.hh:117
static void store(Index &index, SizeType geometry_index, SizeType entity_index)
Definition: ordering/utility.hh:136
Definition: ordering/utility.hh:159
static void store(DOFIndex &dof_index, const GeometryType >, SizeType entity_index, SizeType tree_index)
Definition: ordering/utility.hh:162
Definition: ordering/utility.hh:172
DI DOFIndex
Definition: ordering/utility.hh:174
std::size_t SizeType
Definition: ordering/utility.hh:178
CI ContainerIndex
Definition: ordering/utility.hh:176
DefaultDOFIndexAccessor DOFIndexAccessor
Definition: ordering/utility.hh:180
static constexpr MultiIndexOrder ContainerIndexOrder
Inform about ContainerIndex multi-index order semantics.
Definition: ordering/utility.hh:183
SimpleDOFIndex< SizeType_ > DOFIndex
Definition: ordering/utility.hh:191
SimpleDOFIndexAccessor DOFIndexAccessor
Definition: ordering/utility.hh:197
SizeType_ SizeType
Definition: ordering/utility.hh:195
CI ContainerIndex
Definition: ordering/utility.hh:193
Definition: ordering/utility.hh:205
std::bitset< max_dim > CodimFlag
Definition: ordering/utility.hh:211
DI::size_type SizeType
Definition: ordering/utility.hh:218
DI::TreeIndex TreeIndex
Definition: ordering/utility.hh:213
static const std::size_t max_dim
Definition: ordering/utility.hh:209
DI::View::TreeIndex TreeIndexView
Definition: ordering/utility.hh:216
DI::size_type size_type
Definition: ordering/utility.hh:219
DI::View DOFIndexView
Definition: ordering/utility.hh:215
Definition: ordering/utility.hh:224
typename ES::GridView GridView
Definition: ordering/utility.hh:227
ES EntitySet
Definition: ordering/utility.hh:226
Definition: ordering/utility.hh:233
DI::EntityIndex EntityIndex
Definition: ordering/utility.hh:235
DI::View::EntityIndex EntityIndexView
Definition: ordering/utility.hh:236
Definition: ordering/utility.hh:243
virtual void map_index_dynamic(typename Traits::DOFIndexView di, typename Traits::ContainerIndex &ci) const =0
virtual ~VirtualOrderingBase()=default
OrderingTraits< DI, CI > Traits
Definition: ordering/utility.hh:246
VirtualOrderingBase()
Definition: ordering/utility.hh:248
Definition: ordering/utility.hh:259
extract_child_bases(std::vector< child_type * > &children)
Definition: ordering/utility.hh:280
std::enable_if<!Node::has_dynamic_ordering_children >::type extract_child(const Node &node, Child &child, ChildIndex child_index)
Definition: ordering/utility.hh:276
void afterChild(const Node &node, Child &child, TreePath tp, ChildIndex child_index)
Definition: ordering/utility.hh:262
std::enable_if< Node::has_dynamic_ordering_children >::type extract_child(const Node &node, Child &child, ChildIndex child_index)
Definition: ordering/utility.hh:269
Dummy iterator type over DOF indices.
Definition: ordering/utility.hh:301
DummyDOFIndexIterator & operator++()
Definition: ordering/utility.hh:305
void push_back(size_type i)
Definition: ordering/utility.hh:340
DummyDOFIndexIterator & treeIndex()
Definition: ordering/utility.hh:325
DummyDOFIndexIterator & operator*()
Definition: ordering/utility.hh:315
bool operator==(const DummyDOFIndexIterator &r) const
Definition: ordering/utility.hh:330
std::size_t size_type
Definition: ordering/utility.hh:303
DummyDOFIndexIterator & operator+=(size_type i)
Definition: ordering/utility.hh:310
bool operator!=(const DummyDOFIndexIterator &r) const
Definition: ordering/utility.hh:335
DummyDOFIndexIterator * operator->()
Definition: ordering/utility.hh:320
Adapter to create a size provider from an ordering.
Definition: ordering/utility.hh:363
ContainerIndex SizePrefix
Partial MultiIndex of a ContainerIndex.
Definition: ordering/utility.hh:383
SizeType size(const SizePrefix &prefix) const
Gives the size for a given prefix.
Definition: ordering/utility.hh:396
SizeProviderAdapter(const std::shared_ptr< const Ordering > &ordering)
Construct a new Size Provider Adapter object.
Definition: ordering/utility.hh:372
Size SizeType
Type that refers to the size of containers.
Definition: ordering/utility.hh:386
ContainerIndex_ ContainerIndex
Partial MultiIndex of a ContainerIndex.
Definition: ordering/utility.hh:380
static constexpr MultiIndexOrder ContainerIndexOrder
Inform about ContainerIndex multi-index order semantics.
Definition: ordering/utility.hh:389