This file is indexed.

/usr/include/dune/grid/yaspgrid/yaspgridpersistentcontainer.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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_GRID_YASPGRIDPERSISTENTCONTAINER_HH
#define DUNE_GRID_YASPGRIDPERSISTENTCONTAINER_HH

/** \file
 * \brief Specialization of the PersistentContainer for YaspGrid
 */

#include <cassert>
#include <vector>

#include <dune/grid/utility/persistentcontainer.hh>
#include <dune/grid/utility/persistentcontainervector.hh>
#include "../yaspgrid.hh"

namespace Dune
{

  /** \internal
   *  \brief implement a consecutive index for all entities of given codim of a YaspGrid
   *
   * this class behaves similar to an IndexSet
   *
   * to make this work for a persistent vector we have to implement...
   *
   *      indexSet.size( codim )
   *      indexSet.index( entity );
   *      indexSet.subIndex( entity, subEntity, codimension() );
   */
  template<typename Grid>
  class YaspPersistentContainerIndex
  {

  public:
    YaspPersistentContainerIndex(const Grid & grid, int codim)
      : _grid(grid), _codim(codim)
    {
      recomputeOffsets();
    }

    /** \copydoc IndexSet::IndexType */
    typedef std::size_t IndexType;

    /** \copydoc IndexSet::index */
    template<class Entity>
    IndexType index (const Entity& e) const
    {
      static const int cc = Entity::codimension;
      std::size_t level = e.level();
      return _grid.indexsets[level]->template index<cc>(e) + _offsets[level];
    }

    /** \copydoc IndexSet::subIndex */
    template< class Entity >
    IndexType subIndex ( const Entity &e, int i, unsigned int codim ) const
    {

      static const int cc = Entity::codimension;
      std::size_t level = e.level();
      return _grid.indexsets[level]->template subIndex<cc>(e,i,codim) + _offsets[level];
    }

    /** \copydoc IndexSet::size */
    std::size_t size (int codim) const
    {
      if (_grid.indexsets.size()+1 != _offsets.size())
        recomputeOffsets();
      return _offsets.back();
    }

  private:
    void recomputeOffsets() const
    {
      _offsets.resize(_grid.indexsets.size()+1,0);
      _offsets[0] = 0;
      for (std::size_t i=0; i<_grid.indexsets.size(); i++)
        _offsets[i+1] = _offsets[i] + _grid.indexsets[i]->size(_codim);
    }

    const Grid& _grid;
    int _codim;
    mutable std::vector<std::size_t> _offsets;
  };

  /** \brief Specialization of the PersistentContainer for YaspGrid */
  /**
     \note questions regarding the interface of PersistentContainer:
     - is it allowed to access the container after grid modification, without calling resize?
     - which assumptions on the indexset doe the PersistentContainerVector have?
   */
  template<int dim, class CoordCont, class T>
  class PersistentContainer< YaspGrid<dim, CoordCont>, T >
  /* We have to pass the reference to the IndexSet to the constructor
     of the PersistentContainerVector.  In order to have a valid
     indexset available, we inherit from a private indexset
   */
    : private YaspPersistentContainerIndex< const YaspGrid<dim, CoordCont> >,
      public PersistentContainerVector< YaspGrid<dim, CoordCont>,
                                        YaspPersistentContainerIndex< const YaspGrid<dim, CoordCont> >,
                                        std::vector<T> >
  {
    typedef YaspPersistentContainerIndex< const YaspGrid<dim, CoordCont> > IndexSet;
    typedef PersistentContainerVector< YaspGrid<dim, CoordCont>, IndexSet, std::vector<T> > Base;

  public:
    typedef typename Base::Grid Grid;
    typedef typename Base::Value Value;

    using Base::size;

    PersistentContainer ( const Grid &grid, int codim, const Value &value = Value() )
      : IndexSet(grid, codim),
        Base(*this, codim, value)
    {}
  };

} // end namespace Dune

#endif // end DUNE_GRID_YASPGRIDPERSISTENTCONTAINER_HH