From 7ecb9e25b8d518781850f99fff7f82e0696a55ab Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 11 Sep 2018 10:28:53 +0200
Subject: [PATCH] fix print (python 3)

---
 Lbracket/topo.py | 16 ++++++++--------
 Team25/shape.pro |  4 ++--
 Team25/shape.py  | 16 ++++++++--------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/Lbracket/topo.py b/Lbracket/topo.py
index 1456f32..a75d9f8 100644
--- a/Lbracket/topo.py
+++ b/Lbracket/topo.py
@@ -55,7 +55,7 @@ c.runSubClient('myGmsh', mygmsh + '-2')
 # initializes the density 'xe' field
 # This is done with a GetDP problem named 'DensityField'
 # that solves no FE equations
-# but only fills up the function space with an initial value. 
+# but only fills up the function space with an initial value.
 c.runSubClient('myGetDP', mygetdp + '-solve DensityField')
 
 # read in the 'xe' field from GetDP into a python variable 'd'
@@ -68,11 +68,11 @@ elements = np.array(d[1::2]) # [ele1, ..., eleN ]
 #x = np.array(d[2::2]) # [xe1, ..., xeN]
 x = 0.5*np.ones(numElements)
 
-print 'number of elements in topology optimization:', numElements
+print('number of elements in topology optimization:', numElements)
 
 # This function serializes the python variables 'ele' and 'var' into
 # an ElementTable variable [N, ele1, xe1, ..., eleN, xeN]
-# and set it as a Onelab parameter named `var' 
+# and set it as a Onelab parameter named `var'
 def setElementTable(var, ele, val):
    data = np.ravel(np.column_stack((ele, val)))
    data = np.insert(data, 0, numElements)
@@ -175,11 +175,11 @@ while change > maxChange and it <= maxIter and c.getString('topo/Action') != 'st
     objective *= fscale
     grad_objective *= fscale
 
-    print '*'*50
-    print 'iteration: ', it
-    print 'change: ', change
-    print 'objective:', objective
-    print 'constraints:', constraints
+    print('*'*50)
+    print('iteration: ', it)
+    print('change: ', change)
+    print('objective:', objective)
+    print('constraints:', constraints)
     c.sendInfo('Optimization: it. {}, obj. {}, constr. {}, change {}'.format(it,objective,constraints[0], change))
 
     # call MMA and update the current point
diff --git a/Team25/shape.pro b/Team25/shape.pro
index 61003c9..c19f236 100644
--- a/Team25/shape.pro
+++ b/Team25/shape.pro
@@ -332,8 +332,8 @@ PostOperation {
         Format SimpleTable, File StrCat[Opt_ResDir,"bMag.txt"]];
       Print[az, OnElementsOf Domain, Format NodeTable, File "",
         SendToServer StrCat[Opt_ResDir_Onelab,"a"], Hidden 1];
-      //Print[bMag, OnElementsOf Domain, File StrCat[Opt_ResDir,"az.pos"]];
-      //Print[az, OnElementsOf Domain, File StrCat[Opt_ResDir,"az.pos"]];
+      Print[bMag, OnElementsOf Domain, File StrCat[Opt_ResDir,"az.pos"]];
+      Print[az, OnElementsOf Domain, File StrCat[Opt_ResDir,"az.pos"]];
       Print[bTarget, OnGrid {(9.5e-3+2.25e-3)*Cos[$A],(9.5e-3+2.25e-3)*Sin[$A],0}{0:50*Pi/180:5*Pi/180,0,0},
         File StrCat[Opt_ResDir,"bTarget.pos"]];
       Print[b, OnGrid {(9.5e-3+2.25e-3)*Cos[$A],(9.5e-3+2.25e-3)*Sin[$A],0}{0:50*Pi/180:5*Pi/180,0,0},
diff --git a/Team25/shape.py b/Team25/shape.py
index f93f531..ecb61b9 100644
--- a/Team25/shape.py
+++ b/Team25/shape.py
@@ -1,5 +1,5 @@
-# Open this file with Gmsh (interactively with File->Open->penning.py, or on the
-# command line with 'gmsh penning.py')
+# Open this file with Gmsh (interactively with File->Open->shape.py, or on the
+# command line with 'gmsh shape.py')
 #
 
 import numpy as np
@@ -160,12 +160,12 @@ while it <= maxIter and c.getString('shape/Action') != 'stop':
     objective *= fscale
     grad_objective *= fscale
 
-    print '*'*50
-    print 'iteration: ', it
-    print 'change: ', change
-    print 'current point:', xFromMMA
-    print 'objective:', objective
-    print 'constraints:', constraints
+    print('*'*50)
+    print('iteration: ', it)
+    print('change: ', change)
+    print('current point:', xFromMMA)
+    print('objective:', objective)
+    print('constraints:', constraints)
     c.sendInfo('Optimization: it. {}, obj. {}, constr. {}'.format(it,objective,constraints[0]))
 
     # call MMA and update the current point
-- 
GitLab