This file is indexed.

/usr/include/dolfin/mesh/LocalMeshValueCollection.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
// Copyright (C) 201 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 Anders Logg, 2008-2009.
//
// First added:  2008-11-28
// Last changed: 2011-03-25
//
// Modified by Anders Logg, 2008-2009.
// Modified by Kent-Andre Mardal, 2011.


#ifndef __LOCAL_MESH_VALUE_COLLECTION_H
#define __LOCAL_MESH_VALUE_COLLECTION_H

#include <map>
#include <utility>
#include <vector>
#include <dolfin/common/MPI.h>
#include <dolfin/common/types.h>
#include <dolfin/log/log.h>

namespace dolfin
{

  template <typename T> class MeshValueCollection;

  /// This class stores mesh data on a local processor corresponding
  /// to a portion of a MeshValueCollection.

  template <typename T>
  class LocalMeshValueCollection
  {
  public:

    /// Create local mesh data for given LocalMeshValueCollection
    LocalMeshValueCollection(const MeshValueCollection<T>& values, uint dim);

    /// Destructor
    ~LocalMeshValueCollection() {}

    /// Return dimension of cell entity
    uint dim () const
    { return _dim; }

    /// Return data
    const std::vector<std::pair<std::pair<uint, uint>, T> >& values() const
    { return _values; }

  private:

    /// Topological dimension
    const uint _dim;

    // MeshValueCollection values (cell_index, local_index), value))
    std::vector<std::pair<std::pair<uint, uint>, T> >  _values;

  };

  //---------------------------------------------------------------------------
  // Implementation of LocalMeshValueCollection
  //---------------------------------------------------------------------------
  template <typename T>
  LocalMeshValueCollection<T>::LocalMeshValueCollection(const MeshValueCollection<T>& values,
                                                        uint dim)
      : _dim(dim)
  {
    // Prepare data
    std::vector<std::vector<uint> > send_indices;
    std::vector<std::vector<T> > send_v;

    // Extract data on main process and split among processes
    if (MPI::is_broadcaster())
    {
      // Get number of processes
      const uint num_processes = MPI::num_processes();
      send_indices.resize(num_processes);
      send_v.resize(num_processes);

      const std::map<std::pair<uint, uint>, T>& vals = values.values();
      for (uint p = 0; p < num_processes; p++)
      {
        const std::pair<uint, uint> local_range = MPI::local_range(p, vals.size());
        typename std::map<std::pair<uint, uint>, T>::const_iterator it = vals.begin();
        std::advance(it, local_range.first);
        for (uint i = local_range.first; i < local_range.second; ++i)
        {
          send_indices[p].push_back(it->first.first);
          send_indices[p].push_back(it->first.second);
          send_v[p].push_back(it->second);
          std::advance(it, 1);
        }
      }
    }

    // Scatter data
    std::vector<uint> indices;
    std::vector<T> v;
    MPI::scatter(send_indices, indices);
    MPI::scatter(send_v, v);
    dolfin_assert(2*v.size() == indices.size());

    // Unpack
    for (uint i = 0; i < v.size(); ++i)
    {
      const uint cell_index = indices[2*i];
      const uint local_entity_index = indices[2*i + 1];
      const T value = v[i];

      _values.push_back( std::make_pair( std::make_pair(cell_index, local_entity_index) , value) );
    }
  }
  //---------------------------------------------------------------------------

}

#endif