3 #ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_ENTITYINDEXCACHE_HH
4 #define DUNE_PDELAB_GRIDFUNCTIONSPACE_ENTITYINDEXCACHE_HH
8 #include <dune/typetree/utility.hh>
16 template<
typename GFS,
bool map_dof_indices = false>
26 typedef typename Ordering::Traits::DOFIndex
DOFIndex;
35 static const size_type leaf_count = TypeTree::TreeInfo<Ordering>::leafCount;
39 typedef std::array<size_type,leaf_count + 1>
Offsets;
43 , _container_indices(gfs.maxLocalSize())
44 , _dof_indices(map_dof_indices ? gfs.maxLocalSize() : 0)
46 std::fill(_offsets.begin(),_offsets.end(),0);
49 template<
typename Entity>
52 std::fill(_offsets.begin(),_offsets.end(),0);
53 if (!_gfs.dataHandleContains(Entity::codimension))
56 _gfs.dataHandleIndices(
e,_container_indices,_dof_indices,_offsets.begin(),std::integral_constant<bool,map_dof_indices>());
61 assert(map_dof_indices);
62 return _dof_indices[i];
67 return _container_indices[i];
77 return _offsets[leaf_count];
const Entity & e
Definition: localfunctionspace.hh:123
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Definition: entityindexcache.hh:18
Ordering::Traits::ContainerIndex ContainerIndex
Definition: entityindexcache.hh:24
Ordering::Traits::DOFIndex DOFIndex
Definition: entityindexcache.hh:26
const DI & dofIndex(size_type i) const
Definition: entityindexcache.hh:59
GFS GridFunctionSpace
Definition: entityindexcache.hh:22
std::vector< CI > CIVector
Definition: entityindexcache.hh:30
size_type size() const
Definition: entityindexcache.hh:75
const CI & containerIndex(size_type i) const
Definition: entityindexcache.hh:65
const Offsets & offsets() const
Definition: entityindexcache.hh:80
std::vector< DI > DIVector
Definition: entityindexcache.hh:31
std::size_t size_type
Definition: entityindexcache.hh:28
std::array< size_type, leaf_count+1 > Offsets
Definition: entityindexcache.hh:39
EntityIndexCache(const GFS &gfs)
Definition: entityindexcache.hh:41
DOFIndex DI
Definition: entityindexcache.hh:27
GFS::Ordering Ordering
Definition: entityindexcache.hh:23
ContainerIndex CI
Definition: entityindexcache.hh:25
void update(const Entity &e)
Definition: entityindexcache.hh:50
const GridFunctionSpace & gridFunctionSpace() const
Definition: entityindexcache.hh:70