]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Etape 1 ok
authorAndré Ribes <andre.ribes@edf.fr>
Fri, 1 Apr 2011 07:25:53 +0000 (09:25 +0200)
committerAndré Ribes <andre.ribes@edf.fr>
Fri, 1 Apr 2011 07:25:53 +0000 (09:25 +0200)
src/daSalome/daYacsIntegration/daOptimizerLoop.py
src/tests/daSalome/test017_3DVAR_function_script.py

index c36e66611bda1dcc03a50f40caf78b69fa2a8bf5..edf727efc41da7c9807e8e28db21429546aa9419 100644 (file)
@@ -106,11 +106,8 @@ class OptimizerHooks:
       local_counter = self.sample_counter
 
       # 2: Put sample in the job pool
-      computation = {}
-      computation["method"] = "Tangent"
-      computation["data"] = X
-      computation = pickle.dumps(computation)
-      self.optim_algo.pool.pushInSample(local_counter, computation)
+      sample = self.create_sample(X, "Tangent")
+      self.optim_algo.pool.pushInSample(local_counter, sample)
 
       # 3: Wait
       while 1:
@@ -146,11 +143,8 @@ class OptimizerHooks:
       local_counter = self.sample_counter
 
       # 2: Put sample in the job pool
-      computation = {}
-      computation["method"] = "Adjoint"
-      computation["data"] = (X, Y)
-      computation = pickle.dumps(computation)
-      self.optim_algo.pool.pushInSample(local_counter, computation)
+      sample = self.create_sample(Y, "Tangent")
+      self.optim_algo.pool.pushInSample(local_counter, sample)
 
       # 3: Wait
       while 1:
index 4a8a6b04adfe82efd86b339e384a47c5bb8ee002..ce55cca42901d999bd921ba7fa666b2f9a43413a 100644 (file)
@@ -7,6 +7,8 @@ for param in computation["specificParameters"]:
   if param["name"] == "method":
     method = param["value"]
 print "Method found is", method
+print computation["inputValues"]
+print computation["inputValues"][0][0]
 
 dimension = 300
 H  = numpy.matrix(numpy.core.identity(dimension))
@@ -18,12 +20,12 @@ def AdjointH( (X, Y) ):
     return H.T * Y
 
 if method == "Direct":
-  result = FunctionH(computation["data"])
+  result = FunctionH(numpy.matrix(computation["inputValues"][0][0]).T)
 
 if method == "Tangent":
-  result = FunctionH(computation["data"])
+  result = FunctionH(numpy.matrix(computation["inputValues"][0][0]).T)
 
 if method == "Adjoint":
-  result = AdjointH(computation["data"])
+  result = AdjointH(numpy.matrix(computation["inputValues"][0][0]).T)
 
 print "Computation end"