/usr/include/dune/geometry/genericgeometry/traceprovider.hh is in libdune-geometry-dev 2.3.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 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GEOMETRY_GENERICGEOMETRY_TRACEPROVIDER_HH
#define DUNE_GEOMETRY_GENERICGEOMETRY_TRACEPROVIDER_HH
#include <dune/common/forloop.hh>
#include <dune/common/typetraits.hh>
#include <dune/common/visibility.hh>
#include "mapping.hh"
#include "subtopologies.hh"
namespace Dune
{
namespace GenericGeometry
{
// External Forward Declarations
// -----------------------------
template< class Topology, class GeometryTraits >
class NonHybridMapping;
template< unsigned int dim, class GeometryTraits >
class HybridMapping;
template< class Topology, class GeometryTraits >
class VirtualMapping;
// TraceProvider
// -------------
template< class Topology, class GeometryTraits, unsigned int codim, bool forceHybrid >
class TraceProvider
{
typedef TraceProvider< Topology, GeometryTraits, codim, forceHybrid > This;
typedef typename GeometryTraits::template Mapping< Topology >::type MappingImpl;
public:
static const unsigned int dimension = Topology::dimension;
static const unsigned int codimension = codim;
static const unsigned int mydimension = dimension - codimension;
static const bool hybrid = (forceHybrid || ((mydimension != dimension) && IsHybrid< Topology >::value));
typedef GenericGeometry::Mapping< typename GeometryTraits::CoordTraits, Topology, GeometryTraits::dimWorld, MappingImpl > Mapping;
private:
static const unsigned int numSubTopologies = Mapping::ReferenceElement::template Codim< codimension >::size;
template< bool > class HybridFactory;
template< bool > class NonHybridFactory;
typedef typename conditional< hybrid, HybridFactory< true >, NonHybridFactory< false > >::type Factory;
template< int i > struct Builder;
public:
typedef typename Factory::Trace Trace;
static Trace *construct ( const Mapping &mapping, unsigned int i, char *traceStorage )
{
return (*instance().construct_[ i ])( mapping, traceStorage );
}
private:
typedef Trace *(*Construct)( const Mapping &mapping, char *traceStorage );
TraceProvider ()
{
ForLoop< Builder, 0, numSubTopologies-1 >::apply( construct_ );
}
DUNE_EXPORT static const This &instance ()
{
static This theInstance;
return theInstance;
}
Construct construct_[ numSubTopologies ];
};
// TraceProvider::HybridFactory
// ----------------------------
template< class Topology, class GeometryTraits, unsigned int codim, bool forceHybrid >
template< bool >
class TraceProvider< Topology, GeometryTraits, codim, forceHybrid >::HybridFactory
{
template< unsigned int i >
struct VirtualTrace
{
typedef typename GenericGeometry::SubTopology< Topology, codim, i >::type SubTopology;
typedef VirtualMapping< SubTopology, GeometryTraits > type;
};
public:
typedef HybridMapping< mydimension, GeometryTraits > Trace;
template< int i >
static Trace *construct ( const Mapping &mapping, char *traceStorage )
{
typedef typename VirtualTrace< i >::type TraceImpl;
return new( traceStorage ) TraceImpl( mapping.template trace< codim, i >() );
}
};
// TraceProvider::NonHybridFactory
// -------------------------------
template< class Topology, class GeometryTraits, unsigned int codim, bool forceHybrid >
template< bool >
class TraceProvider< Topology, GeometryTraits, codim, forceHybrid >::NonHybridFactory
{
typedef typename GenericGeometry::SubTopology< Topology, codim, 0 >::type SubTopology;
public:
typedef NonHybridMapping< SubTopology, GeometryTraits > Trace;
template< int i >
static Trace *construct ( const Mapping &mapping, char *traceStorage )
{
return new( traceStorage ) Trace( mapping.template trace< codim, i >() );
}
};
// TraceProvider::Builder
// ----------------------
template< class Topology, class GeometryTraits, unsigned int codim, bool forceHybrid >
template< int i >
struct TraceProvider< Topology, GeometryTraits, codim, forceHybrid >::Builder
{
static void apply ( Construct (&construct)[ numSubTopologies ] )
{
construct[ i ] = &(Factory::template construct< i >);
}
};
} // namespace GenericGeometry
} // namespace Dune
#endif // #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_TRACEPROVIDER_HH
|