This file is indexed.

/usr/bin/dolfin-plot is in dolfin-bin 2016.2.0-2.

This file is owned by root:root, with mode 0o755.

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
139
140
141
142
143
144
145
146
147
148
149
#! /usr/bin/python

"Script for simple command-line plotting."

# Copyright (C) 2010 Anders Logg
#
# 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 Marie E. Rognes, 2010
#
# First added:  2010-12-08
# Last changed: 2010-12-22

import sys

# Try importing DOLFIN
try:
    from dolfin import *
except:
    print """\
Unable to import DOLFIN. The DOLFIN Python module is required
to run this script. Check that DOLFIN is in your PYTHONPATH."""
    sys.exit(1)

def usage():
    "Print usage of this script."

    # Build list of supported elements
    element_list = ""
    for e in supported_elements_for_plotting:
        if e in supported_elements:
            element_list += ("   %s\n" % e)
        else:
            element_list += ("   %s (*)\n" % e)

    print """\
Usage:

1. dolfin-plot <meshfile>

   where <meshfile> is a mesh stored in DOLFIN XML format
   with suffix .xml or .xml.gz.

2. dolfin-plot <family> <domain> [degree] [rotate=1/0]

   where <family> is the name of a finite element family,
   <domain> is the domain type ('triangle' or 'tetrahedron'),
   and <degree> is an optional degree for elements that
   support variable degree.

Examples:

   dolfin-plot mesh.xml
   dolfin-plot Lagrange triangle 3
   dolfin-plot BDM tetrahedron 5
   dolfin-plot Hermite triangle

List of supported element families:

%s
A (*) indicates that the element is not supported by DOLFIN/FFC,
but the element may still be plotted.
""" % element_list

# Check command-line arguments
if len(sys.argv) < 2:
    usage()
    sys.exit(1)

# Check for help text
if "-h" in sys.argv[1:] or "--help" in sys.argv[1:]:
    usage()
    sys.exit(0)

# Extract arguments and options
args = [arg for arg in sys.argv[1:] if not "=" in arg]
options = dict([arg.split("=") for arg in sys.argv[1:] if "=" in arg])

# Check for plotting of mesh
if len(args) == 1:

    # Read mesh
    print "Reading mesh from file '%s'." % args[0]
    try:
        mesh = Mesh(args[0])
    except:
        print "Unable to read mesh from file."
        sys.exit(1)

    # Plot mesh
    print "Plotting mesh."
    plot(mesh, title="Mesh", interactive=True)

    sys.exit(0)

# Check for plotting of element
if len(args) in (2, 3, 4):

    # Get family and domain
    family, domain = args[:2]

    # Get degree
    if len(args) == 2:
        degree = None
    else:
        degree = int(args[2])


    # Create element
    print "Creating finite element."

    if len(args) == 3 or len(args) == 2:
        element = FiniteElement(family, domain, degree)
    elif len(args) == 4:
        assert family == "P Lambda" or family == "P- Lambda"
        form_degree = int(args[3])
        element = FiniteElement(family, domain, degree, form_degree)
    else:
        pass

    # Rotate by default in 3D
    rotate = 1 if str(domain) == "tetrahedron" else 0

    # Check for rotate option
    if "rotate" in options:
        rotate = int(options["rotate"])

    # Plot element
    print "Plotting finite element."
    plot(element, rotate=rotate)

    sys.exit(0)

# Catch all
usage()
sys.exit(1)