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>
24 typedef ContainerIndex
CI;
25 typedef typename Ordering::Traits::DOFIndex
DOFIndex;
34 static const size_type leaf_count = TypeTree::TreeInfo<Ordering>::leafCount;
38 typedef std::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];
87 CIVector _container_indices;
88 DIVector _dof_indices;
96 #endif // DUNE_PDELAB_ENTITYINDEXCACHE_HH const Offsets & offsets() const
Definition: entityindexcache.hh:79
GFS::Ordering Ordering
Definition: entityindexcache.hh:22
std::size_t size_type
Definition: entityindexcache.hh:27
ContainerIndex CI
Definition: entityindexcache.hh:24
size_type size() const
Definition: entityindexcache.hh:74
Definition: entityindexcache.hh:16
const GridFunctionSpace & gridFunctionSpace() const
Definition: entityindexcache.hh:69
std::vector< CI > CIVector
Definition: entityindexcache.hh:29
EntityIndexCache(const GFS &gfs)
Definition: entityindexcache.hh:40
DOFIndex DI
Definition: entityindexcache.hh:26
Definition: adaptivity.hh:27
Ordering::Traits::ContainerIndex ContainerIndex
Definition: entityindexcache.hh:23
const Entity & e
Definition: localfunctionspace.hh:111
const DI & dofIndex(size_type i) const
Definition: entityindexcache.hh:58
std::vector< DI > DIVector
Definition: entityindexcache.hh:30
void update(const Entity &e)
Definition: entityindexcache.hh:49
std::array< size_type, leaf_count+1 > Offsets
Definition: entityindexcache.hh:38
const CI & containerIndex(size_type i) const
Definition: entityindexcache.hh:64
Ordering::Traits::DOFIndex DOFIndex
Definition: entityindexcache.hh:25
GFS GridFunctionSpace
Definition: entityindexcache.hh:21