This file is indexed.

/usr/include/dune/common/parallel/selection.hh is in libdune-common-dev 2.2.1-2.

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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
// $Id$
#ifndef DUNE_SELECTION_HH
#define DUNE_SELECTION_HH

#include"indexset.hh"
#include<dune/common/iteratorfacades.hh>

namespace Dune
{
  /** @addtogroup Common_Parallel
   *
   * @{
   */
  /**
   * @file
   * @brief Provides classes for selecting
   * indices base on attribute flags.
   * @author Markus Blatt
   */
  
  /**
   * @brief A const iterator over an uncached selection.
   */
  template<typename TS, typename TG, typename TL, int N>
  class SelectionIterator
  {
  public:
    /**
     * @brief The type of the Set of attributes.
     *
     * It has to provide a static method
     * \code bool contains(AttributeType a); \endcode
     * that returns true if a is in the set.
     * Such types are EnumItem, EnumRange, Combine.
     */
    typedef TS AttributeSet;
    
    /**
     * @brief The type of the underlying index set.
     */
    typedef Dune::ParallelIndexSet<TG,TL,N> ParallelIndexSet;
    
    //typedef typename ParallelIndexSet::const_iterator ParallelIndexSetIterator;

    typedef ConstArrayListIterator<IndexPair<TG,TL>, N, std::allocator<Dune::IndexPair<TG,TL> > > ParallelIndexSetIterator;
    /**
     * @brief Constructor.
     * @param iter The iterator over the index set.
     * @param end The iterator over the index set positioned at the end.
     */
    SelectionIterator(const ParallelIndexSetIterator& iter, const ParallelIndexSetIterator& end)
      : iter_(iter), end_(end)
    {
      // Step to the first valid entry
      while(iter_!=end_ && !AttributeSet::contains(iter_->local().attribute()))
	++iter_;
    }
    
    void operator++()
    {
      assert(iter_!=end_);
      for(++iter_;iter_!=end_; ++iter_)
	if(AttributeSet::contains(iter_->local().attribute()))
	  break;
    }
    
	
    uint32_t operator*() const
    {
      return iter_->local().local();
    }
    
    bool operator==(const SelectionIterator<TS,TG,TL,N>& other) const
    {
      return iter_ == other.iter_;
    }
      
    bool operator!=(const SelectionIterator<TS,TG,TL,N>& other) const
    {
      return iter_ != other.iter_;
    }
      
  private:
    ParallelIndexSetIterator iter_;
    const ParallelIndexSetIterator end_;
  };
  
  
  /**
   * @brief An uncached selection of indices.
   */
  template<typename TS, typename TG, typename TL, int N>
  class UncachedSelection
  {
  public:
    /**
     * @brief The type of the Set of attributes.
     *
     * It has to provide a static method
     * \code bool contains(AttributeType a); \endcode
     * that returns true if a is in the set.
     * Such types are EnumItem, EnumRange, Combine.
     */
    typedef TS AttributeSet;
   
    /**
     * @brief The type of the global index of the underlying index set.
     */
    typedef TG GlobalIndex;
    
    /**
     * @brief The type of the local index of the underlying index set.
     *
     * It has to provide a function
     * \code AttributeType attribute(); \endcode
     */
    typedef TL LocalIndex;

    /**
     * @brief The type of the underlying index set.
     */
    typedef Dune::ParallelIndexSet<GlobalIndex,LocalIndex,N> ParallelIndexSet;
    
    /**
     * @brief The type of the iterator of the selected indices.
     */
    typedef SelectionIterator<TS,TG,TL,N> iterator;
    
    /**
     * @brief The type of the iterator of the selected indices.
     */
    typedef iterator const_iterator;
  
    UncachedSelection()
      : indexSet_()
    {}
    
    UncachedSelection(const ParallelIndexSet& indexset)
      : indexSet_(&indexset)
    {}
    /**
     * @brief Set the index set of the selection.
     * @param indexset The index set to use.
     */
    void setIndexSet(const ParallelIndexSet& indexset);
    
    /**
     * @brief Get the index set we are a selection for.
     */
    //const ParallelIndexSet& indexSet() const;
    
    /**
     * @brief Get an iterator over the selected indices.
     * @return An iterator positioned at the first selected index.
     */
    const_iterator begin() const;
    
    /** 
     * @brief Get an iterator over the selected indices.
     * @return An iterator positioned at the first selected index.
     */
    const_iterator end() const;
    
	
  private:
    const ParallelIndexSet* indexSet_;
    
  };
  
  /**
   * @brief An cached selection of indices.
   */
  template<typename TS, typename TG, typename TL, int N>
  class Selection
  {
  public:
    /**
     * @brief The type of the Set of attributes.
     *
     * It has to provide a static method
     * \code bool contains(AttributeType a); \endcode
     * that returns true if a is in the set.
     * Such types are EnumItem, EnumRange, Combine.
     */
    typedef TS AttributeSet;
    
    /**
     * @brief The type of the global index of the underlying index set.
     */
    typedef TG GlobalIndex;
    
    /**
     * @brief The type of the local index of the underlying index set.
     *
     * It has to provide a function
     * \code AttributeType attribute(); \endcode
     */
    typedef TL LocalIndex;
    
    /**
     * @brief The type of the underlying index set.
     */
    typedef Dune::ParallelIndexSet<GlobalIndex,LocalIndex,N> ParallelIndexSet;
    
    /**
     * @brief The type of the iterator of the selected indices.
     */
    typedef uint32_t* iterator;
    
    /**
     * @brief The type of the iterator of the selected indices.
     */
    typedef uint32_t* const_iterator;
  
    Selection()
      : selected_()
    {}
  
    Selection(const ParallelIndexSet& indexset)
      : selected_(), size_(0), built_(false)
    {
      setIndexSet(indexset);
    }
    
    ~Selection();
    
    /**
     * @brief Set the index set of the selection.
     * @param indexset The index set to use.
     */
    void setIndexSet(const ParallelIndexSet& indexset);

    /**
     * @brief Free allocated memory.
     */
    void free();
    
    /**
     * @brief Get the index set we are a selection for.
     */
    //IndexSet indexSet() const;
    
    /**
     * @brief Get an iterator over the selected indices.
     * @return An iterator positioned at the first selected index.
     */
    const_iterator begin() const;
    
    /** 
     * @brief Get an iterator over the selected indices.
     * @return An iterator positioned at the first selected index.
     */
    const_iterator end() const;
    
	
  private:
    uint32_t* selected_;
    size_t size_;
    bool built_;
    
  };

  template<typename TS, typename TG, typename TL, int N>
  inline void Selection<TS,TG,TL,N>::setIndexSet(const ParallelIndexSet& indexset)
  {
    if(built_)
      free();
    
    // Count the number of entries the selection has to hold
    typedef typename ParallelIndexSet::const_iterator const_iterator;
    const const_iterator end = indexset.end();
    int entries = 0;
    
    for(const_iterator index = indexset.begin(); index != end; ++index)
      if(AttributeSet::contains(index->local().attribute()))
	 ++entries;

    selected_ = new uint32_t[entries];
    built_ = true;
    
    entries = 0;
    for(const_iterator index = indexset.begin(); index != end; ++index)
      if(AttributeSet::contains(index->local().attribute()))
	selected_[entries++]= index->local().local();
    
    size_=entries;
    built_=true;
  }
  
  template<typename TS, typename TG, typename TL, int N>
  uint32_t* Selection<TS,TG,TL,N>::begin() const
  {
    return selected_;
  }

  template<typename TS, typename TG, typename TL, int N>
  uint32_t* Selection<TS,TG,TL,N>::end() const
  {
    return selected_+size_;
  }
  
  template<typename TS, typename TG, typename TL, int N>
  inline void Selection<TS,TG,TL,N>::free()
  {
    delete[] selected_;
    size_=0;
    built_=false;
  }

  template<typename TS, typename TG, typename TL, int N>
  inline Selection<TS,TG,TL,N>::~Selection()
  {
    if(built_)
      free();
  }
   
  template<typename TS, typename TG, typename TL, int N>
  SelectionIterator<TS,TG,TL,N> UncachedSelection<TS,TG,TL,N>::begin() const
  {
    return SelectionIterator<TS,TG,TL,N>(indexSet_->begin(),
				       indexSet_->end());
  }
  
  template<typename TS, typename TG, typename TL, int N>
  SelectionIterator<TS,TG,TL,N> UncachedSelection<TS,TG,TL,N>::end() const
  {
    return SelectionIterator<TS,TG,TL,N>(indexSet_->end(),
				       indexSet_->end());
  }
  template<typename TS, typename TG, typename TL, int N>
  void UncachedSelection<TS,TG,TL,N>::setIndexSet(const ParallelIndexSet& indexset)
  {
    indexSet_ = &indexset;
  }
  
  /** @} */

  
}
#endif