This file is indexed.

/usr/include/dune/grid/utility/persistentcontainervector.hh is in libdune-grid-dev 2.5.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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_PERSISTENTCONTAINERVECTOR_HH
#define DUNE_PERSISTENTCONTAINERVECTOR_HH

#include <algorithm>
#include <cassert>

namespace Dune
{

  // PersistentContainerVector
  // -------------------------

  /**
   * \brief vector-based implementation of the PersistentContainer
   *
   * Some grid implementations, like YaspGrid, can provide consecutive,
   * zero-based, persistent indices for the entire grid hierarchy.
   * This implementation of a PersistentContainer uses such an index set and
   * a std::vector-like container to store user data in an efficient and
   * persistent manner.
   *
   * \note The persistent index set is actually allowed to be non-consecutive,
   *       i.e., some indices might not be assigned to an entity.
   *       As the result of the size method on the index set is used to allocate
   *       storage for the vector, it must be larger than the largest used index.
   *
   * \note It is sufficient if the index set provides indices to the codimension
   *       the persistent container is created for.
   *       Neither the method types() nor the method contains() need to be
   *       implemented.
   *
   * \note The persistent container is currently restricted to index sets
   *       containing a single geometry type.
   *
   * \todo Actually, we use a mapper rather than an index set.
   *       This would automatically resolve two problems:
   *       - support multiple geometry types,
   *       - the requirement to store a reference to the index set
   *       .
   *
   * \tparam  G         type of grid
   * \tparam  IndexSet  type of persistent index set
   * \tparam  Vector    type of vector to store the data in
   */
  template< class G, class IndexSet, class Vector >
  class PersistentContainerVector
  {
    typedef PersistentContainerVector< G, IndexSet, Vector > This;

  public:
    typedef G Grid;

    typedef typename Vector::value_type Value;
    typedef typename Vector::size_type Size;
    typedef typename Vector::const_iterator ConstIterator;
    typedef typename Vector::iterator Iterator;

    typedef typename Vector::allocator_type Allocator;

    PersistentContainerVector ( const IndexSet &indexSet, int codim, const Value &value,
                                const Allocator &allocator = Allocator() )
      : codim_( codim ),
        indexSet_( &indexSet ),
        data_( indexSet.size( codim ), value, allocator )
    {}

    template< class Entity >
    const Value &operator[] ( const Entity &entity ) const
    {
      assert( Entity::codimension == codimension() );
      const Size index = indexSet().index( entity );
      assert( index < data_.size() );
      return data_[ index ];
    }

    template< class Entity >
    Value &operator[] ( const Entity &entity )
    {
      assert( Entity::codimension == codimension() );
      const Size index = indexSet().index( entity );
      assert( index < data_.size() );
      return data_[ index ];
    }

    template< class Entity >
    const Value &operator() ( const Entity &entity, int subEntity ) const
    {
      const Size index = indexSet().subIndex( entity, subEntity, codimension() );
      assert( index < data_.size() );
      return data_[ index ];
    }

    template< class Entity >
    Value &operator() ( const Entity &entity, int subEntity )
    {
      const Size index = indexSet().subIndex( entity, subEntity, codimension() );
      assert( index < data_.size() );
      return data_[ index ];
    }

    Size size () const { return data_.size(); }

    void resize ( const Value &value = Value() )
    {
      const Size indexSetSize = indexSet().size( codimension() );
      data_.resize( indexSetSize, value );
    }

    void shrinkToFit () {}

    void fill ( const Value &value ) { std::fill( begin(), end(), value ); }

    void swap ( This &other )
    {
      std::swap( codim_, other.codim_ );
      std::swap( indexSet_, other.indexSet_ );
      std::swap( data_, other.data_ );
    }

    ConstIterator begin () const { return data_.begin(); }
    Iterator begin () { return data_.begin(); }

    ConstIterator end () const { return data_.end(); }
    Iterator end () { return data_.end(); }

    int codimension () const { return codim_; }

  protected:
    const IndexSet &indexSet () const { return *indexSet_; }

    int codim_;
    const IndexSet *indexSet_;
    Vector data_;
  };

} // namespace Dune

#endif // #ifndef DUNE_PERSISTENTCONTAINERVECTOR_HH