]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
Gestion des fonctions dagrégation multiples corrections diverses
authorEric Fayolle <eric.fayolle@edf.fr>
Tue, 5 Jul 2022 20:52:43 +0000 (22:52 +0200)
committerEric Fayolle <eric.fayolle@edf.fr>
Tue, 5 Jul 2022 20:52:43 +0000 (22:52 +0200)
generator/generator_UQ.py
generator/textePersalys.py

index 87356ef2fd4f1018e6add8277d5610cc16a539b2..27499aae1660dc18d13af33bc03fadd9db2b9e8d 100644 (file)
@@ -181,34 +181,45 @@ class UQGenerator(PythonGenerator):
         self.txtGetAllResults = ""
         #TODO? from cata_UQ import FonctionDAggregationDict
         fctAggPy={
-            'valeur à t=O':'vIninialTime',
-            'valeur à mi-temps':'vHalfTtime',
+            'valeur à t=O':'vInitialTime',
+            'valeur à mi-temps':'vHalfTime',
             'valeur à t final':'vFinalTime',
-            'valeur moyenne':'mean',
-            'valeur cumulée':'sum',
-            'valeur minimale':'min',
-            'valeur maximale':'max'
+            'valeur moyenne':'vMean',
+            'valeur cumulée':'vSum',
+            'valeur minimale':'vMin',
+            'valeur maximale':'vMax'
         }
         
         for mc in self.lesVariablesOutput :
+            nomFctAggPyList=''
+            nomOutputList=''
             nomVar  =  mc.getChildOrChildInBloc('VariablePhysique').valeur
             nomVarEncode = nomVar.replace(' ','__')
             nomVarPostraite =  mc.getChildOrChildInBloc('VariablePosttraiteeAssociee').valeur
             nomFctAggList = mc.getChildOrChildInBloc('FonctionDAggregation').valeur
             for nomFctAgg in nomFctAggList:
                nomFctAggPy = fctAggPy[nomFctAgg]
+               nomFctAggPyList += nomFctAggPy + ', '
                nomOutput=nomVarEncode+'_'+nomFctAggPy
+               nomOutputList += nomOutput + ', '
                self.chaineDesVariablesOutputEncodee+=nomOutput+ ', '
                variablesOutputDesc = nomFctAgg+'('+nomVarPostraite+')'
-               tmpGetResultCall = getResultCall.format(
-                   variableOutput = nomOutput,
-                   variablePostraitee = nomVarPostraite,
-                   fonctionAggregation = nomFctAggPy 
-               )
-               self.txtGetAllResults += tmpGetResultCall
+               # tmpGetResultCall = getResultCall.format(
+               #     variableOutput = nomOutput,
+               #     postProcessedVar = nomVarPostraite,
+               #     fonctionAggregation = nomFctAggPy 
+               # )
                self.txtOutputVariableInitList += self.indent1 + nomOutput + " = persalys.Output('"+ nomVar+' (Agg: '+nomFctAgg+')' + "', '"+variablesOutputDesc + "')\n"
+            tmpGetResultCall = getResultCall.format(
+                variableOutputList = nomOutputList[0:-2],
+                nomVarPostraite = nomVarPostraite,
+                fonctionAggregationList = nomFctAggPyList[0:-2]
+            )
+            self.txtGetAllResults += tmpGetResultCall
+
         self.chaineDesVariablesOutputEncodee=self.chaineDesVariablesOutputEncodee[0:-2]
-         
+
+        
         sectionExecution = etapeIncertitude.getChildOrChildInBloc('Execution')[0]
         self.ExecutionMode = sectionExecution.getChildOrChildInBloc('ExecutionMode').valeur
         self.NbOfProcs = sectionExecution.getChildOrChildInBloc('NbOfProcs').valeur
@@ -359,6 +370,8 @@ class UQGenerator(PythonGenerator):
         inFiles.append(os.path.join(os.getcwd(),pyFile))
         scriptFile = "ib_test.sh"
         inFiles.append(os.path.join(os.getcwd(),scriptFile))
+        postFile = "post_csv.py"
+        inFiles.append(os.path.join(os.getcwd(),postFile))
         txtYacsJobParameters=yacsJobParameters.format(
             nomEtude = self.JobName,
             workDirectory = self.WorkDirectory,
index 0e3d92cc4f5c3ddeb028a4b15e0740127aad7123..21f69cabe6fa8dc3a6038e24c4ea490acef9a2ec 100644 (file)
@@ -97,10 +97,13 @@ class Study:
 
         pass
 
-    def get_result(self,postProcessedVar, aggregationFct):
-       from post_cvs import get_result_from_csv
+    def get_result_from_csv(self,postProcessedVar, aggregationFctList):
+       from post_csv import get_result_from_csv
+        #Fonctions a implementer dans un fichier post_csv pour définir
+       #comment l'aggrégation des valeurs peut se faire
+       from post_csv import vInitialTime, vHalfTime, vFinalTime, vMean, vSum, vMin, vMax
        print('--------------------------------------- 4 ---------------------------------------')
-       return get_result_from_csv(postProcessedVar, aggregationFct)
+       return get_result_from_csv(postProcessedVar, aggregationFctList)
 
     def run_case(self):
         print('--------------------------------------- 5 ---------------------------------------')
@@ -115,7 +118,7 @@ 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="""    {variableOutput} = study.get_result('{variablePostraitee}', {fonctionAggregation} )
+getResultCall="""    {variableOutputList} = study.get_result_from_csv( '{nomVarPostraite}', [{fonctionAggregationList}] )
 """
 
 #-------------------------
@@ -123,6 +126,8 @@ getResultCall="""    {variableOutput} = study.get_result('{variablePostraitee}',
 # ------------------------
 fonctionPersalys = """
 def _exec({chaineDesVariablesInput}):
+    from post_csv import vInitialTime, vHalfTime, vFinalTime, vMean, vSum, vMin, vMax
+
     print('--------------------------------------- 00 ---------------------------------------')
 
     from {currentFile} import Study