Salome HOME
Update internal settings
[modules/adao.git] / src / daComposant / daAlgorithms / GradientTest.py
index 109088e059758109472cae11a7ff09d6e9e2a4bf..d636c20f1ceb872b8370558b6adc14106dd2e7b7 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2008-2017 EDF R&D
+# Copyright (C) 2008-2019 EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -100,14 +100,18 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             default  = [],
             typecast = tuple,
             message  = "Liste de calculs supplémentaires à stocker et/ou effectuer",
-            listval  = ["CurrentState", "Residu", "SimulatedObservationAtCurrentState"]
+            listval  = [
+                "CurrentState",
+                "Residu",
+                "SimulatedObservationAtCurrentState",
+                ]
             )
         self.requireInputArguments(
             mandatory= ("Xb", "HO"),
             )
 
     def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
-        self._pre_run(Parameters, R, B, Q)
+        self._pre_run(Parameters, Xb, Y, R, B, Q)
         #
         Hm = HO["Direct"].appliedTo
         if self._parameters["ResiduFormula"] in ["Taylor", "TaylorOnNorm"]:
@@ -121,9 +125,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         FX      = numpy.asmatrix(numpy.ravel( Hm( X ) )).T
         NormeX  = numpy.linalg.norm( X )
         NormeFX = numpy.linalg.norm( FX )
-        if "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+        if self._toStore("CurrentState"):
             self.StoredVariables["CurrentState"].store( numpy.ravel(Xn) )
-        if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+        if self._toStore("SimulatedObservationAtCurrentState"):
             self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX) )
         #
         if len(self._parameters["InitialDirection"]) == 0:
@@ -237,9 +241,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             FX_plus_dX = Hm( X + dX )
             FX_plus_dX = numpy.asmatrix(numpy.ravel( FX_plus_dX )).T
             #
-            if "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+            if self._toStore("CurrentState"):
                 self.StoredVariables["CurrentState"].store( numpy.ravel(X + dX) )
-            if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+            if self._toStore("SimulatedObservationAtCurrentState"):
                 self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(FX_plus_dX) )
             #
             NormedX     = numpy.linalg.norm( dX )