/usr/include/dune/grid/common/dynamicsubindexid.hh is in libdune-grid-dev 2.2.1-2.
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 | #ifndef DUNE_DYNAMICCODIMSUBINDEXID_HH
#define DUNE_DYNAMICCODIMSUBINDEXID_HH
#include <dune/common/forloop.hh>
#include <dune/common/typetraits.hh>
#include <dune/geometry/genericgeometry/conversion.hh>
#warning This file is deprecated and will be removed after the release of dune-grid 2.2.
namespace Dune
{
// DynamicSubIndex
// ---------------
template< class Grid, class IndexSet >
class DynamicSubIndex
{
typedef DynamicSubIndex< Grid, IndexSet > This;
typedef typename remove_const< Grid >::type::Traits Traits;
static const unsigned int dimension = remove_const< Grid >::type::dimension;
typedef typename Traits::template Codim< 0 >::Entity Element;
public:
typedef typename IndexSet::IndexType IndexType;
private:
struct Caller
{
virtual ~Caller ()
{}
virtual IndexType
subIndex ( const IndexSet &indexSet, const Element &e, int i ) const = 0;
};
template< int codim >
struct CallerImpl
: public Caller
{
virtual IndexType
subIndex ( const IndexSet &indexSet, const Element &e, int i ) const
{
typedef GenericGeometry::MapNumberingProvider< dimension > Numbering;
const unsigned int tid = GenericGeometry::topologyId( e.type() );
const int j = Numbering::template generic2dune< codim >( tid, i );
return indexSet.template subIndex< codim >( e, j );
}
static void apply ( const Caller *(&caller)[ dimension+1 ] )
{
caller[ codim ] = new CallerImpl< codim >;
}
};
// prohibit copying and assignment
DynamicSubIndex ( const This & );
This &operator= ( const This & );
public:
explicit DynamicSubIndex ( const IndexSet &indexSet )
: indexSet_( indexSet )
{
Dune::ForLoop< CallerImpl, 0, dimension >::apply( caller_ );
}
~DynamicSubIndex ()
{
for( unsigned int codim = 0; codim <= dimension; ++codim )
delete caller_[ codim ];
}
IndexType operator() ( const Element &e, int i, unsigned int codim ) const
{
assert( codim <= dimension );
return caller_[ codim ]->subIndex( indexSet_, e, i );
}
private:
const IndexSet &indexSet_;
const Caller *caller_[ dimension+1 ];
};
// DynamicSubId
// ------------
template< class Grid, class IdSet >
class DynamicSubId
{
typedef DynamicSubId< Grid, IdSet > This;
typedef typename remove_const< Grid >::type::Traits Traits;
static const unsigned int dimension = remove_const< Grid >::type::dimension;
typedef typename Traits::template Codim< 0 >::Entity Element;
public:
typedef typename IdSet::IdType IdType;
private:
struct Caller
{
virtual ~Caller ()
{}
virtual IdType
subId ( const IdSet &idSet, const Element &e, int i ) const = 0;
};
template< int codim >
struct CallerImpl
: public Caller
{
virtual IdType
subId ( const IdSet &idSet, const Element &e, int i ) const
{
typedef GenericGeometry::MapNumberingProvider< dimension > Numbering;
const unsigned int tid = GenericGeometry::topologyId( e.type() );
const int j = Numbering::template generic2dune< codim >( tid, i );
return idSet.template subId< codim >( e, j );
}
static void apply ( const Caller *(&caller)[ dimension+1 ] )
{
caller[ codim ] = new CallerImpl< codim >;
}
};
// prohibit copying and assignment
DynamicSubId ( const This & );
This &operator= ( const This & );
public:
explicit DynamicSubId ( const IdSet &idSet )
: idSet_( idSet )
{
Dune::ForLoop< CallerImpl, 0, dimension >::apply( caller_ );
}
~DynamicSubId ()
{
for( unsigned int codim = 0; codim <= dimension; ++codim )
delete caller_[ codim ];
}
IdType operator() ( const Element &e, int i, unsigned int codim ) const
{
assert( codim <= dimension );
return caller_[ codim ]->subId( idSet_, e, i );
}
private:
const IdSet &idSet_;
const Caller *caller_[ dimension+1 ];
};
}
#endif // #ifndef DUNE_DYNAMICCODIMSUBINDEXID_HH
|