2 # Generated python file of Graph GraphSwitchManyCases
6 # Graph creation of GraphSwitchManyCases
7 def DefGraphSwitchManyCases() :
8 GraphSwitchManyCases = Graph( 'GraphSwitchManyCases' )
9 GraphSwitchManyCases.SetName( 'GraphSwitchManyCases' )
10 GraphSwitchManyCases.SetAuthor( 'JR' )
11 GraphSwitchManyCases.SetComment( '' )
12 GraphSwitchManyCases.Coords( 0 , 0 )
14 # Creation of Factory Nodes
16 # Creation of InLine Nodes
18 PyCase1.append( 'from time import * ' )
19 PyCase1.append( 'def Case1(a) : ' )
20 PyCase1.append( ' sleep(1) ' )
21 PyCase1.append( ' return a ' )
22 Case1 = GraphSwitchManyCases.INode( 'Case1' , PyCase1 )
23 Case1.SetName( 'Case1' )
25 Case1.SetComment( 'Compute Node' )
26 Case1.Coords( 448 , 13 )
27 ICase1a = Case1.InPort( 'a' , 'long' )
28 ICase1Gate = Case1.GetInPort( 'Gate' )
29 OCase1a = Case1.OutPort( 'a' , 'long' )
30 OCase1Gate = Case1.GetOutPort( 'Gate' )
33 PyCase3.append( 'from time import * ' )
34 PyCase3.append( 'def Case3(b) : ' )
35 PyCase3.append( ' sleep(1) ' )
36 PyCase3.append( ' return b ' )
37 Case3 = GraphSwitchManyCases.INode( 'Case3' , PyCase3 )
38 Case3.SetName( 'Case3' )
40 Case3.SetComment( 'Compute Node' )
41 Case3.Coords( 458 , 286 )
42 ICase3b = Case3.InPort( 'b' , 'long' )
43 ICase3Gate = Case3.GetInPort( 'Gate' )
44 OCase3b = Case3.OutPort( 'b' , 'long' )
45 OCase3Gate = Case3.GetOutPort( 'Gate' )
48 PyCase4.append( 'from time import * ' )
49 PyCase4.append( 'def Case4(c) : ' )
50 PyCase4.append( ' sleep(1) ' )
51 PyCase4.append( ' return ' )
52 Case4 = GraphSwitchManyCases.INode( 'Case4' , PyCase4 )
53 Case4.SetName( 'Case4' )
55 Case4.SetComment( 'Compute Node' )
56 Case4.Coords( 459 , 493 )
57 ICase4c = Case4.InPort( 'c' , 'long' )
58 ICase4Gate = Case4.GetInPort( 'Gate' )
59 OCase4Gate = Case4.GetOutPort( 'Gate' )
62 PyCase2a.append( 'from time import * ' )
63 PyCase2a.append( 'def Case2a(a) : ' )
64 PyCase2a.append( ' sleep(1) ' )
65 PyCase2a.append( ' return a ' )
66 Case2a = GraphSwitchManyCases.INode( 'Case2a' , PyCase2a )
67 Case2a.SetName( 'Case2a' )
68 Case2a.SetAuthor( '' )
69 Case2a.SetComment( 'Compute Node' )
70 Case2a.Coords( 453 , 154 )
71 ICase2aa = Case2a.InPort( 'a' , 'long' )
72 ICase2aGate = Case2a.GetInPort( 'Gate' )
73 OCase2aa = Case2a.OutPort( 'a' , 'long' )
74 OCase2aGate = Case2a.GetOutPort( 'Gate' )
76 # Creation of Loop Nodes
78 PyLoop.append( 'def Init(Index,Max,Min) : ' )
79 PyLoop.append( ' Index = Max ' )
80 PyLoop.append( ' return Index,Max,Min ' )
82 PyMoreLoop.append( 'def More(Index,Max,Min) : ' )
83 PyMoreLoop.append( ' if Index >= Min : ' )
84 PyMoreLoop.append( ' DoLoop = 1 ' )
85 PyMoreLoop.append( ' else : ' )
86 PyMoreLoop.append( ' DoLoop = 0 ' )
87 PyMoreLoop.append( ' return DoLoop,Index,Max,Min ' )
89 PyNextLoop.append( 'def Next(Index,Max,Min) : ' )
90 PyNextLoop.append( ' Index = Index - 1 ' )
91 PyNextLoop.append( ' return Index,Max,Min ' )
92 Loop,EndLoop = GraphSwitchManyCases.LNode( 'Init' , PyLoop , 'More' , PyMoreLoop , 'Next' , PyNextLoop )
93 EndLoop.SetName( 'EndLoop' )
94 EndLoop.SetAuthor( '' )
95 EndLoop.SetComment( 'Compute Node' )
96 EndLoop.Coords( 972 , 344 )
98 EndLoop.SetPyFunction( 'EndLoop' , PyEndLoop )
99 ILoopDoLoop = Loop.GetInPort( 'DoLoop' )
100 ILoopIndex = Loop.InPort( 'Index' , 'long' )
101 ILoopMax = Loop.InPort( 'Max' , 'long' )
102 ILoopMin = Loop.InPort( 'Min' , 'long' )
103 ILoopGate = Loop.GetInPort( 'Gate' )
104 OLoopDoLoop = Loop.GetOutPort( 'DoLoop' )
105 OLoopIndex = Loop.GetOutPort( 'Index' )
106 OLoopMax = Loop.GetOutPort( 'Max' )
107 OLoopMin = Loop.GetOutPort( 'Min' )
108 IEndLoopDoLoop = EndLoop.GetInPort( 'DoLoop' )
109 IEndLoopIndex = EndLoop.GetInPort( 'Index' )
110 IEndLoopMax = EndLoop.GetInPort( 'Max' )
111 IEndLoopMin = EndLoop.GetInPort( 'Min' )
112 IEndLoopGate = EndLoop.GetInPort( 'Gate' )
113 OEndLoopDoLoop = EndLoop.GetOutPort( 'DoLoop' )
114 OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
115 OEndLoopMax = EndLoop.GetOutPort( 'Max' )
116 OEndLoopMin = EndLoop.GetOutPort( 'Min' )
117 OEndLoopGate = EndLoop.GetOutPort( 'Gate' )
118 Loop.SetName( 'Loop' )
120 Loop.SetComment( 'Compute Node' )
121 Loop.Coords( 15 , 336 )
123 # Creation of Switch Nodes
125 PySwitch.append( 'from time import * ' )
126 PySwitch.append( 'def Switch(Index) : ' )
127 PySwitch.append( ' sleep(1) ' )
128 PySwitch.append( ' SB1 = 0 ' )
129 PySwitch.append( ' SB2 = 0 ' )
130 PySwitch.append( ' if (Index & 3) == 3 : ' )
131 PySwitch.append( ' SB1 = 1 ' )
132 PySwitch.append( ' elif (Index & 3) == 0 : ' )
133 PySwitch.append( ' SB2 = 1 ' )
134 PySwitch.append( ' return SB1,SB2,Index,Index+1,Index+2,Index+3,Index+4,Index+5 ' )
135 Switch,EndSwitch = GraphSwitchManyCases.SNode( 'Switch' , PySwitch )
136 EndSwitch.SetName( 'EndSwitch' )
137 EndSwitch.SetAuthor( '' )
138 EndSwitch.SetComment( 'Compute Node' )
139 EndSwitch.Coords( 732 , 344 )
141 PyEndSwitch.append( 'from time import * ' )
142 PyEndSwitch.append( 'def EndSwitch(a,b,dd,e,f) : ' )
143 PyEndSwitch.append( ' sleep(1) ' )
144 PyEndSwitch.append( ' if b != (a+1) : ' )
145 PyEndSwitch.append( ' print 'EndSwitch ERROR' ' )
146 PyEndSwitch.append( ' pass ' )
147 PyEndSwitch.append( ' if dd != (a+3) : ' )
148 PyEndSwitch.append( ' print 'EndSwitch ERROR' ' )
149 PyEndSwitch.append( ' pass ' )
150 PyEndSwitch.append( ' if e != (a+4) : ' )
151 PyEndSwitch.append( ' print 'EndSwitch ERROR' ' )
152 PyEndSwitch.append( ' pass ' )
153 PyEndSwitch.append( ' if f != (a+5) : ' )
154 PyEndSwitch.append( ' print 'EndSwitch ERROR' ' )
155 PyEndSwitch.append( ' pass ' )
156 PyEndSwitch.append( ' return a ' )
157 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
158 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
159 IEndSwitchb = EndSwitch.InPort( 'b' , 'long' )
160 IEndSwitchdd = EndSwitch.InPort( 'dd' , 'long' )
161 IEndSwitche = EndSwitch.InPort( 'e' , 'long' )
162 IEndSwitchf = EndSwitch.InPort( 'f' , 'long' )
163 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
164 OEndSwitchIndex = EndSwitch.OutPort( 'Index' , 'long' )
165 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
166 Switch.SetName( 'Switch' )
167 Switch.SetAuthor( '' )
168 Switch.SetComment( 'Compute Node' )
169 Switch.Coords( 232 , 285 )
170 ISwitchIndex = Switch.InPort( 'Index' , 'long' )
171 ISwitchGate = Switch.GetInPort( 'Gate' )
172 OSwitchSB1 = Switch.OutPort( 'SB1' , 'long' )
173 OSwitchSB2 = Switch.OutPort( 'SB2' , 'long' )
174 OSwitcha = Switch.OutPort( 'a' , 'long' )
175 OSwitchb = Switch.OutPort( 'b' , 'long' )
176 OSwitchc = Switch.OutPort( 'c' , 'long' )
177 OSwitchd = Switch.OutPort( 'd' , 'long' )
178 OSwitche = Switch.OutPort( 'e' , 'long' )
179 OSwitchf = Switch.OutPort( 'f' , 'long' )
180 OSwitchDefault = Switch.GetOutPort( 'Default' )
183 LLoopIndexSwitchIndex = GraphSwitchManyCases.Link( OLoopIndex , ISwitchIndex )
185 LLoopMaxEndLoopMax = GraphSwitchManyCases.Link( OLoopMax , IEndLoopMax )
187 LLoopMinEndLoopMin = GraphSwitchManyCases.Link( OLoopMin , IEndLoopMin )
189 LSwitchSB1Case1Gate = GraphSwitchManyCases.Link( OSwitchSB1 , ICase1Gate )
191 LSwitchSB2Case2aGate = GraphSwitchManyCases.Link( OSwitchSB2 , ICase2aGate )
193 LSwitchaCase1a = GraphSwitchManyCases.Link( OSwitcha , ICase1a )
195 LSwitchaCase2aa = GraphSwitchManyCases.Link( OSwitcha , ICase2aa )
197 LSwitchbCase3b = GraphSwitchManyCases.Link( OSwitchb , ICase3b )
199 LSwitchcCase4c = GraphSwitchManyCases.Link( OSwitchc , ICase4c )
201 LSwitchdEndSwitchdd = GraphSwitchManyCases.Link( OSwitchd , IEndSwitchdd )
203 LSwitcheEndSwitche = GraphSwitchManyCases.Link( OSwitche , IEndSwitche )
205 LSwitchDefaultEndSwitchDefault = GraphSwitchManyCases.Link( OSwitchDefault , IEndSwitchDefault )
207 LEndSwitchIndexEndLoopIndex = GraphSwitchManyCases.Link( OEndSwitchIndex , IEndLoopIndex )
209 LCase1aEndSwitcha = GraphSwitchManyCases.Link( OCase1a , IEndSwitcha )
211 LCase3bEndSwitchb = GraphSwitchManyCases.Link( OCase3b , IEndSwitchb )
213 LCase4GateEndSwitchDefault = GraphSwitchManyCases.Link( OCase4Gate , IEndSwitchDefault )
215 LCase2aaEndSwitcha = GraphSwitchManyCases.Link( OCase2aa , IEndSwitcha )
218 ILoopIndex.Input( 0 )
222 # Input Ports of the graph
223 #IEndSwitchf = EndSwitch.GetInPort( 'f' )
225 # Output Ports of the graph
226 #OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
227 #OEndLoopMax = EndLoop.GetOutPort( 'Max' )
228 #OEndLoopMin = EndLoop.GetOutPort( 'Min' )
229 #OSwitchf = Switch.GetOutPort( 'f' )
230 return GraphSwitchManyCases
233 GraphSwitchManyCases = DefGraphSwitchManyCases()