4#ifndef DUNE_PDELAB_ORDERING_DIRECTLEAFLOCALORDERING_HH
5#define DUNE_PDELAB_ORDERING_DIRECTLEAFLOCALORDERING_HH
7#include <dune/typetree/leafnode.hh>
9#include <dune/geometry/referenceelements.hh>
10#include <dune/localfunctions/common/interfaceswitch.hh>
11#include <dune/localfunctions/common/localkey.hh>
24 template<
typename OrderingTag,
typename FEM,
typename ES,
typename DI,
typename CI>
26 :
public TypeTree::LeafNode
35 template<
typename size_type>
36 friend struct ::Dune::PDELab::impl::update_ordering_data;
44 typedef impl::GridFunctionSpaceOrderingData<typename Traits::SizeType> GFSData;
49 const typename Traits::SizeType entity_index,
50 typename Traits::TreeIndexView mi,
51 typename Traits::ContainerIndex& ci)
const
53 DUNE_THROW(NotImplemented,
"not implemented");
56 template<
typename ItIn,
typename ItOut>
62 template<
typename CIOutIterator,
typename DIOutIterator = DummyDOFIndexIterator>
63 typename Traits::SizeType
65 typename Traits::SizeType child_index,
66 CIOutIterator ci_out,
const CIOutIterator ci_end,
67 DIOutIterator di_out = DIOutIterator())
const
69 const typename Traits::SizeType
s =
size(ei);
72 for (
typename Traits::SizeType i = 0; i <
s; ++i, ++di_out)
73 di_out->treeIndex().push_back(i);
80 typename Traits::SizeType
size(
const typename Traits::DOFIndex::EntityIndex&
index)
const
83 Traits::DOFIndexAccessor::GeometryIndex::geometryType(
index),
84 Traits::DOFIndexAccessor::GeometryIndex::entityIndex(
index)
88 typename Traits::SizeType
size(
const typename Traits::SizeType geometry_type_index,
const typename Traits::SizeType entity_index)
const
90 typedef typename Traits::SizeType size_type;
93 else if (
_gt_used[geometry_type_index])
102 typename Traits::SizeType
size(
const typename Traits::SizeType geometry_type_index,
const typename Traits::SizeType entity_index,
const typename Traits::SizeType child_index)
const
104 DUNE_THROW(NotImplemented,
"not implemented");
107 typename Traits::SizeType
offset(
const typename Traits::SizeType geometry_type_index,
const typename Traits::SizeType entity_index,
const typename Traits::SizeType child_index)
const
109 assert(child_index == 0);
133 static constexpr auto GT_UNUSED =
~std::size_t(0);
135 typedef FiniteElementInterfaceSwitch<
136 typename FEM::Traits::FiniteElement
140 void update_a_priori_fixed_size()
145 template<
typename CodimMask>
146 void collect_used_codims(CodimMask& codims)
const
148 for (
typename ES::dim_type codim = 0; codim <= ES::dimension; ++codim)
149 if (
_fem->hasDOFs(codim))
153 template<
typename It>
154 void update_fixed_size(It it,
const It end)
160 typedef typename Traits::SizeType size_type;
161 const size_type
dim = Traits::GridView::dimension;
163 _gt_used.assign(GlobalGeometryTypeIndex::size(
dim),
false);
165 for (; it != end; ++it)
169 _gt_used[GlobalGeometryTypeIndex::index(*it)] =
size > 0;
177 void pre_collect_used_geometry_types_from_cell()
179 typedef typename Traits::SizeType size_type;
180 const size_type
dim = Traits::GridView::dimension;
183 _gt_used.assign(GlobalGeometryTypeIndex::size(
dim),
false);
191 void collect_used_geometry_types_from_cell(
const typename Traits::GridView::template Codim<0>::Entity& cell)
195 const typename FESwitch::Coefficients& coeffs =
200 auto ref_el = ReferenceElements<typename Traits::GridView::ctype,Traits::GridView::dimension>::general(cell.type());
202 for (std::size_t i = 0; i < coeffs.size(); ++i)
204 const LocalKey& key = coeffs.localKey(i);
205 GeometryType gt = ref_el.type(key.subEntity(),key.codim());
206 _gt_used[GlobalGeometryTypeIndex::index(gt)] =
true;
212 template<
typename It>
213 void allocate_entity_offset_vector(It it,
const It end)
216 for (; it != end; ++it)
218 if (
_gt_used[GlobalGeometryTypeIndex::index(*it)])
229 void extract_per_entity_sizes_from_cell(
const typename Traits::GridView::template Codim<0>::Entity& cell)
236 const typename FESwitch::Coefficients& coeffs =
239 typedef typename Traits::SizeType size_type;
241 auto ref_el = ReferenceElements<typename Traits::GridView::ctype,Traits::GridView::dimension>::general(cell.type());
243 for (std::size_t i = 0; i < coeffs.size(); ++i)
245 const LocalKey& key = coeffs.localKey(i);
246 GeometryType gt = ref_el.type(key.subEntity(),key.codim());
247 const size_type geometry_type_index = GlobalGeometryTypeIndex::index(gt);
249 const size_type entity_index =
_es.indexSet().subIndex(cell,key.subEntity(),key.codim());
270 void finalize_non_fixed_size_update()
276 if (
size == GT_UNUSED)
293 typename Traits::SizeType maxLocalSize()
const
300 bool update_gfs_data_size(
typename Traits::SizeType&
size,
typename Traits::SizeType& block_count)
const
307 std::shared_ptr<const FEM>
_fem;
static const int dim
Definition adaptivity.hh:84
const std::string s
Definition function.hh:843
std::size_t index
Definition interpolate.hh:97
For backward compatibility – Do not use this!
Definition adaptivity.hh:28
Definition directleaflocalordering.hh:27
FESwitch::Store _fe_store
Definition directleaflocalordering.hh:308
Traits::SizeType offset(const typename Traits::SizeType geometry_type_index, const typename Traits::SizeType entity_index, const typename Traits::SizeType child_index) const
Definition directleaflocalordering.hh:107
DirectLeafLocalOrdering(const std::shared_ptr< const FEM > &fem, const ES &es)
Definition directleaflocalordering.hh:113
Traits::CodimFlag _codim_used
Definition directleaflocalordering.hh:316
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 directleaflocalordering.hh:48
std::vector< bool > _gt_used
Definition directleaflocalordering.hh:318
bool _fixed_size
Definition directleaflocalordering.hh:311
ES _es
Definition directleaflocalordering.hh:310
std::vector< typename Traits::SizeType > _gt_dof_sizes
Definition directleaflocalordering.hh:321
std::vector< typename Traits::SizeType > _entity_dof_offsets
Definition directleaflocalordering.hh:322
void map_lfs_indices(const ItIn begin, const ItIn end, ItOut out) const
Definition directleaflocalordering.hh:57
Traits::CodimFlag _codim_fixed_size
Definition directleaflocalordering.hh:317
std::vector< typename Traits::SizeType > _gt_entity_offsets
Definition directleaflocalordering.hh:320
Traits::SizeType size(const typename Traits::SizeType geometry_type_index, const typename Traits::SizeType entity_index, const typename Traits::SizeType child_index) const
Definition directleaflocalordering.hh:102
std::shared_ptr< const FEM > _fem
Definition directleaflocalordering.hh:307
bool _fixed_size_possible
Definition directleaflocalordering.hh:312
const FEM & finiteElementMap() const
Definition directleaflocalordering.hh:126
GFSData * _gfs_data
Definition directleaflocalordering.hh:327
const bool _container_blocked
Definition directleaflocalordering.hh:314
Traits::SizeType size(const typename Traits::DOFIndex::EntityIndex &index) const
Definition directleaflocalordering.hh:80
Traits::SizeType _max_local_size
Definition directleaflocalordering.hh:313
LocalOrderingTraits< ES, DI, CI > Traits
Definition directleaflocalordering.hh:40
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 directleaflocalordering.hh:64
const Traits::EntitySet & entitySet() const
Definition directleaflocalordering.hh:121
Traits::SizeType size(const typename Traits::SizeType geometry_type_index, const typename Traits::SizeType entity_index) const
Definition directleaflocalordering.hh:88
std::vector< typename Traits::SizeType > _local_gt_dof_sizes
Definition directleaflocalordering.hh:323
Gridview ordering for leaf spaces.
Definition leafgridviewordering.hh:20
Generic infrastructure for orderings for leaf spaces.
Definition leaforderingbase.hh:27
Definition ordering/utility.hh:212