From: Jean-Philippe ARGAUD Date: Mon, 8 Jun 2015 09:06:17 +0000 (+0200) Subject: Source corrections for calculation precision control X-Git-Tag: V7_6_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=43ba8ed2d321f32f3b4ac4e9a8b91582e7855af6;p=modules%2Fadao.git Source corrections for calculation precision control --- diff --git a/src/daComposant/daAlgorithms/FunctionTest.py b/src/daComposant/daAlgorithms/FunctionTest.py index 6a577d6..0daf286 100644 --- a/src/daComposant/daAlgorithms/FunctionTest.py +++ b/src/daComposant/daAlgorithms/FunctionTest.py @@ -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"]: diff --git a/src/daComposant/daCore/BasicObjects.py b/src/daComposant/daCore/BasicObjects.py index 35625ad..8640705 100644 --- a/src/daComposant/daCore/BasicObjects.py +++ b/src/daComposant/daCore/BasicObjects.py @@ -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