2 # Generated python file of Graph GraphSwitchGatesNoDefaultAborted
6 # Graph creation of GraphSwitchGatesNoDefaultAborted
7 def DefGraphSwitchGatesNoDefaultAborted() :
8 GraphSwitchGatesNoDefaultAborted = Graph( 'GraphSwitchGatesNoDefaultAborted' )
9 GraphSwitchGatesNoDefaultAborted.SetName( 'GraphSwitchGatesNoDefaultAborted' )
10 GraphSwitchGatesNoDefaultAborted.SetAuthor( 'JR' )
11 GraphSwitchGatesNoDefaultAborted.SetComment( '' )
12 GraphSwitchGatesNoDefaultAborted.Coords( 0 , 0 )
14 # Creation of Factory Nodes
16 # Creation of InLine Nodes
18 PyIsOdd.append( 'from time import * ' )
19 PyIsOdd.append( 'def IsOdd() : ' )
20 PyIsOdd.append( ' sleep(1) ' )
21 PyIsOdd.append( ' return ' )
22 IsOdd = GraphSwitchGatesNoDefaultAborted.INode( 'IsOdd' , PyIsOdd )
23 IsOdd.SetName( 'IsOdd' )
25 IsOdd.SetComment( 'Compute Node' )
26 IsOdd.Coords( 424 , 116 )
27 IIsOddGate = IsOdd.GetInPort( 'Gate' )
28 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
31 PyIsEven.append( 'from time import * ' )
32 PyIsEven.append( 'def IsEven() : ' )
33 PyIsEven.append( ' sleep(1) ' )
34 PyIsEven.append( ' return ' )
35 IsEven = GraphSwitchGatesNoDefaultAborted.INode( 'IsEven' , PyIsEven )
36 IsEven.SetName( 'IsEven' )
37 IsEven.SetAuthor( '' )
38 IsEven.SetComment( 'Compute Node' )
39 IsEven.Coords( 428 , 345 )
40 IIsEvenGate = IsEven.GetInPort( 'Gate' )
41 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
43 # Creation of Loop Nodes
45 PyLoopGates.append( 'def InitLoop(Index,Max,Min) : ' )
46 PyLoopGates.append( ' Index = Max ' )
47 PyLoopGates.append( ' return Index,Max,Min ' )
49 PyMoreLoopGates.append( 'from time import * ' )
50 PyMoreLoopGates.append( 'def MoreLoop(Index,Max,Min) : ' )
51 PyMoreLoopGates.append( ' sleep(1) ' )
52 PyMoreLoopGates.append( ' DoLoop = 0 ' )
53 PyMoreLoopGates.append( ' if Index >= Min : ' )
54 PyMoreLoopGates.append( ' DoLoop = 1 ' )
55 PyMoreLoopGates.append( ' return DoLoop,Index,Max,Min ' )
57 PyNextLoopGates.append( 'def NextLoop(Index,Max,Min) : ' )
58 PyNextLoopGates.append( ' Index = Index - 1 ' )
59 PyNextLoopGates.append( ' return Index,Max,Min ' )
60 LoopGates,EndLoopGates = GraphSwitchGatesNoDefaultAborted.LNode( 'InitLoop' , PyLoopGates , 'MoreLoop' , PyMoreLoopGates , 'NextLoop' , PyNextLoopGates )
61 EndLoopGates.SetName( 'EndLoopGates' )
62 EndLoopGates.SetAuthor( '' )
63 EndLoopGates.SetComment( 'Compute Node' )
64 EndLoopGates.Coords( 875 , 216 )
66 EndLoopGates.SetPyFunction( 'EndLoopGates' , PyEndLoopGates )
67 ILoopGatesDoLoop = LoopGates.GetInPort( 'DoLoop' )
68 ILoopGatesIndex = LoopGates.InPort( 'Index' , 'long' )
69 ILoopGatesMax = LoopGates.InPort( 'Max' , 'long' )
70 ILoopGatesMin = LoopGates.InPort( 'Min' , 'long' )
71 ILoopGatesGate = LoopGates.GetInPort( 'Gate' )
72 OLoopGatesDoLoop = LoopGates.GetOutPort( 'DoLoop' )
73 OLoopGatesIndex = LoopGates.GetOutPort( 'Index' )
74 OLoopGatesMax = LoopGates.GetOutPort( 'Max' )
75 OLoopGatesMin = LoopGates.GetOutPort( 'Min' )
76 IEndLoopGatesDoLoop = EndLoopGates.GetInPort( 'DoLoop' )
77 IEndLoopGatesIndex = EndLoopGates.GetInPort( 'Index' )
78 IEndLoopGatesMax = EndLoopGates.GetInPort( 'Max' )
79 IEndLoopGatesMin = EndLoopGates.GetInPort( 'Min' )
80 IEndLoopGatesGate = EndLoopGates.GetInPort( 'Gate' )
81 OEndLoopGatesDoLoop = EndLoopGates.GetOutPort( 'DoLoop' )
82 OEndLoopGatesIndex = EndLoopGates.GetOutPort( 'Index' )
83 OEndLoopGatesMax = EndLoopGates.GetOutPort( 'Max' )
84 OEndLoopGatesMin = EndLoopGates.GetOutPort( 'Min' )
85 OEndLoopGatesGate = EndLoopGates.GetOutPort( 'Gate' )
86 LoopGates.SetName( 'LoopGates' )
87 LoopGates.SetAuthor( '' )
88 LoopGates.SetComment( 'Compute Node' )
89 LoopGates.Coords( 13 , 236 )
91 # Creation of Switch Nodes
93 PySwitchGates.append( 'def SwitchGates(Index) : ' )
94 PySwitchGates.append( ' Odd = 0 ' )
95 PySwitchGates.append( ' Even = 0 ' )
96 PySwitchGates.append( ' if Index > 0 : ' )
97 PySwitchGates.append( ' if (Index & 1) == 1 : ' )
98 PySwitchGates.append( ' Odd = 1 ' )
99 PySwitchGates.append( ' if (Index & 1) == 0 : ' )
100 PySwitchGates.append( ' Even = 1 ' )
101 PySwitchGates.append( ' return Odd,Even ' )
102 SwitchGates,EndSwitchGates = GraphSwitchGatesNoDefaultAborted.SNode( 'SwitchGates' , PySwitchGates )
103 EndSwitchGates.SetName( 'EndSwitchGates' )
104 EndSwitchGates.SetAuthor( '' )
105 EndSwitchGates.SetComment( 'Compute Node' )
106 EndSwitchGates.Coords( 648 , 276 )
107 PyEndSwitchGates = []
108 PyEndSwitchGates.append( 'from time import * ' )
109 PyEndSwitchGates.append( 'def EndSwitchGates() : ' )
110 PyEndSwitchGates.append( ' sleep(1) ' )
111 PyEndSwitchGates.append( ' return ' )
112 PyEndSwitchGates.append( '' )
113 EndSwitchGates.SetPyFunction( 'EndSwitchGates' , PyEndSwitchGates )
114 IEndSwitchGatesDefault = EndSwitchGates.GetInPort( 'Default' )
115 OEndSwitchGatesGate = EndSwitchGates.GetOutPort( 'Gate' )
116 SwitchGates.SetName( 'SwitchGates' )
117 SwitchGates.SetAuthor( '' )
118 SwitchGates.SetComment( 'Compute Node' )
119 SwitchGates.Coords( 204 , 236 )
120 ISwitchGatesIndex = SwitchGates.InPort( 'Index' , 'long' )
121 ISwitchGatesGate = SwitchGates.GetInPort( 'Gate' )
122 OSwitchGatesOdd = SwitchGates.OutPort( 'Odd' , 'long' )
123 OSwitchGatesEven = SwitchGates.OutPort( 'Even' , 'long' )
124 OSwitchGatesDefault = SwitchGates.GetOutPort( 'Default' )
127 LLoopGatesIndexEndLoopGatesIndex = GraphSwitchGatesNoDefaultAborted.Link( OLoopGatesIndex , IEndLoopGatesIndex )
129 LLoopGatesIndexSwitchGatesIndex = GraphSwitchGatesNoDefaultAborted.Link( OLoopGatesIndex , ISwitchGatesIndex )
131 LLoopGatesMaxEndLoopGatesMax = GraphSwitchGatesNoDefaultAborted.Link( OLoopGatesMax , IEndLoopGatesMax )
133 LLoopGatesMinEndLoopGatesMin = GraphSwitchGatesNoDefaultAborted.Link( OLoopGatesMin , IEndLoopGatesMin )
135 LSwitchGatesOddIsOddGate = GraphSwitchGatesNoDefaultAborted.Link( OSwitchGatesOdd , IIsOddGate )
137 LSwitchGatesEvenIsEvenGate = GraphSwitchGatesNoDefaultAborted.Link( OSwitchGatesEven , IIsEvenGate )
139 LEndSwitchGatesGateEndLoopGatesGate = GraphSwitchGatesNoDefaultAborted.Link( OEndSwitchGatesGate , IEndLoopGatesGate )
141 LIsOddGateEndSwitchGatesDefault = GraphSwitchGatesNoDefaultAborted.Link( OIsOddGate , IEndSwitchGatesDefault )
143 LIsEvenGateEndSwitchGatesDefault = GraphSwitchGatesNoDefaultAborted.Link( OIsEvenGate , IEndSwitchGatesDefault )
146 ILoopGatesIndex.Input( 0 )
147 ILoopGatesMax.Input( 13 )
148 ILoopGatesMin.Input( -7 )
150 # Output Ports of the graph
151 #OEndLoopGatesIndex = EndLoopGates.GetOutPort( 'Index' )
152 #OEndLoopGatesMax = EndLoopGates.GetOutPort( 'Max' )
153 #OEndLoopGatesMin = EndLoopGates.GetOutPort( 'Min' )
154 return GraphSwitchGatesNoDefaultAborted
157 GraphSwitchGatesNoDefaultAborted = DefGraphSwitchGatesNoDefaultAborted()