From 471a7c0716ed9300fb259ff83a288f0123bdb896 Mon Sep 17 00:00:00 2001 From: Pascale Noyret Date: Thu, 21 Dec 2006 13:15:09 +0000 Subject: [PATCH] PN --- Traducteur/dictErreurs.py | 1 + Traducteur/inseremocle.py | 6 +++++- Traducteur/log.py | 5 +++-- Traducteur/traduitV7V8.py | 18 ++++++++++++------ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Traducteur/dictErreurs.py b/Traducteur/dictErreurs.py index 46e37dd8..67664e13 100644 --- a/Traducteur/dictErreurs.py +++ b/Traducteur/dictErreurs.py @@ -27,6 +27,7 @@ dict_erreurs={ "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", + "DEFI_MATERIAU_GLRC_FO" : "le materiau GLRC_FO a ete remplace par GLRC_DAMAGE", "DEFI_MATERIAU_OHNO" : "le materiau OHNO a ete remplace par TAHERI", "DEFI_MATERIAU_OHNO_FO" : "le materiau OHNO a ete remplace par TAHERI", "CALC_CHAM_ELEM":"reecrire la partie SOUR_ELGA_ELEC", diff --git a/Traducteur/inseremocle.py b/Traducteur/inseremocle.py index ff8a3357..f8307f5e 100644 --- a/Traducteur/inseremocle.py +++ b/Traducteur/inseremocle.py @@ -58,7 +58,11 @@ def insereMotCleDansFacteur(jdc,facteur,texte): indice = -1 while texte[indice] == " " : indice = indice -1 - if texte[indice] != "," : texte=texte+"," + if texte[indice] != "," : + texte=texte+"," + if (texte.find("#") > -1) and (texte.find("#") < texte.find(",")) : + texte=texte+"\n," + texteinfo=texte texte=texte+"\n" diff --git a/Traducteur/log.py b/Traducteur/log.py index 3e440867..3c43d51a 100644 --- a/Traducteur/log.py +++ b/Traducteur/log.py @@ -3,8 +3,9 @@ import logging logger=logging.getLogger() -def initialise() : - hdlr=logging.FileHandler('/tmp/convert.log','w') +def initialise(flog=None): + flog = flog or '/tmp/convert.log' + hdlr=logging.FileHandler(flog,'w') formatter = logging.Formatter('%(levelname)s: %(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) diff --git a/Traducteur/traduitV7V8.py b/Traducteur/traduitV7V8.py index e74f31a1..a64079c5 100644 --- a/Traducteur/traduitV7V8.py +++ b/Traducteur/traduitV7V8.py @@ -20,7 +20,6 @@ from changeValeur import * from movemocle import * from dictErreurs import GenereErreurPourCommande -# Demander a emmanuel pour affe_char_ther et test_resu import calcG atraiter=( "IMPR_GENE","CALC_FONCTION", "DEFI_MATERIAU","STAT_NON_LINE", @@ -34,16 +33,16 @@ atraiter=( "IMPR_GENE","CALC_FONCTION", "DEFI_MATERIAU","STAT_NON_LINE", "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","COMB_CHAM_ELEM", - "CALC_FATIGUE","IMPR_OAR", + "CALC_FATIGUE","IMPR_OAR", "AFFE_CHAR_MECA_F", "MACR_ASCOUF_CALC","MACR_ASPIC_CALC","MACR_CABRI_CALC", "MACR_ADAP_MAIL","IMPR_FICO_HOMARD" ) #atraiter=( "MACR_ADAP_MAIL",) -def traduc(infile,outfile): +def traduc(infile,outfile,flog=None): - hdlr=log.initialise() + hdlr=log.initialise(flog) jdc=getJDC(infile,atraiter) root=jdc.root @@ -111,6 +110,7 @@ def traduc(infile,outfile): renameMotCleAvecErreur(jdc,"DEFI_MATERIAU","OHNO","TAHERI") renameMotCleAvecErreur(jdc,"DEFI_MATERIAU","OHNO_FO","TAHERI_FO") renameMotCleAvecErreur(jdc,"DEFI_MATERIAU","GLRC","GLRC_DAMAGE") + renameMotCleAvecErreur(jdc,"DEFI_MATERIAU","GLRC_FO","GLRC_DAMAGE") renameMotCleInFact(jdc,"DEFI_MATERIAU","GRAN_IRRA","A","GRAN_A") renameMotCleInFact(jdc,"DEFI_MATERIAU","GRAN_IRRA","B","GRAN_B") @@ -158,11 +158,17 @@ def traduc(infile,outfile): ####################### traitement AFFE_CHAR_MECA (CONTACT) ####################### renameMotCleInFact(jdc,"AFFE_CHAR_MECA","CONTACT","COEF_MULT_ESCL","COEF_MULT") renameMotCleInFact(jdc,"AFFE_CHAR_MECA","CONTACT","NOM_CHAM","NOM_CMP") - renameMotCleInFact(jdc,"AFFE_CHAR_MECA","CONTACT","NOM_CHAM","NOM_CMP") - renameMotCleInFact(jdc,"AFFE_CHAR_MECA","CONTACT","GROUP_MA_ESCL","GROUP_MA") + renameMotCleInFactSiRegle(jdc,"AFFE_CHAR_MECA","CONTACT","GROUP_MA_ESCL","GROUP_MA",((("CONTACT","NOM_CMP"),"existeMCsousMCF"),)) renameMotCleSiRegle(jdc,"AFFE_CHAR_MECA","CONTACT","LIAISON_UNILATER",((("CONTACT","NOM_CMP"),"existeMCsousMCF"),)) removeMotCleInFact(jdc,"AFFE_CHAR_MECA","LIAISON_UNILATER","APPARIEMENT") + ####################### traitement AFFE_CHAR_MECA_F (CONTACT) ####################### + renameMotCleInFact(jdc,"AFFE_CHAR_MECA_F","CONTACT","COEF_MULT_ESCL","COEF_MULT") + renameMotCleInFact(jdc,"AFFE_CHAR_MECA_F","CONTACT","NOM_CHAM","NOM_CMP") + renameMotCleInFactSiRegle(jdc,"AFFE_CHAR_MECA_F","CONTACT","GROUP_MA_ESCL","GROUP_MA",((("CONTACT","NOM_CMP"),"existeMCsousMCF"),)) + renameMotCleSiRegle(jdc,"AFFE_CHAR_MECA_F","CONTACT","LIAISON_UNILATER",((("CONTACT","NOM_CMP"),"existeMCsousMCF"),)) + removeMotCleInFact(jdc,"AFFE_CHAR_MECA_F","LIAISON_UNILATER","APPARIEMENT") + ####################### traitement CALC_G ####################### chercheOperInsereFacteurSiRegle(jdc,"CALC_G_LOCAL_T","LISSAGE",((("LISSAGE_G","LISSAGE_THETA","DEGRE"),"existeMCFParmi"),)) moveMotClefInOperToFact(jdc,"CALC_G_LOCAL_T","LISSAGE_THETA","LISSAGE") -- 2.39.2