/usr/include/dune/grid/genericgeometry/referencetopologies.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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | #ifndef DUNE_GENERICGEOMETRY_REFERENCETOPOLOGIES_HH
#define DUNE_GENERICGEOMETRY_REFERENCETOPOLOGIES_HH
#warning This file is deprecated, and will be removed \
after the release of dune-grid-2.2.
#include <dune/geometry/genericgeometry/conversion.hh>
#include <dune/geometry/genericgeometry/subtopologies.hh>
namespace Dune
{
namespace GenericGeometry
{
// ReferenceTopology
// -----------------
template< unsigned int dim >
class ReferenceTopology
{
typedef ReferenceTopology< dim > This;
class SubEntityInfo;
template< class Topology > struct Initialize;
public:
static const unsigned int dimension = dim;
unsigned int size ( unsigned int codim ) const
{
assert( codim <= dimension );
return info_[ codim ].size();
}
unsigned int
size ( unsigned int codim, unsigned int i, unsigned int subcodim ) const
{
assert( (codim <= dimension) && (i < info_[ codim ].size()) );
return info_[ codim ][ i ].size( subcodim );
}
unsigned int subEntity ( unsigned int codim, unsigned int i,
unsigned int subcodim, unsigned int j ) const
{
assert( (codim <= dimension) && (i < info_[ codim ].size()) );
return info_[ codim ][ i ].number( subcodim, j );
}
unsigned int topologyId ( unsigned int codim, unsigned int i ) const
{
assert( (codim <= dimension) && (i < info_[ codim ].size()) );
return info_[ codim ][ i ].topologyId();
}
template< class Topology >
void initialize ()
{
typedef Initialize< Topology > Init;
ForLoop< Init::template Codim, 0, dimension >::apply( info_ );
}
private:
std::vector< SubEntityInfo > info_[ dimension+1 ];
};
// ReferenceTopology::SubEntityInfo
// --------------------------------
template< unsigned int dim >
class ReferenceTopology< dim >::SubEntityInfo
{
template< class Topology, unsigned int codim > struct Initialize
{
template< int subcodim > struct SubCodim;
};
public:
unsigned int size ( unsigned int subcodim ) const
{
return numbering_[ subcodim ].size();
}
unsigned int number ( unsigned int subcodim, unsigned int j ) const
{
return numbering_[ subcodim ][ j ];
}
unsigned int topologyId () const
{
return topologyId_;
}
template< class Topology, unsigned int codim, unsigned int i >
void initialize ()
{
typedef Initialize< Topology, codim > Init;
typedef typename GenericGeometry::SubTopology< Topology, codim, i >::type SubTopology;
codim_ = codim;
topologyId_ = SubTopology::id;
numbering_.resize( SubTopology::dimension+1 );
const unsigned int iVariable = i;
ForLoop< Init::template SubCodim, 0, SubTopology::dimension >::apply( iVariable, numbering_ );
}
private:
int codim_;
unsigned int topologyId_;
std::vector< std::vector< unsigned int > > numbering_;
};
template< unsigned int dim >
template< class Topology, unsigned int codim >
template< int subcodim >
struct ReferenceTopology< dim >::SubEntityInfo::Initialize< Topology, codim >::SubCodim
{
typedef SubTopologySize< Topology, codim, subcodim > Size;
typedef SubTopologyNumbering< Topology, codim, subcodim > Numbering;
static void
apply ( unsigned int i, std::vector< std::vector< unsigned int > > &numbering )
{
const unsigned int size = Size::size( i );
numbering[ subcodim ].resize( size );
for( unsigned int j = 0; j < size; ++j )
numbering[ subcodim ][ j ] = Numbering::number( i, j );
}
};
// ReferenceTopology::Initialize
// -----------------------------
template< unsigned int dim >
template< class Topology >
struct ReferenceTopology< dim >::Initialize
{
template< int codim >
struct Codim
{
template< int i >
struct SubTopology
{
static void apply ( std::vector< SubEntityInfo > &info )
{
info[ i ].template initialize< Topology, codim, i >();
}
};
static void apply ( std::vector< SubEntityInfo > (&info)[ dim+1 ] )
{
const unsigned int size = Size< Topology, codim >::value;
info[ codim ].resize( size );
ForLoop< SubTopology, 0, size-1 >::apply( info[ codim ] );
}
};
};
// ReferenceTopologyContainer
// --------------------------
template< unsigned int dim >
class ReferenceTopologies
{
typedef ReferenceTopologies< dim > This;
template< int topologyId >
struct Init;
public:
static const unsigned int dimension = dim;
static const unsigned int numTopologies = (1 << dimension);
typedef GenericGeometry::ReferenceTopology< dimension > ReferenceTopology;
static const ReferenceTopology &get ( const unsigned int topologyId )
{
assert( topologyId < numTopologies );
return instance().refTopology_[ topologyId ];
}
private:
ReferenceTopologies ()
{
ForLoop< Init, 0, numTopologies-1 >::apply( refTopology_ );
}
ReferenceTopologies ( const This & );
This &operator= ( const This & );
static const This &instance ()
{
static This instance;
return instance;
}
ReferenceTopology refTopology_[ numTopologies ];
};
template< unsigned int dim >
template< int topologyId >
struct ReferenceTopologies< dim >::Init
{
static void apply ( ReferenceTopology (&refTopology)[ numTopologies ] )
{
typedef typename GenericGeometry::Topology< topologyId, dimension >::type Topology;
refTopology[ topologyId ].template initialize< Topology >();
}
};
}
}
#endif // #ifndef DUNE_GENERICGEOMETRY_REFERENCETOPOLOGIES_HH
|