From 57f426122ed8758c73645f68ad673fe562ba1c8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Ribes?= Date: Fri, 1 Apr 2011 09:25:53 +0200 Subject: [PATCH] Etape 1 ok --- src/daSalome/daYacsIntegration/daOptimizerLoop.py | 14 ++++---------- .../daSalome/test017_3DVAR_function_script.py | 8 +++++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/daSalome/daYacsIntegration/daOptimizerLoop.py b/src/daSalome/daYacsIntegration/daOptimizerLoop.py index c36e666..edf727e 100644 --- a/src/daSalome/daYacsIntegration/daOptimizerLoop.py +++ b/src/daSalome/daYacsIntegration/daOptimizerLoop.py @@ -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: diff --git a/src/tests/daSalome/test017_3DVAR_function_script.py b/src/tests/daSalome/test017_3DVAR_function_script.py index 4a8a6b0..ce55cca 100644 --- a/src/tests/daSalome/test017_3DVAR_function_script.py +++ b/src/tests/daSalome/test017_3DVAR_function_script.py @@ -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" -- 2.39.2