]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
test017 ok
authorAndré Ribes <andre.ribes@edf.fr>
Thu, 15 Jul 2010 09:06:53 +0000 (11:06 +0200)
committerAndré Ribes <andre.ribes@edf.fr>
Thu, 15 Jul 2010 09:06:53 +0000 (11:06 +0200)
src/daEficas/generator_adao.py

index f0ec41d36d410add4656b1cf3d4a7501506ea909..0826a7d066ebb440300e56add1b9e14e3f10a4f6 100644 (file)
@@ -2,6 +2,7 @@
 print "import generator_adao"
 
 from generator.generator_python import PythonGenerator
+import traceback
 
 def entryPoint():
    """
@@ -38,6 +39,7 @@ class AdaoGenerator(PythonGenerator):
       self.text_da_status = True
     except:
       print "Case seems not be correct"
+      traceback.print_exc()
       pass
     return self.text_comm
 
@@ -74,7 +76,11 @@ class AdaoGenerator(PythonGenerator):
     self.text_da += "#-*-coding:iso-8859-1-*- \n"
     self.text_da += "study_config = {} \n"
     self.text_da += "study_config[\"Name\"] = \"" + self.dictMCVal["__ASSIM_STUDY__STUDY_NAME"] + "\"\n"
-    self.text_da += "study_config[\"Algorithm\"] = \"" + self.dictMCVal["ALGORITHM_NAME"] + "\"\n"
+    
+    if self.dictMCVal["ALGORITHM_NAME"] != "ThreeDVAR":
+      self.text_da += "study_config[\"Algorithm\"] = \"" + self.dictMCVal["ALGORITHM_NAME"] + "\"\n"
+    else:
+      self.text_da += "study_config[\"Algorithm\"] = \"3DVAR\"\n"
 
 
     self.add_data("Background")
@@ -138,6 +144,25 @@ class AdaoGenerator(PythonGenerator):
       self.text_da += "study_config[\"" + data_name + "\"] = " + data_name + "_config \n"
       return 1
 
+    # Data is a FunctionDict
+    search_function = back_search_text + "Function"
+    if search_function + "__FROM" in self.dictMCVal:
+      back_from = self.dictMCVal[search_function + "__FROM"]
+      back_data = self.dictMCVal[search_function + "__FUNCTIONDICT_DATA__FUNCTIONDICT_FILE"]
+
+      self.text_da += "FunctionDict = {} \n"
+      self.text_da += "FunctionDict[\"Function\"] = [\"Direct\", \"Tangent\", \"Adjoint\"] \n"
+      self.text_da += "FunctionDict[\"Script\"] = {} \n"
+      self.text_da += "FunctionDict[\"Script\"][\"Direct\"] = \"" + back_data + "\" \n"
+      self.text_da += "FunctionDict[\"Script\"][\"Tangent\"] = \"" + back_data + "\" \n"
+      self.text_da += "FunctionDict[\"Script\"][\"Adjoint\"] = \"" + back_data + "\" \n"
+      self.text_da += data_name + "_config = {} \n"
+      self.text_da += data_name + "_config[\"Type\"] = \"Function\" \n"
+      self.text_da += data_name + "_config[\"From\"] = \"FunctionDict\" \n"
+      self.text_da += data_name + "_config[\"Data\"] = FunctionDict \n"
+      self.text_da += "study_config[\"" + data_name + "\"] = " + data_name + "_config \n"
+      return 1
+
   def add_analysis(self):
     search_text = "__ASSIM_STUDY__ALGORITHM__" + self.dictMCVal["ALGORITHM_NAME"] + "__Analysis__"
     try :