/usr/include/dune/grid/alugrid/2d/indexsets.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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_ALU2DGRIDINDEXSETS_HH
#define DUNE_ALU2DGRIDINDEXSETS_HH
//- System includes
#include <vector>
//- Dune includes
#include <dune/common/stdstreams.hh>
#include <dune/common/bigunsignedint.hh>
#include <dune/grid/common/grid.hh>
#include <dune/grid/common/indexidset.hh>
//- Local includes
#include "alu2dinclude.hh"
namespace Dune
{
// External Forward Declarations
// -----------------------------
template< int dim, int dimworld, ALU2DSPACE ElementType eltype >
class ALU2dGrid;
template<int cd, int dim, class GridImp>
class ALU2dGridEntity;
// ALU2dGridHierarchicIndexSet
// ---------------------------
//! hierarchic index set of ALU2dGrid
template <int dim, int dimworld, ALU2DSPACE ElementType eltype>
class ALU2dGridHierarchicIndexSet :
public IndexSet< ALU2dGrid< dim, dimworld, eltype >,
ALU2dGridHierarchicIndexSet< dim, dimworld, eltype >, int >
{
typedef ALU2dGridHierarchicIndexSet< dim, dimworld, eltype > This;
typedef ALU2dGrid< dim, dimworld, eltype > GridType;
enum { numCodim = dim+1 }; // i.e. 3
friend class ALU2dGrid< dim, dimworld, eltype >;
ALU2dGridHierarchicIndexSet( const GridType &grid )
: grid_( grid )
{}
public:
typedef typename GridType::Traits::template Codim<0>::Entity EntityCodim0Type;
//! return hierarchic index of given entity
template< int codim >
int index ( const typename GridType::Traits::template Codim< codim >::Entity &entity ) const
{
return GridType::getRealImplementation( entity ).getIndex();
}
//! return hierarchic index of given entity
template< class Entity >
int index ( const Entity &entity ) const
{
return GridType::getRealImplementation( entity ).getIndex();
}
//! return subIndex of given entity for codim sub entity
int subIndex ( const EntityCodim0Type &e, int i, unsigned int codim ) const
{
return grid_.getRealImplementation( e ).subIndex( i, codim);
}
//! return size of indexset, i.e. maxindex+1
//! for given type, if type is not exisiting within grid 0 is returned
int size ( GeometryType type ) const
{
const int codim = dim-type.dim();
assert( grid_.geomTypes(codim).size() == 1 );
if( type != grid_.geomTypes(codim)[0] ) return 0;
// return size of hierarchic index set
return grid_.hierSetSize(codim);
}
//! return size of indexset, i.e. maxindex+1
int size ( int codim ) const
{
// return size of hierarchic index set
return grid_.hierSetSize(codim);
}
//! deliver all geometry types used in this grid
const std::vector<GeometryType>& geomTypes (int codim) const
{
return grid_.geomTypes(codim);
}
//! return true because all entities are contained in this set
template <class EntityType>
bool contains (const EntityType &) const { return true; }
private:
// our Grid
const GridType & grid_;
};
//***********************************************************
//
// --LocalIdSet
//
//***********************************************************
//! hierarchic index set of ALU3dGrid
template <int dim, int dimworld, ALU2DSPACE ElementType eltype>
class ALU2dGridLocalIdSet :
public IdSet < ALU2dGrid< dim, dimworld, eltype >,
ALU2dGridLocalIdSet< dim, dimworld, eltype >, int >
{
typedef ALU2dGrid< dim, dimworld, eltype > GridType;
typedef typename GridType :: HierarchicIndexSet HierarchicIndexSetType;
friend class ALU2dGrid< dim, dimworld, eltype >;
// this means that only up to 300000000 entities are allowed
enum { codimMultiplier = 300000000 };
typedef typename GridType::Traits::template Codim<0>::Entity EntityCodim0Type;
// create local id set , only for the grid allowed
ALU2dGridLocalIdSet(const GridType & grid) : hset_(grid.hierarchicIndexSet())
{
for(int i=0; i<dim+1; i++)
codimStart_[i] = i*codimMultiplier;
}
// fake method to have the same method like GlobalIdSet
void updateIdSet() {}
public:
//! export type of id
typedef int IdType;
//! import default implementation of subId<cc>
//! \todo remove after next release
using IdSet < GridType , ALU2dGridLocalIdSet, IdType > :: subId;
//! return global id of given entity
template <class EntityType>
int id (const EntityType & ep) const
{
enum { cd = EntityType :: codimension };
assert( hset_.size(cd) < codimMultiplier );
return codimStart_[cd] + hset_.index(ep);
}
//! return global id of given entity
template <int codim>
int id (const typename GridType:: template Codim<codim> :: Entity & ep) const
{
//enum { cd = EntityType :: codimension };
assert( hset_.size(codim) < codimMultiplier );
return codimStart_[codim] + hset_.index(ep);
}
//! return subId of given entity
int subId ( const EntityCodim0Type &e, int i, unsigned int codim ) const
{
assert( hset_.size( codim ) < codimMultiplier );
return codimStart_[ codim ] + hset_.subIndex( e, i, codim );
}
private:
// our HierarchicIndexSet
const HierarchicIndexSetType & hset_;
// store start of each codim numbers
int codimStart_[dim+1];
};
} // end namespace Dune
#endif
|