Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphSwitchCrash.py
1
2 # Generated python file of Graph GraphSwitchCrash_1
3
4 from SuperV import *
5
6 # Graph creation of GraphSwitchCrash_1
7 def DefGraphSwitchCrash_1() :
8     GraphSwitchCrash_1 = Graph( 'GraphSwitchCrash_1' )
9     GraphSwitchCrash_1.SetName( 'GraphSwitchCrash_1' )
10     GraphSwitchCrash_1.SetAuthor( '' )
11     GraphSwitchCrash_1.SetComment( '' )
12     GraphSwitchCrash_1.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 (IsOdd)"      ' )
21     PyIsOdd.append( '    sleep( 1 )   ' )
22     PyIsOdd.append( '    return a     ' )
23     IsOdd = GraphSwitchCrash_1.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 387 , 58 )
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,Even) :        ' )
36     PyIsOdd_1.append( '    print a,"IsOdd (IsOdd_1)"       ' )
37     PyIsOdd_1.append( '    sleep( 1 )    ' )
38     PyIsOdd_1.append( '    return a      ' )
39     IsOdd_1 = GraphSwitchCrash_1.INode( 'IsOdd' , PyIsOdd_1 )
40     IsOdd_1.SetName( 'IsOdd_1' )
41     IsOdd_1.SetAuthor( '' )
42     IsOdd_1.SetComment( 'Python function' )
43     IsOdd_1.Coords( 417 , 287 )
44     IIsOdd_1a = IsOdd_1.InPort( 'a' , 'long' )
45     IIsOdd_1Even = IsOdd_1.InPort( 'Even' , 'boolean' )
46     IIsOdd_1Gate = IsOdd_1.GetInPort( 'Gate' )
47     OIsOdd_1a = IsOdd_1.OutPort( 'a' , 'long' )
48     OIsOdd_1Gate = IsOdd_1.GetOutPort( 'Gate' )
49     
50     # Creation of Loop Nodes
51     PyInitLoopSwitch = []
52     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :      ' )
53     PyInitLoopSwitch.append( '  return Index,Min,Max     ' )
54     PyMoreInitLoopSwitch = []
55     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :     ' )
56     PyMoreInitLoopSwitch.append( '      if Index <= Max :   ' )
57     PyMoreInitLoopSwitch.append( '              DoLoop = 1     ' )
58     PyMoreInitLoopSwitch.append( '      else :     ' )
59     PyMoreInitLoopSwitch.append( '              DoLoop = 0     ' )
60     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max     ' )
61     PyNextInitLoopSwitch = []
62     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :     ' )
63     PyNextInitLoopSwitch.append( '      Index = Index + 1     ' )
64     PyNextInitLoopSwitch.append( '      return Index,Min,Max     ' )
65     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCrash_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
66     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
67     EndOfInitLoopSwitch.SetAuthor( '' )
68     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
69     EndOfInitLoopSwitch.Coords( 766 , 127 )
70     PyEndOfInitLoopSwitch = []
71     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
72     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
73     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
74     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
75     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
76     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
77     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
78     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
79     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
80     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
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 = GraphSwitchCrash_1.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     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
127     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
128     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
129     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
130     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
131     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
132     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
133     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
134     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
135     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
136     InitLoop.SetName( 'InitLoop' )
137     InitLoop.SetAuthor( '' )
138     InitLoop.SetComment( 'Compute Node' )
139     InitLoop.Coords( 10 , 388 )
140     
141     # Creation of Switch Nodes
142     PySwitch = []
143     PySwitch.append( 'from time import * ' )
144     PySwitch.append( 'def Switch(a) :   ' )
145     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
146     PySwitch.append( '        sleep(1)    ' )
147     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
148     Switch,EndOfSwitch = GraphSwitchCrash_1.SNode( 'Switch' , PySwitch )
149     EndOfSwitch.SetName( 'EndOfSwitch' )
150     EndOfSwitch.SetAuthor( '' )
151     EndOfSwitch.SetComment( 'Compute Node' )
152     EndOfSwitch.Coords( 587 , 126 )
153     PyEndOfSwitch = []
154     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
155     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
156     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
157     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
158     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
159     Switch.SetName( 'Switch' )
160     Switch.SetAuthor( '' )
161     Switch.SetComment( 'Compute Node' )
162     Switch.Coords( 186 , 130 )
163     ISwitcha = Switch.InPort( 'a' , 'long' )
164     ISwitchGate = Switch.GetInPort( 'Gate' )
165     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
166     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
167     OSwitcha = Switch.OutPort( 'a' , 'int' )
168     OSwitchDefault = Switch.GetOutPort( 'Default' )
169     
170     PySwitch_1 = []
171     PySwitch_1.append( 'from time import *  ' )
172     PySwitch_1.append( 'def Switch(a) :    ' )
173     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
174     PySwitch_1.append( '        sleep(1)  ' )
175     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
176     Switch_1,EndSwitch = GraphSwitchCrash_1.SNode( 'Switch' , PySwitch_1 )
177     EndSwitch.SetName( 'EndSwitch' )
178     EndSwitch.SetAuthor( '' )
179     EndSwitch.SetComment( 'Compute Node' )
180     EndSwitch.Coords( 605 , 382 )
181     PyEndSwitch = []
182     EndSwitch.SetPyFunction( '' , PyEndSwitch )
183     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
184     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
185     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
186     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
187     Switch_1.SetName( 'Switch_1' )
188     Switch_1.SetAuthor( '' )
189     Switch_1.SetComment( 'Compute Node' )
190     Switch_1.Coords( 193 , 388 )
191     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
192     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
193     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
194     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
195     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
196     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
197     
198     # Creation of Links
199     LIsOddaEndOfSwitcha = GraphSwitchCrash_1.Link( OIsOdda , IEndOfSwitcha )
200     LIsOddaEndOfSwitcha.AddCoord( 1 , 572 , 157 )
201     LIsOddaEndOfSwitcha.AddCoord( 2 , 572 , 130 )
202     
203     LInitLoopSwitchIndexSwitcha = GraphSwitchCrash_1.Link( OInitLoopSwitchIndex , ISwitcha )
204     
205     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCrash_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
206     
207     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCrash_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
208     
209     LSwitchOddIsOddGate = GraphSwitchCrash_1.Link( OSwitchOdd , IIsOddGate )
210     
211     LSwitchaIsOdda = GraphSwitchCrash_1.Link( OSwitcha , IIsOdda )
212     LSwitchaIsOdda.AddCoord( 1 , 365 , 129 )
213     LSwitchaIsOdda.AddCoord( 2 , 365 , 201 )
214     
215     LSwitchDefaultEndOfSwitchDefault = GraphSwitchCrash_1.Link( OSwitchDefault , IEndOfSwitchDefault )
216     
217     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCrash_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
218     
219     LIsOdd_1aEndSwitcha = GraphSwitchCrash_1.Link( OIsOdd_1a , IEndSwitcha )
220     LIsOdd_1aEndSwitcha.AddCoord( 1 , 593 , 411 )
221     LIsOdd_1aEndSwitcha.AddCoord( 2 , 593 , 358 )
222     
223     LInitLoopIndexSwitch_1a = GraphSwitchCrash_1.Link( OInitLoopIndex , ISwitch_1a )
224     
225     LInitLoopMinEndOfInitLoopMin = GraphSwitchCrash_1.Link( OInitLoopMin , IEndOfInitLoopMin )
226     
227     LInitLoopMaxEndOfInitLoopMax = GraphSwitchCrash_1.Link( OInitLoopMax , IEndOfInitLoopMax )
228     
229     LSwitch_1OddIsOdd_1Gate = GraphSwitchCrash_1.Link( OSwitch_1Odd , IIsOdd_1Gate )
230     
231     LSwitch_1EvenIsOdd_1Even = GraphSwitchCrash_1.Link( OSwitch_1Even , IIsOdd_1Even )
232     
233     LSwitch_1aIsOdd_1a = GraphSwitchCrash_1.Link( OSwitch_1a , IIsOdd_1a )
234     LSwitch_1aIsOdd_1a.AddCoord( 1 , 377 , 358 )
235     LSwitch_1aIsOdd_1a.AddCoord( 2 , 377 , 460 )
236     
237     LSwitch_1DefaultEndSwitchDefault = GraphSwitchCrash_1.Link( OSwitch_1Default , IEndSwitchDefault )
238     
239     LEndSwitchaEndOfInitLoopIndex = GraphSwitchCrash_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
240     
241     # Input datas
242     IInitLoopSwitchIndex.Input( 0 )
243     IInitLoopSwitchMin.Input( 0 )
244     IInitLoopSwitchMax.Input( 23 )
245     IInitLoopIndex.Input( 0 )
246     IInitLoopMin.Input( 0 )
247     IInitLoopMax.Input( 31 )
248     
249     # Output Ports of the graph
250     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
251     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
252     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
253     #OSwitchEven = Switch.GetOutPort( 'Even' )
254     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
255     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
256     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
257     return GraphSwitchCrash_1
258
259
260 GraphSwitchCrash_1 = DefGraphSwitchCrash_1()