From 0c818b684a7e80a8ac5ae8377d426347ab3c45eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Ribes?= Date: Wed, 7 Mar 2012 10:02:26 +0100 Subject: [PATCH] Adding info with observers --- bin/AdaoCatalogGenerator.py | 1 + resources/ADAOSchemaCatalog.xml | 10 ++++++++++ src/daEficas/generator_adao.py | 4 ++++ src/daSalome/daYacsIntegration/daStudy.py | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/bin/AdaoCatalogGenerator.py b/bin/AdaoCatalogGenerator.py index a0605e6..4e5675d 100644 --- a/bin/AdaoCatalogGenerator.py +++ b/bin/AdaoCatalogGenerator.py @@ -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") diff --git a/resources/ADAOSchemaCatalog.xml b/resources/ADAOSchemaCatalog.xml index 8318744..c3b6987 100644 --- a/resources/ADAOSchemaCatalog.xml +++ b/resources/ADAOSchemaCatalog.xml @@ -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 ]]> diff --git a/src/daEficas/generator_adao.py b/src/daEficas/generator_adao.py index 14df651..6ec3fe5 100644 --- a/src/daEficas/generator_adao.py +++ b/src/daEficas/generator_adao.py @@ -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] diff --git a/src/daSalome/daYacsIntegration/daStudy.py b/src/daSalome/daYacsIntegration/daStudy.py index 8f0bf40..e8feb00 100644 --- a/src/daSalome/daYacsIntegration/daStudy.py +++ b/src/daSalome/daYacsIntegration/daStudy.py @@ -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 -- 2.39.2