From: André Ribes Date: Fri, 1 Apr 2011 07:25:53 +0000 (+0200) Subject: Etape 1 ok X-Git-Tag: V6_4_0rc3~56 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=57f426122ed8758c73645f68ad673fe562ba1c8c;p=modules%2Fadao.git Etape 1 ok --- 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"