2 # Generated python file of Graph GraphLoopSwitch
6 # Graph creation of GraphLoopSwitch
7 def DefGraphLoopSwitch() :
8 GraphLoopSwitch = Graph( 'GraphLoopSwitch' )
9 GraphLoopSwitch.SetName( 'GraphLoopSwitch' )
10 GraphLoopSwitch.SetAuthor( 'JR' )
11 GraphLoopSwitch.SetComment( '' )
12 GraphLoopSwitch.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 (GraphLoopSwitch1)" ' )
21 PyIsOdd.append( ' sleep( 1 ) ' )
22 PyIsOdd.append( ' return a ' )
23 IsOdd = GraphLoopSwitch.INode( 'IsOdd' , PyIsOdd )
24 IsOdd.SetName( 'IsOdd' )
26 IsOdd.SetComment( 'Python function' )
27 IsOdd.Coords( 397 , 1 )
28 IIsOdda = IsOdd.InPort( 'a' , 'long' )
29 IIsOddGate = IsOdd.GetInPort( 'Gate' )
30 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
34 PyValEven.append( 'from time import * ' )
35 PyValEven.append( 'def ValEven(Even) : ' )
36 PyValEven.append( ' sleep(1) ' )
37 PyValEven.append( ' return Even ' )
38 PyValEven.append( '' )
39 ValEven = GraphLoopSwitch.INode( 'ValEven' , PyValEven )
40 ValEven.SetName( 'ValEven' )
41 ValEven.SetAuthor( '' )
42 ValEven.SetComment( 'Compute Node' )
43 ValEven.Coords( 396 , 222 )
44 IValEvenEven = ValEven.InPort( 'Even' , 'long' )
45 IValEvenGate = ValEven.GetInPort( 'Gate' )
46 OValEvenEven = ValEven.OutPort( 'Even' , 'long' )
47 OValEvenGate = ValEven.GetOutPort( 'Gate' )
49 # Creation of Loop Nodes
51 PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
52 PyInitLoop.append( ' Index = Min ' )
53 PyInitLoop.append( ' return Index,Min,Max ' )
54 PyInitLoop.append( '' )
56 PyMoreInitLoop.append( '' )
58 PyNextInitLoop.append( '' )
59 InitLoop,EndOfInitLoop = GraphLoopSwitch.LNode( 'InitLoop' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
60 EndOfInitLoop.SetName( 'EndOfInitLoop' )
61 EndOfInitLoop.SetAuthor( '' )
62 EndOfInitLoop.SetComment( 'Compute Node' )
63 EndOfInitLoop.Coords( 767 , 102 )
65 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
66 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
67 PyEndOfInitLoop.append( ' if Index <= Max : ' )
68 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
69 PyEndOfInitLoop.append( ' else : ' )
70 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
71 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max ' )
72 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
73 IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
74 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
75 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
76 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
77 IInitLoopGate = InitLoop.GetInPort( 'Gate' )
78 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
79 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
80 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
81 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
82 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
83 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
84 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
85 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
86 IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
87 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
88 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
89 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
90 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
91 OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
92 InitLoop.SetName( 'InitLoop' )
93 InitLoop.SetAuthor( '' )
94 InitLoop.SetComment( 'Compute Node' )
95 InitLoop.Coords( 10 , 108 )
97 # Creation of Switch Nodes
99 PySwitch.append( 'from time import * ' )
100 PySwitch.append( 'def Switch(a) : ' )
101 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
102 PySwitch.append( ' sleep(1) ' )
103 PySwitch.append( ' return a & 1,1-(a&1),a ' )
104 Switch,EndSwitch = GraphLoopSwitch.SNode( 'Switch' , PySwitch )
105 EndSwitch.SetName( 'EndSwitch' )
106 EndSwitch.SetAuthor( '' )
107 EndSwitch.SetComment( 'Compute Node' )
108 EndSwitch.Coords( 587 , 103 )
110 PyEndSwitch.append( 'def EndSwitch(a,Even) : ' )
111 PyEndSwitch.append( ' sleep(1) ' )
112 PyEndSwitch.append( ' return a ' )
113 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
114 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
115 IEndSwitchEven = EndSwitch.InPort( 'Even' , 'long' )
116 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
117 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
118 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
119 Switch.SetName( 'Switch' )
120 Switch.SetAuthor( '' )
121 Switch.SetComment( 'Compute Node' )
122 Switch.Coords( 194 , 109 )
123 ISwitcha = Switch.InPort( 'a' , 'long' )
124 ISwitchGate = Switch.GetInPort( 'Gate' )
125 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
126 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
127 OSwitcha = Switch.OutPort( 'a' , 'int' )
128 OSwitchDefault = Switch.GetOutPort( 'Default' )
131 LIsOddaEndSwitcha = GraphLoopSwitch.Link( OIsOdda , IEndSwitcha )
133 LInitLoopIndexSwitcha = GraphLoopSwitch.Link( OInitLoopIndex , ISwitcha )
135 LInitLoopMinEndOfInitLoopMin = GraphLoopSwitch.Link( OInitLoopMin , IEndOfInitLoopMin )
137 LInitLoopMaxEndOfInitLoopMax = GraphLoopSwitch.Link( OInitLoopMax , IEndOfInitLoopMax )
139 LSwitchOddIsOddGate = GraphLoopSwitch.Link( OSwitchOdd , IIsOddGate )
141 LSwitchEvenValEvenEven = GraphLoopSwitch.Link( OSwitchEven , IValEvenEven )
143 LSwitchaIsOdda = GraphLoopSwitch.Link( OSwitcha , IIsOdda )
145 LSwitchDefaultEndSwitchDefault = GraphLoopSwitch.Link( OSwitchDefault , IEndSwitchDefault )
147 LEndSwitchaEndOfInitLoopIndex = GraphLoopSwitch.Link( OEndSwitcha , IEndOfInitLoopIndex )
149 LValEvenEvenEndSwitchEven = GraphLoopSwitch.Link( OValEvenEven , IEndSwitchEven )
152 IInitLoopIndex.Input( 0 )
153 IInitLoopMin.Input( 5 )
154 IInitLoopMax.Input( 23 )
156 # Output Ports of the graph
157 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
158 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
159 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
160 return GraphLoopSwitch
163 GraphLoopSwitch = DefGraphLoopSwitch()