Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphSwitchs.py
1
2 # Generated python file of Graph GraphSwitchs
3
4 from SuperV import *
5
6 # Graph creation of GraphSwitchs
7 def DefGraphSwitchs() :
8     GraphSwitchs = Graph( 'GraphSwitchs' )
9     GraphSwitchs.SetName( 'GraphSwitchs' )
10     GraphSwitchs.SetAuthor( '' )
11     GraphSwitchs.SetComment( '' )
12     GraphSwitchs.Coords( 0 , 0 )
13     
14     # Creation of Factory Nodes
15     
16     # Creation of InLine Nodes
17     PyIsOdd = []
18     PyIsOdd.append( 'from time import *   ' )
19     PyIsOdd.append( 'def IsOdd(a) :       ' )
20     PyIsOdd.append( '    print a,"IsOdd (GraphSwitchs)"      ' )
21     PyIsOdd.append( '    sleep( 1 )   ' )
22     PyIsOdd.append( '    return a     ' )
23     IsOdd = GraphSwitchs.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 388 , 50 )
28     IIsOdda = IsOdd.InPort( 'a' , 'long' )
29     IIsOddGate = IsOdd.GetInPort( 'Gate' )
30     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
32     
33     PyIsOdd_1 = []
34     PyIsOdd_1.append( 'from time import *   ' )
35     PyIsOdd_1.append( 'def IsOdd(a) :       ' )
36     PyIsOdd_1.append( '    print a,"IsOdd_1 (GraphSwitchs)"      ' )
37     PyIsOdd_1.append( '    sleep( 1 )   ' )
38     PyIsOdd_1.append( '    return a     ' )
39     IsOdd_1 = GraphSwitchs.INode( 'IsOdd' , PyIsOdd_1 )
40     IsOdd_1.SetName( 'IsOdd_1' )
41     IsOdd_1.SetAuthor( '' )
42     IsOdd_1.SetComment( 'Python function' )
43     IsOdd_1.Coords( 419 , 308 )
44     IIsOdd_1a = IsOdd_1.InPort( 'a' , 'long' )
45     IIsOdd_1Gate = IsOdd_1.GetInPort( 'Gate' )
46     OIsOdd_1a = IsOdd_1.OutPort( 'a' , 'long' )
47     OIsOdd_1Gate = IsOdd_1.GetOutPort( 'Gate' )
48     
49     # Creation of Loop Nodes
50     PyInitLoopSwitch = []
51     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :      ' )
52     PyInitLoopSwitch.append( '  return Index,Min,Max     ' )
53     PyMoreInitLoopSwitch = []
54     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :     ' )
55     PyMoreInitLoopSwitch.append( '      if Index <= Max :   ' )
56     PyMoreInitLoopSwitch.append( '              DoLoop = 1     ' )
57     PyMoreInitLoopSwitch.append( '      else :     ' )
58     PyMoreInitLoopSwitch.append( '              DoLoop = 0     ' )
59     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max     ' )
60     PyNextInitLoopSwitch = []
61     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :     ' )
62     PyNextInitLoopSwitch.append( '      Index = Index + 1     ' )
63     PyNextInitLoopSwitch.append( '      return Index,Min,Max     ' )
64     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchs.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
65     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
66     EndOfInitLoopSwitch.SetAuthor( '' )
67     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
68     EndOfInitLoopSwitch.Coords( 766 , 127 )
69     PyEndOfInitLoopSwitch = []
70     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
71     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
72     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
73     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
74     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
75     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
76     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
77     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
78     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
79     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
80     OInitLoopSwitchGate = InitLoopSwitch.GetOutPort( 'Gate' )
81     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
82     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
83     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
84     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
85     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
86     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
87     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
88     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
89     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
90     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
91     InitLoopSwitch.SetName( 'InitLoopSwitch' )
92     InitLoopSwitch.SetAuthor( '' )
93     InitLoopSwitch.SetComment( 'Compute Node' )
94     InitLoopSwitch.Coords( 10 , 129 )
95     
96     PyInitLoop = []
97     PyInitLoop.append( 'def InitLoop(Index,Min,Max) :      ' )
98     PyInitLoop.append( '        return Index,Min,Max     ' )
99     PyMoreInitLoop = []
100     PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) :     ' )
101     PyMoreInitLoop.append( '    if Index <= Max :   ' )
102     PyMoreInitLoop.append( '            DoLoop = 1     ' )
103     PyMoreInitLoop.append( '    else :     ' )
104     PyMoreInitLoop.append( '            DoLoop = 0     ' )
105     PyMoreInitLoop.append( '    return DoLoop,Index,Min,Max     ' )
106     PyNextInitLoop = []
107     PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) :     ' )
108     PyNextInitLoop.append( '    Index = Index + 1     ' )
109     PyNextInitLoop.append( '    return Index,Min,Max     ' )
110     InitLoop,EndOfInitLoop = GraphSwitchs.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
111     EndOfInitLoop.SetName( 'EndOfInitLoop' )
112     EndOfInitLoop.SetAuthor( '' )
113     EndOfInitLoop.SetComment( 'Compute Node' )
114     EndOfInitLoop.Coords( 783 , 381 )
115     PyEndOfInitLoop = []
116     EndOfInitLoop.SetPyFunction( '' , PyEndOfInitLoop )
117     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
118     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
119     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
120     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
121     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
122     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
123     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
124     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
125     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
126     OInitLoopGate = InitLoop.GetOutPort( 'Gate' )
127     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
128     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
129     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
130     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
131     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
132     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
133     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
134     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
135     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
136     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
137     InitLoop.SetName( 'InitLoop' )
138     InitLoop.SetAuthor( '' )
139     InitLoop.SetComment( 'Compute Node' )
140     InitLoop.Coords( 10 , 388 )
141     
142     # Creation of Switch Nodes
143     PySwitch = []
144     PySwitch.append( 'from time import * ' )
145     PySwitch.append( 'def Switch(a) :   ' )
146     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
147     PySwitch.append( '        sleep(1)    ' )
148     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
149     Switch,EndOfSwitch = GraphSwitchs.SNode( 'Switch' , PySwitch )
150     EndOfSwitch.SetName( 'EndOfSwitch' )
151     EndOfSwitch.SetAuthor( '' )
152     EndOfSwitch.SetComment( 'Compute Node' )
153     EndOfSwitch.Coords( 587 , 126 )
154     PyEndOfSwitch = []
155     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
156     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
157     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
158     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
159     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
160     Switch.SetName( 'Switch' )
161     Switch.SetAuthor( '' )
162     Switch.SetComment( 'Compute Node' )
163     Switch.Coords( 186 , 130 )
164     ISwitcha = Switch.InPort( 'a' , 'long' )
165     ISwitchGate = Switch.GetInPort( 'Gate' )
166     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
167     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
168     OSwitcha = Switch.OutPort( 'a' , 'int' )
169     OSwitchDefault = Switch.GetOutPort( 'Default' )
170     
171     PySwitch_1 = []
172     PySwitch_1.append( 'from time import *  ' )
173     PySwitch_1.append( 'def Switch(a) :    ' )
174     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
175     PySwitch_1.append( '        sleep(1)  ' )
176     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
177     Switch_1,EndSwitch = GraphSwitchs.SNode( 'Switch' , PySwitch_1 )
178     EndSwitch.SetName( 'EndSwitch' )
179     EndSwitch.SetAuthor( '' )
180     EndSwitch.SetComment( 'Compute Node' )
181     EndSwitch.Coords( 605 , 382 )
182     PyEndSwitch = []
183     EndSwitch.SetPyFunction( '' , PyEndSwitch )
184     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
185     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
186     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
187     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
188     Switch_1.SetName( 'Switch_1' )
189     Switch_1.SetAuthor( '' )
190     Switch_1.SetComment( 'Compute Node' )
191     Switch_1.Coords( 193 , 388 )
192     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
193     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
194     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
195     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
196     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
197     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
198     
199     # Creation of Links
200     LIsOddaEndOfSwitcha = GraphSwitchs.Link( OIsOdda , IEndOfSwitcha )
201     LIsOddaEndOfSwitcha.AddCoord( 1 , 573 , 160 )
202     LIsOddaEndOfSwitcha.AddCoord( 2 , 572 , 130 )
203     
204     LInitLoopSwitchIndexSwitcha = GraphSwitchs.Link( OInitLoopSwitchIndex , ISwitcha )
205     
206     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchs.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
207     
208     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchs.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
209     
210     LSwitchOddIsOddGate = GraphSwitchs.Link( OSwitchOdd , IIsOddGate )
211     
212     LSwitchaIsOdda = GraphSwitchs.Link( OSwitcha , IIsOdda )
213     LSwitchaIsOdda.AddCoord( 1 , 365 , 129 )
214     LSwitchaIsOdda.AddCoord( 2 , 365 , 222 )
215     
216     LSwitchDefaultEndOfSwitchDefault = GraphSwitchs.Link( OSwitchDefault , IEndOfSwitchDefault )
217     LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 572 , 194 )
218     LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 571 , 257 )
219     
220     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchs.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
221     
222     LIsOdd_1aEndSwitcha = GraphSwitchs.Link( OIsOdd_1a , IEndSwitcha )
223     LIsOdd_1aEndSwitcha.AddCoord( 1 , 599 , 416 )
224     LIsOdd_1aEndSwitcha.AddCoord( 2 , 598 , 389 )
225     
226     LInitLoopIndexSwitch_1a = GraphSwitchs.Link( OInitLoopIndex , ISwitch_1a )
227     
228     LInitLoopMinEndOfInitLoopMin = GraphSwitchs.Link( OInitLoopMin , IEndOfInitLoopMin )
229     
230     LInitLoopMaxEndOfInitLoopMax = GraphSwitchs.Link( OInitLoopMax , IEndOfInitLoopMax )
231     
232     LSwitch_1OddIsOdd_1Gate = GraphSwitchs.Link( OSwitch_1Odd , IIsOdd_1Gate )
233     
234     LSwitch_1EvenEndSwitchDefault = GraphSwitchs.Link( OSwitch_1Even , IEndSwitchDefault )
235     
236     LSwitch_1aIsOdd_1a = GraphSwitchs.Link( OSwitch_1a , IIsOdd_1a )
237     LSwitch_1aIsOdd_1a.AddCoord( 1 , 379 , 387 )
238     LSwitch_1aIsOdd_1a.AddCoord( 2 , 378 , 481 )
239     
240     LEndSwitchaEndOfInitLoopIndex = GraphSwitchs.Link( OEndSwitcha , IEndOfInitLoopIndex )
241     
242     # Input datas
243     IInitLoopSwitchIndex.Input( 0 )
244     IInitLoopSwitchMin.Input( 0 )
245     IInitLoopSwitchMax.Input( 20 )
246     IInitLoopIndex.Input( 0 )
247     IInitLoopMin.Input( 0 )
248     IInitLoopMax.Input( 20 )
249     
250     # Output Ports of the graph
251     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
252     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
253     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
254     #OSwitchEven = Switch.GetOutPort( 'Even' )
255     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
256     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
257     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
258     return GraphSwitchs
259
260
261 GraphSwitchs = DefGraphSwitchs()