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
|
--- a/scripts/dolfin-order/dolfin-order
+++ b/scripts/dolfin-order/dolfin-order
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# Copyright (C) 2008 Anders Logg
#
@@ -33,7 +33,7 @@
# Convert each mesh
for filename in args:
- print "Ordering %s" % filename
+ print( "Ordering {:s}".format(filename) )
# Read and order mesh
mesh = Mesh(filename)
@@ -54,7 +54,7 @@
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:])
--- a/scripts/dolfin-plot/dolfin-plot
+++ b/scripts/dolfin-plot/dolfin-plot
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"Script for simple command-line plotting."
@@ -25,14 +25,16 @@
# 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():
@@ -40,13 +42,13 @@
# 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>
@@ -73,7 +75,7 @@
%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:
@@ -93,16 +95,16 @@
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)
@@ -120,7 +122,7 @@
# Create element
- print "Creating finite element."
+ print( "Creating finite element." )
if len(args) == 3 or len(args) == 2:
element = FiniteElement(family, domain, degree)
@@ -139,8 +141,9 @@
rotate = int(options["rotate"])
# Plot element
- print "Plotting finite element."
+ print( "Plotting finite element." )
plot(element, rotate=rotate)
+ plt.show()
sys.exit(0)
|