From c1eb3ab5195cf394abfb01986ae85320206141ee Mon Sep 17 00:00:00 2001
From: ErinKuci <Erin.Kuci@ulg.ac.be>
Date: Wed, 28 Nov 2018 16:30:11 +0100
Subject: [PATCH] update the call to conveks

---
 Ccore/onelab_optimize.py | 10 ++++++++--
 Lbracket/topo.py         |  8 +++++++-
 Team25/shape.py          |  8 +++++++-
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/Ccore/onelab_optimize.py b/Ccore/onelab_optimize.py
index 0ec1b8f..e15cc02 100644
--- a/Ccore/onelab_optimize.py
+++ b/Ccore/onelab_optimize.py
@@ -122,7 +122,10 @@ def Optimize(Optimizer):
             initialPoint[label] = var[1]
             lowerBound[label] = var[2]
             upperBound[label] = var[3]
-        
+
+        # Initialize conveks
+        conveks.initialize()
+
         # Initialize the MMA optimizer
         conveks.mma.initialize(initialPoint, lowerBound, upperBound)
 
@@ -170,9 +173,12 @@ def Optimize(Optimizer):
         print 'Converged: %4d %3.6f %3.6f %3.6f' %(it, obj, change_rel, change_mma),
         print xFromMMA, grad_obj
         
-        # This should be called at the end
+        # This should be called at the end of MMA
         conveks.mma.finalize()
 
+        # This should be called at the end 
+        conveks.finalize()
+
 def minimize(name):
     global x, modelName, file_geo, file_pro, file_msh, mygmsh, mygetdp, maxIter, maxChange
     modelName = name
diff --git a/Lbracket/topo.py b/Lbracket/topo.py
index 92dd5b2..1606aae 100644
--- a/Lbracket/topo.py
+++ b/Lbracket/topo.py
@@ -87,6 +87,9 @@ lowerBound = 0.001*np.ones(numVariables)
 # upper bound for design variables (here all set to 1)
 upperBound = np.ones(numVariables)
 
+# Initialize conveks
+conveks.initialize()
+
 # Initialize the MMA optimizer
 conveks.mma.initialize(x, lowerBound, upperBound)
 
@@ -159,5 +162,8 @@ while change > maxChange and it <= maxIter and c.getString('topo/Action') != 'st
     change = conveks.mma.getDesignChange()
     it = conveks.mma.getOuterIteration()
 
-# This should be called at the end
+# This should be called at the end of MMA
 conveks.mma.finalize()
+
+# This should be called at the end
+conveks.finalize()
\ No newline at end of file
diff --git a/Team25/shape.py b/Team25/shape.py
index 70b1dbf..310805d 100644
--- a/Team25/shape.py
+++ b/Team25/shape.py
@@ -101,6 +101,9 @@ for label, var in x.iteritems():
   lowerBound[label] = var[2]
   upperBound[label] = var[3]
 
+# Initialize conveks
+conveks.initialize()
+
 # Initialize the MMA optimizer
 conveks.mma.initialize(initialPoint, lowerBound, upperBound)
 
@@ -159,5 +162,8 @@ while it <= maxIter and c.getString('shape/Action') != 'stop':
     change = conveks.mma.getDesignChange()
     it = conveks.mma.getOuterIteration()
 
-# This should be called at the end
+# This should be called at the end of MMA
 conveks.mma.finalize()
+
+# This should be called at the end
+conveks.finalize()
\ No newline at end of file
-- 
GitLab