This file is indexed.

/usr/include/dolfin/mesh/DistributedMeshTools.h is in libdolfin-dev 1.4.0+dfsg-4.

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
// Copyright (C) 2011-2013 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/>.
//
// First added:  2011-09-17
// Last changed: 2013-01-29

#ifndef __MESH_DISTRIBUTED_TOOLS_H
#define __MESH_DISTRIBUTED_TOOLS_H

#include <map>
#include <numeric>
#include <set>
#include <utility>
#include <vector>
#include <boost/array.hpp>
#include <boost/unordered_map.hpp>
#include <dolfin/common/MPI.h>

namespace dolfin
{

  class Mesh;

  /// This class provides various funtionality for working with
  /// distributed meshes.

  class DistributedMeshTools
  {
  public:

    /// Create global entity indices for entities of dimension d
    static void number_entities(const Mesh& mesh, std::size_t d);

    /// Create global entity indices for entities of dimension d for
    /// given global vertex indices.
    static std::size_t number_entities(
      const Mesh& mesh,
      const std::map<unsigned int, std::pair<unsigned int,
      unsigned int> >& slave_entities,
      std::vector<std::size_t>& global_entity_indices,
      std::map<unsigned int, std::set<unsigned int> >& shared_entities,
      std::size_t d);

    // Compute number of cells connected to each facet
    // (globally). Facets on internal boundaries will be connected to
    // two cells (with the cells residing on neighboring processes)
    static void init_facet_cell_connections(Mesh& mesh);

    /// Find processes that own or share mesh entities (using entity
    /// global indices). Returns (global_dof, set(process_num,
    /// local_index)). Exclusively local entities will not appear in
    /// the map. Works only for vertices and cells
    static
      std::map<std::size_t, std::set<std::pair<std::size_t, std::size_t> > >
      locate_off_process_entities(const std::vector<std::size_t>&
                                  entity_indices,
                                  std::size_t dim, const Mesh& mesh);

    /// Compute map from local index of shared entity to list
    /// of sharing process and local index,
    /// i.e. (local index, [(sharing process p, local index on p)])
    static boost::unordered_map<unsigned int,
      std::vector<std::pair<unsigned int, unsigned int> > >
      compute_shared_entities(const Mesh& mesh, std::size_t d);

  private:

    // Data structure for a mesh entity (list of vertices, using
    // global indices)
    typedef std::vector<std::size_t> Entity;

    // Data structure to mesh entity data
    struct EntityData
    {
      // Constructor
      EntityData() : local_index(0) {}

      // Constructor  (index is local)
      explicit EntityData(unsigned int index) : local_index(index) {}

      // Constructor (index is local)
      EntityData(unsigned int index, const std::vector<unsigned int>& procs)
        : local_index(index), processes(procs) {}

      // Constructor  (index is local)
      EntityData(unsigned int index, unsigned int process)
        : local_index(index), processes(1, process) {}

      // Local (this process) entity index
      unsigned int local_index;

      // Processes on which entity resides
      std::vector<unsigned int> processes;
    };

    // Compute ownership of entities ([entity vertices], data)
    //  [0]: owned exclusively (will be numbered by this process)
    //  [1]: owned and shared (will be numbered by this process, and number
    //       communicated to other processes)
    //  [2]: not owned but shared (will be numbered by another process,
    //       and number communicated to this processes)
    static void compute_entity_ownership(
      const MPI_Comm mpi_comm,
      const std::map<std::vector<std::size_t>, unsigned int>& entities,
      const std::map<unsigned int, std::set<unsigned int> >& shared_vertices_local,
      const std::vector<std::size_t>& global_vertex_indices,
      std::size_t d,
      std::vector<std::size_t>& owned_entities,
      boost::array<std::map<Entity, EntityData>, 2>& shared_entities);

    // Build preliminary 'guess' of shared entities. This function does
    // not involve any inter-process communication.
    static void compute_preliminary_entity_ownership(
      const MPI_Comm mpi_comm,
      const std::map<std::size_t, std::set<unsigned int> >& shared_vertices,
      const std::map<Entity, unsigned int>& entities,
      std::vector<std::size_t>& owned_entities,
      boost::array<std::map<Entity, EntityData>, 2>& entity_ownership);

    // Communicate with other processes to finalise entity ownership
    static void
      compute_final_entity_ownership(const MPI_Comm mpi_comm,
                                     std::vector<std::size_t>& owned_entities,
                                     boost::array<std::map<Entity,
                                     EntityData>, 2>& entity_ownership);

    // Check if all entity vertices are the shared vertices in overlap
    static bool is_shared(const std::vector<std::size_t>& entity_vertices,
                const std::map<std::size_t, std::set<unsigned int> >& shared_vertices);

    // Compute and return (number of global entities, process offset)
    static std::pair<std::size_t, std::size_t>
      compute_num_global_entities(const MPI_Comm mpi_comm,
                                  std::size_t num_local_entities,
                                  std::size_t num_processes,
                                  std::size_t process_number);

  };

}

#endif