| 1 |
--- a/scripts/dolfin-order/dolfin-order |
| 2 |
+++ b/scripts/dolfin-order/dolfin-order |
| 3 |
@@ -1,4 +1,4 @@ |
| 4 |
-#!/usr/bin/env python |
| 5 |
+#!/usr/bin/env python3 |
| 6 |
# |
| 7 |
# Copyright (C) 2008 Anders Logg |
| 8 |
# |
| 9 |
@@ -33,7 +33,7 @@ |
| 10 |
|
| 11 |
# Convert each mesh |
| 12 |
for filename in args: |
| 13 |
- print "Ordering %s" % filename |
| 14 |
+ print( "Ordering {:s}".format(filename) ) |
| 15 |
|
| 16 |
# Read and order mesh |
| 17 |
mesh = Mesh(filename) |
| 18 |
@@ -54,7 +54,7 @@ |
| 19 |
|
| 20 |
def usage(): |
| 21 |
"Print usage instructions" |
| 22 |
- print "Usage: dolfin-order mesh0.xml[.gz] [mesh1.xml[.gz] mesh2.xml[.gz] ...]" |
| 23 |
+ print( "Usage: dolfin-order mesh0.xml[.gz] [mesh1.xml[.gz] mesh2.xml[.gz] ...]" ) |
| 24 |
|
| 25 |
if __name__ == "__main__": |
| 26 |
main(sys.argv[1:]) |
| 27 |
--- a/scripts/dolfin-plot/dolfin-plot |
| 28 |
+++ b/scripts/dolfin-plot/dolfin-plot |
| 29 |
@@ -1,4 +1,4 @@ |
| 30 |
-#!/usr/bin/env python |
| 31 |
+#!/usr/bin/env python3 |
| 32 |
|
| 33 |
"Script for simple command-line plotting." |
| 34 |
|
| 35 |
@@ -25,14 +25,16 @@ |
| 36 |
# Last changed: 2010-12-22 |
| 37 |
|
| 38 |
import sys |
| 39 |
+import ffc |
| 40 |
+import matplotlib.pyplot as plt |
| 41 |
|
| 42 |
# Try importing DOLFIN |
| 43 |
try: |
| 44 |
from dolfin import * |
| 45 |
except: |
| 46 |
- print """\ |
| 47 |
+ print( """\ |
| 48 |
Unable to import DOLFIN. The DOLFIN Python module is required |
| 49 |
-to run this script. Check that DOLFIN is in your PYTHONPATH.""" |
| 50 |
+to run this script. Check that DOLFIN is in your PYTHONPATH.""" ) |
| 51 |
sys.exit(1) |
| 52 |
|
| 53 |
def usage(): |
| 54 |
@@ -40,13 +42,13 @@ |
| 55 |
|
| 56 |
# Build list of supported elements |
| 57 |
element_list = "" |
| 58 |
- for e in supported_elements_for_plotting: |
| 59 |
- if e in supported_elements: |
| 60 |
+ for e in ffc.supported_elements_for_plotting: |
| 61 |
+ if e in ffc.supported_elements: |
| 62 |
element_list += (" %s\n" % e) |
| 63 |
else: |
| 64 |
element_list += (" %s (*)\n" % e) |
| 65 |
|
| 66 |
- print """\ |
| 67 |
+ print( """\ |
| 68 |
Usage: |
| 69 |
|
| 70 |
1. dolfin-plot <meshfile> |
| 71 |
@@ -73,7 +75,7 @@ |
| 72 |
%s |
| 73 |
A (*) indicates that the element is not supported by DOLFIN/FFC, |
| 74 |
but the element may still be plotted. |
| 75 |
-""" % element_list |
| 76 |
+""" % element_list ) |
| 77 |
|
| 78 |
# Check command-line arguments |
| 79 |
if len(sys.argv) < 2: |
| 80 |
@@ -93,16 +95,16 @@ |
| 81 |
if len(args) == 1: |
| 82 |
|
| 83 |
# Read mesh |
| 84 |
- print "Reading mesh from file '%s'." % args[0] |
| 85 |
+ print( "Reading mesh from file '%s'." % args[0] ) |
| 86 |
try: |
| 87 |
mesh = Mesh(args[0]) |
| 88 |
except: |
| 89 |
- print "Unable to read mesh from file." |
| 90 |
+ print( "Unable to read mesh from file." ) |
| 91 |
sys.exit(1) |
| 92 |
|
| 93 |
# Plot mesh |
| 94 |
- print "Plotting mesh." |
| 95 |
- plot(mesh, title="Mesh", interactive=True) |
| 96 |
+ print( "Plotting mesh." ) |
| 97 |
+ plot(mesh, title="Mesh") |
| 98 |
|
| 99 |
sys.exit(0) |
| 100 |
|
| 101 |
@@ -120,7 +122,7 @@ |
| 102 |
|
| 103 |
|
| 104 |
# Create element |
| 105 |
- print "Creating finite element." |
| 106 |
+ print( "Creating finite element." ) |
| 107 |
|
| 108 |
if len(args) == 3 or len(args) == 2: |
| 109 |
element = FiniteElement(family, domain, degree) |
| 110 |
@@ -139,8 +141,9 @@ |
| 111 |
rotate = int(options["rotate"]) |
| 112 |
|
| 113 |
# Plot element |
| 114 |
- print "Plotting finite element." |
| 115 |
+ print( "Plotting finite element." ) |
| 116 |
plot(element, rotate=rotate) |
| 117 |
+ plt.show() |
| 118 |
|
| 119 |
sys.exit(0) |
| 120 |
|