Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphInLinesParall.py
1
2 # Generated python file of Graph GraphInLines
3
4 from SuperV import *
5 # Graph creation 
6 GraphInLinesParall = Graph( 'GraphInLinesParall' )
7 GraphInLinesParall.SetName( 'GraphInLinesParall' )
8 GraphInLinesParall.SetAuthor( '' )
9 GraphInLinesParall.SetComment( '' )
10 GraphInLinesParall.Coords( 0 , 0 )
11
12 # Creation of Factory Nodes
13
14 # Creation of InLine Nodes
15 PyAdd = []
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   ' )
22 PyAdd.append( '' )
23 Add = GraphInLinesParall.INode( 'Add' , PyAdd )
24 Add.InPort( 'a' , 'long' )
25 Add.InPort( 'b' , 'long' )
26 Add.OutPort( 'f' , 'long' )
27 Add.SetName( 'Add' )
28 Add.SetAuthor( '' )
29 Add.SetComment( 'Python function' )
30 Add.Coords( 351 , 77 )
31
32 PySub = []
33 PySub.append( 'def Sub(a,b) : ' )
34 PySub.append( '    return a-b ' )
35 PySub.append( '' )
36 Sub = GraphInLinesParall.INode( 'Sub' , PySub )
37 Sub.InPort( 'a' , 'long' )
38 Sub.InPort( 'b' , 'long' )
39 Sub.OutPort( 'f' , 'long' )
40 Sub.SetName( 'Sub' )
41 Sub.SetAuthor( '' )
42 Sub.SetComment( 'Python function' )
43 Sub.Coords( 86 , 333 )
44
45 PyMul = []
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' )
56 Mul.SetName( 'Mul' )
57 Mul.SetAuthor( '' )
58 Mul.SetComment( 'Python function' )
59 Mul.Coords( 616 , 247 )
60
61 # Creation of Links
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 )
67
68 Addb = GraphInLinesParall.Link( Subf , Add.Port( 'b' ) )
69 Addb.AddCoord( 1 , 282 , 186 )
70 Addb.AddCoord( 2 , 283 , 413 )
71
72 Mula = GraphInLinesParall.Link( Subf , Mul.Port( 'a' ) )
73 Mula.AddCoord( 1 , 583 , 328 )
74 Mula.AddCoord( 2 , 583 , 412 )
75
76 # Creation of Input datas
77 Adda = Add.Input( 'a' , 1)
78 Suba = Sub.Input( 'a' , 3)
79 Subb = Sub.Input( 'b' , 4)
80
81 # Creation of Output variables
82 Addf = Add.Port( 'f' )
83 MulResult = Mul.Port( 'Result' )
84
85 GraphInLinesParall.Run()
86 GraphInLinesParall.DoneW()
87 GraphInLinesParall.PrintPorts()