From: Charles Toulemonde Date: Tue, 23 Nov 2010 15:01:29 +0000 (+0000) Subject: benhur YACS nodes X-Git-Tag: V2_1_1_beta~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c98f8492a4549bce17ca748ed375cc221c48b845;p=modules%2Feficas.git benhur YACS nodes --- diff --git a/MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml b/MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml index f02b4072..f29c1d3e 100644 --- a/MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml +++ b/MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml @@ -43,22 +43,22 @@ result_rve = file_result_rve + + + @@ -69,9 +69,6 @@ benhur_template="/local00/bin/EficaV1/MAP/templates/s_polymers_st_1/benhur_templ - - - @@ -104,20 +105,30 @@ print "benhur for YACS - END" - - pygmee_v2 fdvgrid + + + + + pygmee_v2 benhur - init pygmee_v2 - init fdvgrid + pygmee_v2 fdvgrid init benhur + init fdvgrid + init pygmee_v2 + env init + env benhur + env fdvgrid + env pygmee_v2 pygmee_v2 result_inclusions - fdvgrid file_inclusions + benhur file_inclusions pygmee_v2 result_inclusions - benhur file_inclusions + fdvgrid file_inclusions init phase_number @@ -149,19 +160,19 @@ print "benhur for YACS - END" init rve_size - fdvgrid rve_size + pygmee_v2 rve_size init rve_size - pygmee_v2 rve_size + fdvgrid rve_size init finesse - benhur finesse + fdvgrid finesse init finesse - fdvgrid finesse + benhur finesse init lambda_I @@ -172,40 +183,45 @@ print "benhur for YACS - END" fdvgrid lambda_M - init study_name - pygmee_v2 study_name - - - init study_name + env study_name fdvgrid study_name - init study_name + env study_name benhur study_name - init study_path - benhur study_path + env study_name + pygmee_v2 study_name - init study_path - pygmee_v2 study_path + env study_name + init study_name - init study_path + env study_path fdvgrid study_path - init benhur_template - benhur benhur_template + env study_path + benhur study_path + + + env study_path + init study_path + + + env study_path + pygmee_v2 study_path benhurfile_inclusions - + + + - - - + + diff --git a/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py b/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py index 0158c55b..dd48f3ae 100644 --- a/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py +++ b/MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py @@ -68,3 +68,46 @@ def component_fdvgrid(lambda_I, lambda_M, rve_size, file_inclusions, finesse): print "fdvgrid for YACS - END" return lambda_x + +def remplaceDICO(chaine,dico) : + for mot in dico.keys() : + rplact="%"+mot+"%" + result=chaine.replace(rplact,str(dico[mot])) + chaine=result + return chaine + +def component_benhur(finesse, rve_size, inclusion_name, study_name, study_path): + print "benhur for YACS - BEGIN" + + Template_path=os.path.join(os.getenv('EFICAS_ROOT'), 'MAP/Templates/s_polymers_st_1/') + monFichierInput=Template_path+"benhur_template.txt" + monFichierOutput=Template_path+"s_polymers_st_1_benhur_"+str(finesse)+".bhr" + + + benhur_path=os.path.join(os.getenv('MAP_DIRECTORY'), 'components/benhur/') + + f = file(monFichierInput) + string_0 = f.read() + f.close() + # find and replace with BENHUR dictionnary + dicoBenhur=dict() + dicoBenhur["_RVE_SIZE"]=rve_size + dicoBenhur["_MESH_SIZE"]=finesse + dicoBenhur["_INCLUSION_FILE"]=inclusion_name + dicoBenhur["_PATH_STUDY"]=study_path + dicoBenhur["_NAME_SCHEME"]=study_name + dicoBenhur["_PATH_BENHUR"]=benhur_path + string_1=remplaceDICO(string_0,dicoBenhur) + # write into ouput file + f=open(monFichierOutput,'wb') + f.write(string_1) + f.close() + # launch of BENHUR on the previous file + benhur_path=os.path.join(os.getenv('MAP_DIRECTORY'),'components/benhur/') + commande="cd "+benhur_path+"/bin;\n" + commande+="./benhur -i "+monFichierOutput+";\n" + os.system(commande) + print "benhur_input", string_1 + print "benhur_command", commande + + print "benhur for YACS - END" diff --git a/generator/generator_s_polymers_st_1.py b/generator/generator_s_polymers_st_1.py index 39de0bf1..5749f80b 100644 --- a/generator/generator_s_polymers_st_1.py +++ b/generator/generator_s_polymers_st_1.py @@ -108,9 +108,29 @@ class s_poly_st_1Generator(MapGenerator): SchemaYacs.nodeAvant=SchemaYacs.fdvgridNode print "FDVGRIDYACS node Ok" + def BENHURYACS(self, SchemaYacs, proc): + factoryNode = SchemaYacs.monCata._nodeMap["benhur"] + SchemaYacs.benhurNode = factoryNode.cloneNode("benhur") + + SchemaYacs.benhurNode.getInputPort("rve_size").edInitPy(self.rve_size) + SchemaYacs.benhurNode.getInputPort("finesse").edInitPy(self.finesse) + SchemaYacs.benhurNode.getInputPort("study_name").edInitPy(self.study_name) + SchemaYacs.benhurNode.getInputPort("study_path").edInitPy(self.study_path) + + proc.edAddChild(SchemaYacs.benhurNode) + pout=SchemaYacs.pygmeeNode.getOutputPort("result_inclusions") + pin=SchemaYacs.benhurNode.getInputPort("file_inclusions") + proc.edAddLink(pout,pin) + + if SchemaYacs.nodeAvant != None : + proc.edAddCFLink(SchemaYacs.nodeAvant,SchemaYacs.benhurNode) + SchemaYacs.nodeAvant=SchemaYacs.benhurNode + print "BENHURYACS node Ok" + def METHODEYACS(self, SchemaYacs, proc): self.PYGMEEYACS(SchemaYacs, proc) if (self.CHOIX=="FD+grid") : self.FDVGRIDYACS(SchemaYacs,proc) + if (self.CHOIX=="FEM+mesh") : self.BENHURYACS(SchemaYacs,proc) # II - shell functions def ETUDE(self,execution) : @@ -154,7 +174,7 @@ class s_poly_st_1Generator(MapGenerator): print "option fdvgrid" commande+= self.FDVGRID() return commande - if (choix=="FEM+mesh") : + elif (self.CHOIX=="FEM+mesh") : print "option Code_Aster" commande+= self.BENHUR() commande+= self.ASTER() @@ -177,34 +197,40 @@ class s_poly_st_1Generator(MapGenerator): return 'python -c "'+commande_python+'"\n' def BENHUR(self): - commande="echo 'execution de BENHUR';\n" - #Lecture du fichier a trous - print "name_SCHEME =", self.config.NAME_SCHEME - monFichierInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/benhur_template.txt" - monFichierOutput=self.config.PATH_STUDY+"/"+self.config.NAME_SCHEME+"_benhur_"+str(finesse)+".bhr" + commande_python="import os,sys;\n" + commande_python+="sys.path.append(os.path.join(os.getenv('MAP_DIRECTORY'), '../EficasV1/MAP/Templates/s_polymers_st_1'));\n" + commande_python+="from s_polymers_st_1_YACS_nodes import *;\n" + commande_python+="component_benhur("+str(self.finesse)+","+str(self.rve_size)+","+str(self.inclusion_name)+",'"+str(self.study_name)+"',"+str(self.study_path)+");\n" + return 'python -c "'+commande_python+'"\n' + +## commande="echo 'execution de BENHUR';\n" +## #Lecture du fichier a trous +## print "name_SCHEME =", self.config.NAME_SCHEME +## monFichierInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/benhur_template.txt" +## monFichierOutput=self.config.PATH_STUDY+"/"+self.config.NAME_SCHEME+"_benhur_"+str(finesse)+".bhr" - f = file(monFichierInput) - string_0 = f.read() - f.close() - # find and replace with CONFIG idctionnary - string_1=self.remplaceCONFIG(string_0,CONFIGliste) - dicoBenhur=dict() - dicoBenhur["_RVE_SIZE"]=self.size - dicoBenhur["_MESH_SIZE"]=finesse - dicoBenhur["_INCLUSION_FILE"]=self.inclusion_name - # find and replace with BENHUR dictionnary - string_2=self.remplaceDICO(string_1,dicoBenhur) - # write into ouput file - f=open(monFichierOutput,'wb') - f.write(string_2) - f.close() - # launch of BENHUR on the previous file - commande=commande + "cd "+self.config.PATH_BENHUR+"/bin;\n" - commande=commande + "./benhur -i "+monFichierOutput+";\n" - commande=commande + "echo 'fin execution de BENHUR';\n" - return commande +## f = file(monFichierInput) +## string_0 = f.read() +## f.close() +## # find and replace with CONFIG idctionnary +## string_1=self.remplaceCONFIG(string_0,CONFIGliste) +## dicoBenhur=dict() +## dicoBenhur["_RVE_SIZE"]=self.size +## dicoBenhur["_MESH_SIZE"]=finesse +## dicoBenhur["_INCLUSION_FILE"]=self.inclusion_name +## # find and replace with BENHUR dictionnary +## string_2=self.remplaceDICO(string_1,dicoBenhur) +## # write into ouput file +## f=open(monFichierOutput,'wb') +## f.write(string_2) +## f.close() +## # launch of BENHUR on the previous file +## commande=commande + "cd "+self.config.PATH_BENHUR+"/bin;\n" +## commande=commande + "./benhur -i "+monFichierOutput+";\n" +## commande=commande + "echo 'fin execution de BENHUR';\n" +## return commande - def ASTER(self,execution) : + def ASTER(self) : commande="echo 'execution de CODE_ASTER';\n" monFichierCommInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/s_polymers_st_1_aster_template.comm" monFichierExportInput=self.config.INSTALLDIR+"/MAP/Templates/"+self.config.NAME_SCHEME+"/s_polymers_st_1_aster_template.export" @@ -219,7 +245,7 @@ class s_poly_st_1Generator(MapGenerator): string_1=self.remplaceCONFIG(string_0,CONFIGliste) # find and replace with CODE_ASTER dictionnary dicoAster=dict() - dicoAster["_MESH_SIZE"]=finesse + dicoAster["_MESH_SIZE"]=self.finesse dicoAster["_ASTER_VERSION"]="STA10" dicoAster["_NAME_STUDY"]="s_polymers_st_1" string_2=self.remplaceDICO(string_1,dicoAster) @@ -236,9 +262,9 @@ class s_poly_st_1Generator(MapGenerator): string_1=self.remplaceCONFIG(string_0,CONFIGliste) # find and replace with CODE_ASTER dictionnary dicoAster=dict() - dicoAster["_RVE_SIZE"]=self.size - dicoAster["_CONDUCTIVITE_I"]=self.dicoMATERIAUX["_MATERIAUX_CONDUCTIVITE_I"] - dicoAster["_CONDUCTIVITE_M"]=self.dicoMATERIAUX["_MATERIAUX_CONDUCTIVITE_M"] + dicoAster["_RVE_SIZE"]=self.rve_size + dicoAster["_CONDUCTIVITE_I"]=self.lambda_I + dicoAster["_CONDUCTIVITE_M"]=self.lambda_M string_2=self.remplaceDICO(string_1,dicoAster) # write into output file f=open(monFichierCommOutput,'wb') @@ -250,7 +276,7 @@ class s_poly_st_1Generator(MapGenerator): commande=commande + "echo 'fin execution de CODE_ASTER';\n" return commande - def GMSH(self,execution) : + def GMSH(self) : commande="echo 'execution de GMSH';\n" commande+= "gmsh "+self.config.PATH_STUDY+"/s_polymers_st_1_aster.resu.msh;\n" commande+= "echo 'fin execution de GMSH';\n" diff --git a/generator/monCreateYacs.py b/generator/monCreateYacs.py index 63a88f4d..51d2fa0b 100755 --- a/generator/monCreateYacs.py +++ b/generator/monCreateYacs.py @@ -47,20 +47,6 @@ class CreeSchemaYacs : proc.saveSchema(yacs_schema_filename) class s_polymers_st_1(CreeSchemaYacs) : - - # CTL 20101121 : obsolete, has been transfered to genarator_s_polymers_st_1 - # for better genericity -## def BENHURYACS(self,proc,dico): -## monFichierInput=self.config.PATH_BENHUR+"/BHR_files.txt" -## factoryNode = self.monCata._nodeMap["benhur"] -## self.benhurNode = factoryNode.cloneNode("benhur") -## self.benhurNode.getInputPort("fileInput").edInitPy(monFichierInput) -## self.benhurNode.getInputPort("pathBenhur").edInitPy(self.config.PATH_BENHUR) -## proc.edAddChild(self.benhurNode) -## if self.nodeAvant != None : -## proc.edAddCFLink(self.nodeAvant,self.benhurNode) -## self.nodeAvant=self.benhurNode - # CTL 20101121 : obsolete, has been transfered to genarator_s_polymers_st_1 # for better genericity ## def ASTERYACS(self,proc,dico):