This file is indexed.

/usr/include/dune/geometry/genericgeometry/conversion.hh is in libdune-geometry-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
185
186
187
188
189
190
191
192
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GEOMETRY_GENERICGEOMETRY_CONVERSION_HH
#define DUNE_GEOMETRY_GENERICGEOMETRY_CONVERSION_HH

#include <dune/common/visibility.hh>

#include <dune/geometry/type.hh>
#include <dune/geometry/genericgeometry/topologytypes.hh>
#include <dune/geometry/genericgeometry/subtopologies.hh>

namespace Dune
{

  namespace GenericGeometry
  {

    // DuneGeometryType
    // ----------------

    /** \class DuneGeometryType
     *  \ingroup GenericGeometry
     *  \brief statically convert a generic topology type into a GeometryType
     *
     *  \tparam  Topology  topology type to be converted
     *  \tparam  linetype  basic geometry type to assign to a line
     *                     (either simplex or cube)
     */
    template< class Topology, GeometryType::BasicType linetype >
    class DuneGeometryType;

    template< GeometryType::BasicType linetype >
    class DuneGeometryType< Point, linetype >
    {
      static_assert((linetype == GeometryType::simplex)
                     || (linetype == GeometryType::cube),
                    "Parameter linetype may only be a simplex or a cube.");

    public:
      static const unsigned int dimension = 0;
      static const GeometryType::BasicType basicType = linetype;
    };

    template< class BaseTopology, GeometryType::BasicType linetype >
    class DuneGeometryType< Prism< BaseTopology >, linetype >
    {
      typedef DuneGeometryType< BaseTopology, linetype > DuneBaseGeometryType;

      static_assert((linetype == GeometryType::simplex)
                     || (linetype == GeometryType::cube),
                          "Parameter linetype may only be a simplex or a cube.");

      static_assert((DuneBaseGeometryType::basicType == GeometryType::simplex)
                     || (DuneBaseGeometryType::basicType == GeometryType::cube),
                    "Only prisms over simplices or cubes can be converted.");

    public:
      static const unsigned int dimension = DuneBaseGeometryType::dimension + 1;
      static const GeometryType::BasicType basicType
        = ((dimension == 1)
           ? linetype
           : ((dimension == 2) || (DuneBaseGeometryType::basicType == GeometryType::cube))
           ? GeometryType::cube
           : GeometryType::prism);
    };

    template< class BaseTopology, GeometryType::BasicType linetype >
    class DuneGeometryType< Pyramid< BaseTopology >, linetype >
    {
      typedef DuneGeometryType< BaseTopology, linetype > DuneBaseGeometryType;

      static_assert((linetype == GeometryType::simplex)
                     || (linetype == GeometryType::cube),
                    "Parameter linetype may only be a simplex or a cube.");

      static_assert((DuneBaseGeometryType::basicType == GeometryType::simplex)
                     || (DuneBaseGeometryType::basicType == GeometryType::cube),
                    "Only pyramids over simplices or cubes can be converted.");

    public:
      static const unsigned int dimension = DuneBaseGeometryType::dimension + 1;
      static const GeometryType::BasicType basicType
        = ((dimension == 1)
           ? linetype
           : ((dimension == 2) || (DuneBaseGeometryType::basicType == GeometryType::simplex))
           ? GeometryType::simplex
           : GeometryType::pyramid);
    };



    // DuneGeometryTypeProvider
    // ------------------------

    /** \class DuneGeometryTypeProvider
     *  \brief dynamically convert a generic topology type into a GeometryType
     *
     *  \tparam  dim       dimension of the topologies to be converted
     *  \tparam  linetype  basic geometry type to assign to a line
     *                     (either simplex or cube)
     *
     *  \note After 3D not all geometries are simplices, pyramids, prisms or
     *        cubes so that no meaningful GeometryType is available; therefore
     *        none is returned.
     */
    template< unsigned int dim, GeometryType::BasicType linetype >
    struct DuneGeometryTypeProvider
    {
      /** \brief dimension of the topologies to be converted */
      static const unsigned int dimension = dim;

      /** \brief number of possible topologies */
      static const unsigned int numTopologies = (1 << dimension);

    private:
      GeometryType types_[ (dimension>=1) ? numTopologies / 2 : numTopologies ];

      DUNE_EXPORT static const DuneGeometryTypeProvider &instance ()
      {
        static DuneGeometryTypeProvider inst;
        return inst;
      }

    public:
      /** \brief obtain a Geometry type from a topology id
       *
       *  \param[in]  topologyId  id of the topology to be converted
       *
       *  \returns GeometryType associated with the given topology id
       */
      static const GeometryType &type ( unsigned int topologyId )
      {
        assert( topologyId < numTopologies );
        return instance().types_[ topologyId / 2 ];
      }
    };


    // Convert
    // -------

    template< GeometryType :: BasicType type, unsigned int dim >
    struct Convert;

    template< unsigned int dim >
    struct Convert< GeometryType :: simplex, dim >
    {
      typedef Pyramid
      < typename Convert< GeometryType :: simplex, dim-1 > :: type >
      type;
    };

    template<>
    struct Convert< GeometryType :: simplex, 0 >
    {
      typedef Point type;
    };

    template< unsigned int dim >
    struct Convert< GeometryType :: cube, dim >
    {
      typedef Prism< typename Convert< GeometryType :: cube, dim-1 > :: type >
      type;
    };

    template<>
    struct Convert< GeometryType :: cube, 0 >
    {
      typedef Point type;
    };

    template< unsigned int dim >
    struct Convert< GeometryType :: prism, dim >
    {
      typedef Prism
      < typename Convert< GeometryType :: simplex, dim-1 > :: type >
      type;
    };

    template< unsigned int dim >
    struct Convert< GeometryType :: pyramid, dim >
    {
      typedef Pyramid
      < typename Convert< GeometryType :: cube, dim-1 > :: type >
      type;
    };

  }

}

#endif // #ifndef DUNE_GEOMETRY_GENERICGEOMETRY_CONVERSION_HH