From: Pascale Noyret Date: Tue, 30 May 2006 08:29:07 +0000 (+0000) Subject: PN X-Git-Tag: V1_10b2~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=974897c5280ea769e6e70293b48b5aa235805dd7;p=modules%2Feficas.git PN --- diff --git a/Traducteur/inseremocle.py b/Traducteur/inseremocle.py index 6e23e96f..b8d345b4 100644 --- a/Traducteur/inseremocle.py +++ b/Traducteur/inseremocle.py @@ -36,7 +36,7 @@ def inseremotcleincommand(jdc,command,texte): def inseremotcleinfacteur(jdc,facteur,texte): #------------------------------------------------- if debug : print "inseremotcle ", texte , " dans ", facteur.name - ancien=jdc.getLine(facteur.endline -1) + ancien=jdc.getLine(facteur.lineno ) # On va chercher la dernier ) pour ajouter avant # on va verifier s il il y a un , avant ligne,col,boolvirgule=chercheDerniereParenthese(jdc,facteur) @@ -47,6 +47,11 @@ def inseremotcleinfacteur(jdc,facteur,texte): jdc.joinLineandNext(ligne) debut=ancien.find("_F") + 3 aligne=debut*" " + # enleve les blancs en debut de texte + i = 0 + while i < len(texte) : + if texte[i] != " " : break + i = i +1 texte=aligne+texte+"\n" jdc.addLine(texte,ligne) jdc.joinLineandNext(ligne+1) diff --git a/Traducteur/jdcparser.py b/Traducteur/jdcparser.py index a6a81ab3..d6a1651d 100644 --- a/Traducteur/jdcparser.py +++ b/Traducteur/jdcparser.py @@ -12,7 +12,7 @@ import movemocle # "AFFE_MATERIAU","DEFI_MATERIAU","STAT_NONLINE", # ) -atraiter=("CALC_FONCTION","IMPR_GENE","STAT_NON_LINE") +atraiter=("CALC_FONCTION","IMPR_GENE","STAT_NON_LINE","DEFI_MATERIAU") filename="toto.comm" jdc=getJDC(filename,atraiter) root=jdc.root @@ -31,6 +31,8 @@ parseKeywords(root) #renamemocle.renamemocle(jdc,"AFFE_MATERIAU","MAILLAGE","MAILL") #removemocle.removemocleinfact(jdc,"STAT_NONLINE","SOLV","METHOD") #removemocle.removemocle(jdc,"STAT_NONLINE","AFFE") +#renamemocle.renamecommande(jdc,"AFFE_CHAR_MECA","AFFE_CHAR_MECA_PN") +#renamemocle.renamecommande(jdc,"DEBUT","DEBUT_PN") # les arguments sont jdc,ancien-nom-de-commande,nouveau-nom-de-commande renamemocle.renamecommande(jdc,"CALC_FONCTION","INFO_FONCTION") @@ -51,8 +53,21 @@ movemocle.movemoclefromfacttofather(jdc,"IMPR_GENE","GENE","FORMAT") # Attention ne fonctionne pas pour l instant avec +sieurs occurences du mot cle à déplacer movemocle.movemoclefromfacttofactmulti(jdc,"STAT_NON_LINE","CONVERGENCE","RESI_INTE_RELA",("COMP_INCR","COMP_ELAS")) -#renamemocle.renamecommande(jdc,"AFFE_CHAR_MECA","AFFE_CHAR_MECA_PN") -#renamemocle.renamecommande(jdc,"DEBUT","DEBUT_PN") + +renamemocle.renamemocle(jdc,"DEFI_MATERIAU","LEMAITRE","LEMAITRE_IRRA") +movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","FLU_IRRA","QSR_K",("LEMAITRE_IRRA",)) +movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","FLU_IRRA","BETA",("LEMAITRE_IRRA",)) +movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","FLU_IRRA","PHI_ZERO",("LEMAITRE_IRRA",)) +movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","FLU_IRRA","L",("LEMAITRE_IRRA",)) +removemocle.removemocle(jdc,"DEFI_MATERIAU","FLU_IRRA") + +renamemocle.renamemocleinfact(jdc,"DEFI_MATERIAU","GRAN_IRRA","A","GRAN_A") +renamemocle.renamemocleinfact(jdc,"DEFI_MATERIAU","GRAN_IRRA","B","GRAN_B") +renamemocle.renamemocleinfact(jdc,"DEFI_MATERIAU","GRAN_IRRA","S","GRAN_S") +movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","GRAN_IRRA","GRAN_A",("LEMAITRE_IRRA",)) +movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","GRAN_IRRA","GRAN_B",("LEMAITRE_IRRA",)) +movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","GRAN_IRRA","GRAN_S",("LEMAITRE_IRRA",)) +removemocle.removemocle(jdc,"DEFI_MATERIAU","GRAN_IRRA") f=open("tutu.comm",'w') diff --git a/Traducteur/movemocle.py b/Traducteur/movemocle.py index c5a8c242..8e07cbe7 100644 --- a/Traducteur/movemocle.py +++ b/Traducteur/movemocle.py @@ -29,6 +29,7 @@ def movemoclefromfacttofactmulti(jdc,oper,factsource,mocle,liste_factcible): movemoclefromfacttofact(jdc,oper,factsource,mocle,factcible) removemocle.removemocleinfact(jdc,oper,factsource,mocle) + def movemoclefromfacttofact(jdc,oper,factsource,mocle,factcible): if debug : print "movemoclefromfacttofact pour " ,oper,factsource,mocle,factcible for c in jdc.root.childNodes: @@ -65,9 +66,7 @@ def movemoclefromfacttofact(jdc,oper,factsource,mocle,factcible): for n in ll.childNodes: if n.name != mocle:continue MonTexte=n.getText(jdc); - print cible.name inseremocle.inseremotcleinfacteur(jdc,cible,MonTexte) logging.info("Changement de place : %s,%s, %s ",n.name, n.lineno, n.colno) logging.info("vers : %s", cible.name) - diff --git a/Traducteur/removemocle.py b/Traducteur/removemocle.py index 96161176..4af3caee 100644 --- a/Traducteur/removemocle.py +++ b/Traducteur/removemocle.py @@ -31,6 +31,7 @@ def removemc(jdc,c,mc): if debug:print "mocle sur une ligne--%s--" % jdc.getLines()[mc.lineno-1][mc.colno:mc.endcol] s=jdc.getLines()[mc.lineno-1] jdc.getLines()[mc.lineno-1]=s[:mc.colno]+s[mc.endcol:] + fusionne(jdc,mc.lineno-1) jdc.reset(jdc.getSource()) def removemocleinfact(jdc,command,fact,mocle): @@ -49,3 +50,16 @@ def removemocleinfact(jdc,command,fact,mocle): removemc(jdc,c,n) jdc.reset(jdc.getSource()) + +def fusionne(jdc,numLigne): + index=0 + texte=jdc.getLines()[numLigne] + fusion=1 + while (index < len(texte)) : + if texte[index] not in (" ",",",")",";","\n") : + fusion=0 + break + index=index+1 + if fusion : + import load + jdc.joinLineandNext(numLigne)