]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Source corrections for calculation precision control
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Mon, 8 Jun 2015 09:06:17 +0000 (11:06 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Mon, 8 Jun 2015 09:06:17 +0000 (11:06 +0200)
src/daComposant/daAlgorithms/FunctionTest.py
src/daComposant/daCore/BasicObjects.py

index 6a577d6d75764345995e7e8cd8f997ec1c69a53b..0daf2869bd849cf01c606bfb850c1cd4ea8c0872 100644 (file)
@@ -92,6 +92,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             print("===> Beginning of evaluation, without activating debug\n")
         #
         # ----------
+        HO["Direct"].disableAvoidingRedundancy()
+        # ----------
         Ys = []
         for i in range(self._parameters["NumberOfRepetition"]):
             print("     %s\n"%("-"*75,))
@@ -118,6 +120,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 Yn
                 ) ) )
         # ----------
+        HO["Direct"].enableAvoidingRedundancy()
+        # ----------
         #
         print("     %s\n"%("-"*75,))
         if self._parameters["SetDebug"]:
index 35625adef6214fb9bcdeb480ca1b8a746ad8ed5e..864070516898bef5b5d3ac345570de8c2a1d4bd7 100644 (file)
@@ -48,6 +48,7 @@ class CacheManager:
         """
         self.__tolerBP  = float(toleranceInRedundancy)
         self.__lenghtOR = int(lenghtOfRedundancy)
+        self.__initlnOR = self.__lenghtOR
         self.clearCache()
 
     def clearCache(self):
@@ -69,7 +70,9 @@ class CacheManager:
         return __alc, __HxV
 
     def storeValueInX(self, xValue, HxValue ):
-        if self.__lenghtOR < 0: self.__lenghtOR = 2 * xValue.size + 2
+        if self.__lenghtOR < 0:
+            self.__lenghtOR = 2 * xValue.size + 2
+            self.__initlnOR = self.__lenghtOR
         while len(self.__listOPCV) > self.__lenghtOR:
             # logging.debug("CM Réduction de la liste des cas à %i éléments par suppression du premier"%self.__lenghtOR)
             self.__listOPCV.pop(0)
@@ -79,6 +82,13 @@ class CacheManager:
             numpy.linalg.norm(xValue),
             ) )
 
+    def disable(self):
+        self.__initlnOR = self.__lenghtOR
+        self.__lenghtOR = 0
+
+    def enable(self):
+        self.__lenghtOR = self.__initlnOR
+
 # ==============================================================================
 class Operator:
     """
@@ -113,6 +123,15 @@ class Operator:
             self.__Matrix = None
             self.__Type   = None
 
+    def disableAvoidingRedundancy(self):
+        Operator.CM.disable()
+
+    def enableAvoidingRedundancy(self):
+        if self.__AvoidRC:
+            Operator.CM.enable()
+        else:
+            Operator.CM.disable()
+
     def isType(self):
         return self.__Type