4#ifndef DUNE_PDELAB_ORDERING_LOCALORDERINGBASE_HH
5#define DUNE_PDELAB_ORDERING_LOCALORDERINGBASE_HH
10#include <dune/common/rangeutilities.hh>
28 template<
typename ES,
typename DI,
typename CI>
54 template<
typename size_type>
55 friend struct ::Dune::PDELab::impl::update_ordering_data;
69 typedef impl::GridFunctionSpaceOrderingData<typename Traits::SizeType>
GFSData;
80 assert(mi.size() == 1 &&
"MultiIndex length must match GridFunctionSpace tree depth");
81 ci.push_back(mi.back());
87 _children[child_index]->map_local_index(geometry_type_index,entity_index,mi.back_popped(),ci);
90 ci.push_back(child_index);
92 else if (child_index > 0)
101 assert(
_gt_used[geometry_type_index]);
121 template<
typename ItIn,
typename ItOut>
126 for (ItIn in = begin; in != end; ++in, ++out) {
127 assert(in->size() == 1 &&
128 "MultiIndex length must match GridFunctionSpace tree depth");
129 out->push_back(in->treeIndex().back());
133 for (ItIn in = begin; in != end; ++in, ++out)
134 out->push_back(in->treeIndex().back());
137 for (ItIn in = begin; in != end; ++in, ++out) {
139 in->treeIndex().back();
141 Traits::DOFIndexAccessor::geometryType(*in);
142 if (child_index > 0) {
150 for (ItIn in = begin; in != end; ++in, ++out) {
152 in->treeIndex().back();
153 if (child_index > 0) {
155 Traits::DOFIndexAccessor::geometryType(*in);
157 Traits::DOFIndexAccessor::entityIndex(*in);
171 template<
typename CIOutIterator,
typename DIOutIterator = DummyDOFIndexIterator>
175 CIOutIterator ci_out,
const CIOutIterator ci_end,
176 DIOutIterator di_out = DIOutIterator())
const
180 const size_type geometry_type_index = Traits::DOFIndexAccessor::GeometryIndex::geometryType(ei);
181 const size_type entity_index = Traits::DOFIndexAccessor::GeometryIndex::entityIndex(ei);
192 for (size_type i = 0; i <
size; ++i, ++ci_out, ++di_out)
194 ci_out->push_back(i);
195 di_out->treeIndex().push_back(i);
203 for (; ci_out != ci_end; ++ci_out)
205 ci_out->push_back(child_index);
208 else if (child_index > 0)
211 for (; ci_out != ci_end; ++ci_out)
217 for (; ci_out != ci_end; ++ci_out)
232 Traits::DOFIndexAccessor::GeometryIndex::geometryType(
index),
233 Traits::DOFIndexAccessor::GeometryIndex::entityIndex(
index)
288 const typename Traits::DOFIndex::EntityIndex &
index)
const {
292 if (suffix.size() == 0)
293 return node.size(
index);
295 if constexpr (Node::isLeaf) {
299 auto back_index = suffix.back();
303 if (node.containerBlocked()) {
309 const size_type gt_index = Traits::DOFIndexAccessor::GeometryIndex::geometryType(
index);
310 const size_type entity_index = Traits::DOFIndexAccessor::GeometryIndex::entityIndex(
index);
311 auto dof_begin = node._fixed_size ? node._gt_dof_offsets.begin() : node._entity_dof_offsets.begin();
312 auto dof_end = node._fixed_size ? node._gt_dof_offsets.end() : node._entity_dof_offsets.end();
313 auto dof_it = std::prev(std::upper_bound(dof_begin, dof_end, back_index));
314 size_type dof_dist = std::distance(dof_begin, dof_it);
315 if (node._fixed_size)
316 _child = dof_dist - gt_index * node._child_count + 1;
318 _child = dof_dist - (node._gt_entity_offsets[gt_index] + entity_index) * node._child_count + 1;
321 assert(node.degree() > _child);
324 auto indices = Dune::range(node.degree());
326 Hybrid::forEach(indices, [&](
auto i){
328 _size = node.child(i).size(suffix,
index);
339 assert(
_gt_used[geometry_type_index]);
346 template<
typename Node>
353 ,
_children(TypeTree::degree(node),nullptr)
366 return _gt_used[GlobalGeometryTypeIndex::index(gt)];
std::size_t index
Definition: interpolate.hh:97
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Definition: gridviewordering.hh:46
Definition: gridviewordering.hh:83
Definition: gridviewordering.hh:174
Definition: gridviewordering.hh:231
Definition: gridviewordering.hh:324
Transforms a local ordering (entity-wise order) into a global ordering.
Definition: gridviewordering.hh:440
Entity-wise orderings.
Definition: localorderingbase.hh:30
LocalOrderingBase & childOrdering(typename Traits::SizeType i)
Definition: localorderingbase.hh:403
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Set last index of container indices.
Definition: localorderingbase.hh:122
Traits::SizeType maxLocalSize() const
Definition: localorderingbase.hh:379
LocalOrderingTraits< ES, DI, CI, MultiIndexOrder::Inner2Outer > Traits
Definition: localorderingbase.hh:63
const std::size_t _child_count
Definition: localorderingbase.hh:442
bool containerBlocked() const
Definition: localorderingbase.hh:393
void setup_fixed_size_possible()
Initial setup of the flag indicating whether a fixed size ordering is possible.
Definition: localorderingbase.hh:428
void disable_container_blocking()
Definition: localorderingbase.hh:413
std::vector< typename Traits::SizeType > _gt_entity_offsets
Definition: localorderingbase.hh:448
bool contains_geometry_type(typename Traits::SizeType gt_index) const
Definition: localorderingbase.hh:369
static const bool has_dynamic_ordering_children
Definition: localorderingbase.hh:59
Traits::SizeType offset(const typename Traits::SizeType geometry_type_index, const typename Traits::SizeType entity_index, const typename Traits::SizeType child_index) const
Definition: localorderingbase.hh:336
bool _fixed_size_possible
Definition: localorderingbase.hh:438
Traits::SizeType node_size(const Node &node, typename Traits::ContainerIndex suffix, const typename Traits::DOFIndex::EntityIndex &index) const
Gives the size for a given entity and suffix.
Definition: localorderingbase.hh:287
Traits::SizeType size(const typename Traits::DOFIndex::EntityIndex &index) const
Definition: localorderingbase.hh:229
Traits::SizeType size(const typename Traits::SizeType geometry_type_index, const typename Traits::SizeType entity_index) const
Definition: localorderingbase.hh:237
friend struct collect_used_geometry_types_from_cell
Definition: localorderingbase.hh:46
GFSData * _gfs_data
Definition: localorderingbase.hh:452
bool contains(const GeometryType >) const
Definition: localorderingbase.hh:364
bool _fixed_size
Definition: localorderingbase.hh:437
std::vector< bool > _gt_used
Definition: localorderingbase.hh:446
bool contains(typename Traits::SizeType codim) const
Definition: localorderingbase.hh:374
Traits::CodimFlag _codim_used
Definition: localorderingbase.hh:445
bool _container_blocked
Definition: localorderingbase.hh:439
friend struct extract_per_entity_sizes_from_cell
Definition: localorderingbase.hh:49
LocalOrderingBase(Node &node, bool container_blocked, GFSData *gfs_data)
Definition: localorderingbase.hh:347
void map_local_index(const typename Traits::SizeType geometry_type_index, const typename Traits::SizeType entity_index, typename Traits::TreeIndexView mi, typename Traits::ContainerIndex &ci) const
Definition: localorderingbase.hh:73
impl::GridFunctionSpaceOrderingData< typename Traits::SizeType > GFSData
Definition: localorderingbase.hh:69
Traits::SizeType extract_entity_indices(const typename Traits::DOFIndex::EntityIndex &ei, typename Traits::SizeType child_index, CIOutIterator ci_out, const CIOutIterator ci_end, DIOutIterator di_out=DIOutIterator()) const
Definition: localorderingbase.hh:173
bool fixedSize() const
Definition: localorderingbase.hh:359
std::vector< typename Traits::SizeType > _gt_dof_offsets
Definition: localorderingbase.hh:449
static constexpr auto GT_UNUSED
Definition: localorderingbase.hh:65
static const bool consume_tree_index
Definition: localorderingbase.hh:61
std::size_t childOrderingCount() const
Definition: localorderingbase.hh:398
std::size_t _max_local_size
Definition: localorderingbase.hh:440
std::vector< LocalOrderingBase * > _children
Definition: localorderingbase.hh:443
Traits::SizeType size(const typename Traits::SizeType geometry_type_index, const typename Traits::SizeType entity_index, const typename Traits::SizeType child_index) const
Definition: localorderingbase.hh:252
const LocalOrderingBase & childOrdering(typename Traits::SizeType i) const
Definition: localorderingbase.hh:408
std::vector< typename Traits::SizeType > _entity_dof_offsets
Definition: localorderingbase.hh:450
std::size_t SizeType
Definition: ordering/utility.hh:178
CI ContainerIndex
Definition: ordering/utility.hh:176
std::bitset< max_dim > CodimFlag
Definition: ordering/utility.hh:211
DI::View::TreeIndex TreeIndexView
Definition: ordering/utility.hh:216
DI::size_type size_type
Definition: ordering/utility.hh:219
Definition: ordering/utility.hh:224
Definition: ordering/utility.hh:259