]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
String et Script pour les observers
authorAndré Ribes <andre.ribes@edf.fr>
Tue, 27 Mar 2012 13:35:49 +0000 (15:35 +0200)
committerAndré Ribes <andre.ribes@edf.fr>
Tue, 27 Mar 2012 13:35:49 +0000 (15:35 +0200)
bin/AdaoCatalogGenerator.py
examples/daSalome/test006_Observers.comm.in
src/daEficas/generator_adao.py
src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py
src/daSalome/daYacsSchemaCreator/help_methods.py
src/daSalome/daYacsSchemaCreator/methods.py

index 4e5675dceabe2557a5a3014ecaf795e2f9a1bc29..941d1dd3c32f409f5865cef678adc97ec541429b 100644 (file)
@@ -96,11 +96,11 @@ observers_choice = """
                                                   ${var_name}_data = FACT(statut = "o",
                                                              Scheduler = SIMP(statut = "f", typ = "TXM"),
                                                              Info      = SIMP(statut = "f", typ = "TXM"),
-                                                             NodeType  = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "", into=("pyscript", "userfile")),
-                                                             PythonScript = BLOC (condition = " NodeType == 'pyscript' ",
+                                                             NodeType  = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "", into=("String", "Script")),
+                                                             PythonScript = BLOC (condition = " NodeType == 'String' ",
                                                                                   Value = SIMP(statut = "o", typ = "TXM")
                                                                                  ),
-                                                             UserFile = BLOC (condition = " NodeType == 'userfile' ",
+                                                             UserFile = BLOC (condition = " NodeType == 'Script' ",
                                                                               Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=(OnlyStr()))
                                                                              )
                                                                       ),
@@ -109,7 +109,7 @@ observers_choice = """
 
 observers_method = """
 def F_Observers(statut) : return FACT(statut=statut,
-                                      SELECTION = SIMP(statut="o", defaut=[], typ="TXM", max="**", validators=NoRepeat(), into=(${choices})),
+                                      SELECTION = SIMP(statut="o", defaut=[], typ="TXM", min=0, max="**", validators=NoRepeat(), into=(${choices})),
 ${decl_choices}
                                      )
 """
index f1b323c96557bdd9e9c60e20a6b45f13dbcc44d0..1efe8e49f25edd0d1c2f836666c1b9c289b722d3 100644 (file)
@@ -26,7 +26,7 @@ ASSIMILATION_STUDY(Study_name='test_observers',
                                    ('Background','BackgroundError','Observation',
                                                  'ObservationError','AlgorithmParameters',),),
                    Observers=_F(SELECTION=('CurrentState','CostFunctionJ',),
-                                CostFunctionJ_data=_F(NodeType='pyscript',
+                                CostFunctionJ_data=_F(NodeType='String',
                                                       Value=
 """print "  ---> observerCost"
 print "       var  =",var.valueserie()
@@ -47,5 +47,5 @@ print "       imageCost %s"%filename
 gp.hardcopy(filename=filename, color=1)
 numero += 1
 """,),
-                                CurrentState_data=_F(NodeType='userfile',
+                                CurrentState_data=_F(NodeType='Script',
                                                      Value='test006_Observers_observer_with_file.py',),),);
index 6ec3fe5a780acc12b7314da0ee24f3dbc001881a..9673b803c1edcc9f0f5503bbb35f930cff959064 100644 (file)
@@ -275,10 +275,10 @@ class AdaoGenerator(PythonGenerator):
       self.text_da += "observers[\"" + observer + "\"] = {}\n"
       self.text_da += "observers[\"" + observer + "\"][\"number\"] = " + str(number) + "\n"
       self.text_da += "observers[\"" + observer + "\"][\"nodetype\"] = \"" + observers[observer]["nodetype"] + "\"\n"
-      if observers[observer]["nodetype"] == "pyscript":
-        self.text_da += "observers[\"" + observer + "\"][\"pyscript\"] = \"\"\"" + observers[observer]["script"] + "\"\"\"\n"
+      if observers[observer]["nodetype"] == "String":
+        self.text_da += "observers[\"" + observer + "\"][\"String\"] = \"\"\"" + observers[observer]["script"] + "\"\"\"\n"
       else:
-        self.text_da += "observers[\"" + observer + "\"][\"userfile\"] = \"" + observers[observer]["file"] + "\"\n"
+        self.text_da += "observers[\"" + observer + "\"][\"Script\"] = \"" + observers[observer]["file"] + "\"\n"
       if "scheduler" in observers[observer].keys():
         self.text_da += "observers[\"" + observer + "\"][\"scheduler\"] = \"\"\"" + observers[observer]["scheduler"] + "\"\"\"\n"
     self.text_da += "study_config['Observers'] = observers\n"
@@ -295,7 +295,7 @@ class AdaoGenerator(PythonGenerator):
     observers[observer]["nodetype"] = self.dictMCVal[node_type_key_name]
 
     # NodeType script/file
-    if observers[observer]["nodetype"] == "pyscript":
+    if observers[observer]["nodetype"] == "String":
       observers[observer]["script"] = self.dictMCVal[observer_eficas_name + "PythonScript__Value"]
     else:
       observers[observer]["file"] = self.dictMCVal[observer_eficas_name + "UserFile__Value"]
index 454ce6eb8db7f9029884d19894b62d7a57264130..ef7b8b11a711e522f8fa155181f3ab99174ef58b 100644 (file)
@@ -86,7 +86,7 @@ def updateItem(salomeStudyId, salomeStudyItem, adaoCase):
       itemValue = adaoCase.filename
     else:
       itemName  = salomeStudyItem.GetName()
-      itemValue = adaoCase.get_filename()
+      itemValue = adaoCase.filename
 
     icon = adaoModuleHelper.studyItemPixmapNOk()
     if adaoCase.isOk():
index 9879ca6490fe0ed0a67b75887f71cdecd975e6ef..018a20d69b3289bb12d9a6dc1d4c80f8948c3a45 100644 (file)
@@ -136,26 +136,26 @@ def check_study(study_config):
         logging.fatal("An observer nodetype description must be a string")
         logging.fatal("Observer is %s" % obs_var)
         sys.exit(1)
-      if nodetype != "pyscript" and nodetype != "userfile":
-        logging.fatal("An observer nodetype must be equal to 'pyscript' or 'userfile'")
+      if nodetype != "String" and nodetype != "Script":
+        logging.fatal("An observer nodetype must be equal to 'String' or 'Script'")
         logging.fatal("Observer is %s" % obs_var)
         sys.exit(1)
-      if nodetype == "pyscript":
-        if "pyscript" not in study_config["Observers"][obs_var].keys():
-          logging.fatal("An observer with nodetype pyscript must provide a pyscript")
+      if nodetype == "String":
+        if "String" not in study_config["Observers"][obs_var].keys():
+          logging.fatal("An observer with nodetype String must provide a String")
           logging.fatal("Observer is %s" % obs_var)
           sys.exit(1)
-        if not isinstance(study_config["Observers"][obs_var]["pyscript"], type("")):
-          logging.fatal("An observer pyscript description must be a string")
+        if not isinstance(study_config["Observers"][obs_var]["String"], type("")):
+          logging.fatal("An observer String description must be a string")
           logging.fatal("Observer is %s" % obs_var)
           sys.exit(1)
-      if nodetype == "userfile":
-        if "userfile" not in study_config["Observers"][obs_var].keys():
-          logging.fatal("An observer with nodetype userfileuserfilemust provide a pyscript")
+      if nodetype == "Script":
+        if "Script" not in study_config["Observers"][obs_var].keys():
+          logging.fatal("An observer with nodetype Script provide a Script")
           logging.fatal("Observer is %s" % obs_var)
           sys.exit(1)
-        if not isinstance(study_config["Observers"][obs_var]["userfile"], type("")):
-          logging.fatal("An observer userfile description must be a string")
+        if not isinstance(study_config["Observers"][obs_var]["Script"], type("")):
+          logging.fatal("An observer Script description must be a string")
           logging.fatal("Observer is %s" % obs_var)
           sys.exit(1)
       if "scheduler" in study_config["Observers"][obs_var].keys():
index 3750d59e8f17171d04080ba5dcb12a1e3c8d706f..08c468b43c98ddfea2b0abacb733fdb4a344bb3a 100644 (file)
@@ -346,19 +346,19 @@ def create_yacs_proc(study_config):
       proc.edAddDFLink(read_for_switch_node.getOutputPort("data"), extract_data_node.getInputPort("data"))
 
       observation_node = None
-      if observer_cfg["nodetype"] == "pyscript":
+      if observer_cfg["nodetype"] == "String":
         factory_observation_node = catalogAd.getNodeFromNodeMap("ObservationNodeString")
         observation_node = factory_observation_node.cloneNode("Observation")
         node_script = observation_node.getScript()
-        node_script += observer_cfg["pyscript"]
+        node_script += observer_cfg["String"]
         observation_node.setScript(node_script)
       else:
         factory_observation_node = catalogAd.getNodeFromNodeMap("ObservationNodeFile")
         observation_node = factory_observation_node.cloneNode("Observation")
         if repertory:
-          observation_node.getInputPort("script").edInitPy(os.path.join(base_repertory, os.path.basename(observer_cfg["userfile"])))
+          observation_node.getInputPort("script").edInitPy(os.path.join(base_repertory, os.path.basename(observer_cfg["Script"])))
         else:
-          observation_node.getInputPort("script").edInitPy(observer_cfg["userfile"])
+          observation_node.getInputPort("script").edInitPy(observer_cfg["Script"])
       observer_bloc.edAddChild(observation_node)
       proc.edAddDFLink(extract_data_node.getOutputPort("var"), observation_node.getInputPort("var"))
       proc.edAddDFLink(extract_data_node.getOutputPort("info"), observation_node.getInputPort("info"))