2 # Generated python file of Graph GraphInputInLoop_2
6 # Graph creation of GraphInputInLoop_2
7 def DefGraphInputInLoop_2() :
8 GraphInputInLoop_2 = Graph( 'GraphInputInLoop_2' )
9 GraphInputInLoop_2.SetName( 'GraphInputInLoop_2' )
10 GraphInputInLoop_2.SetAuthor( '' )
11 GraphInputInLoop_2.SetComment( '' )
12 GraphInputInLoop_2.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,Even,Const) : ' )
20 PyIsOdd.append( ' print 'IsOdd',a,Even,Const ' )
21 PyIsOdd.append( ' sleep( 1 ) ' )
22 PyIsOdd.append( ' return a,Const ' )
23 IsOdd = GraphInputInLoop_2.INode( 'IsOdd' , PyIsOdd )
24 IsOdd.SetName( 'IsOdd' )
26 IsOdd.SetComment( 'Python function' )
27 IsOdd.Coords( 397 , 1 )
28 IIsOdda = IsOdd.InPort( 'a' , 'long' )
29 IIsOddEven = IsOdd.InPort( 'Even' , 'boolean' )
30 IIsOddConst = IsOdd.InPort( 'Const' , 'string' )
31 IIsOddGate = IsOdd.GetInPort( 'Gate' )
32 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
33 OIsOddConst = IsOdd.OutPort( 'Const' , 'string' )
34 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
36 # Creation of Loop Nodes
39 PyMoreInitLoop.append( '' )
41 PyNextInitLoop.append( '' )
42 InitLoop,EndOfInitLoop = GraphInputInLoop_2.LNode( '' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
43 EndOfInitLoop.SetName( 'EndOfInitLoop' )
44 EndOfInitLoop.SetAuthor( '' )
45 EndOfInitLoop.SetComment( 'Compute Node' )
46 EndOfInitLoop.Coords( 767 , 105 )
48 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
49 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
50 PyEndOfInitLoop.append( ' if Index <= Max : ' )
51 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
52 PyEndOfInitLoop.append( ' else : ' )
53 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
54 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max ' )
55 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
56 IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
57 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
58 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
59 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
60 IInitLoopGate = InitLoop.GetInPort( 'Gate' )
61 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
62 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
63 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
64 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
65 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
66 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
67 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
68 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
69 IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
70 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
71 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
72 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
73 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
74 OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
75 InitLoop.SetName( 'InitLoop' )
76 InitLoop.SetAuthor( '' )
77 InitLoop.SetComment( 'Compute Node' )
78 InitLoop.Coords( 10 , 108 )
80 # Creation of Switch Nodes
82 PySwitch.append( 'from time import * ' )
83 PySwitch.append( 'def Switch(a) : ' )
84 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
85 PySwitch.append( ' sleep(1) ' )
86 PySwitch.append( ' return a & 1,1-(a&1),a ' )
87 Switch,EndSwitch = GraphInputInLoop_2.SNode( 'Switch' , PySwitch )
88 EndSwitch.SetName( 'EndSwitch' )
89 EndSwitch.SetAuthor( '' )
90 EndSwitch.SetComment( 'Compute Node' )
91 EndSwitch.Coords( 587 , 105 )
93 PyEndSwitch.append( 'def EndSwitch(a) : ' )
94 PyEndSwitch.append( ' if ( a & 1 ) == 0 : ' )
95 PyEndSwitch.append( ' sleep(1) ' )
96 PyEndSwitch.append( ' return a ' )
97 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
98 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
99 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
100 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
101 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
102 Switch.SetName( 'Switch' )
103 Switch.SetAuthor( '' )
104 Switch.SetComment( 'Compute Node' )
105 Switch.Coords( 194 , 109 )
106 ISwitcha = Switch.InPort( 'a' , 'long' )
107 ISwitchGate = Switch.GetInPort( 'Gate' )
108 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
109 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
110 OSwitcha = Switch.OutPort( 'a' , 'int' )
111 OSwitchDefault = Switch.GetOutPort( 'Default' )
114 LIsOddaEndSwitcha = GraphInputInLoop_2.Link( OIsOdda , IEndSwitcha )
115 LIsOddaEndSwitcha.AddCoord( 1 , 576 , 136 )
116 LIsOddaEndSwitcha.AddCoord( 2 , 576 , 73 )
118 LInitLoopIndexSwitcha = GraphInputInLoop_2.Link( OInitLoopIndex , ISwitcha )
120 LInitLoopMinEndOfInitLoopMin = GraphInputInLoop_2.Link( OInitLoopMin , IEndOfInitLoopMin )
122 LInitLoopMaxEndOfInitLoopMax = GraphInputInLoop_2.Link( OInitLoopMax , IEndOfInitLoopMax )
124 LSwitchOddIsOddGate = GraphInputInLoop_2.Link( OSwitchOdd , IIsOddGate )
126 LSwitchEvenEndSwitchDefault = GraphInputInLoop_2.Link( OSwitchEven , IEndSwitchDefault )
128 LSwitchEvenIsOddEven = GraphInputInLoop_2.Link( OSwitchEven , IIsOddEven )
129 LSwitchEvenIsOddEven.AddCoord( 1 , 375 , 92 )
130 LSwitchEvenIsOddEven.AddCoord( 2 , 375 , 159 )
132 LSwitchaIsOdda = GraphInputInLoop_2.Link( OSwitcha , IIsOdda )
133 LSwitchaIsOdda.AddCoord( 1 , 366 , 71 )
134 LSwitchaIsOdda.AddCoord( 2 , 366 , 182 )
136 LEndSwitchaEndOfInitLoopIndex = GraphInputInLoop_2.Link( OEndSwitcha , IEndOfInitLoopIndex )
139 IIsOddConst.Input( 'Const Input Value' )
140 IInitLoopIndex.Input( 0 )
141 IInitLoopMin.Input( 0 )
142 IInitLoopMax.Input( 100 )
144 # Output Ports of the graph
145 #OIsOddConst = IsOdd.GetOutPort( 'Const' )
146 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
147 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
148 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
149 return GraphInputInLoop_2
152 GraphInputInLoop_2 = DefGraphInputInLoop_2()