2 # CONFIGURATION MANAGEMENT OF EDF VERSION
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
20 # ======================================================================
22 Ce module contient le plugin generateur de fichier au format
27 import types,string,re,os
29 from generator_map import MapGenerator
31 #____________________________________________________________________________________
32 # PYGMEEDict contient une equivalence entre le catalogue Map et les lignes generees
33 # comme entete (commentaire ?) dans le fichier d'input de pygmee
36 CONFIGliste=('NAME_SCHEME', 'PATH_ASTER', 'PATH_BENHUR', 'PATH_MODULE', 'PATH_PYGMEE', 'PATH_STUDY', 'repIni')
38 "_PYGMEE_FUSEAU1_b_forme_FICHIER" : "#fuseau 1 (entree de lecfus) format : diametre DCE croissant / fraction cumulee decroisant ",
39 "FUSEAU2" : "#fuseau 2 (entree de lecfus) format : diametre DCE croissant / fraction cumulee decroisant",
40 "_PYGMEE_TAILLE" : "# taille du VER en microns ",
41 "_PYGMEE_DISTANCE" : "# distance de repulsion :",
44 #_______________________________________________________________________________________________________
45 # listeOrdonneeMCPygmee contient une liste (donc ordonnee) des mots clefs pour
46 # imposer l'ordre des lignes generees
47 listeOrdonneeMCPygmee =('_PYGMEE_FUSEAU1_b_forme_FICHIER', 'FUSEAU2', '_PYGMEE_TAILLE','_PYGMEE_DISTANCE')
51 "_BENHUR_FINESSE" : "discretisation des arretes du VER ",
55 "_ASTER_LANCEMENT" : "execution de Code_Aster",
56 "_ASTER_CONDUCTIVITE_I" : "conductivite des inclusions",
57 "_ASTER_CONDUCTIVITE_M" : "conductivite de la matrice",
61 "_GMSH_LANCEMENT" : "execution de GMSH",
66 Retourne les informations necessaires pour le chargeur de plugins
68 Ces informations sont retournees dans un dictionnaire
72 'name' : 's_polymers_st_1',
73 # La factory pour creer une instance du plugin
74 'factory' : s_poly_st_1Generator,
78 class s_poly_st_1Generator(MapGenerator):
80 Ce generateur parcourt un objet de type JDC et produit
81 un texte au format eficas et
88 for i in self.listeCODE:
89 liste.append(i.keys()[0])
90 if len(liste) != len(set(liste)):
91 raise AsException("il n'est pas prevu d avoir deux fois le meme code dans ce schema")
94 def PYGMEE(self,execution) :
95 dicoPygmee=self.dictMCVal["PYGMEE"]
96 self.dictPYGMEE=dicoPygmee
97 monFichier=self.config.PATH_PYGMEE+"/pygmee_input.txt"
99 #Lecture du fichier a trous
100 f = file(self.config.repIni+"/pygmee_input.txt","r")
103 chaine2=self.remplaceCONFIG(chaine,CONFIGliste)
104 chaine=self.remplaceDICO(chaine2,dicoPygmee)
106 if os.path.isfile(monFichier) :
107 print "je detruis pygmee_input.txt"
108 commande="rm -rf " + monFichier
110 f=open(monFichier,'wb')
113 if execution=="non" : return ""
115 if ('_PYGMEE_LANCEMENT' in dicoPygmee.keys()) and dicoPygmee['_PYGMEE_LANCEMENT'] == 'oui':
116 commande="echo '__________________';\n"
117 commande=commande + "echo 'execution de PYGMEE';\n"
118 commande=commande + "cd "+self.config.PATH_PYGMEE+";\n"
119 commande=commande + "python "+self.config.PATH_PYGMEE+"/pygmee_v1.py;\n"
120 commande=commande + "echo 'fin execution de PYGMEE';\n"
121 commande=commande + "echo '_____________________';\n\n\n"
126 def BENHUR(self,execution) :
127 dicoBenhur=self.dictMCVal["BENHUR"]
128 if hasattr(self,'dictPYGMEE') and '_PYGMEE_TAILLE' in self.dictMCVal['PYGMEE']:
129 dicoBenhur["_PYGMEE_TAILLE"]=self.dictPYGMEE['_PYGMEE_TAILLE']
131 dicoBenhur["_PYGMEE_TAILLE"]=0
132 print "Attention la variable Taille_VER non definie"
134 finesse=str(dicoBenhur["_BENHUR_FINESSE"])
135 nom_fichier_BHR=self.config.PATH_STUDY+"/"+self.config.NAME_SCHEME+"_benhur_"+finesse+".bhr"
136 nom_BHR_Files=self.config.PATH_BENHUR+"/BHR_files.txt"
138 #Lecture du fichier a trous
139 f = file(self.config.repIni+"/benhur_pygmee.txt","r")
142 chaine2=self.remplaceCONFIG(chaine,CONFIGliste)
143 chaine=self.remplaceDICO(chaine2,dicoBenhur)
146 f=open(nom_fichier_BHR,'wb')
148 print "Pb de Generation de BENHUR"
153 f=open(nom_BHR_Files,'wb')
154 f.write(nom_fichier_BHR)
158 if execution=="non" : return ""
159 if ('_BENHUR_LANCEMENT' in dicoBenhur.keys()) and dicoBenhur['_BENHUR_LANCEMENT'] == 'oui':
160 commande="echo '__________________';\n"
161 commande=commande + "echo 'execution de BENHUR';\n"
162 commande=commande + "cd "+self.config.PATH_BENHUR+";\n"
163 commande=commande + "./benhur;\n"
164 commande=commande + "echo 'fin execution de BENHUR';\n"
165 commande=commande + "echo '________________________';\n\n\n"
172 def ASTER(self,execution) :
173 print "Generation de ASTER"
174 dicoAster=self.dictMCVal["ASTER"]
175 nom_racine=self.config.PATH_MODULE+"/"+self.config.NAME_SCHEME+"/"+self.config.NAME_SCHEME
176 nom_fichier_ASTER=nom_racine+"_aster.comm"
178 #Lecture du fichier a trous
179 f = file(self.config.repIni+"/s_poly_st_1_aster_template.comm","r")
182 chaine2=self.remplaceDICO(chaine,self.dictPYGMEE)
183 chaine=self.remplaceDICO(chaine2,dicoAster)
185 f=open(nom_fichier_ASTER,'wb')
189 if ('_ASTER_LANCEMENT' in dicoAster.keys()) and dicoAster['_ASTER_LANCEMENT'] == 'oui':
190 commande="cd "+self.config.PATH_MODULE+";"
191 commande=commande + self.config.PATH_ASTER + "/as_run "+self.config.PATH_MODULE
192 commande=commande + "/"+self.config.NAME_SCHEME+"/"+self.config.NAME_SCHEME+"_aster.export"
197 def GMSH(self,execution) :
198 dicoGmsh=self.dictMCVal["GMSH"]
199 if ('_GMSH_LANCEMENT' in dicoGmsh.keys()) and dicoGmsh['_GMSH_LANCEMENT'] == 'oui':
200 commande="cd "+self.config.PATH_MODULE+";"
201 commande=commande + "gmsh "+self.config.PATH_MODULE+"/"+self.config.NAME_SCHEME+"/"+self.config.NAME_SCHEME+"_aster.resu.msh"
207 def METHODE(self,execution) :
211 def MATERIAUX(self,execution) :
215 def DISCRETISATION(self,execution) :
216 print "DISCRETISATION"