2 # Generated python file of Graph GraphInLines
6 GraphInLinesParall = Graph( 'GraphInLinesParall' )
7 GraphInLinesParall.SetName( 'GraphInLinesParall' )
8 GraphInLinesParall.SetAuthor( '' )
9 GraphInLinesParall.SetComment( '' )
10 GraphInLinesParall.Coords( 0 , 0 )
12 # Creation of Factory Nodes
14 # Creation of InLine Nodes
16 PyAdd.append( 'import time ' )
17 PyAdd.append( 'def Add(a,b) : ' )
18 PyAdd.append( ' print "Add will wait 5 seconds" ' )
19 PyAdd.append( ' time.sleep(5) ' )
20 PyAdd.append( ' print "Add waited" ' )
21 PyAdd.append( ' return a+b ' )
23 Add = GraphInLinesParall.INode( 'Add' , PyAdd )
24 Add.InPort( 'a' , 'long' )
25 Add.InPort( 'b' , 'long' )
26 Add.OutPort( 'f' , 'long' )
29 Add.SetComment( 'Python function' )
30 Add.Coords( 351 , 77 )
33 PySub.append( 'def Sub(a,b) : ' )
34 PySub.append( ' return a-b ' )
36 Sub = GraphInLinesParall.INode( 'Sub' , PySub )
37 Sub.InPort( 'a' , 'long' )
38 Sub.InPort( 'b' , 'long' )
39 Sub.OutPort( 'f' , 'long' )
42 Sub.SetComment( 'Python function' )
43 Sub.Coords( 86 , 333 )
46 PyMul.append( 'import time ' )
47 PyMul.append( 'def Mul(a,b) : ' )
48 PyMul.append( ' print "Mul will wait 5 seconds" ' )
49 PyMul.append( ' time.sleep(5) ' )
50 PyMul.append( ' print "Mul waited" ' )
51 PyMul.append( ' return a*b ' )
52 Mul = GraphInLinesParall.INode( 'Mul' , PyMul )
53 Mul.InPort( 'a' , 'long' )
54 Mul.InPort( 'b' , 'long' )
55 Mul.OutPort( 'Result' , 'long' )
58 Mul.SetComment( 'Python function' )
59 Mul.Coords( 616 , 247 )
62 Subf = Sub.Port( 'f' )
63 Mulb = GraphInLinesParall.Link( Subf , Mul.Port( 'b' ) )
64 Mulb.AddCoord( 1 , 583 , 357 )
65 Mulb.AddCoord( 2 , 583 , 413 )
66 Mulb.AddCoord( 3 , 282 , 413 )
68 Addb = GraphInLinesParall.Link( Subf , Add.Port( 'b' ) )
69 Addb.AddCoord( 1 , 282 , 186 )
70 Addb.AddCoord( 2 , 283 , 413 )
72 Mula = GraphInLinesParall.Link( Subf , Mul.Port( 'a' ) )
73 Mula.AddCoord( 1 , 583 , 328 )
74 Mula.AddCoord( 2 , 583 , 412 )
76 # Creation of Input datas
77 Adda = Add.Input( 'a' , 1)
78 Suba = Sub.Input( 'a' , 3)
79 Subb = Sub.Input( 'b' , 4)
81 # Creation of Output variables
82 Addf = Add.Port( 'f' )
83 MulResult = Mul.Port( 'Result' )
85 GraphInLinesParall.Run()
86 GraphInLinesParall.DoneW()
87 GraphInLinesParall.PrintPorts()