/usr/include/dune/pdelab/gridfunctionspace/entityindexcache.hh is in libdune-pdelab-dev 2.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_PDELAB_ENTITYINDEXCACHE_HH
#define DUNE_PDELAB_ENTITYINDEXCACHE_HH
#include <dune/common/array.hh>
#include <dune/typetree/utility.hh>
#include <dune/pdelab/gridfunctionspace/lfsindexcache.hh>
namespace Dune {
namespace PDELab {
template<typename GFS, bool map_dof_indices = false>
class EntityIndexCache
{
public:
typedef GFS GridFunctionSpace;
typedef typename GFS::Ordering Ordering;
typedef typename Ordering::Traits::ContainerIndex ContainerIndex;
typedef ContainerIndex CI;
typedef typename Ordering::Traits::DOFIndex DOFIndex;
typedef DOFIndex DI;
typedef std::size_t size_type;
typedef std::vector<CI> CIVector;
typedef std::vector<DI> DIVector;
private:
static const size_type leaf_count = TypeTree::TreeInfo<Ordering>::leafCount;
public:
typedef array<size_type,leaf_count + 1> Offsets;
EntityIndexCache(const GFS& gfs)
: _gfs(gfs)
, _container_indices(gfs.maxLocalSize())
, _dof_indices(map_dof_indices ? gfs.maxLocalSize() : 0)
{
std::fill(_offsets.begin(),_offsets.end(),0);
}
template<typename Entity>
void update(const Entity& e)
{
std::fill(_offsets.begin(),_offsets.end(),0);
if (!_gfs.dataHandleContains(Entity::codimension))
return;
_gfs.dataHandleIndices(e,_container_indices,_dof_indices,_offsets.begin(),std::integral_constant<bool,map_dof_indices>());
}
const DI& dofIndex(size_type i) const
{
assert(map_dof_indices);
return _dof_indices[i];
}
const CI& containerIndex(size_type i) const
{
return _container_indices[i];
}
const GridFunctionSpace& gridFunctionSpace() const
{
return _gfs;
}
size_type size() const
{
return _offsets[leaf_count];
}
const Offsets& offsets() const
{
return _offsets;
}
private:
const GFS& _gfs;
CIVector _container_indices;
DIVector _dof_indices;
Offsets _offsets;
};
} // namespace PDELab
} // namespace Dune
#endif // DUNE_PDELAB_ENTITYINDEXCACHE_HH
|