From 1e81b8f3cec4b03411df50e2e54eefb231e9f81b Mon Sep 17 00:00:00 2001 From: Pascale Noyret Date: Tue, 12 Dec 2006 13:28:15 +0000 Subject: [PATCH] PN : --- Traducteur/changeValeur.py | 11 ++++++--- Traducteur/dictErreurs.py | 24 +++++++++++++++++--- Traducteur/traduitV7V8.py | 46 ++++++++++++++++++++++++++++++++------ 3 files changed, 68 insertions(+), 13 deletions(-) diff --git a/Traducteur/changeValeur.py b/Traducteur/changeValeur.py index d56369d1..f8e3fe70 100644 --- a/Traducteur/changeValeur.py +++ b/Traducteur/changeValeur.py @@ -36,7 +36,7 @@ def ChangementValeur(jdc,command,motcle,DictNouvVal,liste=(),defaut=0): MaLigneTexte=Nouveau # raccourci honteux mais ... MaLigneGlob=Nouveau if Valeur in liste : - EcritErreur((command,motcle,"VALEUR"),indexLigneGlob) + EcritErreur((command,motcle,Valeur),indexLigneGlob) else : logging.info("Changement de %s par %s dans %s ligne %d",Valeur,DictNouvVal[Valeur],command,indexLigneGlob) boolChange=1 @@ -82,7 +82,7 @@ def ChangementValeurDsMCF(jdc,command,fact,motcle,DictNouvVal,liste=(),defaut=0) MaLigneTexte=Nouveau # raccourci honteux mais ... MaLigneGlob=Nouveau if Valeur in liste : - EcritErreur((command,fact,motcle,"VALEUR"),indexLigneGlob) + EcritErreur((command,fact,motcle,valeur),indexLigneGlob) else : logging.info("Changement de %s par %s dans %s ligne %d",Valeur,DictNouvVal[Valeur],command,indexLigneGlob) boolChange=1 @@ -257,4 +257,9 @@ def AppelleMacroSelonValeurConcept(jdc,macro,genea): if c.lineno < c.endline: decaleLignesdeNBlancs(jdc,c.lineno,c.endline-1,nbBlanc) if boolChange : jdc.reset(jdc.getSource()) - removeMotCleInFact(jdc,"MACR_LIGN_COUPE","LIGN_COUPE","TABLE") + +#---------------------------------------------- +def ChangeTouteValeur(jdc,command,motcle,DictNouvVal,liste=(),defaut=0): +#---------------------------------------------- + if macro not in jdcSet : return + boolChange=0 diff --git a/Traducteur/dictErreurs.py b/Traducteur/dictErreurs.py index d55e6904..3a3d8f59 100644 --- a/Traducteur/dictErreurs.py +++ b/Traducteur/dictErreurs.py @@ -5,8 +5,6 @@ import sets jdcSet=sets.Set() - - dict_erreurs={ "DIST_LIGN_3D": "la commande DIST_LIGN_3D a ete supprimee", "DEFI_THER_JOULE": "la commande DIST_LIGN_3D a ete supprimee", @@ -16,12 +14,18 @@ dict_erreurs={ "AFFE_CHAR_MECA_SECH_CALCULEE": "le sechage est maintenant une variable de commande", "AFFE_CHAR_MECA_HYDR_CALCULEE": "l'hydratation est maintenant une variable de commande", "AFFE_CHAR_MECA_EPSA_CALCULEE":"EPSA est maintenant une variable de commande", + "AFFE_CHAR_MECA_PRESSION_CALCULEE":"PRESSION_CALCULEE est remplace par EVOL_CHAR", "MACR_LIGN_COUPE" : "MACR_LIGN_COUPE demande un traitement manuel", "POST_RCCM" : "POST_RCCM demande un traitement manuel", "DEFI_MATERIAU_CHABOCHE" : "remplacer la valeur CINx_CHAB", "DEFI_MATERIAU_POLY_CFC" : "le materiau POLY_CFC est remplace par le comportement POLYCRISTAL", "DEFI_MATERIAU_ECOU_PLAS1" : "le materiau ECOU_PLAS1 est supprime", - "DEFI_MATERIAU_COMP_THM" : "les materiaux ELAS_THM, SURF_ETAT_SATU, SURF_ETAT_NSAT, CAM_CLAY_THM, LIQU_SATU_GAT, LIQU_NSAT_GAT ont ete supprimes", + "DEFI_MATERIAU_COMP_THM_ELAS_THM" : "le materiau ELAS_THM a ete supprime", + "DEFI_MATERIAU_COMP_THM_SURF_ETAT_SATU" : "le materiau SURF_ETAT_SATU a ete supprime", + "DEFI_MATERIAU_COMP_THM_SURF_ETAT_NSAT" : "le materiau SURF_ETAT_NSAT a ete supprime", + "DEFI_MATERIAU_COMP_THM_CAM_CLAY_THM" : "le materiau CAM_CLAY_THM a ete supprime", + "DEFI_MATERIAU_COMP_THM_LIQU_SATU_GAT" : "le materiau LIQU_SATU_GAT a ete supprime", + "DEFI_MATERIAU_COMP_THM_LIQU_NSAT_GAT" : "le materiau LIQU_NSAT_GAT a ete supprime", "DEFI_MATERIAU_GLRC" : "le materiau GLRC a ete remplace par GLRC_DAMAGE", "CALC_CHAM_ELEM":"reecrire la partie SOUR_ELGA_ELEC", "CALC_G_THETA_T_OPTION_VALEUR":"verifier la valeur d OPTION", @@ -49,6 +53,9 @@ dict_erreurs={ "DEFI_INTERF_DYNA_INTERFACE_DDL_ACTIF":"DDL_ACTIF supprime de DEFI_INTERF_DYNA; utiliser MASQUE", "DEFI_TEXTURE":"le materiau POLY_CFC est remplace par le comportement POLYCRISTAL", "CREA_RESU_NOM_CHAM_VALEUR":"HYDR_ELGA est remplace par HYDR_ELNO_ELGA et HYDR_NOEU_ELGA", + "COMB_CHAM_NO":"COMB_CHAM_NO est remplace par CREA_CHAMP", + "COMB_CHAM_ELEM":"COMB_CHAM_ELEM est remplace par CREA_CHAMP", + "IMPR_OAR":"IMPR_OAR doit etre traduit manuellement", } def EcritErreur(listeGena,ligne=None) : @@ -63,6 +70,17 @@ def EcritErreur(listeGena,ligne=None) : logging.warning("%s ligne %d ",dict_erreurs[maClef], ligne) else : logging.warning("%s",dict_erreurs[maClef]) + else : + maCle="" + for Mot in listeGena[:-1] : + maCle=maCle+"_"+Mot + maClef=maCle[1:] + maClef=maCle+"_"+"VALEUR" + if maClef in dict_erreurs.keys() : + if ligne != None : + logging.warning("%s ligne %d ",dict_erreurs[maClef], ligne) + else : + logging.warning("%s",dict_erreurs[maClef]) #except : # pass diff --git a/Traducteur/traduitV7V8.py b/Traducteur/traduitV7V8.py index fbed9e22..904afc30 100644 --- a/Traducteur/traduitV7V8.py +++ b/Traducteur/traduitV7V8.py @@ -33,8 +33,9 @@ atraiter=( "IMPR_GENE","CALC_FONCTION", "DEFI_MATERIAU","STAT_NON_LINE", "CREA_RESU","CREA_CHAMP","DIST_LIGN_3D","MODI_MAILLAGE","LIRE_TABLE", "POST_SIMPLIFIE","AFFE_MATERIAU","DEFI_MAILLAGE","DEPL_INTERNE", "POST_DYNA_ALEA","RECU_FONCTION","DYNA_TRAN_MODAL","DEFI_INTERF_DYNA", - "CALC_PRECONT","DEFI_TEXTURE","TEST_RESU","COMB_CHAM_NO", - "CALC_FATIGUE", + "CALC_PRECONT","DEFI_TEXTURE","TEST_RESU","COMB_CHAM_NO","COMB_CHAM_ELEM", + "CALC_FATIGUE","IMPR_OAR","MACR_ASCOUF_CALC","MACR_ASPIC_CALC","MACR_CABRI_CALC", + "MACR_ADAPT_MAILLE", ) #atraiter=( "IMPR_GENE",) @@ -49,7 +50,7 @@ def traduc(infile,outfile): parseKeywords(root) ####################### traitement erreurs ######################## - GenereErreurPourCommande(jdc,("POST_RCCM","DIST_LIGN_3D","IMPR_OAR")) + GenereErreurPourCommande(jdc,("POST_RCCM","DIST_LIGN_3D","IMPR_OAR","COMB_CHAM_NO","COMB_CHAM_ELEM")) ####################### traitement CALC_META ####################### renameMotCleInFact(jdc,"CALC_META","ETAT_INIT","META_INIT","META_INIT_ELNO") @@ -122,7 +123,7 @@ def traduc(infile,outfile): removeMotCleAvecErreur(jdc,"DEFI_MATERIAU","POLY_CFC") removeMotCleAvecErreur(jdc,"DEFI_MATERIAU","ECOU_PLAS1") - lavertit=("DEFI_MATERIAU","COMP_THM") + lavertit=("ELAS_THM","SURF_ETAT_SATU","SURF_ETAT_NSAT","CAM_CLAY_THM","LIQU_SATU_GAT","LIQU_NSAT_GAT") dTHM={"ELAS_THM":"xxx", "SURF_ETAT_SATU":"xxx", "SURF_ETAT_NSAT":"xxx","CAM_CLAY_THM":"xxx","LIQU_SATU_GAT":"xxx","LIQU_NSAT_GAT":"xxx"} ChangementValeurAvecAvertissement(jdc,"DEFI_MATERIAU","COMP_THM",dTHM,lavertit) @@ -142,6 +143,7 @@ def traduc(infile,outfile): removeMotCle(jdc,"AFFE_CHAR_MECA","VERI_DDL") removeMotCle(jdc,"AFFE_CHAR_MECA","SECH_CALCULEE") removeMotCle(jdc,"AFFE_CHAR_MECA","HYDR_CALCULEE") + removeMotCle(jdc,"AFFE_CHAR_MECA","PRESSION_CALCULEE") removeMotCleAvecErreur(jdc,"AFFE_CHAR_MECA","EPSA_CALCULEE") removeMotCle(jdc,"AFFE_CHAR_THER_F","VERI_DDL") removeMotCle(jdc,"AFFE_CHAR_THER","VERI_DDL") @@ -198,7 +200,7 @@ def traduc(infile,outfile): removeMotCleInFactSiRegleAvecErreur(jdc,"AFFE_CHAR_MECA","CONTACT","FROTTEMENT",((("CONTACT","METHODE","CONTRAINTE",jdc),"MCsousMCFaPourValeur"),)) ####################### traitement CALC_ELEM / CALC_NO ####################### - dcalcelemno={"ERRE_ELGA_NORE":"ERRE_ELEM_SIGM","ERRE_ELEM_NOZ1":"ERZ1_ELEM_SIGM","ERRE_ELEM_NOZ2":"ERZ2_ELEM_SIGM","ERRE_ELNO_ELGA":"ERRE_ELNO_ELEM","ERRE_NOEU_ELGA":"ERRE_NOEU_ELEM","ERTH_ELEM_TEMP":"ERRE_ELEM_TEMP","ERTH_ELNO_ELEM":"ERRE_ELNO_ELEM","EPGR_ELNO":"EPFP_ELNO","EPGR_ELGA":"EPFP_ELGA"} + dcalcelemno={"ERRE_ELGA_NORE":"ERRE_ELEM_SIGM","ERRE_ELEM_NOZ1":"ERZ1_ELEM_SIGM","ERRE_ELEM_NOZ2":"ERZ2_ELEM_SIGM","ERRE_ELNO_ELGA":"ERRE_ELNO_ELEM","ERRE_NOEU_ELGA":"ERRE_NOEU_ELEM","ERTH_ELEM_TEMP":"ERRE_ELEM_TEMP","ERTH_ELNO_ELEM":"ERRE_ELNO_ELEM","EPGR_ELNO":"EPFP_ELNO","EPGR_ELGA":"EPFP_ELGA","DURT_ELGA_TEMP":"DURT_ELNO_TEMP"} ChangementValeur(jdc,"CALC_ELEM","OPTION",dcalcelemno) ChangementValeur(jdc,"CALC_NO","OPTION",dcalcelemno) ChangementValeurDsMCF(jdc,"IMPR_RESU","RESU","NOM_CHAM",dcalcelemno) @@ -247,6 +249,7 @@ def traduc(infile,outfile): ####################### traitement MACR_LIGNE_COUPE ####################### AppelleMacroSelonValeurConcept(jdc,"MACR_LIGN_COUPE",("LIGN_COUPE","TABLE")) + removeMotCleInFact(jdc,"MACR_LIGN_COUPE","LIGN_COUPE","TABLE") ####################### traitement MODI_MAILLAGE ####################### removeMotCle(jdc,"MODI_MAILLAGE","MODELE") @@ -280,9 +283,11 @@ def traduc(infile,outfile): removeMotCleAvecErreur(jdc,"POST_DYNA_ALEA","VANMARCKE") ####################### traitement RECU_FONCTION ####################### - removeMotCle(jdc,"RECU_FONCTION","TYPE_RESU") # il faut aussi ajouter la regle suivante : # s'il existe TYPE_RESU='FONCTION_C', renommer NOM_PARA_TABL='FONCTION_C' + removeMotCleSiRegle(jdc,"RECU_FONCTION","NOM_PARA_TABL",((("TYPE_RESU","FONCTION_C",jdc),"MCaPourValeur"),)) + chercheOperInsereFacteurSiRegle(jdc,"RECU_FONCTION","NOM_PARA_TABL='FONCTION_C',",((("TYPE_RESU","FONCTION_C",jdc),"MCaPourValeur"),),estunFacteur=0) + removeMotCle(jdc,"RECU_FONCTION","TYPE_RESU") chercheOperInsereFacteurSiRegle(jdc,"RECU_FONCTION","FILTRE",((("OBSTACLE",),"existe"),)) AjouteMotClefDansFacteurSiRegle(jdc,"RECU_FONCTION","FILTRE","NOM_PARA='LIEU',",((("OBSTACLE",),"existe"),)) AjouteMotClefDansFacteurSiRegle(jdc,"RECU_FONCTION","FILTRE","VALE_K='DEFIOBST',",((("OBSTACLE",),"existe"),)) @@ -297,6 +302,10 @@ def traduc(infile,outfile): ####################### traitement CALC_PRECONT ####################### AjouteMotClefDansFacteurSiRegle(jdc,"CALC_PRECONT","INCREMENT","SUBD_METHODE='UNIFORME',",((("INCREMENT","SUBD_PAS"),"existeMCsousMCF"),)) + moveMotCleFromFactToFactMulti(jdc,"CALC_PRECONT","CONVERGENCE","RESI_INTE_RELA",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"CALC_PRECONT","CONVERGENCE","ITER_INTE_MAXI",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"CALC_PRECONT","CONVERGENCE","ITER_INTE_PAS",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"CALC_PRECONT","CONVERGENCE","RESO_INTE",("COMP_INCR","COMP_ELAS")) renameMotCleInFact(jdc,"CALC_PRECONT","INCREMENT","COEF_SUBD_PAS_1","SUBD_COEF_PAS_1") @@ -315,6 +324,30 @@ def traduc(infile,outfile): renameOper(jdc,"COMB_CHAM_NO","CREA_CHAMP") + ####################### traitement MACR_ASCOUF_CALC ####################### + AjouteMotClefDansFacteurSiRegle(jdc,"MACR_ASCOUF_CALC","INCREMENT","SUBD_METHODE='UNIFORME',",((("INCREMENT","SUBD_PAS"),"existeMCsousMCF"),)) + renameMotCleInFact(jdc,"MACR_ASCOUF_CALC","INCREMENT","COEF_SUBD_PAS_1","SUBD_COEF_PAS_1") + moveMotCleFromFactToFactMulti(jdc,"MACR_ASCOUF_CALC","CONVERGENCE","RESI_INTE_RELA",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"MACR_ASCOUF_CALC","CONVERGENCE","ITER_INTE_MAXI",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"MACR_ASCOUF_CALC","CONVERGENCE","ITER_INTE_PAS",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"MACR_ASCOUF_CALC","CONVERGENCE","RESO_INTE",("COMP_INCR","COMP_ELAS")) + + + ####################### traitement MACR_ASPIC_CALC ####################### + AjouteMotClefDansFacteurSiRegle(jdc,"MACR_ASPIC_CALC","INCREMENT","SUBD_METHODE='UNIFORME',",((("INCREMENT","SUBD_PAS"),"existeMCsousMCF"),)) + renameMotCleInFact(jdc,"MACR_ASPIC_CALC","INCREMENT","COEF_SUBD_PAS_1","SUBD_COEF_PAS_1") + moveMotCleFromFactToFactMulti(jdc,"MACR_ASPIC_CALC","CONVERGENCE","RESI_INTE_RELA",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"MACR_ASPIC_CALC","CONVERGENCE","ITER_INTE_MAXI",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"MACR_ASPIC_CALC","CONVERGENCE","ITER_INTE_PAS",("COMP_INCR","COMP_ELAS")) + + + ####################### traitement MACR_CABRI_CALC ####################### + AjouteMotClefDansFacteurSiRegle(jdc,"MACR_CABRI_CALC","INCREMENT","SUBD_METHODE='UNIFORME',",((("INCREMENT","SUBD_PAS"),"existeMCsousMCF"),)) + renameMotCleInFact(jdc,"MACR_CABRI_CALC","INCREMENT","COEF_SUBD_PAS_1","SUBD_COEF_PAS_1") + moveMotCleFromFactToFactMulti(jdc,"MACR_CABRI_CALC","CONVERGENCE","RESI_INTE_RELA",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"MACR_CABRI_CALC","CONVERGENCE","ITER_INTE_MAXI",("COMP_INCR","COMP_ELAS")) + moveMotCleFromFactToFactMulti(jdc,"MACR_CABRI_CALC","CONVERGENCE","ITER_INTE_PAS",("COMP_INCR","COMP_ELAS")) + ####################### traitement CALC_FATIGUE ####################### dfatigue={"MATAKE":"MATAKE_MODI_AC", "DOMM_MAXI":"MATAKE_MODI_AV", "FATEMI_SOCIE":"FATESOCI_MODI_AV"} @@ -326,7 +359,6 @@ def traduc(infile,outfile): ######################################################################### - f=open(outfile,'w') f.write(jdc.getSource()) f.close() -- 2.39.2