This file is indexed.

/usr/include/libwildmagic/Wm5UniqueVerticesTriangles.inl is in libwildmagic-dev 5.13-1ubuntu3.

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
// Geometric Tools, LLC
// Copyright (c) 1998-2014
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.0 (2010/01/01)

//----------------------------------------------------------------------------
template <int N, typename Real>
UniqueVerticesTriangles<N,Real>::UniqueVerticesTriangles (int numTriangles,
    const Tuple<N,Real>* inVertices, int& numOutVertices,
    Tuple<N,Real>*& outVertices, int*& outIndices)
{
    assertion(numTriangles > 0 && inVertices,
        "Invalid inputs to UniqueVerticesTriangles constructor\n");

    ConstructUniqueVertices(3*numTriangles,inVertices,numOutVertices,
        outVertices);

    // The input index array is implicitly {<0,1,2>,<3,4,5>,...,<n-3,n-2,n-1>}
    // where n is the number of vertices.  The output index array is the same
    // as the mapping array.
    int numIndices = 3*numTriangles;
    outIndices = new1<int>(numIndices);
    size_t numBytes = numIndices*sizeof(int);
    memcpy(outIndices, mInToOutMapping, numBytes);
}
//----------------------------------------------------------------------------
template <int N, typename Real>
UniqueVerticesTriangles<N,Real>::UniqueVerticesTriangles (int numInVertices,
    const Tuple<N,Real>* inVertices, int numTriangles, const int* inIndices,
    int& numOutVertices, Tuple<N,Real>*& outVertices, int*& outIndices)
{
    assertion(
        numInVertices > 0 && inVertices && numTriangles > 0 && inIndices,
        "Invalid inputs to UniqueVerticesTriangles constructor\n");

    ConstructUniqueVertices(numInVertices, inVertices, numOutVertices,
        outVertices);

    // The input index array needs it indices mapped to the unique vertex
    // indices.
    int numIndices = 3*numTriangles;
    outIndices = new1<int>(numIndices);
    for (int i = 0; i < numIndices; ++i)
    {
        assertion(0 <= inIndices[i] && inIndices[i] < numInVertices,
            "Invalid condition in UniqueVerticesTriangles constructor\n");

        outIndices[i] = mInToOutMapping[inIndices[i]];

        assertion(0 <= outIndices[i] && outIndices[i] < numOutVertices,
            "Invalid condition in UniqueVerticesTriangles constructor\n");
    }
}
//----------------------------------------------------------------------------
template <int N, typename Real>
UniqueVerticesTriangles<N,Real>::~UniqueVerticesTriangles ()
{
    delete1(mInToOutMapping);
}
//----------------------------------------------------------------------------
template <int N, typename Real>
int UniqueVerticesTriangles<N,Real>::GetOutputIndexFor (int inputIndex) const
{
    assertion(0 <= inputIndex && inputIndex < mNumInVertices,
        "Invalid condition in GetOutputIndexFor\n");

    return mInToOutMapping[inputIndex];
}
//----------------------------------------------------------------------------
template <int N, typename Real>
void UniqueVerticesTriangles<N,Real>::ConstructUniqueVertices (
    int numInVertices, const Tuple<N,Real>* inVertices, int& numOutVertices,
    Tuple<N,Real>*& outVertices)
{
    // Construct the unique vertices.
    mNumInVertices = numInVertices;
    mInToOutMapping = new1<int>(mNumInVertices);
    std::map<Tuple<N,Real>,int> table;
    mNumOutVertices = 0;
    typename std::map<Tuple<N,Real>,int>::iterator iter;
    for (int i = 0; i < mNumInVertices; ++i)
    {
        iter = table.find(inVertices[i]);
        if (iter != table.end())
        {
            // Vertex i is a duplicate of one inserted earlier into the
            // table.  Map vertex i to the first-found copy.
            mInToOutMapping[i] = iter->second;
        }
        else
        {
            // Vertex i is the first occurrence of such a point.
            table.insert(std::make_pair(inVertices[i], mNumOutVertices));
            mInToOutMapping[i] = mNumOutVertices;
            mNumOutVertices++;
        }
    }

    // Pack the unique vertices into an array in the correct order.
    numOutVertices = mNumOutVertices;
    outVertices = new1<Tuple<N,Real> >(mNumOutVertices);
    for (iter = table.begin(); iter != table.end(); iter++)
    {
        assertion(0 <= iter->second && iter->second < mNumOutVertices,
            "Invalid condition in ConstructUniqueVertices\n");

        outVertices[iter->second] = iter->first;
    }
}
//----------------------------------------------------------------------------