]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
benhur YACS nodes
authorCharles Toulemonde <charles.toulemonde@edf.fr>
Tue, 23 Nov 2010 15:01:29 +0000 (15:01 +0000)
committerCharles Toulemonde <charles.toulemonde@edf.fr>
Tue, 23 Nov 2010 15:01:29 +0000 (15:01 +0000)
MAP/Templates/s_polymers_st_1/cata_s_polymers_st_1.xml
MAP/Templates/s_polymers_st_1/s_polymers_st_1_YACS_nodes.py
generator/generator_s_polymers_st_1.py
generator/monCreateYacs.py

index f02b40722738e85d66a507c8352baf970fd1fd4b..f29c1d3e7459ed74fce8a7280da24bdb6e60bf5d 100644 (file)
@@ -43,22 +43,22 @@ result_rve = file_result_rve
       <inport name="study_path" type="string"/>
       <outport name="result_inclusions" type="string"/>
       <outport name="result_rve" type="string"/>
+      <outport name="volume_fraction" type="double"/>
    </inline>
    <inline name="init">
       <script><code><![CDATA[phase_number=1
 rve_size=50.0
-study_path="/local00/bin/MAP/studies/demonstrateur_s_polymers_st_1/"
 sieve_curve_in=study_path+"inclusion_size_distribution.txt"
 sieve_curve_out=study_path+"pygmee_v2_test_YACS.sieve_out"
 repulsion_distance=0.1
-study_name="test YACS"
 file_result_inclusions=study_path+"inclusions.txt"
 file_result_rve=study_path+"rve.txt"
-finesse=32
+finesse=10
 lambda_I=100.
 lambda_M=1.
-benhur_template="/local00/bin/EficaV1/MAP/templates/s_polymers_st_1/benhur_template.txt"
 ]]></code></script>
+      <inport name="study_name" type="string"/>
+      <inport name="study_path" type="string"/>
       <outport name="phase_number" type="int"/>
       <outport name="sieve_curve_in" type="string"/>
       <outport name="sieve_curve_out" type="string"/>
@@ -69,9 +69,6 @@ benhur_template="/local00/bin/EficaV1/MAP/templates/s_polymers_st_1/benhur_templ
       <outport name="finesse" type="int"/>
       <outport name="lambda_I" type="double"/>
       <outport name="lambda_M" type="double"/>
-      <outport name="study_name" type="string"/>
-      <outport name="study_path" type="string"/>
-      <outport name="benhur_template" type="string"/>
    </inline>
    <inline name="fdvgrid">
       <script><code><![CDATA[import sys
@@ -93,10 +90,14 @@ lambda_x=component_fdvgrid(lambda_I, lambda_M, rve_size, file_inclusions, finess
       <outport name="lambda_x" type="double"/>
    </inline>
    <inline name="benhur">
-      <script><code><![CDATA[import os, sys
+      <script><code><![CDATA[import sys
+import os
+
+sys.path.append(os.path.join(os.getenv('MAP_DIRECTORY'),'../EficasV1/MAP/Templates/s_polymers_st_1'))
 
-print "benhur for YACS - BEGIN"
-print "benhur for YACS - END"
+from s_polymers_st_1_YACS_nodes import *
+
+component_benhur(finesse, rve_size, file_inclusions, study_name, study_path)
 
 ]]></code></script>
       <inport name="rve_size" type="double"/>
@@ -104,20 +105,30 @@ print "benhur for YACS - END"
       <inport name="file_inclusions" type="string"/>
       <inport name="study_name" type="string"/>
       <inport name="study_path" type="string"/>
-      <inport name="benhur_template" type="string"/>
    </inline>
-   <control> <fromnode>pygmee_v2</fromnode> <tonode>fdvgrid</tonode> </control>
+   <inline name="env">
+      <script><code><![CDATA[study_path="/local00/bin/MAP/studies/demonstrateur_s_polymers_st_1/"
+study_name="test YACS"
+]]></code></script>
+      <outport name="study_name" type="string"/>
+      <outport name="study_path" type="string"/>
+   </inline>
    <control> <fromnode>pygmee_v2</fromnode> <tonode>benhur</tonode> </control>
-   <control> <fromnode>init</fromnode> <tonode>pygmee_v2</tonode> </control>
-   <control> <fromnode>init</fromnode> <tonode>fdvgrid</tonode> </control>
+   <control> <fromnode>pygmee_v2</fromnode> <tonode>fdvgrid</tonode> </control>
    <control> <fromnode>init</fromnode> <tonode>benhur</tonode> </control>
+   <control> <fromnode>init</fromnode> <tonode>fdvgrid</tonode> </control>
+   <control> <fromnode>init</fromnode> <tonode>pygmee_v2</tonode> </control>
+   <control> <fromnode>env</fromnode> <tonode>init</tonode> </control>
+   <control> <fromnode>env</fromnode> <tonode>benhur</tonode> </control>
+   <control> <fromnode>env</fromnode> <tonode>fdvgrid</tonode> </control>
+   <control> <fromnode>env</fromnode> <tonode>pygmee_v2</tonode> </control>
    <datalink control="false">
       <fromnode>pygmee_v2</fromnode> <fromport>result_inclusions</fromport>
-      <tonode>fdvgrid</tonode> <toport>file_inclusions</toport>
+      <tonode>benhur</tonode> <toport>file_inclusions</toport>
    </datalink>
    <datalink control="false">
       <fromnode>pygmee_v2</fromnode> <fromport>result_inclusions</fromport>
-      <tonode>benhur</tonode> <toport>file_inclusions</toport>
+      <tonode>fdvgrid</tonode> <toport>file_inclusions</toport>
    </datalink>
    <datalink control="false">
       <fromnode>init</fromnode> <fromport>phase_number</fromport>
@@ -149,19 +160,19 @@ print "benhur for YACS - END"
    </datalink>
    <datalink control="false">
       <fromnode>init</fromnode> <fromport>rve_size</fromport>
-      <tonode>fdvgrid</tonode> <toport>rve_size</toport>
+      <tonode>pygmee_v2</tonode> <toport>rve_size</toport>
    </datalink>
    <datalink control="false">
       <fromnode>init</fromnode> <fromport>rve_size</fromport>
-      <tonode>pygmee_v2</tonode> <toport>rve_size</toport>
+      <tonode>fdvgrid</tonode> <toport>rve_size</toport>
    </datalink>
    <datalink control="false">
       <fromnode>init</fromnode> <fromport>finesse</fromport>
-      <tonode>benhur</tonode> <toport>finesse</toport>
+      <tonode>fdvgrid</tonode> <toport>finesse</toport>
    </datalink>
    <datalink control="false">
       <fromnode>init</fromnode> <fromport>finesse</fromport>
-      <tonode>fdvgrid</tonode> <toport>finesse</toport>
+      <tonode>benhur</tonode> <toport>finesse</toport>
    </datalink>
    <datalink control="false">
       <fromnode>init</fromnode> <fromport>lambda_I</fromport>
@@ -172,40 +183,45 @@ print "benhur for YACS - END"
       <tonode>fdvgrid</tonode> <toport>lambda_M</toport>
    </datalink>
    <datalink control="false">
-      <fromnode>init</fromnode> <fromport>study_name</fromport>
-      <tonode>pygmee_v2</tonode> <toport>study_name</toport>
-   </datalink>
-   <datalink control="false">
-      <fromnode>init</fromnode> <fromport>study_name</fromport>
+      <fromnode>env</fromnode> <fromport>study_name</fromport>
       <tonode>fdvgrid</tonode> <toport>study_name</toport>
    </datalink>
    <datalink control="false">
-      <fromnode>init</fromnode> <fromport>study_name</fromport>
+      <fromnode>env</fromnode> <fromport>study_name</fromport>
       <tonode>benhur</tonode> <toport>study_name</toport>
    </datalink>
    <datalink control="false">
-      <fromnode>init</fromnode> <fromport>study_path</fromport>
-      <tonode>benhur</tonode> <toport>study_path</toport>
+      <fromnode>env</fromnode> <fromport>study_name</fromport>
+      <tonode>pygmee_v2</tonode> <toport>study_name</toport>
    </datalink>
    <datalink control="false">
-      <fromnode>init</fromnode> <fromport>study_path</fromport>
-      <tonode>pygmee_v2</tonode> <toport>study_path</toport>
+      <fromnode>env</fromnode> <fromport>study_name</fromport>
+      <tonode>init</tonode> <toport>study_name</toport>
    </datalink>
    <datalink control="false">
-      <fromnode>init</fromnode> <fromport>study_path</fromport>
+      <fromnode>env</fromnode> <fromport>study_path</fromport>
       <tonode>fdvgrid</tonode> <toport>study_path</toport>
    </datalink>
    <datalink control="false">
-      <fromnode>init</fromnode> <fromport>benhur_template</fromport>
-      <tonode>benhur</tonode> <toport>benhur_template</toport>
+      <fromnode>env</fromnode> <fromport>study_path</fromport>
+      <tonode>benhur</tonode> <toport>study_path</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>env</fromnode> <fromport>study_path</fromport>
+      <tonode>init</tonode> <toport>study_path</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>env</fromnode> <fromport>study_path</fromport>
+      <tonode>pygmee_v2</tonode> <toport>study_path</toport>
    </datalink>
    <parameter>
       <tonode>benhur</tonode><toport>file_inclusions</toport>
       <value><string></string></value>
    </parameter>
-   <presentation name="pygmee_v2" x="415.186" y="179.5" width="249.5" height="342"/>
+   <presentation name="env" x="518.009" y="574.447" width="227.5" height="139"/>
+   <presentation name="init" x="9" y="422.773" width="273.5" height="371"/>
+   <presentation name="benhur" x="948.69" y="94.3462" width="223" height="226"/>
    <presentation name="fdvgrid" x="888.902" y="551.141" width="227.5" height="284"/>
-   <presentation name="init" x="9" y="328" width="273.5" height="458"/>
-   <presentation name="benhur" x="848.961" y="95.838" width="223" height="255"/>
-   <presentation name="__ROOT__" x="0" y="0" width="1125.9" height="844.141"/>
+   <presentation name="pygmee_v2" x="390.897" y="87.3212" width="249.5" height="342"/>
+   <presentation name="__ROOT__" x="0" y="0" width="1181.19" height="844.141"/>
 </proc>
index 0158c55b54e7d0e1ed2630e8320e8b60a1f00f7b..dd48f3ae61a2e4488be6cf109890773166ff59b4 100644 (file)
@@ -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"
index 39de0bf120fdb9d450383ec1e5cdded366704750..5749f80b7a0211eb27e7532914c381e9075d46e5 100644 (file)
@@ -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"
index 63a88f4db06d3f8c94f4a48d26c31c696eeb9c5b..51d2fa0b82d8f90069ca45642b719bec2be9e52b 100755 (executable)
@@ -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):