This file is indexed.

/usr/share/pyshared/sfc/geometry/mappings.py is in sfc 1.0.0.dfsg-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
    # -*- coding: utf-8 -*-
"""
This module contains functions for computing 
integrals both symbolically and numerically.
"""

# Copyright (C) 2007-2009 Martin Sandve Alnes and Simula Resarch Laboratory
#
# This file is part of SyFi.
#
# SyFi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# SyFi 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SyFi. If not, see <http://www.gnu.org/licenses/>.
#
# First added:  2007-11-07
# Last changed: 2009-03-04

import swiginac
import SyFi

from sfc.quadrature import find_quadrature_rule
from sfc.symbolic_utils import symbol, symbols
from sfc.geometry.UFCCell import UFCCell


def geometry_mapping(polygon):
    """
    This function computes the geometry mapping from
    the corresponding reference polygon to polygon.
    It returns the tuple (G,x0) in the
    mapping x = G xi + x0
    """

    vlen = SyFi.cvar.nsd 

    # If we get a point, return this trivial mapping
    if isinstance(polygon, swiginac.matrix):
        # x = 1 * xi + x0 = x0 because xi is always zero at the point
        assert vlen == 1
        assert polygon.rows() == 1
        assert polygon.cols() == 1
        G  = swiginac.matrix(1, 1, [1])
        x0 = polygon
        return G, x0

    Gl = []
    v0 = polygon.vertex(0)
    v1 = polygon.vertex(1)
    
    assert vlen == len(v0)

    if isinstance(polygon, SyFi.Line):
        Gl.extend(v1[k] - v0[k] for k in range(vlen))

    elif isinstance(polygon, SyFi.Triangle):
        if vlen == 2 or vlen == 3:
            v2 = polygon.vertex(2)
            Gl.extend(v1[k] - v0[k] for k in range(vlen))
            Gl.extend(v2[k] - v0[k] for k in range(vlen))
        else:
            raise RuntimeError("Unsupported vertex size.")

    elif isinstance(polygon, SyFi.Rectangle):
        if vlen == 2 or vlen == 3: # TODO: improve mapping
            v2 = polygon.vertex(2)
            v3 = polygon.vertex(3)
            Gl.extend(v1[k] - v0[k] for k in range(vlen))
            Gl.extend(v3[k] - v0[k] for k in range(vlen))
        else:
            raise RuntimeError("Unsupported vertex size.")

    elif isinstance(polygon, SyFi.Tetrahedron):
        if vlen != 3:
            raise RuntimeError("Unsupported vertex size.")
        v2 = polygon.vertex(2)
        v3 = polygon.vertex(3)
        Gl.extend(v1[k] - v0[k] for k in range(vlen))
        Gl.extend(v2[k] - v0[k] for k in range(vlen))
        Gl.extend(v3[k] - v0[k] for k in range(vlen))

    elif isinstance(polygon, SyFi.Box):
        if vlen != 3:
            raise RuntimeError("Unsupported vertex size.")
        v2 = polygon.vertex(2) # TODO: improve mapping
        v3 = polygon.vertex(3)
        v4 = polygon.vertex(4)
        Gl.extend(v1[k] - v0[k] for k in range(vlen))
        Gl.extend(v3[k] - v0[k] for k in range(vlen))
        Gl.extend(v4[k] - v0[k] for k in range(vlen))

    else:
        raise RuntimeError("Unsupported polygon type.")

    G  = swiginac.matrix(vlen, vlen, Gl).transpose()
    x0 = swiginac.matrix(vlen, 1, v0)

    #print "G =", G

    return G, x0