/usr/include/dune/grid/yaspgrid/yaspgridindexsets.hh is in libdune-grid-dev 2.4.1-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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GRID_YASPGRIDINDEXSET_HH
#define DUNE_GRID_YASPGRIDINDEXSET_HH
/** \file
*
\brief level-wise, non-persistent, consecutive indices for YaspGrid
*/
namespace Dune {
/** \brief Implementation of Level- and LeafIndexSets for YaspGrid
*
* \tparam GridImp The YaspGrid class we are an index set for
* \tparam isLeafIndexSet false: class functions as level index set,
* true: class functions as leaf index set
*/
template<class GridImp, bool isLeafIndexSet>
class YaspIndexSet
: public IndexSet< GridImp, YaspIndexSet< GridImp, isLeafIndexSet >, unsigned int >
{
typedef YaspIndexSet< GridImp, isLeafIndexSet > This;
typedef IndexSet< GridImp, This, unsigned int > Base;
public:
typedef typename Base::IndexType IndexType;
using Base::subIndex;
/** \brief Level grid view constructor stores reference to a grid and level */
YaspIndexSet ( const GridImp &g, int l )
: grid( g ),
level( l )
{
assert(not isLeafIndexSet);
// contains a single element type;
for (int codim=0; codim<=GridImp::dimension; codim++)
mytypes[codim].push_back(GeometryType(GeometryType::cube,GridImp::dimension-codim));
}
/** \brief Level grid view constructor stores reference to a grid and level */
YaspIndexSet ( const GridImp &g )
: grid( g )
{
assert(isLeafIndexSet);
// contains a single element type;
for (int codim=0; codim<=GridImp::dimension; codim++)
mytypes[codim].push_back(GeometryType(GeometryType::cube,GridImp::dimension-codim));
}
//! get index of an entity
template<int cc>
IndexType index (const typename remove_const<GridImp>::type::Traits::template Codim<cc>::Entity& e) const
{
return grid.getRealImplementation(e).compressedIndex();
}
//! get index of subentity of an entity
template< int cc >
IndexType subIndex ( const typename remove_const< GridImp >::type::Traits::template Codim< cc >::Entity &e,
int i, unsigned int codim ) const
{
assert( cc == 0 || cc == GridImp::dimension );
if( cc == GridImp::dimension )
return grid.getRealImplementation(e).compressedIndex();
else
return grid.getRealImplementation(e).subCompressedIndex(i,codim);
}
//! get number of entities of given type and level (the level is known to the object)
int size (GeometryType type) const
{
return (isLeafIndexSet)
? grid.size( type )
: grid.size( level, type );
}
//! return size of set for a given codim
int size (int codim) const
{
return (isLeafIndexSet)
? grid.size( codim )
: grid.size( level, codim );
}
//! return true if the given entity is contained in \f$E\f$.
template<class EntityType>
bool contains (const EntityType& e) const
{
return (isLeafIndexSet)
? e.level() == grid.maxLevel()
: e.level() == level;
}
std::vector< GeometryType > types ( int codim ) const { return mytypes[ codim ]; }
//! deliver all geometry types used in this grid
const std::vector<GeometryType>& geomTypes (int codim) const
{
return mytypes[codim];
}
private:
const GridImp& grid;
int level;
std::vector<GeometryType> mytypes[remove_const<GridImp>::type::dimension+1];
};
} // namespace Dune
#endif // DUNE_GRID_YASPGRIDINDEXSET_HH
|