From: Eric Fayolle Date: Tue, 20 Sep 2022 11:50:12 +0000 (+0200) Subject: Eviction du bug Persalys sur la longueur de chaine des variables de sorties (_exec) X-Git-Tag: merge_uncertainty_odysee_1210~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b44f9e9a337df0b577e74abebf88c2c6d33e23f5;p=tools%2Feficas.git Eviction du bug Persalys sur la longueur de chaine des variables de sorties (_exec) --- diff --git a/generator/generator_UQ.py b/generator/generator_UQ.py index 2827a780..65824151 100644 --- a/generator/generator_UQ.py +++ b/generator/generator_UQ.py @@ -35,7 +35,7 @@ import Accas from .generator_python import PythonGenerator from .textePersalys import headerScriptPersalys, fonctionPersalys, etudeScript, codePersalys from .textePersalys import mainPersalys, inputHeaderPersalys, outputHeaderPersalys -from .textePersalys import getResultCall +from .textePersalys import getResultCall,getResultCallAvoidPersalysBug from .textePersalys import centralTendencyTaylor, resultTaylor from .textePersalys import optionalResultTaylor, optionalPrintResultTaylor from .textePersalys import centralTendencyMC, resultMC @@ -158,6 +158,7 @@ class UQGenerator(PythonGenerator): return '@ '+obj.nom+' @,' def analyseIncertitude(self) : + from functools import reduce as reduce self.txtScriptPersalys = '' etapeIncertitude=self.jdc.getEtapesByName('ExpressionIncertitude') @@ -215,8 +216,10 @@ class UQGenerator(PythonGenerator): 'valeur minimale':'vMin', 'valeur maximale':'vMax' } - + + index=0; for mc in self.lesVariablesOutput : + nomShortVariableOutputList='' nomFctAggPyList='' nomOutputList='' nomVar = mc.getChildOrChildInBloc('VariablePhysique').valeur @@ -230,22 +233,22 @@ class UQGenerator(PythonGenerator): nomOutputList += nomOutput + ', ' self.chaineDesVariablesOutputEncodee+=nomOutput+ ', ' variablesOutputDesc = nomFctAgg+'('+nomVarPostraite+')' - # tmpGetResultCall = getResultCall.format( - # variableOutput = nomOutput, - # postProcessedVar = nomVarPostraite, - # fonctionAggregation = nomFctAggPy - # ) + nomShortVariableOutputList+='a'+str(index)+', ' # Avoid a Persalys Bug + index+=1 self.txtOutputVariableInitList += self.indent1 + nomOutput + " = persalys.Output('"+ nomVar+' (Agg: '+nomFctAgg+')' + "', '"+variablesOutputDesc + "')\n" - tmpGetResultCall = getResultCall.format( + # tmpGetResultCall = getResultCall.format( + tmpGetResultCall = getResultCallAvoidPersalysBug.format( # Avoid a Persalys Bug variableOutputList = nomOutputList[0:-2], nomVarPostraite = nomVarPostraite, - fonctionAggregationList = nomFctAggPyList[0:-2] + fonctionAggregationList = nomFctAggPyList[0:-2], + shortVariableOutputList = nomShortVariableOutputList # Avoid a Persalys Bug ) self.txtGetAllResults += tmpGetResultCall self.chaineDesVariablesOutputEncodee=self.chaineDesVariablesOutputEncodee[0:-2] + self.chaineDesShortVariablesOutput = reduce(lambda x,y:x+y, + [ "a"+str(i)+', ' for i in range(index)]) - sectionExecution = etapeIncertitude.getChildOrChildInBloc('Execution')[0] self.NbDeBranches = sectionExecution.getChildOrChildInBloc('NbDeBranches').valeur if sectionExecution.getChildOrChildInBloc('ExecutionMode') != None : @@ -340,7 +343,8 @@ class UQGenerator(PythonGenerator): currentFile = self.fichierUQModule, chaineDesVariablesInput = self.chaineDesVariablesInput, getAllResults = self.txtGetAllResults, - chaineDesVariablesOutput = self.chaineDesVariablesOutputEncodee + #chaineDesVariablesOutput = self.chaineDesVariablesOutputEncodee + chaineDesVariablesOutput = self.chaineDesShortVariablesOutput # Avoid a Persalys Bug ) self.txtScriptPersalys += codePersalys.format( fonctionPersalys =txtFonctionPersalys diff --git a/generator/textePersalys.py b/generator/textePersalys.py index ad453140..f3aeb278 100644 --- a/generator/textePersalys.py +++ b/generator/textePersalys.py @@ -118,13 +118,19 @@ class Study: # /home/C65845/VIMMP/Banc_integration.newer_odysee/environment/bin/python3 /home/C65845/VIMMP/Banc_integration.newer_odysee/environment/bin/ib-run --cocagne-neutro-solver SPN --cocagne-thermo-solver THERMOMI/TRMIC -- /home/C65845/VIMMP/Banc_integration.newer_odysee/integration_bench/tests/control_rod_ejection_small_core_cathare3_cocagne.comm /home/C65845/VIMMP/Banc_integration.newer_odysee/integration_bench/tests/control_rod_ejection_small_core_cathare3_cocagne_spn_thermomi-trmic_serial -# getResultCall=""" {variableOutputList}, = study.get_result_from_csv( '{nomVarPostraite}', [{fonctionAggregationList}] ) -# """ - getResultCall=""" {variableOutputList}, = study.get_result_from_csv( '{nomVarPostraite}', [{fonctionAggregationList}] ) print( '{nomVarPostraite}: ({variableOutputList})',{variableOutputList}) """ +getResultCallAvoidPersalysBug=""" {variableOutputList}, = study.get_result_from_csv( '{nomVarPostraite}', [{fonctionAggregationList}] ) + + print( '{nomVarPostraite}: ({variableOutputList})',{variableOutputList}) + + #Contournement Bug Persalys sur la longueur de la chaine retour + {shortVariableOutputList} = {variableOutputList} + +""" + #------------------------- # fonctionPersalys # ------------------------ @@ -140,7 +146,6 @@ def _exec({chaineDesVariablesInput}): study.run_case() {getAllResults} - return {chaineDesVariablesOutput} """