from generator_map import MapGenerator
+import sys
+sys.path.append('/local00/bin/MAP/classes/python/')
+from class_MAP_parameters import *
+
#____________________________________________________________________________________
# PYGMEEDict contient une equivalence entre le catalogue Map et les lignes generees
# comme entete (commentaire ?) dans le fichier d'input de pygmee
if len(liste) != len(set(liste)):
raise AsException("il n'est pas prevu d avoir deux fois le meme code dans ce schema")
-
- def PYGMEE(self,execution) :
- dicoPygmee=self.dictMCVal["PYGMEE"]
- self.dictPYGMEE=dicoPygmee
- monFichier=self.config.PATH_PYGMEE+"/pygmee_input.txt"
-
- #Lecture du fichier a trous
- f = file(self.config.repIni+"/pygmee_input.txt","r")
- chaine = f.read()
- f.close()
- chaine2=self.remplaceCONFIG(chaine,CONFIGliste)
- chaine=self.remplaceDICO(chaine2,dicoPygmee)
-
- if os.path.isfile(monFichier) :
- print "je detruis pygmee_input.txt"
- commande="rm -rf " + monFichier
- os.system (commande)
- f=open(monFichier,'wb')
- f.write(chaine)
- f.close()
- if execution=="non" : return ""
-
- if ('_PYGMEE_LANCEMENT' in dicoPygmee.keys()) and dicoPygmee['_PYGMEE_LANCEMENT'] == 'oui':
- commande="echo '__________________';\n"
- commande=commande + "echo 'execution de PYGMEE';\n"
- commande=commande + "cd "+self.config.PATH_PYGMEE+";\n"
- commande=commande + "python "+self.config.PATH_PYGMEE+"/pygmee_v1.py;\n"
- commande=commande + "echo 'fin execution de PYGMEE';\n"
- commande=commande + "echo '_____________________';\n\n\n"
- return commande
- else:
- return ""
-
- def BENHUR(self,execution) :
- dicoBenhur=self.dictMCVal["BENHUR"]
- if hasattr(self,'dictPYGMEE') and '_PYGMEE_TAILLE' in self.dictMCVal['PYGMEE']:
- dicoBenhur["_PYGMEE_TAILLE"]=self.dictPYGMEE['_PYGMEE_TAILLE']
- else :
- dicoBenhur["_PYGMEE_TAILLE"]=0
- print "Attention la variable Taille_VER non definie"
-
- finesse=str(dicoBenhur["_BENHUR_FINESSE"])
- nom_fichier_BHR=self.config.PATH_STUDY+"/"+self.config.NAME_SCHEME+"_benhur_"+finesse+".bhr"
- nom_BHR_Files=self.config.PATH_BENHUR+"/BHR_files.txt"
-
- #Lecture du fichier a trous
- f = file(self.config.repIni+"/benhur_pygmee.txt","r")
- chaine = f.read()
- f.close()
- chaine2=self.remplaceCONFIG(chaine,CONFIGliste)
- chaine=self.remplaceDICO(chaine2,dicoBenhur)
-
- try :
- f=open(nom_fichier_BHR,'wb')
- except :
- print "Pb de Generation de BENHUR"
- return ""
- f.write(chaine)
- f.close()
-
- f=open(nom_BHR_Files,'wb')
- f.write(nom_fichier_BHR)
- f.write("\n\n\n")
- f.close()
-
- if execution=="non" : return ""
- if ('_BENHUR_LANCEMENT' in dicoBenhur.keys()) and dicoBenhur['_BENHUR_LANCEMENT'] == 'oui':
- commande="echo '__________________';\n"
- commande=commande + "echo 'execution de BENHUR';\n"
- commande=commande + "cd "+self.config.PATH_BENHUR+";\n"
- commande=commande + "./benhur;\n"
- commande=commande + "echo 'fin execution de BENHUR';\n"
- commande=commande + "echo '________________________';\n\n\n"
- return commande
- else:
- return ""
-
-
-
def ASTER(self,execution) :
print "Generation de ASTER"
dicoAster=self.dictMCVal["ASTER"]
return ""
def METHODE(self,execution) :
- print "METHODE"
- return ""
+ self.dicoMETHODE=self.dictMCVal["METHODE"]
+ print "_____________________"
+ print self.dicoMETHODE
+ result=self.dicoMETHODE['_METHODE_LANCEMENT']
+ print '_METHODE_LANCEMENT =', result
+ if (result=='oui') :
+ composant="pygmee_v2"
+ self.size=float(self.dicoMATERIAUX['_MATERIAUX_TAILLE'])
+ self.sieve_in=self.config.PATH_PYGMEE+"/tests/pygmee_v2_test_1.sieve_in"
+ self.sieve_out=self.config.PATH_STUDY+"/pygmee_v2.sieve_out"
+ self.distance=self.dicoMATERIAUX['_MATERIAUX_DISTANCE']
+ self.inclusion_name=self.config.PATH_STUDY+"/pygmee_v2_test_1.inclusions"
+ self.rve_name=self.config.PATH_STUDY+"/pygmee_v2_test_1.rve"
+ pygmee_v2_input=self.config.PATH_STUDY+"/pygmee_v2.input"
+ parameter=MAP_parameters()
+ parameter.add_component(composant)
+ parameter.add_parameter(composant, 'rve_size', self.size)
+ parameter.add_parameter(composant, 'phase_number', 1)
+ parameter.add_parameter(composant, 'sieve_curve_in', self.sieve_in)
+ parameter.add_parameter(composant, 'sieve_curve_out', self.sieve_out)
+ parameter.add_parameter(composant, 'repulsion_distance', self.distance)
+ parameter.add_parameter(composant, 'study_name', "study")
+ parameter.add_parameter(composant, 'file_result_inclusions', self.inclusion_name)
+ parameter.add_parameter(composant, 'file_result_rve', self.rve_name)
+ commande_python=parameter.write_for_shell(pygmee_v2_input)
+ commande="echo 'parametres de PYGMEE v2';\n"
+
+ commande+= commande_python
+
+ commande+= "echo 'execution de PYGMEE v2';\n"
+ commande+= "cd "+self.config.PATH_PYGMEE+"/src;\n"
+ commande+= "python pygmee_v2.py -i "+pygmee_v2_input+";\n"
+ commande+= "echo 'fin execution de PYGMEE v2';\n"
+
+ self.contrast=float(self.dicoMATERIAUX['_MATERIAUX_CONDUCTIVITE_I']/self.dicoMATERIAUX['_MATERIAUX_CONDUCTIVITE_M'])
+ choix=self.dicoMETHODE['_METHODE_CHOIX']
+
+ if (choix=="FD+grid") :
+ commande+= "echo 'execution de FDVGRID';\n"
+ commande+= "cd "+self.config.PATH_FDVGRID+";\n"
+ finesse=int(self.dicoDISCRETISATION['_DISCRETISATION_FINESSE'])
+ if (finesse<32):
+ finesse=32
+ commande+= "echo "+str(self.size)+" > "+"rve.input"+";\n"
+ commande+= "cp "+str(self.config.PATH_STUDY+"/pygmee_v2_test_1.inclusions")+" "+"inclusions.input"+";\n"
+ commande+= "echo "+str(self.contrast)+" > "+"contrast.input"+";\n"
+ commande+= "./fdvgrid 3D 1.0 0.0 0.0 v t "+str(finesse)+" cross 1e-6 "+";\n"
+ commande+= "echo 'fin execution de FDVGRID';\n"
+
+ if (choix=="FEM+mesh") :
+ print "option Code_Aster"
+ print "METHODE Ok"
+ print "_____________________\n"
+ return commande
def MATERIAUX(self,execution) :
- print "MATERIAUX"
+ self.dicoMATERIAUX=self.dictMCVal["MATERIAUX"]
+ print "_____________________"
+ print self.dicoMATERIAUX
+ print "MATERIAUX Ok"
+ print "_____________________\n"
return ""
def DISCRETISATION(self,execution) :
- print "DISCRETISATION"
+ self.dicoDISCRETISATION=self.dictMCVal["DISCRETISATION"]
+ print "_____________________"
+ print self.dicoDISCRETISATION
+ print "DISCRETISATION Ok"
+ print "_____________________\n"
return ""