-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# Copyright (C) 2008 Anders Logg
#
# Convert each mesh
for filename in args:
- print "Ordering %s" % filename
+ print( "Ordering {:s}".format(filename) )
# Read and order mesh
mesh = Mesh(filename)
def usage():
"Print usage instructions"
- print "Usage: dolfin-order mesh0.xml[.gz] [mesh1.xml[.gz] mesh2.xml[.gz] ...]"
+ print( "Usage: dolfin-order mesh0.xml[.gz] [mesh1.xml[.gz] mesh2.xml[.gz] ...]" )
if __name__ == "__main__":
main(sys.argv[1:])
-#!/usr/bin/env python
+#!/usr/bin/env python3
"Script for simple command-line plotting."
# Last changed: 2010-12-22
import sys
+import ffc
+import matplotlib.pyplot as plt
# Try importing DOLFIN
try:
from dolfin import *
except:
- print """\
+ print( """\
Unable to import DOLFIN. The DOLFIN Python module is required
-to run this script. Check that DOLFIN is in your PYTHONPATH."""
+to run this script. Check that DOLFIN is in your PYTHONPATH.""" )
sys.exit(1)
def usage():
# Build list of supported elements
element_list = ""
- for e in supported_elements_for_plotting:
- if e in supported_elements:
+ for e in ffc.supported_elements_for_plotting:
+ if e in ffc.supported_elements:
element_list += (" %s\n" % e)
else:
element_list += (" %s (*)\n" % e)
- print """\
+ print( """\
Usage:
1. dolfin-plot <meshfile>
%s
A (*) indicates that the element is not supported by DOLFIN/FFC,
but the element may still be plotted.
-""" % element_list
+""" % element_list )
# Check command-line arguments
if len(sys.argv) < 2:
if len(args) == 1:
# Read mesh
- print "Reading mesh from file '%s'." % args[0]
+ print( "Reading mesh from file '%s'." % args[0] )
try:
mesh = Mesh(args[0])
except:
- print "Unable to read mesh from file."
+ print( "Unable to read mesh from file." )
sys.exit(1)
# Plot mesh
- print "Plotting mesh."
- plot(mesh, title="Mesh", interactive=True)
+ print( "Plotting mesh." )
+ plot(mesh, title="Mesh")
sys.exit(0)
# Create element
- print "Creating finite element."
+ print( "Creating finite element." )
if len(args) == 3 or len(args) == 2:
element = FiniteElement(family, domain, degree)
rotate = int(options["rotate"])
# Plot element
- print "Plotting finite element."
+ print( "Plotting finite element." )
plot(element, rotate=rotate)
+ plt.show()
sys.exit(0)