2 # Copyright (C) 2018-2019 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
27 SALOMERuntime.RuntimeSALOME.setRuntime()
28 r=SALOMERuntime.getSALOMERuntime()
30 p=r.createProc("prTest1")
31 ti=p.createType("int","int")
32 tdi=p.createSequenceTc("seqint","seqint",ti)
34 node0=r.createScriptNode("Salome","Func0")
35 node0.setScript("""o1=[1,4,3,2,0,6,7,8]""")
36 out0=node0.edAddOutputPort("o1",tdi)
39 node1=r.createForEachLoop("ForEachLoop_pyobj1",ti)
41 p.edAddCFLink(node0,node1)
42 p.edAddLink(out0,node1.edGetSeqOfSamplesPort())
43 node1.edGetNbOfBranchesPort().edInitInt(2)
45 node2=r.createScriptNode("Salome","Func1")
46 node2.setScript("""o2=i1*i1""")
47 i1=node2.edAddInputPort("i1",ti)
48 o2=node2.edAddOutputPort("o2",ti)
49 node1.edAddChild(node2)
50 p.edAddLink(node1.edGetSamplePort(),i1)
52 p.saveSchema("thomas.xml")
54 ex=pilot.ExecutorSwig()
55 assert(p.getState()==pilot.READY)
56 pilot.LoadObserversPluginIfAny(p,ex)
58 assert(p.getState()==pilot.DONE)
59 pilot.UnLoadObserversPluginIfAny()
65 p=l.load("thomas.xml")
66 ex=pilot.ExecutorSwig()
67 assert(p.getState()==pilot.READY)
68 pilot.LoadObserversPluginIfAny(p,ex)
70 assert(p.getState()==pilot.DONE)
71 pilot.UnLoadObserversPluginIfAny()