]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
PN
authorPascale Noyret <pascale.noyret@edf.fr>
Tue, 30 May 2006 08:29:07 +0000 (08:29 +0000)
committerPascale Noyret <pascale.noyret@edf.fr>
Tue, 30 May 2006 08:29:07 +0000 (08:29 +0000)
Traducteur/inseremocle.py
Traducteur/jdcparser.py
Traducteur/movemocle.py
Traducteur/removemocle.py

index 6e23e96fa87737e7c8bb5727bdadcb958af613bb..b8d345b40070b52975c994e6898986d8ee4e188b 100644 (file)
@@ -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)
index a6a81ab3d1aa397b423633157f61601f17fc589d..d6a1651d6d58b02e2938215f3de994331d18bb82 100644 (file)
@@ -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')
index c5a8c2421d94b789578b8932498c8424f8d1ac65..8e07cbe7dd353d4bd1683adbcd81ce1fd6e82570 100644 (file)
@@ -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)
 
-
index 96161176a25b6c783d4e4d2a23eba23f5328de4f..4af3caeee56a4e28e409f3b3fdc3201567d4da09 100644 (file)
@@ -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)