This file is indexed.

/usr/include/dune/pdelab/common/elementmapper.hh is in libdune-pdelab-dev 2.0.0-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
#ifndef DUNE_PDELAB_COMMON_ELEMENTMAPPER_HH
#define DUNE_PDELAB_COMMON_ELEMENTMAPPER_HH

#include <vector>
#include <algorithm>
#include <numeric>

#include <dune/geometry/type.hh>
#include <dune/geometry/typeindex.hh>
#include <dune/grid/common/capabilities.hh>

namespace Dune {

  namespace PDELab {

#ifndef DOXYGEN

    // implementation for mixed grids
    template<typename GV, bool has_single_cell_type>
    class ElementMapperBase
    {

    protected:

      typedef typename GV::template Codim<0>::Entity Element;
      typedef std::size_t size_type;

    private:

      static const size_type dim = GV::dimension;
      typedef typename GV::IndexSet IndexSet;

    protected:

      void update()
      {
        // clear old values
        std::fill(_gt_offsets.begin(),_gt_offsets.end(),0);

        // extract per-GeometryType sizes in codim 0
        typedef std::vector<GeometryType> GTVector;
        const GTVector& geometry_types = _index_set.geomTypes(0);
        for (typename GTVector::const_iterator it = geometry_types.begin(), end = geometry_types.end();
             it != end;
             ++it)
          {
            _gt_offsets[LocalGeometryTypeIndex::index(*it) + 1] = _index_set.size(*it);
          }

        // convert to offsets
        std::partial_sum(_gt_offsets.begin(),_gt_offsets.end(),_gt_offsets.begin());
      }

      size_type map(const Element& e) const
      {
        return _gt_offsets[LocalGeometryTypeIndex::index(e.type())] + _index_set.index(e);
      }

      ElementMapperBase(const GV& gv)
        : _gt_offsets(LocalGeometryTypeIndex::size(dim) + 1)
        , _index_set(gv.indexSet())
      {
        update();
      }

    private:

      std::vector<size_type> _gt_offsets;
      const IndexSet& _index_set;

    };

    // implementation for grids with a single codim 0 geometry type
    template<typename GV>
    class ElementMapperBase<GV,true>
    {

    protected:

      typedef typename GV::template Codim<0>::Entity Element;
      typedef typename GV::IndexSet IndexSet;
      typedef std::size_t size_type;

      void update()
      {}

      size_type map(const Element& e) const
      {
        return _index_set.index(e);
      }

      ElementMapperBase(const GV& gv)
        : _index_set(gv.indexSet())
      {}

    private:

      const IndexSet& _index_set;

    };

#endif // DOXYGEN


    //! Class providing a consecutive index for codim 0 entities of a GridView.
    /**
     * ElementMapper yields a unique, consecutive, zero-based index for all
     * codim 0 entities of a GridView. Conceptually, this can also be achieved
     * using a Mapper from dune-grid, but this implementation has better performance
     * as it avoids looking up the GeometryType in a std::map. For the common case
     * of grids with a single codim 0 GeometryType, ElementMapper is specialized
     * to just look up the cell index on the IndexSet of the GridView.
     *
     * \tparam GV  The type of the GridView to operate on.
     */
    template<typename GV>
    class ElementMapper
      : public ElementMapperBase<GV,
                                 Dune::Capabilities::hasSingleGeometryType<
                                   typename GV::Grid
                                   >::v
                                 >
    {

      typedef ElementMapperBase<
        GV,
        Dune::Capabilities::hasSingleGeometryType<
          typename GV::Grid
          >::v
        > BaseT;

    public:

      //! The type of the returned index.
      typedef typename BaseT::size_type size_type;

      //! The type of the codim 0 entities of the GridView.
      typedef typename BaseT::Element Element;

      //! Construct a CellIndexProvider for the given GridView.
      /**
       * \param gv  the GridView to operate on.
       */
      ElementMapper(const GV& gv)
        : BaseT(gv)
      {}

      //! Return the index of the given element.
      /**
       * Returns an index for the given codim 0 entity that is guaranteed to be
       * zero-based, consecutive and unique across all codim 0 entities
       * of the GridView.
       *
       * \param cell  The codim 0 entity for which to calculate an index.
       * \return      The index of the entity.
       */
      size_type map(const Element& e) const
      {
        return BaseT::map(e);
      }

    };

  } // namespace PDELab

} // namespace Dune

#endif // DUNE_PDELAB_COMMON_ELEMENTMAPPER_HH