/usr/include/dune/grid/utility/multiindex.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 | #ifndef DUNE_GRID_UTILITY_MULTIINDEX_HH
#define DUNE_GRID_UTILITY_MULTIINDEX_HH
/** \file
 *  \brief Implements a multiindex with arbitrary dimension and fixed index ranges
 *  This is used by various factory classes.
 */
#include<array>
namespace Dune
{
 namespace FactoryUtilities
 {
  template<std::size_t dim>
  class MultiIndex : public std::array<unsigned int,dim>
  {
    // The range of each component
    std::array<unsigned int,dim> limits_;
  public:
    /** \brief Constructor with a given range for each digit */
    MultiIndex(const std::array<unsigned int,dim>& limits) : limits_(limits)
    {
      std::fill(this->begin(), this->end(), 0);
    }
    /** \brief Increment the MultiIndex */
    MultiIndex<dim>& operator++()
    {
      for (std::size_t i=0; i<dim; i++)
      {
        // Augment digit
        (*this)[i]++;
        // If there is no carry-over we can stop here
        if ((*this)[i]<limits_[i])
          break;
        (*this)[i] = 0;
      }
      return *this;
    }
    /** \brief Compute how many times you can call operator++ before getting to (0,...,0) again */
    size_t cycle() const
    {
      size_t result = 1;
      for (std::size_t i=0; i<dim; i++)
        result *= limits_[i];
      return result;
    }
  };
 }
}
#endif
 |