This file is indexed.

/usr/include/dolfin/fem/DofMap.h is in libdolfin1.0-dev 1.0.0-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
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
// Copyright (C) 2007-2011 Anders Logg and Garth N. Wells
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// Modified by Martin Alnes, 2008
// Modified by Kent-Andre Mardal, 2009
// Modified by Ola Skavhaug, 2009
//
// First added:  2007-03-01
// Last changed: 2011-10-31

#ifndef __DOLFIN_DOF_MAP_H
#define __DOLFIN_DOF_MAP_H

#include <map>
#include <memory>
#include <utility>
#include <vector>
#include <boost/multi_array.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/unordered_map.hpp>
#include <ufc.h>

#include <dolfin/common/types.h>
#include <dolfin/mesh/Cell.h>
#include "GenericDofMap.h"

namespace dolfin
{

  class UFC;
  class UFCMesh;

  /// This class handles the mapping of degrees of freedom. It builds
  /// a dof map based on a ufc::dofmap on a specific mesh. It will
  /// reorder the dofs when running in parallel. Sub-dofmaps, both
  /// views and copies, are supported.

  class DofMap : public GenericDofMap
  {
  public:

    /// Create dof map on mesh (data is not shared)
    ///
    /// *Arguments*
    ///     ufc_dofmap (ufc::dofmap)
    ///         The ufc::dofmap.
    ///     mesh (_Mesh_)
    ///         The mesh.
    DofMap(boost::shared_ptr<const ufc::dofmap> ufc_dofmap, Mesh& mesh);

    /// Create dof map on mesh ((data is not shared), const mesh
    /// version)
    ///
    /// *Arguments*
    ///     ufc_dofmap (ufc::dofmap)
    ///         The ufc::dofmap.
    ///     mesh (_Mesh_)
    ///         The mesh.
    DofMap(boost::shared_ptr<const ufc::dofmap> ufc_dofmap, const Mesh& mesh);

    /// Copy constructor
    ///
    /// *Arguments*
    ///     dofmap (_DofMap_)
    ///         The object to be copied.
    DofMap(const DofMap& dofmap);

  private:

    /// Create a sub-dofmap (a view) from parent_dofmap
    DofMap(const DofMap& parent_dofmap, const std::vector<uint>& component,
           const Mesh& mesh, bool distributed);

    /// Create a collapsed dofmap from parent_dofmap
    DofMap(boost::unordered_map<uint, uint>& collapsed_map,
           const DofMap& dofmap_view, const Mesh& mesh, bool distributed);

  public:

    /// Destructor
    ~DofMap();

    /// True if dof map is a view into another map
    ///
    /// *Returns*
    ///     bool
    ///         True if the dof map is a sub-dof map (a view into
    ///         another map).
    bool is_view() const
    { return _is_view; }

    /// Return true iff mesh entities of topological dimension d are
    /// needed
    ///
    /// *Arguments*
    ///     d (unsigned int)
    ///         Topological dimension.
    ///
    /// *Returns*
    ///     bool
    ///         True if the mesh entities are needed.
    bool needs_mesh_entities(unsigned int d) const;

    /// Return the dimension of the global finite element function
    /// space
    ///
    /// *Returns*
    ///     unsigned int
    ///         The dimension of the global finite element function space.
    unsigned int global_dimension() const;

    // FIXME: Rename this function, 'cell_dimension' sounds confusing

    /// Return the dimension of the local finite element function
    /// space on a cell
    ///
    /// *Arguments*
    ///     cell_index (uint)
    ///         Index of cell
    ///
    /// *Returns*
    ///     unsigned int
    ///         Dimension of the local finite element function space.
    unsigned int cell_dimension(uint cell_index) const;

    /// Return the maximum dimension of the local finite element
    /// function space
    ///
    /// *Returns*
    ///     unsigned int
    ///         Maximum dimension of the local finite element function
    ///         space.
    unsigned int max_cell_dimension() const;

    /// Return the geometric dimension of the coordinates this dof map
    /// provides
    ///
    /// *Returns*
    ///     unsigned int
    ///         The geometric dimension.
    unsigned int geometric_dimension() const;

    /// Return number of facet dofs
    ///
    /// *Returns*
    ///     unsigned int
    ///         The number of facet dofs.
    unsigned int num_facet_dofs() const;

    /// Return the ownership range (dofs in this range are owned by
    /// this process)
    ///
    /// *Returns*
    ///     std::pair<unsigned int, unsigned int>
    ///         The ownership range.
    std::pair<unsigned int, unsigned int> ownership_range() const;

    /// Return map from nonlocal dofs that appear in local dof map to
    /// owning process
    ///
    /// *Returns*
    ///     boost::unordered_map<unsigned int, unsigned int>
    ///         The map from non-local dofs.
    const boost::unordered_map<unsigned int, unsigned int>& off_process_owner() const;

    /// Local-to-global mapping of dofs on a cell
    ///
    /// *Arguments*
    ///     cell_index (uint)
    ///         The cell index.
    ///
    /// *Returns*
    ///     std::vector<uint>
    ///         Local-to-global mapping of dofs.
    const std::vector<uint>& cell_dofs(uint cell_index) const
    {
      dolfin_assert(cell_index < _dofmap.size());
      return _dofmap[cell_index];
    }

    /// Tabulate the local-to-global mapping of dofs on a cell
    ///
    /// *Arguments*
    ///     dofs (uint)
    ///         Degrees of freedom on a cell.
    ///     cell (_Cell_)
    ///         The cell.
    void tabulate_dofs(uint* dofs, const Cell& cell) const
    {
      const uint cell_index = cell.index();
      dolfin_assert(cell_index < _dofmap.size());
      std::copy(_dofmap[cell_index].begin(), _dofmap[cell_index].end(), dofs);
    }

    /// Tabulate local-local facet dofs
    ///
    /// *Arguments*
    ///     dofs (uint)
    ///         Degrees of freedom.
    ///     local_facet (uint)
    ///         The local facet.
    void tabulate_facet_dofs(uint* dofs, uint local_facet) const;

    /// Tabulate the coordinates of all dofs on a cell (UFC cell
    /// version)
    ///
    /// *Arguments*
    ///     coordinates (boost::multi_array<double, 2>)
    ///         The coordinates of all dofs on a cell.
    ///     ufc_cell (ufc::cell)
    ///         The cell.
    void tabulate_coordinates(boost::multi_array<double, 2>& coordinates,
                                      const ufc::cell& ufc_cell) const;

    /// Tabulate the coordinates of all dofs on a cell (DOLFIN cell
    /// version)
    ///
    /// *Arguments*
    ///     coordinates (boost::multi_array<double, 2>)
    ///         The coordinates of all dofs on a cell.
    ///     cell (_Cell_)
    ///         The cell.
    void tabulate_coordinates(boost::multi_array<double, 2>& coordinates,
                                      const Cell& cell) const;

    /// Create a copy of the dof map
    ///
    /// *Arguments*
    ///     mesh (_Mesh_)
    ///         The object to be copied.
    DofMap* copy(const Mesh& mesh) const;

    /// Extract subdofmap component
    ///
    /// *Arguments*
    ///     component (std::vector<uint>)
    ///         The component.
    ///     mesh (_Mesh_)
    ///         The mesh.
    ///
    /// *Returns*
    ///     DofMap
    ///         The subdofmap component.
    DofMap* extract_sub_dofmap(const std::vector<uint>& component,
                               const Mesh& mesh) const;

    /// Create a "collapsed" dofmap (collapses a sub-dofmap)
    ///
    /// *Arguments*
    ///     collapsed_map (boost::unordered_map<uint, uint>)
    ///         The "collapsed" map.
    ///     mesh (_Mesh_)
    ///         The mesh.
    ///
    /// *Returns*
    ///     DofMap
    ///         The collapsed dofmap.
    DofMap* collapse(boost::unordered_map<uint, uint>& collapsed_map,
                     const Mesh& mesh) const;

    /// Return the set of dof indices
    ///
    /// *Returns*
    ///     boost::unordered_set<dolfin::uint>
    ///         The set of dof indices.
    boost::unordered_set<uint> dofs() const;

    /// Return the underlying dof map data. Intended for internal library
    /// use only.
    ///
    /// *Returns*
    ///     std::vector<std::vector<dolfin::uint> >
    ///         The local-to-global map for each cell.
    const std::vector<std::vector<uint> >& data() const
    { return _dofmap; }

    /// Renumber dofs
    ///
    /// *Arguments*
    ///     renumbering_map (std::vector<uint>)
    ///         The map of dofs to be renumbered.
    void renumber(const std::vector<uint>& renumbering_map);

    /// Return informal string representation (pretty-print)
    ///
    /// *Arguments*
    ///     verbose (bool)
    ///         Flag to turn on additional output.
    ///
    /// *Returns*
    ///     std::string
    ///         An informal representation of the function space.
    std::string str(bool verbose) const;

  private:

    // Friends
    friend class DofMapBuilder;

    // Recursively extract UFC sub-dofmap and compute offset
    static ufc::dofmap* extract_ufc_sub_dofmap(const ufc::dofmap& ufc_dofmap,
                                            uint& offset,
                                            const std::vector<uint>& component,
                                            const ufc::mesh ufc_mesh,
                                            const Mesh& dolfin_mesh);

    // Initialize the UFC dofmap
    static void init_ufc_dofmap(ufc::dofmap& dofmap, const ufc::mesh ufc_mesh,
                                const Mesh& dolfin_mesh);

    // Check dimensional consistency between UFC dofmap and the mesh
    static void check_dimensional_consistency(const ufc::dofmap& dofmap,
                                              const Mesh& mesh);

    // Local-to-global dof map (dofs for cell dofmap[i])
    std::vector<std::vector<uint> > _dofmap;

    // UFC dof map
    boost::scoped_ptr<ufc::dofmap> _ufc_dofmap;

    // Map from UFC dof numbering to renumbered dof (ufc_dof, actual_dof)
    boost::unordered_map<uint, uint> ufc_map_to_dofmap;

    // UFC dof map offset
    unsigned int ufc_offset;

    // Ownership range (dofs in this range are owned by this process)
    std::pair<uint, uint> _ownership_range;

    // Owner (process) of dofs in local dof map that do not belong to
    // this process
    boost::unordered_map<uint, uint> _off_process_owner;

    // True iff sub-dofmap (a view, i.e. not collapsed)
    bool _is_view;

    // True iff running in parallel
    bool _distributed;

  };

}

#endif