Salome HOME
NRI : Add documentation.
[modules/superv.git] / examples / GraphInLines.py
1
2 # Generated python file of Graph GraphInLines
3
4 from SuperV import *
5 # Graph creation 
6 GraphInLines = Graph( 'GraphInLines' )
7 GraphInLines.SetName( 'GraphInLines' )
8 GraphInLines.SetAuthor( '' )
9 GraphInLines.SetComment( '' )
10 GraphInLines.Coords( 0 , 0 )
11
12 # Creation of Factory Nodes
13
14 # Creation of InLine Nodes
15 PyAdd = []
16 PyAdd.append( 'def Add(a,b) :  ' )
17 PyAdd.append( '    return a+b  ' )
18 PyAdd.append( '' )
19 Add = GraphInLines.INode( 'Add' , PyAdd )
20 Add.InPort( 'a' , 'long' )
21 Add.InPort( 'b' , 'long' )
22 Add.OutPort( 'f' , 'long' )
23 Add.SetName( 'Add' )
24 Add.SetAuthor( '' )
25 Add.SetComment( 'Python function' )
26 Add.Coords( 351 , 77 )
27 PySub = []
28 PySub.append( 'def Sub(a,b) : ' )
29 PySub.append( '    return a-b ' )
30 PySub.append( '' )
31 Sub = GraphInLines.INode( 'Sub' , PySub )
32 Sub.InPort( 'a' , 'long' )
33 Sub.InPort( 'b' , 'long' )
34 Sub.OutPort( 'f' , 'long' )
35 Sub.SetName( 'Sub' )
36 Sub.SetAuthor( '' )
37 Sub.SetComment( 'Python function' )
38 Sub.Coords( 86 , 333 )
39 PyMul = []
40 PyMul.append( 'def Mul(a,b) : ' )
41 PyMul.append( '    return a*b ' )
42 Mul = GraphInLines.INode( 'Mul' , PyMul )
43 Mul.InPort( 'a' , 'long' )
44 Mul.InPort( 'b' , 'long' )
45 Mul.OutPort( 'Result' , 'long' )
46 Mul.SetName( 'Mul' )
47 Mul.SetAuthor( '' )
48 Mul.SetComment( 'Python function' )
49 Mul.Coords( 616 , 247 )
50
51 # Creation of intermediate Output variables and of Control Links
52 Addf = Add.Port( 'f' )
53 Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) )
54 Mula.AddCoord( 1 , 570 , 356 )
55 Mula.AddCoord( 2 , 570 , 186 )
56 Subf = Sub.Port( 'f' )
57 Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) )
58 Mulb.AddCoord( 1 , 282 , 376 )
59 Mulb.AddCoord( 2 , 282 , 442 )
60 Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) )
61 Addb.AddCoord( 1 , 283 , 209 )
62 Addb.AddCoord( 2 , 283 , 374 )
63 Addb.AddCoord( 3 , 283 , 442 )
64
65 # Creation of Input datas
66 Adda = Add.Input( 'a' , 1)
67 Suba = Sub.Input( 'a' , 3)
68 Subb = Sub.Input( 'b' , 4)
69
70 # Creation of Output variables
71 MulResult = Mul.Port( 'Result' )
72
73 GraphInLines.Run()
74
75 GraphInLines.DoneW()
76
77 GraphInLines.PrintPorts()
78