From: Jean-Philippe ARGAUD Date: Sun, 12 Apr 2020 14:29:44 +0000 (+0200) Subject: Improvements for classification of algorithms X-Git-Tag: V9_5_0b~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=425b8902ca1aeb461ccaacb9156177b01224f431;p=modules%2Fadao.git Improvements for classification of algorithms --- diff --git a/src/daComposant/daAlgorithms/AdjointTest.py b/src/daComposant/daAlgorithms/AdjointTest.py index 634e6d9..31561ba 100644 --- a/src/daComposant/daAlgorithms/AdjointTest.py +++ b/src/daComposant/daAlgorithms/AdjointTest.py @@ -84,6 +84,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): mandatory= ("Xb", "HO" ), optional = ("Y", ), ) + self.setAttributes(tags=( + "Checking", + )) 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, Xb, Y, R, B, Q) diff --git a/src/daComposant/daAlgorithms/Blue.py b/src/daComposant/daAlgorithms/Blue.py index cceab0c..d8d5b86 100644 --- a/src/daComposant/daAlgorithms/Blue.py +++ b/src/daComposant/daAlgorithms/Blue.py @@ -97,6 +97,11 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): self.requireInputArguments( mandatory= ("Xb", "Y", "HO", "R", "B"), ) + self.setAttributes(tags=( + "DataAssimilation", + "Linear", + "Filter", + )) 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, Xb, Y, R, B, Q) diff --git a/src/daComposant/daAlgorithms/LinearLeastSquares.py b/src/daComposant/daAlgorithms/LinearLeastSquares.py index e8af931..f36aa16 100644 --- a/src/daComposant/daAlgorithms/LinearLeastSquares.py +++ b/src/daComposant/daAlgorithms/LinearLeastSquares.py @@ -58,6 +58,11 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): self.requireInputArguments( mandatory= ("Y", "HO", "R"), ) + self.setAttributes(tags=( + "Optimization", + "Linear", + "Variational", + )) 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, Xb, Y, R, B, Q) diff --git a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py index dc59068..231764c 100644 --- a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py +++ b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py @@ -103,6 +103,11 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): self.requireInputArguments( mandatory= ("Xb", "Y", "HO", "R"), ) + self.setAttributes(tags=( + "Optimization", + "NonLinear", + "Variational", + )) 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, Xb, Y, R, B, Q) diff --git a/src/daComposant/daCore/BasicObjects.py b/src/daComposant/daCore/BasicObjects.py index 9535f5b..d89f9b2 100644 --- a/src/daComposant/daCore/BasicObjects.py +++ b/src/daComposant/daCore/BasicObjects.py @@ -331,7 +331,7 @@ class Operator(object): if self.__Matrix is not None: self.__addOneMatrixCall() mValue = [self.__Matrix,] - elif ValueForMethodForm is not "UnknownVoidValue": # Ne pas utiliser "None" + elif not isinstance(ValueForMethodForm,str) or ValueForMethodForm != "UnknownVoidValue": # Ne pas utiliser "None" mValue = [] if argsAsSerie: self.__addOneMethodCall( len(ValueForMethodForm) ) @@ -624,7 +624,10 @@ class Algorithm(object): self._name = str( name ) self._parameters = {"StoreSupplementaryCalculations":[]} self.__required_parameters = {} - self.__required_inputs = {"RequiredInputValues":{"mandatory":(), "optional":()}} + self.__required_inputs = { + "RequiredInputValues":{"mandatory":(), "optional":()}, + "ClassificationTags":[], + } self.__variable_names_not_public = {"nextStep":False} # Duplication dans AlgorithmAndParameters self.__canonical_parameter_name = {} # Correspondance "lower"->"correct" self.__canonical_stored_name = {} # Correspondance "lower"->"correct" @@ -882,11 +885,25 @@ class Algorithm(object): def requireInputArguments(self, mandatory=(), optional=()): """ - Permet d'imposer des arguments requises en entrée + Permet d'imposer des arguments de calcul requis en entrée. """ self.__required_inputs["RequiredInputValues"]["mandatory"] = tuple( mandatory ) self.__required_inputs["RequiredInputValues"]["optional"] = tuple( optional ) + def getInputArguments(self): + """ + Permet d'obtenir les listes des arguments de calcul requis en entrée. + """ + return self.__required_inputs["RequiredInputValues"]["mandatory"], self.__required_inputs["RequiredInputValues"]["optional"] + + def setAttributes(self, tags=()): + """ + Permet d'adjoindre des attributs comme les tags de classification. + Renvoie la liste actuelle dans tous les cas. + """ + self.__required_inputs["ClassificationTags"].extend( tags ) + return self.__required_inputs["ClassificationTags"] + def __setParameters(self, fromDico={}, reset=False): """ Permet de stocker les paramètres reçus dans le dictionnaire interne.