2 # Generated python file of Graph GraphLoopSwitchs
6 # Graph creation of GraphLoopSwitchs
7 def DefGraphLoopSwitchs() :
8 GraphLoopSwitchs = Graph( 'GraphLoopSwitchs' )
9 GraphLoopSwitchs.SetName( 'GraphLoopSwitchs' )
10 GraphLoopSwitchs.SetAuthor( 'JR' )
11 GraphLoopSwitchs.SetComment( '' )
12 GraphLoopSwitchs.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" ' )
21 PyIsOdd.append( ' sleep( 1 ) ' )
22 PyIsOdd.append( ' return a ' )
23 IsOdd = GraphLoopSwitchs.INode( 'IsOdd' , PyIsOdd )
24 IsOdd.SetName( 'IsOdd' )
26 IsOdd.SetComment( 'Python function' )
27 IsOdd.Coords( 476 , 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" ' )
37 PyIsEven.append( ' sleep( 1 ) ' )
38 PyIsEven.append( ' return a ' )
39 IsEven = GraphLoopSwitchs.INode( 'IsEven' , PyIsEven )
40 IsEven.SetName( 'IsEven' )
41 IsEven.SetAuthor( '' )
42 IsEven.SetComment( 'Python function' )
43 IsEven.Coords( 479 , 311 )
44 IIsEvena = IsEven.InPort( 'a' , 'long' )
45 IIsEvenGate = IsEven.GetInPort( 'Gate' )
46 OIsEvena = IsEven.OutPort( 'a' , 'long' )
47 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
50 PySwitchsCompare.append( 'def SwitchsCompare(aOdd,Odd,aEven,Even) : ' )
51 PySwitchsCompare.append( ' return a ' )
52 SwitchsCompare = GraphLoopSwitchs.INode( 'SwitchsCompare' , PySwitchsCompare )
53 SwitchsCompare.SetName( 'SwitchsCompare' )
54 SwitchsCompare.SetAuthor( '' )
55 SwitchsCompare.SetComment( 'Compute Node' )
56 SwitchsCompare.Coords( 919 , 242 )
57 ISwitchsCompareaOdd = SwitchsCompare.InPort( 'aOdd' , 'long' )
58 ISwitchsCompareOdd = SwitchsCompare.InPort( 'Odd' , 'boolean' )
59 ISwitchsCompareaEven = SwitchsCompare.InPort( 'aEven' , 'long' )
60 ISwitchsCompareEven = SwitchsCompare.InPort( 'Even' , 'boolean' )
61 ISwitchsCompareGate = SwitchsCompare.GetInPort( 'Gate' )
62 OSwitchsComparea = SwitchsCompare.OutPort( 'a' , 'long' )
63 OSwitchsCompareGate = SwitchsCompare.GetOutPort( 'Gate' )
65 # Creation of Loop Nodes
67 PyLoop.append( 'def InitLoop(Index,Min,Max) : ' )
68 PyLoop.append( ' return Index,Min,Max ' )
70 PyMoreLoop.append( 'def MoreLoop(Index,Min,Max) : ' )
71 PyMoreLoop.append( ' if Index <= Max : ' )
72 PyMoreLoop.append( ' DoLoop = 1 ' )
73 PyMoreLoop.append( ' else : ' )
74 PyMoreLoop.append( ' DoLoop = 0 ' )
75 PyMoreLoop.append( ' return DoLoop,Index,Min,Max ' )
77 PyNextLoop.append( 'def NextLoop(Index,Min,Max) : ' )
78 PyNextLoop.append( ' Index = Index + 1 ' )
79 PyNextLoop.append( ' return Index,Min,Max ' )
80 Loop,EndOfLoop = GraphLoopSwitchs.LNode( 'InitLoop' , PyLoop , 'MoreLoop' , PyMoreLoop , 'NextLoop' , PyNextLoop )
81 EndOfLoop.SetName( 'EndOfLoop' )
82 EndOfLoop.SetAuthor( '' )
83 EndOfLoop.SetComment( 'Compute Node' )
84 EndOfLoop.Coords( 1102 , 282 )
86 EndOfLoop.SetPyFunction( '' , PyEndOfLoop )
87 ILoopDoLoop = Loop.GetInPort( 'DoLoop' )
88 ILoopIndex = Loop.InPort( 'Index' , 'long' )
89 ILoopMin = Loop.InPort( 'Min' , 'long' )
90 ILoopMax = Loop.InPort( 'Max' , 'long' )
91 ILoopGate = Loop.GetInPort( 'Gate' )
92 OLoopDoLoop = Loop.GetOutPort( 'DoLoop' )
93 OLoopIndex = Loop.GetOutPort( 'Index' )
94 OLoopMin = Loop.GetOutPort( 'Min' )
95 OLoopMax = Loop.GetOutPort( 'Max' )
96 IEndOfLoopDoLoop = EndOfLoop.GetInPort( 'DoLoop' )
97 IEndOfLoopIndex = EndOfLoop.GetInPort( 'Index' )
98 IEndOfLoopMin = EndOfLoop.GetInPort( 'Min' )
99 IEndOfLoopMax = EndOfLoop.GetInPort( 'Max' )
100 IEndOfLoopGate = EndOfLoop.GetInPort( 'Gate' )
101 OEndOfLoopDoLoop = EndOfLoop.GetOutPort( 'DoLoop' )
102 OEndOfLoopIndex = EndOfLoop.GetOutPort( 'Index' )
103 OEndOfLoopMin = EndOfLoop.GetOutPort( 'Min' )
104 OEndOfLoopMax = EndOfLoop.GetOutPort( 'Max' )
105 OEndOfLoopGate = EndOfLoop.GetOutPort( 'Gate' )
106 Loop.SetName( 'Loop' )
108 Loop.SetComment( 'Compute Node' )
109 Loop.Coords( 12 , 276 )
111 # Creation of Switch Nodes
113 PySwitchOdd.append( 'from time import * ' )
114 PySwitchOdd.append( 'def Switch(a) : ' )
115 PySwitchOdd.append( ' if ( a & 1 ) == 0 : ' )
116 PySwitchOdd.append( ' sleep(1) ' )
117 PySwitchOdd.append( ' return a & 1,1-(a&1),a ' )
118 SwitchOdd,EndOfSwitchOdd = GraphLoopSwitchs.SNode( 'Switch' , PySwitchOdd )
119 EndOfSwitchOdd.SetName( 'EndOfSwitchOdd' )
120 EndOfSwitchOdd.SetAuthor( '' )
121 EndOfSwitchOdd.SetComment( 'Compute Node' )
122 EndOfSwitchOdd.Coords( 711 , 161 )
123 PyEndOfSwitchOdd = []
124 EndOfSwitchOdd.SetPyFunction( '' , PyEndOfSwitchOdd )
125 IEndOfSwitchOdda = EndOfSwitchOdd.InPort( 'a' , 'long' )
126 IEndOfSwitchOddOdd = EndOfSwitchOdd.InPort( 'Odd' , 'boolean' )
127 IEndOfSwitchOddDefault = EndOfSwitchOdd.GetInPort( 'Default' )
128 OEndOfSwitchOdda = EndOfSwitchOdd.OutPort( 'a' , 'long' )
129 OEndOfSwitchOddOdd = EndOfSwitchOdd.OutPort( 'Odd' , 'boolean' )
130 OEndOfSwitchOddGate = EndOfSwitchOdd.GetOutPort( 'Gate' )
131 SwitchOdd.SetName( 'SwitchOdd' )
132 SwitchOdd.SetAuthor( '' )
133 SwitchOdd.SetComment( 'Compute Node' )
134 SwitchOdd.Coords( 240 , 141 )
135 ISwitchOdda = SwitchOdd.InPort( 'a' , 'long' )
136 ISwitchOddGate = SwitchOdd.GetInPort( 'Gate' )
137 OSwitchOddOdd = SwitchOdd.OutPort( 'Odd' , 'long' )
138 OSwitchOddEven = SwitchOdd.OutPort( 'Even' , 'int' )
139 OSwitchOdda = SwitchOdd.OutPort( 'a' , 'int' )
140 OSwitchOddDefault = SwitchOdd.GetOutPort( 'Default' )
143 PySwitchEven.append( 'from time import * ' )
144 PySwitchEven.append( 'def Switch(a) : ' )
145 PySwitchEven.append( ' if ( a & 1 ) == 0 : ' )
146 PySwitchEven.append( ' sleep(1) ' )
147 PySwitchEven.append( ' return a & 1,1-(a&1),a ' )
148 SwitchEven,EndOfSwitchEven = GraphLoopSwitchs.SNode( 'Switch' , PySwitchEven )
149 EndOfSwitchEven.SetName( 'EndOfSwitchEven' )
150 EndOfSwitchEven.SetAuthor( '' )
151 EndOfSwitchEven.SetComment( 'Compute Node' )
152 EndOfSwitchEven.Coords( 718 , 361 )
153 PyEndOfSwitchEven = []
154 EndOfSwitchEven.SetPyFunction( '' , PyEndOfSwitchEven )
155 IEndOfSwitchEvena = EndOfSwitchEven.InPort( 'a' , 'long' )
156 IEndOfSwitchEvenEven = EndOfSwitchEven.InPort( 'Even' , 'boolean' )
157 IEndOfSwitchEvenDefault = EndOfSwitchEven.GetInPort( 'Default' )
158 OEndOfSwitchEvena = EndOfSwitchEven.OutPort( 'a' , 'long' )
159 OEndOfSwitchEvenEven = EndOfSwitchEven.OutPort( 'Even' , 'boolean' )
160 OEndOfSwitchEvenGate = EndOfSwitchEven.GetOutPort( 'Gate' )
161 SwitchEven.SetName( 'SwitchEven' )
162 SwitchEven.SetAuthor( '' )
163 SwitchEven.SetComment( 'Compute Node' )
164 SwitchEven.Coords( 235 , 386 )
165 ISwitchEvena = SwitchEven.InPort( 'a' , 'long' )
166 ISwitchEvenGate = SwitchEven.GetInPort( 'Gate' )
167 OSwitchEvenOdd = SwitchEven.OutPort( 'Odd' , 'long' )
168 OSwitchEvenEven = SwitchEven.OutPort( 'Even' , 'int' )
169 OSwitchEvena = SwitchEven.OutPort( 'a' , 'int' )
170 OSwitchEvenDefault = SwitchEven.GetOutPort( 'Default' )
173 LIsOddaEndOfSwitchOdda = GraphLoopSwitchs.Link( OIsOdda , IEndOfSwitchOdda )
175 LSwitchOddOddIsOddGate = GraphLoopSwitchs.Link( OSwitchOddOdd , IIsOddGate )
177 LSwitchOddOddEndOfSwitchOddOdd = GraphLoopSwitchs.Link( OSwitchOddOdd , IEndOfSwitchOddOdd )
179 LSwitchOddaIsOdda = GraphLoopSwitchs.Link( OSwitchOdda , IIsOdda )
180 LSwitchOddaIsOdda.AddCoord( 1 , 443 , 121 )
181 LSwitchOddaIsOdda.AddCoord( 2 , 443 , 212 )
183 LSwitchOddDefaultEndOfSwitchOddDefault = GraphLoopSwitchs.Link( OSwitchOddDefault , IEndOfSwitchOddDefault )
185 LEndOfSwitchOddaSwitchsCompareaOdd = GraphLoopSwitchs.Link( OEndOfSwitchOdda , ISwitchsCompareaOdd )
187 LEndOfSwitchOddOddSwitchsCompareOdd = GraphLoopSwitchs.Link( OEndOfSwitchOddOdd , ISwitchsCompareOdd )
189 LIsEvenaEndOfSwitchEvena = GraphLoopSwitchs.Link( OIsEvena , IEndOfSwitchEvena )
191 LLoopIndexSwitchEvena = GraphLoopSwitchs.Link( OLoopIndex , ISwitchEvena )
193 LLoopIndexSwitchOdda = GraphLoopSwitchs.Link( OLoopIndex , ISwitchOdda )
195 LLoopMinEndOfLoopMin = GraphLoopSwitchs.Link( OLoopMin , IEndOfLoopMin )
197 LLoopMaxEndOfLoopMax = GraphLoopSwitchs.Link( OLoopMax , IEndOfLoopMax )
199 LSwitchEvenOddIsEvenGate = GraphLoopSwitchs.Link( OSwitchEvenOdd , IIsEvenGate )
201 LSwitchEvenEvenEndOfSwitchEvenDefault = GraphLoopSwitchs.Link( OSwitchEvenEven , IEndOfSwitchEvenDefault )
203 LSwitchEvenaIsEvena = GraphLoopSwitchs.Link( OSwitchEvena , IIsEvena )
204 LSwitchEvenaIsEvena.AddCoord( 1 , 434 , 382 )
205 LSwitchEvenaIsEvena.AddCoord( 2 , 434 , 457 )
207 LEndOfSwitchEvenaSwitchsCompareaEven = GraphLoopSwitchs.Link( OEndOfSwitchEvena , ISwitchsCompareaEven )
209 LEndOfSwitchEvenEvenSwitchsCompareEven = GraphLoopSwitchs.Link( OEndOfSwitchEvenEven , ISwitchsCompareEven )
211 LSwitchsCompareaEndOfLoopIndex = GraphLoopSwitchs.Link( OSwitchsComparea , IEndOfLoopIndex )
214 ILoopIndex.Input( 0 )
216 ILoopMax.Input( 100 )
218 # Output Ports of the graph
219 #OSwitchOddEven = SwitchOdd.GetOutPort( 'Even' )
220 #OEndOfLoopIndex = EndOfLoop.GetOutPort( 'Index' )
221 #OEndOfLoopMin = EndOfLoop.GetOutPort( 'Min' )
222 #OEndOfLoopMax = EndOfLoop.GetOutPort( 'Max' )
223 return GraphLoopSwitchs
226 GraphLoopSwitchs = DefGraphLoopSwitchs()