3 #ifndef DUNE_PDELAB_ENTITYINDEXCACHE_HH
4 #define DUNE_PDELAB_ENTITYINDEXCACHE_HH
6 #include <dune/common/array.hh>
7 #include <dune/typetree/utility.hh>
15 template<
typename GFS,
bool map_dof_indices = false>
25 typedef typename Ordering::Traits::DOFIndex
DOFIndex;
34 static const size_type leaf_count = TypeTree::TreeInfo<Ordering>::leafCount;
38 typedef array<size_type,leaf_count + 1>
Offsets;
42 , _container_indices(gfs.maxLocalSize())
43 , _dof_indices(map_dof_indices ? gfs.maxLocalSize() : 0)
45 std::fill(_offsets.begin(),_offsets.end(),0);
48 template<
typename Entity>
51 std::fill(_offsets.begin(),_offsets.end(),0);
52 if (!_gfs.dataHandleContains(Entity::codimension))
55 _gfs.dataHandleIndices(e,_container_indices,_dof_indices,_offsets.begin(),std::integral_constant<bool,map_dof_indices>());
60 assert(map_dof_indices);
61 return _dof_indices[i];
66 return _container_indices[i];
76 return _offsets[leaf_count];
96 #endif // DUNE_PDELAB_ENTITYINDEXCACHE_HH
void update(const Entity &e)
Definition: entityindexcache.hh:49
const DI & dofIndex(size_type i) const
Definition: entityindexcache.hh:58
const CI & containerIndex(size_type i) const
Definition: entityindexcache.hh:64
EntityIndexCache(const GFS &gfs)
Definition: entityindexcache.hh:40
ContainerIndex CI
Definition: entityindexcache.hh:24
std::vector< CI > CIVector
Definition: entityindexcache.hh:29
size_type size() const
Definition: entityindexcache.hh:74
std::size_t size_type
Definition: entityindexcache.hh:27
Ordering::Traits::DOFIndex DOFIndex
Definition: entityindexcache.hh:25
Definition: entityindexcache.hh:16
GFS GridFunctionSpace
Definition: entityindexcache.hh:21
DOFIndex DI
Definition: entityindexcache.hh:26
array< size_type, leaf_count+1 > Offsets
Definition: entityindexcache.hh:38
const GridFunctionSpace & gridFunctionSpace() const
Definition: entityindexcache.hh:69
const Offsets & offsets() const
Definition: entityindexcache.hh:79
std::vector< DI > DIVector
Definition: entityindexcache.hh:30
const E & e
Definition: interpolate.hh:172
GFS::Ordering Ordering
Definition: entityindexcache.hh:22
Ordering::Traits::ContainerIndex ContainerIndex
Definition: entityindexcache.hh:23