2 # Generated python file of Graph GraphSwitch_1
6 # Graph creation of GraphSwitch_1
7 def DefGraphSwitch_1() :
8 GraphSwitch_1 = Graph( 'GraphSwitch_1' )
9 GraphSwitch_1.SetName( 'GraphSwitch_1' )
10 GraphSwitch_1.SetAuthor( '' )
11 GraphSwitch_1.SetComment( '' )
12 GraphSwitch_1.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_1.INode( 'IsOdd' , PyIsOdd )
24 IsOdd.SetName( 'IsOdd' )
26 IsOdd.SetComment( 'Python function' )
27 IsOdd.Coords( 388 , 50 )
28 IIsOdda = IsOdd.InPort( 'a' , 'long' )
29 IIsOddGate = IsOdd.GetInPort( 'Gate' )
30 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
34 PyIsEven.append( 'from time import * ' )
35 PyIsEven.append( 'def IsEven(a) : ' )
36 PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' )
37 PyIsEven.append( ' sleep( 1 ) ' )
38 PyIsEven.append( ' return a ' )
39 IsEven = GraphSwitch_1.INode( 'IsEven' , PyIsEven )
40 IsEven.SetName( 'IsEven' )
41 IsEven.SetAuthor( '' )
42 IsEven.SetComment( 'Compute Node' )
43 IsEven.Coords( 397 , 279 )
44 IIsEvena = IsEven.InPort( 'a' , 'long' )
45 IIsEvenGate = IsEven.GetInPort( 'Gate' )
46 OIsEvena = IsEven.OutPort( 'a' , 'long' )
47 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
49 # Creation of Loop Nodes
51 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
52 PyInitLoopSwitch.append( ' Index = Max ' )
53 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
54 PyMoreInitLoopSwitch = []
55 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
56 PyMoreInitLoopSwitch.append( ' if Index >= Min : ' )
57 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
58 PyMoreInitLoopSwitch.append( ' else : ' )
59 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
60 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
61 PyNextInitLoopSwitch = []
62 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
63 PyNextInitLoopSwitch.append( ' Index = Index - 1 ' )
64 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
65 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitch_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
66 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
67 EndOfInitLoopSwitch.SetAuthor( '' )
68 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
69 EndOfInitLoopSwitch.Coords( 766 , 127 )
70 PyEndOfInitLoopSwitch = []
71 EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
72 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
73 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
74 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
75 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
76 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
77 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
78 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
79 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
80 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
81 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
82 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
83 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
84 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
85 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
86 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
87 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
88 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
89 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
90 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
91 InitLoopSwitch.SetName( 'InitLoopSwitch' )
92 InitLoopSwitch.SetAuthor( '' )
93 InitLoopSwitch.SetComment( 'Compute Node' )
94 InitLoopSwitch.Coords( 10 , 129 )
96 # Creation of Switch Nodes
98 PySwitch.append( 'from time import * ' )
99 PySwitch.append( 'def Switch(a) : ' )
100 PySwitch.append( ' if a == 0 : ' )
101 PySwitch.append( ' return 0,0,a ' )
102 PySwitch.append( ' if a < 0 : ' )
103 PySwitch.append( ' return 1,1,a ' )
104 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
105 PySwitch.append( ' sleep(1) ' )
106 PySwitch.append( ' return a & 1,1-(a&1),a ' )
107 Switch,EndOfSwitch = GraphSwitch_1.SNode( 'Switch' , PySwitch )
108 EndOfSwitch.SetName( 'EndOfSwitch' )
109 EndOfSwitch.SetAuthor( '' )
110 EndOfSwitch.SetComment( 'Compute Node' )
111 EndOfSwitch.Coords( 580 , 147 )
113 EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch )
114 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
115 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
116 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
117 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
118 Switch.SetName( 'Switch' )
119 Switch.SetAuthor( '' )
120 Switch.SetComment( 'Compute Node' )
121 Switch.Coords( 195 , 129 )
122 ISwitcha = Switch.InPort( 'a' , 'long' )
123 ISwitchGate = Switch.GetInPort( 'Gate' )
124 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
125 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
126 OSwitcha = Switch.OutPort( 'a' , 'int' )
127 OSwitchDefault = Switch.GetOutPort( 'Default' )
130 LIsOddaEndOfSwitcha = GraphSwitch_1.Link( OIsOdda , IEndOfSwitcha )
132 LInitLoopSwitchIndexSwitcha = GraphSwitch_1.Link( OInitLoopSwitchIndex , ISwitcha )
134 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitch_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
136 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitch_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
138 LIsEvenaEndOfSwitcha = GraphSwitch_1.Link( OIsEvena , IEndOfSwitcha )
140 LSwitchOddIsOddGate = GraphSwitch_1.Link( OSwitchOdd , IIsOddGate )
142 LSwitchEvenIsEvenGate = GraphSwitch_1.Link( OSwitchEven , IIsEvenGate )
144 LSwitchaIsOdda = GraphSwitch_1.Link( OSwitcha , IIsOdda )
146 LSwitchaIsEvena = GraphSwitch_1.Link( OSwitcha , IIsEvena )
148 LSwitchDefaultEndOfSwitchDefault = GraphSwitch_1.Link( OSwitchDefault , IEndOfSwitchDefault )
150 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitch_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
153 IInitLoopSwitchIndex.Input( 0 )
154 IInitLoopSwitchMin.Input( -5 )
155 IInitLoopSwitchMax.Input( 10 )
157 # Output Ports of the graph
158 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
159 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
160 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
164 GraphSwitch_1 = DefGraphSwitch_1()