This file is indexed.

/usr/lib/python2.7/dist-packages/ffc/uflacs/uflacsgenerator.py is in python-ffc 2016.2.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
# -*- coding: utf-8 -*-
# Copyright (C) 2013-2016 Martin Sandve Alnæs
#
# This file is part of FFC.
#
# FFC 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.
#
# FFC 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 FFC. If not, see <http://www.gnu.org/licenses/>.

"""Controlling algorithm for building the tabulate_tensor
source structure from factorized representation."""

from ffc.log import info
from ffc.representationutils import initialize_integral_code

from ffc.uflacs.backends.ffc.backend import FFCBackend
from ffc.uflacs.generation.integralgenerator import IntegralGenerator
from ffc.uflacs.language.format_lines import format_indented_lines


def generate_integral_code(ir, prefix, parameters):
    "Generate code for integral from intermediate representation."

    info("Generating code from ffc.uflacs representation")

    # Generate generic ffc code snippets
    code = initialize_integral_code(ir, prefix, parameters)

    # Generate tabulate_tensor body using uflacs algorithms
    uflacs_code = generate_tabulate_tensor_code(ir, prefix, parameters)

    code["tabulate_tensor"] = uflacs_code["tabulate_tensor"]

    # TODO: Use code generation utils here for consistency
    if ir.get("num_cells") is not None:
        code["num_cells"] = "  return %d;" % (ir["num_cells"],)

    code["additional_includes_set"] = set()
    code["additional_includes_set"].update(ir.get("additional_includes_set",()))
    code["additional_includes_set"].update(uflacs_code["additional_includes_set"])

    return code


def generate_tabulate_tensor_code(ir, prefix, parameters):

    # Create FFC C++ backend
    backend = FFCBackend(ir, parameters)

    # Create code generator for integral body
    ig = IntegralGenerator(ir, backend)

    # Generate code ast for the tabulate_tensor body
    parts = ig.generate()

    # Format code AST as one string
    body = format_indented_lines(parts.cs_format(), 1)

    # Fetch includes
    includes = set(ig.get_includes())

    # Format uflacs specific code structures into a single
    # string and place in dict before returning to ffc
    code = {
        "tabulate_tensor": body,
        "additional_includes_set": includes,
    }

    return code