Salome HOME
PR: avoids unnecessary compilation after regeneration of SALOMEconfig.h, with gcc3.2
[modules/superv.git] / examples / GraphGOTO.py
1
2 # Generated python file of Graph GraphGOTO
3
4 from SuperV import *
5 # Graph creation 
6 GraphGOTO = Graph( 'GraphGOTO' )
7 GraphGOTO.SetName( 'GraphGOTO' )
8 GraphGOTO.SetAuthor( '' )
9 GraphGOTO.SetComment( '' )
10 GraphGOTO.Coords( 0 , 0 )
11
12 # Creation of Factory Nodes
13
14 # Creation of InLine Nodes
15 PyIsOdd = []
16 PyIsOdd.append( 'import time' )
17 PyIsOdd.append( 'def IsOdd(a) :    ' )
18 PyIsOdd.append( '    print a,"IsOdd"   ' )
19 PyIsOdd.append( '    time.sleep( 1 )' )
20 PyIsOdd.append( '    return a+1 ' )
21 IsOdd = GraphGOTO.INode( 'IsOdd' , PyIsOdd )
22 IsOdd.InPort( 'a' , 'long' )
23 IsOdd.OutPort( 'a' , 'long' )
24 IsOdd.SetName( 'IsOdd' )
25 IsOdd.SetAuthor( '' )
26 IsOdd.SetComment( 'Python function' )
27 IsOdd.Coords( 296 , 249 )
28
29 # Creation of Switch Nodes
30 PySwitch = []
31 PySwitch.append( 'import time' )
32 PySwitch.append( 'def Switch(a) :  ' )
33 PySwitch.append( '    print "Switch(",a,")"' )
34 PySwitch.append( '    time.sleep( 1 )' )
35 PySwitch.append( '    b = a & 1' )
36 PySwitch.append( '    print "Switch(",a,") ->",b,a' )
37 PySwitch.append( '    return b,a ' )
38 Switch,EndSwitch = GraphGOTO.SNode( 'Switch' , PySwitch )
39 EndSwitch.SetName( 'EndSwitch' )
40 EndSwitch.SetAuthor( '' )
41 EndSwitch.SetComment( '' )
42 EndSwitch.Coords( 569 , 94 )
43 PyEndSwitch = []
44 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
45 EndSwitch.InPort( 'a' , 'long' )
46 EndSwitch.OutPort( 'a' , 'long' )
47 Switch.InPort( 'a' , 'long' )
48 Switch.OutPort( 'Odd' , 'long' )
49 Switch.OutPort( 'a' , 'long' )
50 Switch.SetName( 'Switch' )
51 Switch.SetAuthor( '' )
52 Switch.SetComment( '' )
53 Switch.Coords( 25 , 94 )
54
55 # Creation of GOTO Nodes
56 PyGoTo = []
57 GoTo = GraphGOTO.GNode( '' , PyGoTo , 'Switch' )
58 GoTo.InPort( 'a' , 'long' )
59 GoTo.OutPort( 'a' , 'long' )
60 GoTo.SetName( 'GoTo' )
61 GoTo.SetAuthor( '' )
62 GoTo.SetComment( '' )
63 GoTo.Coords( 520 , 323 )
64
65 # Creation of intermediate Output variables and of Control Links
66 IsOdda = IsOdd.Port( 'a' )
67 GoToa = GraphGOTO.Link( IsOdda , GoTo.Port( 'a' ) )
68 SwitchDefault = Switch.Port( 'Default' )
69 EndSwitchDefault = GraphGOTO.Link( SwitchDefault , EndSwitch.Port( 'Default' ) )
70 SwitchOdd = Switch.Port( 'Odd' )
71 IsOddInGate = GraphGOTO.Link( SwitchOdd , IsOdd.Port( 'InGate' ) )
72 IsOddInGate.AddCoord( 1 , 249 , 323 )
73 IsOddInGate.AddCoord( 2 , 249 , 157 )
74 IsOddInGate.AddCoord( 3 , 247 , 157 )
75 Switcha = Switch.Port( 'a' )
76 IsOdda = GraphGOTO.Link( Switcha , IsOdd.Port( 'a' ) )
77 IsOdda.AddCoord( 1 , 196 , 357 )
78 IsOdda.AddCoord( 2 , 196 , 186 )
79 EndSwitcha = GraphGOTO.Link( Switcha , EndSwitch.Port( 'a' ) )
80 GoToOutGate = GoTo.Port( 'OutGate' )
81 SwitchInGate = GraphGOTO.Link( GoToOutGate , Switch.Port( 'InGate' ) )
82
83 # Creation of Input datas
84 Switcha = Switch.Input( 'a' , 1)
85
86 # Creation of Output variables
87 EndSwitcha = EndSwitch.Port( 'a' )
88
89 GraphGOTO.Run()
90
91 GraphGOTO.DoneW()
92
93 GraphGOTO.PrintPorts()
94