catalogues = (
# (code,version,catalogue,formatIn)
- #('Map','V0',os.path.join(rep_cata,'Map_Cata_V0.py'),'map'),
- #('Map','V0',os.path.join(rep_cata,'Map1_Cata_V0.py'),'map'),
- ('Map','V1',os.path.join(rep_cata,'Map1_Cata_V1.py'),'map'),
+# ('Map','V1',os.path.join(rep_cata,'Map1_Cata_V1.py'),'map'),
('Map2','V0',os.path.join(rep_cata,'Map2_Cata_V0.py'),'map'),
+ ('Map','V0',os.path.join(rep_cata,'Map_Openturns.py'),'map_OT'),
)
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="mySchema">
+ <property name="DefaultStudyID" value="1"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <type name="double" kind="double"/>
+ <sequence name="Point" content="double"/>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="stringvec" content="string"/>
+ <container name="DefaultContainer">
+ <property name="container_name" value="FactoryServer"/>
+ <property name="hostname" value="localhost"/>
+ </container>
+ <optimizer name="OpenTurnsLoop" nbranch="4" lib="libOpenTURNS_YACS_Integration" entry="createOpenTURNSScriptLauncher">
+ <initnode>
+ <service name="InitNode">
+ <component>%_CODE_NOMCODE%</component>
+ <load container="DefaultContainer"/>
+ <method>InitWithVarList</method>
+ <inport name="inputVarList" type="stringvec"/>
+ <inport name="outputVarList" type="stringvec"/>
+ <inport name="deterministicVars" type="pyobj"/>
+ </service>
+ </initnode>
+ <service name="ExecNode">
+ <node>OpenTurnsLoop.InitNode</node>
+ <method>ExecWithVarList</method>
+ <inport name="inPoint" type="Point"/>
+ <outport name="outPoint" type="Point"/>
+ </service>
+ <finalizenode>
+ <service name="FinalizeNode">
+ <node>OpenTurnsLoop.InitNode</node>
+ <method>Finalize</method>
+ <outport name="return" type="int"/>
+ </service>
+ </finalizenode>
+ </optimizer>
+ <inline name="SaveResultsToFile">
+ <script><code><![CDATA[f = open(fileName, "w")
+for (k, v) in algoResults.iteritems():
+ f.write("%s: %s\n" % (k, v))
+f.close()
+]]></code></script>
+ <inport name="algoResults" type="pyobj"/>
+ <inport name="fileName" type="string"/>
+ </inline>
+ <service name="WrapperParser">
+ <component>OPENTURNS</component>
+ <load container="DefaultContainer"/>
+ <method>WrapperParser</method>
+ <inport name="wrapperFilePath" type="string"/>
+ <inport name="studyFilePath" type="string"/>
+ <outport name="initOptLoop" type="pyobj"/>
+ <outport name="wrapperContent" type="string"/>
+ <outport name="inputVarList" type="stringvec"/>
+ <outport name="outputVarList" type="stringvec"/>
+ </service>
+ <inline name="InitDeterministicVars">
+ <script><code><![CDATA[detVars = {}
+detVars["E"] = 2.1e+11
+detVars["I"] = 2.1e-06
+]]></code></script>
+ <outport name="detVars" type="pyobj"/>
+ </inline>
+ <control> <fromnode>OpenTurnsLoop</fromnode> <tonode>SaveResultsToFile</tonode> </control>
+ <control> <fromnode>WrapperParser</fromnode> <tonode>OpenTurnsLoop</tonode> </control>
+ <control> <fromnode>InitDeterministicVars</fromnode> <tonode>OpenTurnsLoop</tonode> </control>
+ <datalink control="false">
+ <fromnode>OpenTurnsLoop</fromnode> <fromport>algoResults</fromport>
+ <tonode>SaveResultsToFile</tonode> <toport>algoResults</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OpenTurnsLoop</fromnode> <fromport>evalSamples</fromport>
+ <tonode>OpenTurnsLoop.ExecNode</tonode> <toport>inPoint</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>WrapperParser</fromnode> <fromport>initOptLoop</fromport>
+ <tonode>OpenTurnsLoop</tonode> <toport>algoInit</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>WrapperParser</fromnode> <fromport>inputVarList</fromport>
+ <tonode>OpenTurnsLoop.InitNode</tonode> <toport>inputVarList</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>WrapperParser</fromnode> <fromport>outputVarList</fromport>
+ <tonode>OpenTurnsLoop.InitNode</tonode> <toport>outputVarList</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>InitDeterministicVars</fromnode> <fromport>detVars</fromport>
+ <tonode>OpenTurnsLoop.InitNode</tonode> <toport>deterministicVars</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>OpenTurnsLoop.ExecNode</fromnode> <fromport>outPoint</fromport>
+ <tonode>OpenTurnsLoop</tonode> <toport>evalResults</toport>
+ </datalink>
+ <parameter>
+ <tonode>OpenTurnsLoop</tonode><toport>nbBranches</toport>
+ <value><int>4</int></value>
+ </parameter>
+ <parameter>
+ <tonode>SaveResultsToFile</tonode><toport>fileName</toport>
+ <value><string>/tmp/savedResults.txt</string></value>
+ </parameter>
+ <parameter>
+ <tonode>WrapperParser</tonode><toport>wrapperFilePath</toport>
+ <value><string>/local00/renaud/salome/test-OT-YACS/wrap.xml</string></value>
+ </parameter>
+ <parameter>
+ <tonode>WrapperParser</tonode><toport>studyFilePath</toport>
+ <value><string>/local00/renaud/salome/test-OT-YACS/openturns_study.py</string></value>
+ </parameter>
+ <presentation name="InitDeterministicVars" x="4" y="273" width="158" height="63" expanded="1"/>
+ <presentation name="OpenTurnsLoop" x="233.5" y="32" width="473" height="308.5" expanded="1"/>
+ <presentation name="OpenTurnsLoop.ExecNode" x="175" y="126" width="158" height="63" expanded="1"/>
+ <presentation name="OpenTurnsLoop.FinalizeNode" x="311" y="221" width="158" height="63" expanded="1"/>
+ <presentation name="SaveResultsToFile" x="747" y="32" width="158" height="90" expanded="1"/>
+ <presentation name="OpenTurnsLoop.InitNode" x="4" y="187.5" width="158" height="117" expanded="1"/>
+ <presentation name="WrapperParser" x="4" y="59.5" width="158" height="144" expanded="1"/>
+ <presentation name="__ROOT__" x="0" y="0" width="909" height="344.5" expanded="1"/>
+</proc>
--- /dev/null
+# -*- coding: utf-8 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+"""
+ Ce module contient le plugin generateur de fichier au format
+ SEP pour EFICAS.
+
+"""
+import traceback
+import types,string,re,os
+
+from generator_python import PythonGenerator
+
+
+CONFIGliste=()
+MOTCLEFListe=("_CODE_NOMCODE",)
+
+def entryPoint():
+ """
+ Retourne les informations necessaires pour le chargeur de plugins
+
+ Ces informations sont retournees dans un dictionnaire
+ """
+ return {
+ # Le nom du plugin
+ 'name' : 'map_OT',
+ # La factory pour creer une instance du plugin
+ 'factory' : MapGenerator,
+ }
+
+
+class MapGenerator(PythonGenerator):
+ """
+ Ce generateur parcourt un objet de type JDC et produit
+ un texte au format eficas et
+ un texte au format py
+
+ """
+ # Les extensions de fichier permis?
+ extensions=('.comm',)
+
+ def gener(self,obj,format='brut',config=None):
+ self.config=config
+ self.dictMCVal={}
+ self.text=PythonGenerator.gener(self,obj,format)
+ self.generePythonOT()
+ return self.text
+
+
+ def generePythonOT(self) :
+ '''
+ self.dictMCVal est un dictionnaire.
+ ce dictionnaire a pour clef la genealogie du MCSimp suivi de sa valeur
+
+ '''
+ f = file(self.config.repIni+"/schema-openturns-template.xml","r")
+ chaine = f.read()
+ f.close()
+ chaine2=self.remplaceCONFIG(chaine)
+ chaine=self.remplaceDICO(chaine2,MOTCLEFListe)
+ f=open("/tmp/nouveau_scema.xml",'wb')
+ f.write(chaine)
+ f.close()
+
+
+ def generMCSIMP(self,obj) :
+ """
+ Convertit un objet MCSIMP en texte python
+ Remplit le dictionnaire des MCSIMP si nous ne sommes ni dans une loi, ni dans une variable
+ """
+ s=PythonGenerator.generMCSIMP(self,obj)
+ clef=""
+ for i in obj.get_genealogie() :
+ clef=clef+"_"+i
+ self.dictMCVal[clef]=obj.valeur
+ return s
+
+
+ def remplaceCONFIG(self,chaine) :
+ for mot in CONFIGliste :
+ rplact="%_"+mot+"%"
+ result=chaine.replace(rplact,self.config.__dict__[mot])
+ chaine=result
+ return chaine
+
+ def remplaceDICO(self,chaine,dico) :
+ for mot in MOTCLEFListe :
+ rplact="%"+mot+"%"
+ try :
+ result=chaine.replace(rplact,str(self.dictMCVal[mot]))
+ except :
+ result=chaine
+ chaine=result
+ return chaine
+