2 # Generated python file of Graph GraphSwitch
6 # Graph creation of GraphSwitch
8 GraphSwitch = Graph( 'GraphSwitch' )
9 GraphSwitch.SetName( 'GraphSwitch' )
10 GraphSwitch.SetAuthor( '' )
11 GraphSwitch.SetComment( '' )
12 GraphSwitch.Coords( 0 , 0 )
14 # Creation of Factory Nodes
16 # Creation of InLine Nodes
18 PyIsOdd.append( 'from time import * ' )
19 PyIsOdd.append( 'def IsOdd(a) : ' )
20 PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' )
21 PyIsOdd.append( ' sleep( 1 ) ' )
22 PyIsOdd.append( ' return a ' )
23 IsOdd = GraphSwitch.INode( 'IsOdd' , PyIsOdd )
24 IsOdd.SetName( 'IsOdd' )
26 IsOdd.SetComment( 'Python function' )
27 IsOdd.Coords( 389 , 65 )
28 IIsOdda = IsOdd.InPort( 'a' , 'long' )
29 IIsOddGate = IsOdd.GetInPort( 'Gate' )
30 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
33 # Creation of Loop Nodes
35 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
36 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
37 PyMoreInitLoopSwitch = []
38 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
39 PyMoreInitLoopSwitch.append( ' if Index <= Max : ' )
40 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
41 PyMoreInitLoopSwitch.append( ' else : ' )
42 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
43 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
44 PyNextInitLoopSwitch = []
45 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
46 PyNextInitLoopSwitch.append( ' Index = Index + 1 ' )
47 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
48 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitch.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
49 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
50 EndOfInitLoopSwitch.SetAuthor( '' )
51 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
52 EndOfInitLoopSwitch.Coords( 776 , 170 )
53 PyEndOfInitLoopSwitch = []
54 EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
55 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
56 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
57 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
58 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
59 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
60 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
61 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
62 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
63 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
64 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
65 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
66 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
67 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
68 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
69 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
70 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
71 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
72 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
73 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
74 InitLoopSwitch.SetName( 'InitLoopSwitch' )
75 InitLoopSwitch.SetAuthor( '' )
76 InitLoopSwitch.SetComment( 'Compute Node' )
77 InitLoopSwitch.Coords( 10 , 129 )
79 # Creation of Switch Nodes
81 PySwitch.append( 'from time import * ' )
82 PySwitch.append( 'def Switch(a) : ' )
83 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
84 PySwitch.append( ' sleep(1) ' )
85 PySwitch.append( ' return a & 1,1-(a&1),a ' )
86 Switch,EndOfSwitch = GraphSwitch.SNode( 'Switch' , PySwitch )
87 EndOfSwitch.SetName( 'EndOfSwitch' )
88 EndOfSwitch.SetAuthor( '' )
89 EndOfSwitch.SetComment( 'Compute Node' )
90 EndOfSwitch.Coords( 582 , 170 )
92 EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
93 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
94 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
95 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
96 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
97 Switch.SetName( 'Switch' )
98 Switch.SetAuthor( '' )
99 Switch.SetComment( 'Compute Node' )
100 Switch.Coords( 194 , 129 )
101 ISwitcha = Switch.InPort( 'a' , 'long' )
102 ISwitchGate = Switch.GetInPort( 'Gate' )
103 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
104 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
105 OSwitcha = Switch.OutPort( 'a' , 'int' )
106 OSwitchDefault = Switch.GetOutPort( 'Default' )
109 LIsOddaEndOfSwitcha = GraphSwitch.Link( OIsOdda , IEndOfSwitcha )
110 LIsOddaEndOfSwitcha.AddCoord( 1 , 564 , 201 )
111 LIsOddaEndOfSwitcha.AddCoord( 2 , 564 , 137 )
113 LInitLoopSwitchIndexSwitcha = GraphSwitch.Link( OInitLoopSwitchIndex , ISwitcha )
115 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitch.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
117 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitch.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
119 LSwitchOddIsOddGate = GraphSwitch.Link( OSwitchOdd , IIsOddGate )
121 LSwitchaIsOdda = GraphSwitch.Link( OSwitcha , IIsOdda )
122 LSwitchaIsOdda.AddCoord( 1 , 371 , 136 )
123 LSwitchaIsOdda.AddCoord( 2 , 371 , 200 )
125 LSwitchDefaultEndOfSwitchDefault = GraphSwitch.Link( OSwitchDefault , IEndOfSwitchDefault )
127 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitch.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
130 IInitLoopSwitchIndex.Input( 0 )
131 IInitLoopSwitchMin.Input( 0 )
132 IInitLoopSwitchMax.Input( 100 )
134 # Output Ports of the graph
135 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
136 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
137 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
138 #OSwitchEven = Switch.GetOutPort( 'Even' )
142 GraphSwitch = DefGraphSwitch()