]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Adding evolution modelisation in GUI
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 5 Apr 2012 08:48:06 +0000 (10:48 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 5 Apr 2012 08:50:09 +0000 (10:50 +0200)
bin/AdaoCatalogGenerator.py
src/daSalome/daYacsIntegration/daStudy.py
src/daSalome/daYacsSchemaCreator/infos_daComposant.py

index be2782a12eb601c26a64ff56c41765ac442f3937..c3f895f31ceffae8bb85a32e4f984edeeef68054 100644 (file)
@@ -68,6 +68,8 @@ def F_InitChoice() : return  ("Background",
                               "Observation",
                               "ObservationError",
                               "ObservationOperator",
+                              "EvolutionModel",
+                              "EvolutionError",
                               "AlgorithmParameters",
                               "UserPostAnalysis",
                              )
@@ -134,6 +136,8 @@ ASSIMILATION_STUDY = PROC(nom="ASSIMILATION_STUDY",
                           Observation         = F_Observation("o"),
                           ObservationError    = F_ObservationError("o"),
                           ObservationOperator = F_ObservationOperator("o"),
+                          EvolutionModel      = F_EvolutionModel("f"),
+                          EvolutionError      = F_EvolutionError("f"),
                           AlgorithmParameters = F_AlgorithmParameters("f"),
                           UserDataInit        = F_Init("f"),
                           UserPostAnalysis    = F_UserPostAnalysis("f"),
index 6dce5161a0209cd1a61732b97c1379577f4fee0d..cd708be99ea0445829af9d43f1452543f0077eb8 100644 (file)
@@ -52,8 +52,11 @@ class daStudy:
 
     # Observation Management
     self.ObservationOperatorType = {}
+    self.EvolutionModelType = {}
     self.FunctionObservationOperator = {}
 
+  #--------------------------------------
+
   def setInputVariable(self, name, size):
     self.InputVariables[name] = size
     self.InputVariablesOrder.append(name)
@@ -62,68 +65,72 @@ class daStudy:
     self.OutputVariables[name] = size
     self.OutputVariablesOrder.append(name)
 
+  #--------------------------------------
+
   def setAlgorithmParameters(self, parameters):
     self.algorithm_dict = parameters
 
-  def initAlgorithm(self):
+  #--------------------------------------
 
+  def initAlgorithm(self):
     self.ADD.setAlgorithm(choice=self.algorithm)
     if self.algorithm_dict != None:
       logging.debug("ADD.setAlgorithm : "+str(self.algorithm_dict))
       self.ADD.setAlgorithmParameters(asDico=self.algorithm_dict)
 
-  def getAssimilationStudy(self):
+  #--------------------------------------
 
+  def getAssimilationStudy(self):
     return self.ADD
 
+  #--------------------------------------
   # Methods to initialize AssimilationStudy
 
   def setBackgroundType(self, Type):
-
     if Type == "Vector":
       self.BackgroundType = Type
     else:
       raise daError("[daStudy::setBackgroundType] Type is unkown : " + Type + " Types are : Vector")
 
   def setBackground(self, Background):
-
     try:
       self.BackgroundType
     except AttributeError:
       raise daError("[daStudy::setBackground] Type is not defined !")
-
     self.Background = Background
-
     if self.BackgroundType == "Vector":
       self.ADD.setBackground(asVector = Background)
 
   def getBackground(self):
     return self.Background
 
-  def setBackgroundError(self, BackgroundError):
+  #--------------------------------------
 
+  def setBackgroundError(self, BackgroundError):
     self.ADD.setBackgroundError(asCovariance = BackgroundError)
 
-  def setObservationType(self, Type):
+  #--------------------------------------
 
+  def setObservationType(self, Type):
     if Type == "Vector":
       self.ObservationType = Type
     else:
       raise daError("[daStudy::setObservationType] Type is unkown : " + Type + " Types are : Vector")
 
   def setObservation(self, Observation):
-
     try:
       self.ObservationType
     except AttributeError:
       raise daError("[daStudy::setObservation] Type is not defined !")
-
     if self.ObservationType == "Vector":
       self.ADD.setObservation(asVector = Observation)
 
+  #--------------------------------------
+
   def setObservationError(self, ObservationError):
     self.ADD.setObservationError(asCovariance = ObservationError)
 
+  #--------------------------------------
 
   def getObservationOperatorType(self, Name):
     rtn = None
@@ -139,19 +146,48 @@ class daStudy:
     elif Type == "Function":
       self.ObservationOperatorType[Name] = Type
     else:
-      raise daError("[daStudy::setObservationOperatorType] Type is unkown : " + Type + " Types are : Matrix")
+      raise daError("[daStudy::setObservationOperatorType] Type is unkown : " + Type + " Types are : Matrix, Function")
 
   def setObservationOperator(self, Name, ObservationOperator):
     try:
       self.ObservationOperatorType[Name]
     except AttributeError:
       raise daError("[daStudy::setObservationOperator] Type is not defined !")
-
     if self.ObservationOperatorType[Name] == "Matrix":
       self.ADD.setObservationOperator(asMatrix = ObservationOperator)
     elif self.ObservationOperatorType[Name] == "Function":
       self.FunctionObservationOperator[Name] = ObservationOperator
 
+  #--------------------------------------
+
+  def getEvolutionModelType(self, Name):
+    rtn = None
+    try:
+      rtn = self.EvolutionModelType[Name]
+    except:
+      pass
+    return rtn
+
+  def setEvolutionModelType(self, Name, Type):
+    if Type == "Matrix":
+      self.EvolutionModelType[Name] = Type
+    elif Type == "Function":
+      self.EvolutionModelType[Name] = Type
+    else:
+      raise daError("[daStudy::setEvolutionModelType] Type is unkown : " + Type + " Types are : Matrix, Function")
+
+  def setEvolutionModel(self, Name, EvolutionModel):
+    try:
+      self.EvolutionModelType[Name]
+    except AttributeError:
+      raise daError("[daStudy::setEvolutionModel] Type is not defined !")
+    if self.EvolutionModelType[Name] == "Matrix":
+      self.ADD.setEvolutionModel(asMatrix = EvolutionModel)
+    elif self.EvolutionModelType[Name] == "Function":
+      self.FunctionEvolutionModel[Name] = EvolutionModel
+
+  #--------------------------------------
+
   def addObserver(self, name, scheduler, info, number):
     self.observers_dict[name] = {}
     self.observers_dict[name]["scheduler"] = scheduler
index 1aa9c8c54f3303fddd565297871ecda8910c4a5f..a3d764d19bf2e4ebfa2012d5fdd2581378eae2b8 100644 (file)
@@ -28,8 +28,8 @@ AnalysisFromList = ["String", "Script"]
 # -- Infos from daCore --
 AssimData = ["Background", "BackgroundError",
              "Observation", "ObservationError",
-             "EvolutionModel", "EvolutionError",
              "ObservationOperator",
+             "EvolutionModel", "EvolutionError",
              "AlgorithmParameters"]
 
 AssimType = {}
@@ -38,6 +38,8 @@ AssimType["BackgroundError"] = ["Matrix"]
 AssimType["Observation"] = ["Vector"]
 AssimType["ObservationError"] = ["Matrix"]
 AssimType["ObservationOperator"] = ["Matrix", "Function"]
+AssimType["EvolutionModel"] = ["Matrix", "Function"]
+AssimType["EvolutionError"] = ["Matrix"]
 AssimType["AlgorithmParameters"] = ["Dict"]
 AssimType["UserDataInit"] = ["Dict"]
 
@@ -124,6 +126,8 @@ AssimDataDict["BackgroundError"] = ["Matrix"]
 AssimDataDict["Observation"] = ["Vector"]
 AssimDataDict["ObservationError"] = ["Matrix"]
 AssimDataDict["ObservationOperator"] = ["Matrix", "Function"]
+AssimDataDict["EvolutionModel"] = ["Matrix", "Function"]
+AssimDataDict["EvolutionError"] = ["Matrix"]
 AssimDataDict["AlgorithmParameters"] = ["Dict"]
 AssimDataDict["UserDataInit"] = ["Dict"]
 
@@ -133,6 +137,8 @@ AssimDataDefaultDict["BackgroundError"]     = "Matrix"
 AssimDataDefaultDict["Observation"]         = "Vector"
 AssimDataDefaultDict["ObservationError"]    = "Matrix"
 AssimDataDefaultDict["ObservationOperator"] = "Function"
+AssimDataDefaultDict["EvolutionModel"]      = "Function"
+AssimDataDefaultDict["EvolutionError"]      = "Matrix"
 AssimDataDefaultDict["AlgorithmParameters"] = "Dict"
 AssimDataDefaultDict["UserDataInit"]        = "Dict"