This file is indexed.

/usr/include/dune/grid-glue/common/projectionwriter_impl.hh is in libdune-grid-glue-dev 2.4.0-1build1.

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
#include <fstream>

namespace Dune {
namespace GridGlue {

namespace ProjectionWriterImplementation {

template<unsigned side, typename Coordinate, typename Corners>
void write_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
{
  using namespace ProjectionImplementation;
  using std::get;
  const unsigned other_side = 1 - side;

  for (const auto& c : get<side>(corners))
    out << c << "\n";

  for (const auto& i : get<side>(projection.images())) {
    const auto global = interpolate(i, get<other_side>(corners));
    out << global << "\n";
  }
}

template<unsigned side, typename Coordinate, typename Normals>
void write_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
{
  using namespace ProjectionImplementation;
  using std::get;
  const unsigned other_side = 1 - side;

  for (const auto& n : get<side>(normals))
    out << n << "\n";

  for (const auto& x : get<side>(projection.images())) {
    const auto n = interpolate_unit_normals(x, get<other_side>(normals));
    out << n << "\n";
  }
}

template<typename Coordinate, typename Corners>
void write_edge_intersection_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
{
  using namespace ProjectionImplementation;
  using std::get;

  for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
    const auto& local = projection.edgeIntersections()[i].local;
    out << interpolate(local[0], get<0>(corners)) << "\n"
        << interpolate(local[1], get<1>(corners)) << "\n";
  }
}

template<typename Coordinate, typename Normals>
void write_edge_intersection_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
{
  using namespace ProjectionImplementation;
  using std::get;

  for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
    const auto& local = projection.edgeIntersections()[i].local;
    const auto n0 = interpolate_unit_normals(local[0], get<0>(normals));
    const auto n1 = interpolate_unit_normals(local[1], get<1>(normals));

    out << n0 << "\n"
        << n1 << "\n";
  }
}

template<unsigned side, typename Coordinate>
void write_success(const Projection<Coordinate>& projection, std::ostream& out)
{
  using std::get;

  out << side << "\n";

  const auto& success = get<side>(projection.success());
  for (std::size_t i = 0; i < success.size(); ++i)
    out << (success[i] ? "1\n" : "0\n");
}

} /* namespace ProjectionWriterImplementation */

template<typename Coordinate, typename Corners, typename Normals>
void write(const Projection<Coordinate>& projection,
           const Corners& corners,
           const Normals& normals,
           std::ostream& out)
{
  using namespace ProjectionWriterImplementation;

  const auto numberOfEdgeIntersections = projection.numberOfEdgeIntersections();
  const auto nPoints = 12 + 2 * numberOfEdgeIntersections;

  out << "# vtk DataFile Version2.0\n"
      << "Filename: projection\n"
      << "ASCII\n"
      << "DATASET UNSTRUCTURED_GRID\n"
      << "POINTS " << nPoints << " double\n";
  write_points<0>(projection, corners, out);
  write_points<1>(projection, corners, out);
  write_edge_intersection_points(projection, corners, out);
  out << "CELLS " << (8 + numberOfEdgeIntersections) << " " << (26 + 3 * numberOfEdgeIntersections) << "\n";
  out << "3 0 1 2\n" "2 0 3\n" "2 1 4\n" "2 2 5\n"
      << "3 6 7 8\n" "2 6 9\n" "2 7 10\n" "2 8 11\n";
  for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    out << "2 " << (12 + 2*i) << " " << (12 + 2*i + 1) << "\n";
  out << "CELL_TYPES " << (8 + numberOfEdgeIntersections) << "\n" "5\n3\n3\n3\n" "5\n3\n3\n3\n";
  for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    out << "3\n";
  out << "CELL_DATA " << (8 + numberOfEdgeIntersections) << "\n";
  out << "SCALARS success int 1\n"
      << "LOOKUP_TABLE success\n";
  write_success<0>(projection, out);
  write_success<1>(projection, out);
  for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
    out << "2\n";
  out << "LOOKUP_TABLE success 2\n"
      << "1.0 0.0 0.0 1.0\n"
      << "0.0 1.0 0.0 1.0\n";
  out << "POINT_DATA " << nPoints << "\n"
      << "NORMALS normals double\n";
  write_normals<0>(projection, normals, out);
  write_normals<1>(projection, normals, out);
  write_edge_intersection_normals(projection, normals, out);
}

template<typename Coordinate, typename Corners, typename Normals>
void write(const Projection<Coordinate>& projection,
           const Corners& corners,
           const Normals& normals,
           const std::string& filename)
{
  std::ofstream out(filename.c_str());
  write(projection, corners, normals, out);
}

} /* namespace GridGlue */
} /* namespace Dune */