2 # Generated python file of Graph GraphSwitchGatesdefaultBranch
6 # Graph creation of GraphSwitchGatesdefaultBranch
7 def DefGraphSwitchGatesdefaultBranch() :
8 GraphSwitchGatesdefaultBranch = Graph( 'GraphSwitchGatesdefaultBranch' )
9 GraphSwitchGatesdefaultBranch.SetName( 'GraphSwitchGatesdefaultBranch' )
10 GraphSwitchGatesdefaultBranch.SetAuthor( 'JR' )
11 GraphSwitchGatesdefaultBranch.SetComment( '' )
12 GraphSwitchGatesdefaultBranch.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 = GraphSwitchGatesdefaultBranch.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 = GraphSwitchGatesdefaultBranch.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' )
44 PydefaultNode.append( 'from time import * ' )
45 PydefaultNode.append( 'def defaultNode() : ' )
46 PydefaultNode.append( ' sleep(1) ' )
47 PydefaultNode.append( ' return ' )
48 defaultNode = GraphSwitchGatesdefaultBranch.INode( 'defaultNode' , PydefaultNode )
49 defaultNode.SetName( 'defaultNode' )
50 defaultNode.SetAuthor( '' )
51 defaultNode.SetComment( 'Compute Node' )
52 defaultNode.Coords( 425 , 232 )
53 IdefaultNodeGate = defaultNode.GetInPort( 'Gate' )
54 OdefaultNodeGate = defaultNode.GetOutPort( 'Gate' )
56 # Creation of Loop Nodes
58 PyLoopGates.append( 'def InitLoop(Index,Max,Min) : ' )
59 PyLoopGates.append( ' Index = Max ' )
60 PyLoopGates.append( ' return Index,Max,Min ' )
62 PyMoreLoopGates.append( 'from time import * ' )
63 PyMoreLoopGates.append( 'def MoreLoop(Index,Max,Min) : ' )
64 PyMoreLoopGates.append( ' sleep(1) ' )
65 PyMoreLoopGates.append( ' DoLoop = 0 ' )
66 PyMoreLoopGates.append( ' if Index >= Min : ' )
67 PyMoreLoopGates.append( ' DoLoop = 1 ' )
68 PyMoreLoopGates.append( ' return DoLoop,Index,Max,Min ' )
70 PyNextLoopGates.append( 'def NextLoop(Index,Max,Min) : ' )
71 PyNextLoopGates.append( ' Index = Index - 1 ' )
72 PyNextLoopGates.append( ' return Index,Max,Min ' )
73 LoopGates,EndLoopGates = GraphSwitchGatesdefaultBranch.LNode( 'InitLoop' , PyLoopGates , 'MoreLoop' , PyMoreLoopGates , 'NextLoop' , PyNextLoopGates )
74 EndLoopGates.SetName( 'EndLoopGates' )
75 EndLoopGates.SetAuthor( '' )
76 EndLoopGates.SetComment( 'Compute Node' )
77 EndLoopGates.Coords( 875 , 216 )
79 EndLoopGates.SetPyFunction( 'EndLoopGates' , PyEndLoopGates )
80 ILoopGatesDoLoop = LoopGates.GetInPort( 'DoLoop' )
81 ILoopGatesIndex = LoopGates.InPort( 'Index' , 'long' )
82 ILoopGatesMax = LoopGates.InPort( 'Max' , 'long' )
83 ILoopGatesMin = LoopGates.InPort( 'Min' , 'long' )
84 ILoopGatesGate = LoopGates.GetInPort( 'Gate' )
85 OLoopGatesDoLoop = LoopGates.GetOutPort( 'DoLoop' )
86 OLoopGatesIndex = LoopGates.GetOutPort( 'Index' )
87 OLoopGatesMax = LoopGates.GetOutPort( 'Max' )
88 OLoopGatesMin = LoopGates.GetOutPort( 'Min' )
89 IEndLoopGatesDoLoop = EndLoopGates.GetInPort( 'DoLoop' )
90 IEndLoopGatesIndex = EndLoopGates.GetInPort( 'Index' )
91 IEndLoopGatesMax = EndLoopGates.GetInPort( 'Max' )
92 IEndLoopGatesMin = EndLoopGates.GetInPort( 'Min' )
93 IEndLoopGatesGate = EndLoopGates.GetInPort( 'Gate' )
94 OEndLoopGatesDoLoop = EndLoopGates.GetOutPort( 'DoLoop' )
95 OEndLoopGatesIndex = EndLoopGates.GetOutPort( 'Index' )
96 OEndLoopGatesMax = EndLoopGates.GetOutPort( 'Max' )
97 OEndLoopGatesMin = EndLoopGates.GetOutPort( 'Min' )
98 OEndLoopGatesGate = EndLoopGates.GetOutPort( 'Gate' )
99 LoopGates.SetName( 'LoopGates' )
100 LoopGates.SetAuthor( '' )
101 LoopGates.SetComment( 'Compute Node' )
102 LoopGates.Coords( 13 , 236 )
104 # Creation of Switch Nodes
106 PySwitchGates.append( 'def SwitchGates(Index) : ' )
107 PySwitchGates.append( ' Odd = 0 ' )
108 PySwitchGates.append( ' Even = 0 ' )
109 PySwitchGates.append( ' default = 0 ' )
110 PySwitchGates.append( ' if Index > 0 : ' )
111 PySwitchGates.append( ' if (Index & 1) == 1 : ' )
112 PySwitchGates.append( ' Odd = 1 ' )
113 PySwitchGates.append( ' if (Index & 1) == 0 : ' )
114 PySwitchGates.append( ' Even = 1 ' )
115 PySwitchGates.append( ' else : ' )
116 PySwitchGates.append( ' default = 1 ' )
117 PySwitchGates.append( ' return Odd,Even,default ' )
118 SwitchGates,EndSwitchGates = GraphSwitchGatesdefaultBranch.SNode( 'SwitchGates' , PySwitchGates )
119 EndSwitchGates.SetName( 'EndSwitchGates' )
120 EndSwitchGates.SetAuthor( '' )
121 EndSwitchGates.SetComment( 'Compute Node' )
122 EndSwitchGates.Coords( 647 , 272 )
123 PyEndSwitchGates = []
124 PyEndSwitchGates.append( 'from time import * ' )
125 PyEndSwitchGates.append( 'def EndSwitchGates() : ' )
126 PyEndSwitchGates.append( ' sleep(1) ' )
127 PyEndSwitchGates.append( ' return ' )
128 PyEndSwitchGates.append( '' )
129 EndSwitchGates.SetPyFunction( 'EndSwitchGates' , PyEndSwitchGates )
130 IEndSwitchGatesDefault = EndSwitchGates.GetInPort( 'Default' )
131 OEndSwitchGatesGate = EndSwitchGates.GetOutPort( 'Gate' )
132 SwitchGates.SetName( 'SwitchGates' )
133 SwitchGates.SetAuthor( '' )
134 SwitchGates.SetComment( 'Compute Node' )
135 SwitchGates.Coords( 204 , 236 )
136 ISwitchGatesIndex = SwitchGates.InPort( 'Index' , 'long' )
137 ISwitchGatesGate = SwitchGates.GetInPort( 'Gate' )
138 OSwitchGatesOdd = SwitchGates.OutPort( 'Odd' , 'long' )
139 OSwitchGatesEven = SwitchGates.OutPort( 'Even' , 'long' )
140 OSwitchGatesdefault = SwitchGates.OutPort( 'default' , 'long' )
141 OSwitchGatesDefault = SwitchGates.GetOutPort( 'Default' )
144 LLoopGatesIndexEndLoopGatesIndex = GraphSwitchGatesdefaultBranch.Link( OLoopGatesIndex , IEndLoopGatesIndex )
146 LLoopGatesIndexSwitchGatesIndex = GraphSwitchGatesdefaultBranch.Link( OLoopGatesIndex , ISwitchGatesIndex )
148 LLoopGatesMaxEndLoopGatesMax = GraphSwitchGatesdefaultBranch.Link( OLoopGatesMax , IEndLoopGatesMax )
150 LLoopGatesMinEndLoopGatesMin = GraphSwitchGatesdefaultBranch.Link( OLoopGatesMin , IEndLoopGatesMin )
152 LSwitchGatesOddIsOddGate = GraphSwitchGatesdefaultBranch.Link( OSwitchGatesOdd , IIsOddGate )
154 LSwitchGatesEvenIsEvenGate = GraphSwitchGatesdefaultBranch.Link( OSwitchGatesEven , IIsEvenGate )
156 LSwitchGatesdefaultdefaultNodeGate = GraphSwitchGatesdefaultBranch.Link( OSwitchGatesdefault , IdefaultNodeGate )
158 LEndSwitchGatesGateEndLoopGatesGate = GraphSwitchGatesdefaultBranch.Link( OEndSwitchGatesGate , IEndLoopGatesGate )
160 LIsOddGateEndSwitchGatesDefault = GraphSwitchGatesdefaultBranch.Link( OIsOddGate , IEndSwitchGatesDefault )
162 LIsEvenGateEndSwitchGatesDefault = GraphSwitchGatesdefaultBranch.Link( OIsEvenGate , IEndSwitchGatesDefault )
164 LdefaultNodeGateEndSwitchGatesDefault = GraphSwitchGatesdefaultBranch.Link( OdefaultNodeGate , IEndSwitchGatesDefault )
167 ILoopGatesIndex.Input( 0 )
168 ILoopGatesMax.Input( 13 )
169 ILoopGatesMin.Input( -7 )
171 # Output Ports of the graph
172 #OEndLoopGatesIndex = EndLoopGates.GetOutPort( 'Index' )
173 #OEndLoopGatesMax = EndLoopGates.GetOutPort( 'Max' )
174 #OEndLoopGatesMin = EndLoopGates.GetOutPort( 'Min' )
175 return GraphSwitchGatesdefaultBranch
178 GraphSwitchGatesdefaultBranch = DefGraphSwitchGatesdefaultBranch()