This file is indexed.

/usr/include/dune/pdelab/gridfunctionspace/gridfunctionspacebase.hh is in libdune-pdelab-dev 2.5.0~20170124g7cf9f47a-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
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
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_GRIDFUNCTIONSPACEBASE_HH
#define DUNE_PDELAB_GRIDFUNCTIONSPACE_GRIDFUNCTIONSPACEBASE_HH

#include <dune/typetree/visitor.hh>
#include <dune/typetree/traversal.hh>

#include <dune/pdelab/common/exceptions.hh>

namespace Dune {
  namespace PDELab {

    //! \addtogroup GridFunctionSpace grid function space
    //! \ingroup PDELab
    //! \{

#ifndef DOXYGEN

    // forward declaration for friend declaration
    template<typename GFS, typename GFSTraits>
    class GridFunctionSpaceBase;

    namespace impl {

      struct reset_root_space_flag
        : public TypeTree::DirectChildrenVisitor
        , public TypeTree::DynamicTraversal
      {

        template<typename GFS, typename Child, typename TreePath, typename ChildIndex>
        void afterChild(const GFS& gfs, Child& child, TreePath, ChildIndex) const
        {
          if (child._initialized && child._is_root_space)
            {
              DUNE_THROW(GridFunctionSpaceHierarchyError,"initialized space cannot become part of larger GridFunctionSpace tree");
            }
          child._is_root_space = false;
        }

      };

      template<typename size_type>
      struct update_ordering_data;

      // helper class with minimal dependencies. Orderings keep a pointer to this structure and populate it
      // during their update procedure.

      template<typename size_type>
      class GridFunctionSpaceOrderingData
      {

        template<typename,typename>
        friend class ::Dune::PDELab::GridFunctionSpaceBase;

        template<typename>
        friend struct update_ordering_data;

        GridFunctionSpaceOrderingData()
          : _size(0)
          , _block_count(0)
          , _global_size(0)
          , _max_local_size(0)
          , _is_root_space(true)
          , _initialized(false)
          , _size_available(true)
        {}

        size_type _size;
        size_type _block_count;
        size_type _global_size;
        size_type _max_local_size;
        bool _is_root_space;
        bool _initialized;
        bool _size_available;

      };

      template<typename size_type>
      struct update_ordering_data
        : public TypeTree::TreeVisitor
        , public TypeTree::DynamicTraversal
      {

        typedef GridFunctionSpaceOrderingData<size_type> Data;

        template<typename Ordering>
        void update(const Ordering& ordering, bool is_root)
        {
          if (ordering._gfs_data)
            {
              Data& data = *ordering._gfs_data;
              // if (data._initialized && data._is_root_space && !is_root)
              //   {
              //     DUNE_THROW(GridFunctionSpaceHierarchyError,"former root space is now part of a larger tree");
              //   }
              data._initialized = true;
              data._global_size = _global_size;
              data._max_local_size = _max_local_size;
              data._size_available = ordering.update_gfs_data_size(data._size,data._block_count);
            }
        }

        template<typename Ordering, typename TreePath>
        void leaf(const Ordering& ordering, TreePath tp)
        {
          update(ordering,tp.size() == 0);
        }

        template<typename Ordering, typename TreePath>
        void post(const Ordering& ordering, TreePath tp)
        {
          update(ordering,tp.size() == 0);
        }

        template<typename Ordering>
        explicit update_ordering_data(const Ordering& ordering)
          : _global_size(ordering.size())
          , _max_local_size(ordering.maxLocalSize())
        {}

        const size_type _global_size;
        const size_type _max_local_size;

      };


    } // namespace impl

#endif // DOXYGEN


    template<typename GFS, typename GFSTraits>
    class GridFunctionSpaceBase
      : public impl::GridFunctionSpaceOrderingData<typename GFSTraits::SizeType>
    {

      friend struct impl::reset_root_space_flag;

    public:

      typedef GFSTraits Traits;

      template<typename Backend_, typename OrderingTag_>
      GridFunctionSpaceBase(Backend_&& backend, OrderingTag_&& ordering_tag)
        : _backend(std::forward<Backend_>(backend))
        , _ordering_tag(std::forward<OrderingTag_>(ordering_tag))
      {
        TypeTree::applyToTree(gfs(),impl::reset_root_space_flag());
      }

      typename Traits::SizeType size() const
      {
        if (!_initialized)
          {
            DUNE_THROW(UninitializedGridFunctionSpaceError,"space is not initialized");
          }
        if (!_size_available)
          {
            DUNE_THROW(GridFunctionSpaceHierarchyError,
                       "Size cannot be calculated at this point in the GFS tree.");
          }
        return _size;
      }

      typename Traits::SizeType blockCount() const
      {
        if (!_initialized)
          {
            DUNE_THROW(UninitializedGridFunctionSpaceError,"space is not initialized");
          }
        if (!_size_available)
          {
            DUNE_THROW(GridFunctionSpaceHierarchyError,
                       "Block count cannot be calculated at this point in the GFS tree.");
          }
        return _block_count;
      }

      typename Traits::SizeType globalSize() const
      {
        if (!_initialized)
          {
            DUNE_THROW(UninitializedGridFunctionSpaceError,"space is not initialized");
          }
        return _global_size;
      }

      //! get max dimension of shape function space
      typename Traits::SizeType maxLocalSize () const
      {
        if (!_initialized)
          {
            DUNE_THROW(UninitializedGridFunctionSpaceError,"space is not initialized");
          }
        return _max_local_size;
      }

      //! Update the indexing information of the GridFunctionSpace.
      /**
       *
       * \ param force   Set to true if the underlying grid has changed (e.g. due to adaptivity)
       *                 to force an update of the embedded EntitySet.
       */
      void update(bool force = false)
      {
        auto entity_set = gfs().entitySet();
        entity_set.update(force);
        // We bypass the normal access using ordering() here to avoid a double
        // update if the Ordering has not been created yet.
        if (!gfs()._ordering)
          gfs().create_ordering();
        update(*gfs()._ordering);
      }

      const std::string& name() const
      {
        return _name;
      }

      void name(const std::string& name)
      {
        _name = name;
      }

      typename Traits::Backend& backend()
      {
        return _backend;
      }

      const typename Traits::Backend& backend() const
      {
        return _backend;
      }

      typename Traits::OrderingTag& orderingTag()
      {
        return _ordering_tag;
      }

      const typename Traits::OrderingTag& orderingTag() const
      {
        return _ordering_tag;
      }

      bool isRootSpace() const
      {
        return _is_root_space;
      }

    protected:

      template<typename Ordering>
      void update(Ordering& ordering) const
      {
        if (!_is_root_space)
          {
            DUNE_THROW(GridFunctionSpaceHierarchyError,"update() may only be called on the root of the function space hierarchy");
          }
        ordering.update();
        TypeTree::applyToTree(ordering,impl::update_ordering_data<typename Traits::SizeType>(ordering));
      }

    private:

      typedef impl::GridFunctionSpaceOrderingData<typename GFSTraits::SizeType> BaseT;

      GFS& gfs()
      {
        return static_cast<GFS&>(*this);
      }

      const GFS& gfs() const
      {
        return static_cast<const GFS&>(*this);
      }

      std::string _name;
      typename Traits::Backend _backend;
      typename Traits::OrderingTag _ordering_tag;

      using BaseT::_size;
      using BaseT::_block_count;
      using BaseT::_global_size;
      using BaseT::_max_local_size;
      using BaseT::_is_root_space;
      using BaseT::_initialized;
      using BaseT::_size_available;

    };


  } // namespace PDELab
} // namespace Dune

#endif // DUNE_PDELAB_GRIDFUNCTIONSPACE_GRIDFUNCTIONSPACEBASE_HH