Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphSwitchCheckDefault2.py
1
2 # Generated python file of Graph GraphSwitchCheckDefault2
3
4 from SuperV import *
5
6 # Graph creation of GraphSwitchCheckDefault2
7 def DefGraphSwitchCheckDefault2() :
8     GraphSwitchCheckDefault2 = Graph( 'GraphSwitchCheckDefault2' )
9     GraphSwitchCheckDefault2.SetName( 'GraphSwitchCheckDefault2' )
10     GraphSwitchCheckDefault2.SetAuthor( 'JR' )
11     GraphSwitchCheckDefault2.SetComment( '' )
12     GraphSwitchCheckDefault2.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 (GraphSwitch)"      ' )
21     PyIsOdd.append( '    sleep( 1 )   ' )
22     PyIsOdd.append( '    return a     ' )
23     IsOdd = GraphSwitchCheckDefault2.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 415 , 7 )
28     IIsOdda = IsOdd.InPort( 'a' , 'long' )
29     IIsOddGate = IsOdd.GetInPort( 'Gate' )
30     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
32     
33     PyIsEven = []
34     PyIsEven.append( 'from time import *    ' )
35     PyIsEven.append( 'def IsEven(a) :        ' )
36     PyIsEven.append( '    print a,"IsEven (GraphSwitch)"       ' )
37     PyIsEven.append( '    sleep( 1 )    ' )
38     PyIsEven.append( '    return a      ' )
39     IsEven = GraphSwitchCheckDefault2.INode( 'IsEven' , PyIsEven )
40     IsEven.SetName( 'IsEven' )
41     IsEven.SetAuthor( '' )
42     IsEven.SetComment( 'Compute Node' )
43     IsEven.Coords( 421 , 438 )
44     IIsEvena = IsEven.InPort( 'a' , 'long' )
45     IIsEvenGate = IsEven.GetInPort( 'Gate' )
46     OIsEvena = IsEven.OutPort( 'a' , 'long' )
47     OIsEvenGate = IsEven.GetOutPort( 'Gate' )
48     
49     PyPrintOdd = []
50     PyPrintOdd.append( 'from time import * ' )
51     PyPrintOdd.append( 'def Print(a,Branch) :     ' )
52     PyPrintOdd.append( '    print "Print ",a,Branch ' )
53     PyPrintOdd.append( '    sleep(1) ' )
54     PyPrintOdd.append( '    return Branch     ' )
55     PrintOdd = GraphSwitchCheckDefault2.INode( 'Print' , PyPrintOdd )
56     PrintOdd.SetName( 'PrintOdd' )
57     PrintOdd.SetAuthor( '' )
58     PrintOdd.SetComment( 'Compute Node' )
59     PrintOdd.Coords( 415 , 130 )
60     IPrintOdda = PrintOdd.InPort( 'a' , 'long' )
61     IPrintOddBranch = PrintOdd.InPort( 'Branch' , 'string' )
62     IPrintOddGate = PrintOdd.GetInPort( 'Gate' )
63     OPrintOddBranch = PrintOdd.OutPort( 'Branch' , 'string' )
64     OPrintOddGate = PrintOdd.GetOutPort( 'Gate' )
65     
66     PyPrintEven = []
67     PyPrintEven.append( 'from time import * ' )
68     PyPrintEven.append( 'def Print_1(a,Branch) :     ' )
69     PyPrintEven.append( '    print "Print ",a,Branch ' )
70     PyPrintEven.append( '    sleep(1) ' )
71     PyPrintEven.append( '    return Branch     ' )
72     PrintEven = GraphSwitchCheckDefault2.INode( 'Print_1' , PyPrintEven )
73     PrintEven.SetName( 'PrintEven' )
74     PrintEven.SetAuthor( '' )
75     PrintEven.SetComment( 'Compute Node' )
76     PrintEven.Coords( 423 , 289 )
77     IPrintEvena = PrintEven.InPort( 'a' , 'long' )
78     IPrintEvenBranch = PrintEven.InPort( 'Branch' , 'string' )
79     IPrintEvenGate = PrintEven.GetInPort( 'Gate' )
80     OPrintEvenBranch = PrintEven.OutPort( 'Branch' , 'string' )
81     OPrintEvenGate = PrintEven.GetOutPort( 'Gate' )
82     
83     PyEmptyNode = []
84     PyEmptyNode.append( 'from time import * ' )
85     PyEmptyNode.append( 'def EmptyNode(a,Branch) : ' )
86     PyEmptyNode.append( '    sleep(1) ' )
87     PyEmptyNode.append( '    return a,Branch  ' )
88     EmptyNode = GraphSwitchCheckDefault2.INode( 'EmptyNode' , PyEmptyNode )
89     EmptyNode.SetName( 'EmptyNode' )
90     EmptyNode.SetAuthor( '' )
91     EmptyNode.SetComment( 'Compute Node' )
92     EmptyNode.Coords( 652 , 110 )
93     IEmptyNodea = EmptyNode.InPort( 'a' , 'long' )
94     IEmptyNodeBranch = EmptyNode.InPort( 'Branch' , 'string' )
95     IEmptyNodeGate = EmptyNode.GetInPort( 'Gate' )
96     OEmptyNodea = EmptyNode.OutPort( 'a' , 'long' )
97     OEmptyNodeBranch = EmptyNode.OutPort( 'Branch' , 'string' )
98     OEmptyNodeGate = EmptyNode.GetOutPort( 'Gate' )
99     
100     PyDefault = []
101     PyDefault.append( 'from time import * ' )
102     PyDefault.append( 'def Default(a,Branch) : ' )
103     PyDefault.append( '    sleep(1) ' )
104     PyDefault.append( '    return a,Branch ' )
105     Default = GraphSwitchCheckDefault2.INode( 'Default' , PyDefault )
106     Default.SetName( 'Default' )
107     Default.SetAuthor( '' )
108     Default.SetComment( 'Compute Node' )
109     Default.Coords( 421 , 592 )
110     IDefaulta = Default.InPort( 'a' , 'long' )
111     IDefaultBranch = Default.InPort( 'Branch' , 'string' )
112     IDefaultGate = Default.GetInPort( 'Gate' )
113     ODefaulta = Default.OutPort( 'a' , 'long' )
114     ODefaultBranch = Default.OutPort( 'Branch' , 'string' )
115     ODefaultGate = Default.GetOutPort( 'Gate' )
116     
117     PyPuta = []
118     PyPuta.append( 'from time import * ' )
119     PyPuta.append( 'def Puta(a) : ' )
120     PyPuta.append( '    sleep(1) ' )
121     PyPuta.append( '    return a ' )
122     Puta = GraphSwitchCheckDefault2.INode( 'Puta' , PyPuta )
123     Puta.SetName( 'Puta' )
124     Puta.SetAuthor( '' )
125     Puta.SetComment( 'Compute Node' )
126     Puta.Coords( 665 , 486 )
127     IPutaa = Puta.InPort( 'a' , 'long' )
128     IPutaGate = Puta.GetInPort( 'Gate' )
129     OPutaa = Puta.OutPort( 'a' , 'long' )
130     OPutaGate = Puta.GetOutPort( 'Gate' )
131     
132     PyPutBranch = []
133     PyPutBranch.append( 'from time import * ' )
134     PyPutBranch.append( 'def PutBranch(Branch) : ' )
135     PyPutBranch.append( '    sleep(1) ' )
136     PyPutBranch.append( '    return Branch ' )
137     PutBranch = GraphSwitchCheckDefault2.INode( 'PutBranch' , PyPutBranch )
138     PutBranch.SetName( 'PutBranch' )
139     PutBranch.SetAuthor( '' )
140     PutBranch.SetComment( 'Compute Node' )
141     PutBranch.Coords( 662 , 613 )
142     IPutBranchBranch = PutBranch.InPort( 'Branch' , 'string' )
143     IPutBranchGate = PutBranch.GetInPort( 'Gate' )
144     OPutBranchBranch = PutBranch.OutPort( 'Branch' , 'string' )
145     OPutBranchGate = PutBranch.GetOutPort( 'Gate' )
146     
147     # Creation of Loop Nodes
148     PyInitLoopSwitch = []
149     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :        ' )
150     PyInitLoopSwitch.append( '  Index = Max  ' )
151     PyInitLoopSwitch.append( '  return Index,Min,Max       ' )
152     PyMoreInitLoopSwitch = []
153     PyMoreInitLoopSwitch.append( 'from time import * ' )
154     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
155     PyMoreInitLoopSwitch.append( '      sleep(1)  ' )
156     PyMoreInitLoopSwitch.append( '      if Index >= Min :     ' )
157     PyMoreInitLoopSwitch.append( '              DoLoop = 1       ' )
158     PyMoreInitLoopSwitch.append( '      else :       ' )
159     PyMoreInitLoopSwitch.append( '              DoLoop = 0       ' )
160     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max       ' )
161     PyNextInitLoopSwitch = []
162     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :       ' )
163     PyNextInitLoopSwitch.append( '      Index = Index - 1       ' )
164     PyNextInitLoopSwitch.append( '      return Index,Min,Max       ' )
165     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckDefault2.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
166     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
167     EndOfInitLoopSwitch.SetAuthor( '' )
168     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
169     EndOfInitLoopSwitch.Coords( 1074 , 194 )
170     PyEndOfInitLoopSwitch = []
171     PyEndOfInitLoopSwitch.append( 'from time import *  ' )
172     PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) :  ' )
173     PyEndOfInitLoopSwitch.append( '    sleep(1)  ' )
174     PyEndOfInitLoopSwitch.append( '    return DoLoop,Index,Min,Max  ' )
175     EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch )
176     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
177     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
178     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
179     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
180     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
181     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
182     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
183     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
184     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
185     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
186     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
187     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
188     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
189     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
190     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
191     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
192     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
193     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
194     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
195     InitLoopSwitch.SetName( 'InitLoopSwitch' )
196     InitLoopSwitch.SetAuthor( '' )
197     InitLoopSwitch.SetComment( 'Compute Node' )
198     InitLoopSwitch.Coords( 10 , 129 )
199     
200     # Creation of Switch Nodes
201     PySwitch = []
202     PySwitch.append( 'from time import *        ' )
203     PySwitch.append( 'def Switch(a) : ' )
204     PySwitch.append( '    sleep(1) ' )
205     PySwitch.append( '    Branch = "Negative or null"    ' )
206     PySwitch.append( '    if a <= 0 :       ' )
207     PySwitch.append( '        return 0,0,a,Branch,1  ' )
208     PySwitch.append( '    if ( a & 1 ) == 0 :    ' )
209     PySwitch.append( '        Branch = "Even"    ' )
210     PySwitch.append( '    else :    ' )
211     PySwitch.append( '        Branch = "Odd"    ' )
212     PySwitch.append( '    return a & 1,1-(a&1),a,Branch,0  ' )
213     Switch,EndOfSwitch = GraphSwitchCheckDefault2.SNode( 'Switch' , PySwitch )
214     EndOfSwitch.SetName( 'EndOfSwitch' )
215     EndOfSwitch.SetAuthor( '' )
216     EndOfSwitch.SetComment( 'Compute Node' )
217     EndOfSwitch.Coords( 882 , 194 )
218     PyEndOfSwitch = []
219     PyEndOfSwitch.append( 'from time import * ' )
220     PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' )
221     PyEndOfSwitch.append( '    sleep(1) ' )
222     PyEndOfSwitch.append( '    return a ' )
223     EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
224     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
225     IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' )
226     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
227     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
228     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
229     Switch.SetName( 'Switch' )
230     Switch.SetAuthor( '' )
231     Switch.SetComment( 'Compute Node' )
232     Switch.Coords( 190 , 129 )
233     ISwitcha = Switch.InPort( 'a' , 'long' )
234     ISwitchGate = Switch.GetInPort( 'Gate' )
235     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
236     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
237     OSwitcha = Switch.OutPort( 'a' , 'int' )
238     OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
239     OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
240     OSwitchDefault = Switch.GetOutPort( 'Default' )
241     
242     # Creation of Links
243     LIsOddaEmptyNodea = GraphSwitchCheckDefault2.Link( OIsOdda , IEmptyNodea )
244     LIsOddaEmptyNodea.AddCoord( 1 , 646 , 78 )
245     
246     LIsEvenaEndOfSwitcha = GraphSwitchCheckDefault2.Link( OIsEvena , IEndOfSwitcha )
247     
248     LPrintOddBranchEmptyNodeBranch = GraphSwitchCheckDefault2.Link( OPrintOddBranch , IEmptyNodeBranch )
249     
250     LPrintEvenBranchEndOfSwitchBranch = GraphSwitchCheckDefault2.Link( OPrintEvenBranch , IEndOfSwitchBranch )
251     
252     LEmptyNodeaEndOfSwitcha = GraphSwitchCheckDefault2.Link( OEmptyNodea , IEndOfSwitcha )
253     
254     LEmptyNodeBranchEndOfSwitchBranch = GraphSwitchCheckDefault2.Link( OEmptyNodeBranch , IEndOfSwitchBranch )
255     
256     LDefaultaPutaa = GraphSwitchCheckDefault2.Link( ODefaulta , IPutaa )
257     
258     LDefaultBranchPutBranchBranch = GraphSwitchCheckDefault2.Link( ODefaultBranch , IPutBranchBranch )
259     
260     LInitLoopSwitchIndexSwitcha = GraphSwitchCheckDefault2.Link( OInitLoopSwitchIndex , ISwitcha )
261     
262     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckDefault2.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
263     
264     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckDefault2.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
265     
266     LSwitchOddIsOddGate = GraphSwitchCheckDefault2.Link( OSwitchOdd , IIsOddGate )
267     LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 )
268     LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 )
269     
270     LSwitchOddPrintOddGate = GraphSwitchCheckDefault2.Link( OSwitchOdd , IPrintOddGate )
271     LSwitchOddPrintOddGate.AddCoord( 1 , 401 , 245 )
272     LSwitchOddPrintOddGate.AddCoord( 2 , 401 , 159 )
273     
274     LSwitchEvenIsEvenGate = GraphSwitchCheckDefault2.Link( OSwitchEven , IIsEvenGate )
275     LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 )
276     LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 )
277     
278     LSwitchEvenPrintEvenGate = GraphSwitchCheckDefault2.Link( OSwitchEven , IPrintEvenGate )
279     LSwitchEvenPrintEvenGate.AddCoord( 1 , 392 , 403 )
280     LSwitchEvenPrintEvenGate.AddCoord( 2 , 392 , 181 )
281     
282     LSwitchaIsOdda = GraphSwitchCheckDefault2.Link( OSwitcha , IIsOdda )
283     LSwitchaIsOdda.AddCoord( 1 , 382 , 78 )
284     LSwitchaIsOdda.AddCoord( 2 , 382 , 199 )
285     
286     LSwitchaIsEvena = GraphSwitchCheckDefault2.Link( OSwitcha , IIsEvena )
287     LSwitchaIsEvena.AddCoord( 1 , 381 , 509 )
288     LSwitchaIsEvena.AddCoord( 2 , 382 , 200 )
289     
290     LSwitchaPrintOdda = GraphSwitchCheckDefault2.Link( OSwitcha , IPrintOdda )
291     
292     LSwitchaPrintEvena = GraphSwitchCheckDefault2.Link( OSwitcha , IPrintEvena )
293     LSwitchaPrintEvena.AddCoord( 1 , 381 , 361 )
294     LSwitchaPrintEvena.AddCoord( 2 , 382 , 200 )
295     
296     LSwitchaDefaulta = GraphSwitchCheckDefault2.Link( OSwitcha , IDefaulta )
297     LSwitchaDefaulta.AddCoord( 1 , 382 , 663 )
298     LSwitchaDefaulta.AddCoord( 2 , 382 , 199 )
299     
300     LSwitchBranchPrintOddBranch = GraphSwitchCheckDefault2.Link( OSwitchBranch , IPrintOddBranch )
301     
302     LSwitchBranchPrintEvenBranch = GraphSwitchCheckDefault2.Link( OSwitchBranch , IPrintEvenBranch )
303     LSwitchBranchPrintEvenBranch.AddCoord( 1 , 369 , 381 )
304     LSwitchBranchPrintEvenBranch.AddCoord( 2 , 369 , 219 )
305     
306     LSwitchBranchDefaultBranch = GraphSwitchCheckDefault2.Link( OSwitchBranch , IDefaultBranch )
307     LSwitchBranchDefaultBranch.AddCoord( 1 , 370 , 683 )
308     LSwitchBranchDefaultBranch.AddCoord( 2 , 370 , 220 )
309     
310     LSwitchdefaultDefaultGate = GraphSwitchCheckDefault2.Link( OSwitchdefault , IDefaultGate )
311     LSwitchdefaultDefaultGate.AddCoord( 1 , 363 , 707 )
312     LSwitchdefaultDefaultGate.AddCoord( 2 , 362 , 239 )
313     
314     LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheckDefault2.Link( OSwitchDefault , IEndOfSwitchDefault )
315     
316     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckDefault2.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
317     
318     LPutaaEndOfSwitcha = GraphSwitchCheckDefault2.Link( OPutaa , IEndOfSwitcha )
319     
320     LPutBranchBranchEndOfSwitchBranch = GraphSwitchCheckDefault2.Link( OPutBranchBranch , IEndOfSwitchBranch )
321     
322     # Input datas
323     IInitLoopSwitchIndex.Input( 0 )
324     IInitLoopSwitchMin.Input( -5 )
325     IInitLoopSwitchMax.Input( 10 )
326     
327     # Output Ports of the graph
328     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
329     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
330     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
331     return GraphSwitchCheckDefault2
332
333
334 GraphSwitchCheckDefault2 = DefGraphSwitchCheckDefault2()