1 #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_CONVERSION_HH
2 #define DUNE_GEOMETRY_GENERICGEOMETRY_CONVERSION_HH
4 #include <dune/common/static_assert.hh>
25 operator unsigned int () {
return i; }
27 unsigned int value() {
return i; }
34 namespace GenericGeometry
47 template<
class Topology, GeometryType::BasicType linetype >
50 template< GeometryType::BasicType linetype >
55 "Parameter linetype may only be a simplex or a cube." );
58 static const unsigned int dimension = 0;
68 template<
class BaseTopology, GeometryType::BasicType linetype >
75 "Parameter linetype may only be a simplex or a cube." );
79 "Only prisms over simplices or cubes can be converted." );
82 static const unsigned int dimension = DuneBaseGeometryType::dimension + 1;
97 template<
class BaseTopology, GeometryType::BasicType linetype >
104 "Parameter linetype may only be a simplex or a cube." );
108 "Only pyramids over simplices or cubes can be converted." );
111 static const unsigned int dimension = DuneBaseGeometryType::dimension + 1;
142 template<
unsigned int dim, GeometryType::BasicType linetype >
196 return instance().types_[ topologyId / 2 ];
205 template<
class Topology >
211 template<
unsigned int codim >
217 template<
unsigned int codim >
244 template<
unsigned int codim >
247 return (codim == 1 ? 2 - i : i);
250 template<
unsigned int codim >
253 return dune2generic< codim >( i );
282 template<
unsigned int codim >
285 static unsigned int edge[ 6 ] = { 0, 2, 1, 3, 4, 5 };
286 return (codim == 1 ? 3 - i : (codim == 2 ? edge[ i ] : i));
289 template<
unsigned int codim >
292 return dune2generic< codim >( i );
309 template<
unsigned int codim >
312 static unsigned int edge[ 12 ] = { 0, 1, 2, 3, 4, 5, 8, 9, 6, 7, 10, 11 };
313 return (codim == 2 ? edge[ i ] : i);
316 template<
unsigned int codim >
319 return dune2generic< codim >( i );
336 template<
unsigned int codim >
339 static unsigned int codim2[ 24 ] =
340 { 0, 1, 2, 3, 4, 5, 8, 9, 12, 13, 18, 19,
341 6, 7, 10, 11, 14, 15, 20, 21, 16, 17, 22, 23 };
342 static unsigned int codim3[ 32 ] =
343 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 21, 22, 23,
344 12, 13, 16, 17, 24, 25, 28, 29, 14, 15, 18, 19, 26, 27, 30, 31 };
353 template<
unsigned int codim >
356 static unsigned int codim2[ 24 ] =
357 { 0, 1, 2, 3, 4, 5, 12, 13, 6, 7, 14, 15,
358 8, 9, 16, 17, 20, 21, 10, 11, 18, 19, 22, 23 };
359 static unsigned int codim3[ 32 ] =
360 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 24, 25,
361 18, 19, 26, 27, 12, 13, 14, 15, 20, 21, 28, 29, 22, 23, 30, 31 };
384 template<
unsigned int codim >
387 static unsigned int vertex[ 5 ] = { 0, 1, 3, 2, 4 };
388 static unsigned int edge[ 8 ] = { 2, 1, 3, 0, 4, 5, 7, 6 };
389 static unsigned int face[ 5 ] = { 0, 3, 2, 4, 1 };
393 else if( codim == 2 )
395 else if( codim == 1 )
401 template<
unsigned int codim >
404 static unsigned int vertex[ 5 ] = { 0, 1, 3, 2, 4 };
405 static unsigned int edge[ 8 ] = { 3, 1, 0, 2, 4, 5, 7, 6 };
406 static unsigned int face[ 5 ] = { 0, 4, 2, 1, 3 };
410 else if( codim == 2 )
412 else if( codim == 1 )
432 template<
unsigned int codim >
435 static unsigned int edge[ 9 ] = { 3, 5, 4, 0, 1, 2, 6, 8, 7 };
436 static unsigned int face[ 5 ] = { 3, 0, 2, 1, 4 };
440 else if( codim == 1 )
446 template<
unsigned int codim >
449 static unsigned int edge[ 9 ] = { 3, 4, 5, 0, 2, 1, 6, 8, 7 };
450 static unsigned int face[ 5 ] = { 1, 3, 2, 0, 4 };
454 else if( codim == 1 )
476 template<
unsigned int dim >
486 typedef std :: vector< unsigned int > Map;
493 ForLoop< Builder, 0, (1 << dim)-1 >::apply( dune2generic_, generic2dune_ );
507 assert( i < instance().dune2generic_[ topologyId ][ codim ].size() );
508 return instance().dune2generic_[
topologyId ][ codim ][ i ];
511 template<
unsigned int codim >
522 assert( i < instance().dune2generic_[ topologyId ][ codim ].size() );
523 return instance().generic2dune_[
topologyId ][ codim ][ i ];
526 template<
unsigned int codim >
535 template<
unsigned int dim >
536 template<
int topologyId >
537 struct MapNumberingProvider< dim >::Builder
542 template<
int codim >
552 template<
unsigned int dim >
554 template<
int codim >
564 for(
unsigned int j = 0; j < size; ++j )
565 d2g[ j ] = MapNumbering::template dune2generic< codim >( j );
569 for(
unsigned int j = 0; j < size; ++j )
570 g2d[ j ] = MapNumbering::template generic2dune< codim >( j );
579 template< GeometryType :: BasicType type,
unsigned int dim >
582 template<
unsigned int dim >
589 template<
unsigned int codim >
590 static unsigned int map (
unsigned int i )
601 template<
unsigned int codim >
602 static unsigned int map (
unsigned int i )
608 template<
unsigned int dim >
614 template<
unsigned int codim >
615 static unsigned int map (
unsigned int i )
626 template<
unsigned int codim >
627 static unsigned int map (
unsigned int i )
633 template<
unsigned int dim >
640 template<
unsigned int codim >
641 static unsigned int map (
unsigned int i )
650 template<
unsigned int dim >
659 template<
unsigned int codim >
660 static unsigned int map (
unsigned int i )
683 inline unsigned int topologyId (
const GeometryType &type ) DUNE_DEPRECATED_MSG(
"use GeometryType::id() instead");
709 geometryType (
const unsigned int topologyId,
const unsigned int dimension ) DUNE_DEPRECATED_MSG(
"Construct a GeometryTpye directly instead");
720 #endif // #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_CONVERSION_HH