]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Adding info with observers
authorAndré Ribes <andre.ribes@edf.fr>
Wed, 7 Mar 2012 09:02:26 +0000 (10:02 +0100)
committerAndré Ribes <andre.ribes@edf.fr>
Wed, 7 Mar 2012 09:02:26 +0000 (10:02 +0100)
bin/AdaoCatalogGenerator.py
resources/ADAOSchemaCatalog.xml
src/daEficas/generator_adao.py
src/daSalome/daYacsIntegration/daStudy.py

index a0605e6744772f85a6c6d27265b29158779ff0dc..4e5675dceabe2557a5a3014ecaf795e2f9a1bc29 100644 (file)
@@ -95,6 +95,7 @@ observers_choice = """
                                        ${var_name} = BLOC (condition=" '${var_name}' in set(SELECTION) ",
                                                   ${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' ",
                                                                                   Value = SIMP(statut = "o", typ = "TXM")
index 83187443e7b8edefd3af4fd5a092d941cdbefc59..c3b6987f70f5c7b726287ddfbc2e66e946d9bcf4 100644 (file)
@@ -164,6 +164,16 @@ for name, size in zip(InputVariablesNames, InputVariablesSizes):
 for name, size in zip(OutputVariablesNames, OutputVariablesSizes):
   assim_study.setOutputVariable(name, size)
 
+if has_observers:
+  # Adding observers to the study
+  for observer_name in observers.keys():
+    scheduler = ""
+    info = ""
+    if "scheduler" in observers[observer_name].keys():
+      scheduler = observers[observer_name]["scheduler"]
+    if "info" in observers[observer_name].keys():
+      scheduler = observers[observer_name]["info"]
+    assim_study.addObserver(observer_name, scheduler, info)
 Study = assim_study
 ]]>
 
index 14df65125e497955d7a000f788463032bbcdcfbf..6ec3fe5a780acc12b7314da0ee24f3dbc001881a 100644 (file)
@@ -304,3 +304,7 @@ class AdaoGenerator(PythonGenerator):
     scheduler_key_name = observer_eficas_name + "Scheduler"
     if scheduler_key_name in self.dictMCVal.keys():
       observers[observer]["scheduler"] = self.dictMCVal[scheduler_key_name]
+    # Info
+    info_key_name = observer_eficas_name + "Info"
+    if info_key_name in self.dictMCVal.keys():
+      observers[observer]["info"] = self.dictMCVal[info_key_name]
index 8f0bf405a380063a17d6639eeaafbc35a62b9375..e8feb00ad8ca1536ff2517b62eea0570dc344a47 100644 (file)
@@ -42,6 +42,7 @@ class daStudy:
     self.OutputVariables = {}
     self.InputVariablesOrder = []
     self.OutputVariablesOrder = []
+    self.observers_dict = {}
 
     self.debug = debug
     if self.debug:
@@ -150,3 +151,10 @@ class daStudy:
     elif self.ObservationOperatorType[Name] == "Function":
       self.FunctionObservationOperator[Name] = ObservationOperator
 
+  def addObserver(self, name, scheduler, info):
+    observers_dict[name] = {}
+    observers_dict[name]["scheduler"] = scheduler
+    observers_dict[name]["info"] = info
+
+  def getObservers(self):
+    return self.observers_dict