1 # Copyright (C) 2015-2019 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 def buildScheme(fname):
23 SALOMERuntime.RuntimeSALOME.setRuntime()
24 r=SALOMERuntime.getSALOMERuntime()
26 td=p.createType("double","double")
28 cont=p.createContainer("zeCont","Salome")
30 n0=r.createFuncNode("Salome","node0")
34 n0.setScript("""def func0(a,b):
37 n0.setExecutionMode("remote")
38 a=n0.edAddInputPort("a",td)
39 b=n0.edAddInputPort("b",td) ; b.edInitPy(1.3)
40 c=n0.edAddOutputPort("c",td)
42 n1=r.createFuncNode("Salome","node1")
46 n1.setScript("""def func1(a,b):
49 n1.setExecutionMode("remote")
50 d=n1.edAddInputPort("d",td)
51 e=n1.edAddInputPort("e",td) ; e.edInitPy(2.5) # agy : useless but for test
52 f=n1.edAddOutputPort("f",td)
53 g=n1.edAddOutputPort("g",td)
62 session=evalyfx.YACSEvalSession()
65 efx=evalyfx.YACSEvalYFX.BuildFromFile(fileName)
66 inps=efx.getFreeInputPorts()
68 inps[0].setDefaultValue(3.4)
70 inps[0].setDefaultValue(None)
71 inps[2].setDefaultValue(2.7)
72 inps[2].setDefaultValue(None)
74 outps=efx.getFreeOutputPorts()
75 # prepare for execution
76 inps[0].setDefaultValue(1.1)
77 inps[1].setSequenceOfValuesToEval([10.1,10.2,10.3])
78 a=inps[2].hasSequenceOfValuesToEval()
79 inps[2].setSequenceOfValuesToEval([20.1,20.2,30.3,40.4])
80 a=inps[2].hasSequenceOfValuesToEval()
81 inps[2].setSequenceOfValuesToEval([20.1,20.2,30.3])
82 efx.lockPortsForEvaluation([inps[1],inps[2]],[outps[0],outps[2]])
85 g=efx.getUndergroundGeneratedGraph()
86 g.saveSchema("toto.xml")
87 rss=efx.giveResources()
88 rss[0][0].setWantedMachine("localhost")
92 assert(efx.getResults()==[[11.110000000000001, 11.22, 11.330000000000002], [93.63, 94.26, 124.89000000000001]])
96 #l=loader.YACSLoader()
97 #p=l.load("/home/H87074/aaaaaaa.xml")
98 #ex=pilot.ExecutorSwig()
99 #ex.RunW(efx.getUndergroundGeneratedGraph())
106 zePath=os.path.join(os.environ["KERNEL_ROOT_DIR"],"bin","salome","appliskel")
107 sys.path.append(zePath)
108 import salome_test_session
109 port=salome_test_session.startSession(shutdownAtExit=False)
110 omniorb_cfg=os.environ["OMNIORB_CONFIG"]
111 SALOMERuntime.RuntimeSALOME.setRuntime()
112 r=SALOMERuntime.getSALOMERuntime()
113 l=loader.YACSLoader()
114 p=l.load("/home/H87074/aaaaaaa.xml")
115 ex=pilot.ExecutorSwig()
117 salome_test_session.terminateSession(port)