]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Ajout de AlgorithmParameters
authorAndré Ribes <andre.ribes@edf.fr>
Wed, 30 Jun 2010 15:05:09 +0000 (17:05 +0200)
committerAndré Ribes <andre.ribes@edf.fr>
Wed, 30 Jun 2010 15:05:09 +0000 (17:05 +0200)
resources/ADAOSchemaCatalog.xml
src/daSalome/daYacsIntegration/daStudy.py
src/daSalome/daYacsSchemaCreator/infos_daComposant.py
src/daSalome/daYacsSchemaCreator/methods.py
src/tests/daSalome/test_aster_zzzz159a.py.in
src/tests/daSalome/test_aster_zzzz159a_init_algorithm.py

index 012e83bb08c59debbddf893fa301bf3e21907bce..3bb4f28ae71bd8eaf9603c7545061a254b25205c 100644 (file)
@@ -18,6 +18,14 @@ print "Algorithm is", Algorithm
 from daYacsIntegration.daStudy import *
 assim_study = daStudy(Name, Algorithm)
 
+# Algorithm parameters
+try:
+  AlgorithmParameters
+except NameError:
+  pass
+else:
+  assim_study.setAlgorithmParameters(AlgorithmParameters)
+
 # Data
 print "Data entered are:"
 # Background
@@ -189,4 +197,12 @@ result = None
     <outport name="result" type="pyobj"/>
   </inline>
 
+  <inline name="CreateDictFromScript">
+    <script><code><![CDATA[
+print "Entering in CreateDictFromScript"
+execfile(script)
+]]></code></script>
+    <inport name="script" type="string"/>
+  </inline>
+
 </proc>
index 68db0b935e4c77ac23a3f895334eb48ec6b3d416..745ca259cdea9bddab072a0695c69cd406449603 100644 (file)
@@ -15,14 +15,21 @@ class daStudy:
     self.ADD = AssimilationStudy(name)
     self.ADD.setControls()
     self.algorithm = algorithm
+    self.algorithm_dict = None
     self.Background = None
 
     # Observation Management
     self.ObservationOperatorType = {}
     self.FunctionObservationOperator = {}
 
+  def setAlgorithmParameters(self, parameters):
+    self.algorithm_dict = parameters
+
   def initAlgorithm(self):
+
     self.ADD.setAlgorithm(choice=self.algorithm)
+    if self.algorithm_dict != None:
+      self.ADD.setAlgorithmParameters(asDico=self.algorithm_dict)
 
   def getAssimilationStudy(self):
 
index 06df3c16fd229d24bfdf6f9279c6a3e19b641ab4..5253e4ca1e8dbdc806025724e2dc1d96fbfc005b 100644 (file)
@@ -28,7 +28,7 @@ AnalysisFromList = ["String", "File"]
 # -- Infos from daCore --
 AssimData = ["Background", "BackgroundError",
              "Observation", "ObservationError", "ObservationOperator", "ObservationOperatorAppliedToX",
-             "EvolutionModel", "EvolutionError"]
+             "EvolutionModel", "EvolutionError", "AlgorithmParameters"]
 
 AssimType = {}
 AssimType["Background"] = ["Vector"]
@@ -37,6 +37,7 @@ AssimType["Observation"] = ["Vector"]
 AssimType["ObservationError"] = ["Matrix"]
 AssimType["ObservationOperator"] = ["Matrix", "Function"]
 AssimType["ObservationOperatorAppliedToX"] = ["List"]
+AssimType["AlgorithmParameters"] = ["Dict"]
 
 FromNumpyList = {}
 FromNumpyList["Vector"] = ["String", "Script"]
index a3c8fa66f9ab30f8afa67d4c94cba058de8948ac..19b9b7f1e4e6bfdaf731fb9cd1b7493eee4bb2b2 100644 (file)
@@ -66,6 +66,17 @@ def create_yacs_proc(study_config):
 
       key_type = key + "Type"
 
+      if data_config["Type"] == "Dict" and data_config["From"] == "Script":
+        # Create node
+        factory_back_node = catalogAd._nodeMap["CreateDictFromScript"]
+        back_node = factory_back_node.cloneNode("Get" + key)
+        back_node.getInputPort("script").edInitPy(data_config["Data"])
+        back_node.edAddOutputPort(key, t_pyobj)
+        proc.edAddChild(back_node)
+        # Connect node with CreateAssimilationStudy
+        CAS_node.edAddInputPort(key, t_pyobj)
+        proc.edAddDFLink(back_node.getOutputPort(key), CAS_node.getInputPort(key))
+
       if data_config["Type"] == "Vector" and data_config["From"] == "String":
         # Create node
         factory_back_node = catalogAd._nodeMap["CreateNumpyVectorFromString"]
index b02239ae2a192f2b4fed3d703bee9b016f3785ec..9443c298140209884d988a35f3fe088c6c1edbc0 100644 (file)
@@ -14,7 +14,7 @@ Algorithm_config = {}
 Algorithm_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_init_algorithm.py"
 Algorithm_config["Type"] = "Dict"
 Algorithm_config["From"] = "Script"
-study_config["Algorithm"] = Algorithm_config
+study_config["AlgorithmParameters"] = Algorithm_config
 
 Background_config = {}
 Background_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_background.py"
index a72431abe867969bde925285f7fbb201e0ab0adf..b3b8f542daf24b8b038df2e5f745d8c693478ec7 100644 (file)
@@ -10,6 +10,6 @@ if debug:
     print "Bornes  = ",Bornes
     print
 
-Algorithm = { "Minimizer"           : "TNC",
-              "Bounds"              : Bornes,
-            }
+AlgorithmParameters = { "Minimizer"           : "TNC",
+    "Bounds"              : Bornes,
+    }