Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/datafiles.git] / Superv / Python / GraphSwitchCrash.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # Generated python file of Graph GraphSwitchCrash_1
23 #
24 from SuperV import *
25
26 # Graph creation of GraphSwitchCrash_1
27 def DefGraphSwitchCrash_1() :
28     GraphSwitchCrash_1 = Graph( 'GraphSwitchCrash_1' )
29     GraphSwitchCrash_1.SetName( 'GraphSwitchCrash_1' )
30     GraphSwitchCrash_1.SetAuthor( '' )
31     GraphSwitchCrash_1.SetComment( '' )
32     GraphSwitchCrash_1.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     # Creation of InLine Nodes
37     PyIsOdd = []
38     PyIsOdd.append( 'from time import *   ' )
39     PyIsOdd.append( 'def IsOdd(a) :       ' )
40     PyIsOdd.append( '    print a,"IsOdd (IsOdd)"      ' )
41     PyIsOdd.append( '    sleep( 1 )   ' )
42     PyIsOdd.append( '    return a     ' )
43     IsOdd = GraphSwitchCrash_1.INode( 'IsOdd' , PyIsOdd )
44     IsOdd.SetName( 'IsOdd' )
45     IsOdd.SetAuthor( '' )
46     IsOdd.SetComment( 'Python function' )
47     IsOdd.Coords( 387 , 58 )
48     IIsOdda = IsOdd.InPort( 'a' , 'long' )
49     IIsOddGate = IsOdd.GetInPort( 'Gate' )
50     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
51     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
52     
53     PyIsOdd_1 = []
54     PyIsOdd_1.append( 'from time import *    ' )
55     PyIsOdd_1.append( 'def IsOdd(a,Even) :        ' )
56     PyIsOdd_1.append( '    print a,"IsOdd (IsOdd_1)"       ' )
57     PyIsOdd_1.append( '    sleep( 1 )    ' )
58     PyIsOdd_1.append( '    return a      ' )
59     IsOdd_1 = GraphSwitchCrash_1.INode( 'IsOdd' , PyIsOdd_1 )
60     IsOdd_1.SetName( 'IsOdd_1' )
61     IsOdd_1.SetAuthor( '' )
62     IsOdd_1.SetComment( 'Python function' )
63     IsOdd_1.Coords( 417 , 287 )
64     IIsOdd_1a = IsOdd_1.InPort( 'a' , 'long' )
65     IIsOdd_1Even = IsOdd_1.InPort( 'Even' , 'boolean' )
66     IIsOdd_1Gate = IsOdd_1.GetInPort( 'Gate' )
67     OIsOdd_1a = IsOdd_1.OutPort( 'a' , 'long' )
68     OIsOdd_1Gate = IsOdd_1.GetOutPort( 'Gate' )
69     
70     # Creation of Loop Nodes
71     PyInitLoopSwitch = []
72     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :      ' )
73     PyInitLoopSwitch.append( '  return Index,Min,Max     ' )
74     PyMoreInitLoopSwitch = []
75     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :     ' )
76     PyMoreInitLoopSwitch.append( '      if Index <= Max :   ' )
77     PyMoreInitLoopSwitch.append( '              DoLoop = 1     ' )
78     PyMoreInitLoopSwitch.append( '      else :     ' )
79     PyMoreInitLoopSwitch.append( '              DoLoop = 0     ' )
80     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max     ' )
81     PyNextInitLoopSwitch = []
82     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :     ' )
83     PyNextInitLoopSwitch.append( '      Index = Index + 1     ' )
84     PyNextInitLoopSwitch.append( '      return Index,Min,Max     ' )
85     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCrash_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
86     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
87     EndOfInitLoopSwitch.SetAuthor( '' )
88     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
89     EndOfInitLoopSwitch.Coords( 766 , 127 )
90     PyEndOfInitLoopSwitch = []
91     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
92     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
93     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
94     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
95     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
96     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
97     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
98     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
99     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
100     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
101     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
102     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
103     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
104     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
105     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
106     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
107     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
108     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
109     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
110     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
111     InitLoopSwitch.SetName( 'InitLoopSwitch' )
112     InitLoopSwitch.SetAuthor( '' )
113     InitLoopSwitch.SetComment( 'Compute Node' )
114     InitLoopSwitch.Coords( 10 , 129 )
115     
116     PyInitLoop = []
117     PyInitLoop.append( 'def InitLoop(Index,Min,Max) :      ' )
118     PyInitLoop.append( '        return Index,Min,Max     ' )
119     PyMoreInitLoop = []
120     PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) :     ' )
121     PyMoreInitLoop.append( '    if Index <= Max :   ' )
122     PyMoreInitLoop.append( '            DoLoop = 1     ' )
123     PyMoreInitLoop.append( '    else :     ' )
124     PyMoreInitLoop.append( '            DoLoop = 0     ' )
125     PyMoreInitLoop.append( '    return DoLoop,Index,Min,Max     ' )
126     PyNextInitLoop = []
127     PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) :     ' )
128     PyNextInitLoop.append( '    Index = Index + 1     ' )
129     PyNextInitLoop.append( '    return Index,Min,Max     ' )
130     InitLoop,EndOfInitLoop = GraphSwitchCrash_1.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
131     EndOfInitLoop.SetName( 'EndOfInitLoop' )
132     EndOfInitLoop.SetAuthor( '' )
133     EndOfInitLoop.SetComment( 'Compute Node' )
134     EndOfInitLoop.Coords( 783 , 381 )
135     PyEndOfInitLoop = []
136     EndOfInitLoop.SetPyFunction( '' , PyEndOfInitLoop )
137     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
138     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
139     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
140     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
141     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
142     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
143     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
144     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
145     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
146     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
147     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
148     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
149     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
150     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
151     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
152     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
153     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
154     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
155     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
156     InitLoop.SetName( 'InitLoop' )
157     InitLoop.SetAuthor( '' )
158     InitLoop.SetComment( 'Compute Node' )
159     InitLoop.Coords( 10 , 388 )
160     
161     # Creation of Switch Nodes
162     PySwitch = []
163     PySwitch.append( 'from time import * ' )
164     PySwitch.append( 'def Switch(a) :   ' )
165     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
166     PySwitch.append( '        sleep(1)    ' )
167     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
168     Switch,EndOfSwitch = GraphSwitchCrash_1.SNode( 'Switch' , PySwitch )
169     EndOfSwitch.SetName( 'EndOfSwitch' )
170     EndOfSwitch.SetAuthor( '' )
171     EndOfSwitch.SetComment( 'Compute Node' )
172     EndOfSwitch.Coords( 587 , 126 )
173     PyEndOfSwitch = []
174     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
175     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
176     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
177     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
178     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
179     Switch.SetName( 'Switch' )
180     Switch.SetAuthor( '' )
181     Switch.SetComment( 'Compute Node' )
182     Switch.Coords( 186 , 130 )
183     ISwitcha = Switch.InPort( 'a' , 'long' )
184     ISwitchGate = Switch.GetInPort( 'Gate' )
185     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
186     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
187     OSwitcha = Switch.OutPort( 'a' , 'int' )
188     OSwitchDefault = Switch.GetOutPort( 'Default' )
189     
190     PySwitch_1 = []
191     PySwitch_1.append( 'from time import *  ' )
192     PySwitch_1.append( 'def Switch(a) :    ' )
193     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
194     PySwitch_1.append( '        sleep(1)  ' )
195     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
196     Switch_1,EndSwitch = GraphSwitchCrash_1.SNode( 'Switch' , PySwitch_1 )
197     EndSwitch.SetName( 'EndSwitch' )
198     EndSwitch.SetAuthor( '' )
199     EndSwitch.SetComment( 'Compute Node' )
200     EndSwitch.Coords( 605 , 382 )
201     PyEndSwitch = []
202     EndSwitch.SetPyFunction( '' , PyEndSwitch )
203     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
204     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
205     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
206     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
207     Switch_1.SetName( 'Switch_1' )
208     Switch_1.SetAuthor( '' )
209     Switch_1.SetComment( 'Compute Node' )
210     Switch_1.Coords( 193 , 388 )
211     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
212     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
213     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
214     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
215     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
216     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
217     
218     # Creation of Links
219     LIsOddaEndOfSwitcha = GraphSwitchCrash_1.Link( OIsOdda , IEndOfSwitcha )
220     LIsOddaEndOfSwitcha.AddCoord( 1 , 572 , 157 )
221     LIsOddaEndOfSwitcha.AddCoord( 2 , 572 , 130 )
222     
223     LInitLoopSwitchIndexSwitcha = GraphSwitchCrash_1.Link( OInitLoopSwitchIndex , ISwitcha )
224     
225     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCrash_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
226     
227     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCrash_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
228     
229     LSwitchOddIsOddGate = GraphSwitchCrash_1.Link( OSwitchOdd , IIsOddGate )
230     
231     LSwitchaIsOdda = GraphSwitchCrash_1.Link( OSwitcha , IIsOdda )
232     LSwitchaIsOdda.AddCoord( 1 , 365 , 129 )
233     LSwitchaIsOdda.AddCoord( 2 , 365 , 201 )
234     
235     LSwitchDefaultEndOfSwitchDefault = GraphSwitchCrash_1.Link( OSwitchDefault , IEndOfSwitchDefault )
236     
237     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCrash_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
238     
239     LIsOdd_1aEndSwitcha = GraphSwitchCrash_1.Link( OIsOdd_1a , IEndSwitcha )
240     LIsOdd_1aEndSwitcha.AddCoord( 1 , 593 , 411 )
241     LIsOdd_1aEndSwitcha.AddCoord( 2 , 593 , 358 )
242     
243     LInitLoopIndexSwitch_1a = GraphSwitchCrash_1.Link( OInitLoopIndex , ISwitch_1a )
244     
245     LInitLoopMinEndOfInitLoopMin = GraphSwitchCrash_1.Link( OInitLoopMin , IEndOfInitLoopMin )
246     
247     LInitLoopMaxEndOfInitLoopMax = GraphSwitchCrash_1.Link( OInitLoopMax , IEndOfInitLoopMax )
248     
249     LSwitch_1OddIsOdd_1Gate = GraphSwitchCrash_1.Link( OSwitch_1Odd , IIsOdd_1Gate )
250     
251     LSwitch_1EvenIsOdd_1Even = GraphSwitchCrash_1.Link( OSwitch_1Even , IIsOdd_1Even )
252     
253     LSwitch_1aIsOdd_1a = GraphSwitchCrash_1.Link( OSwitch_1a , IIsOdd_1a )
254     LSwitch_1aIsOdd_1a.AddCoord( 1 , 377 , 358 )
255     LSwitch_1aIsOdd_1a.AddCoord( 2 , 377 , 460 )
256     
257     LSwitch_1DefaultEndSwitchDefault = GraphSwitchCrash_1.Link( OSwitch_1Default , IEndSwitchDefault )
258     
259     LEndSwitchaEndOfInitLoopIndex = GraphSwitchCrash_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
260     
261     # Input datas
262     IInitLoopSwitchIndex.Input( 0 )
263     IInitLoopSwitchMin.Input( 0 )
264     IInitLoopSwitchMax.Input( 23 )
265     IInitLoopIndex.Input( 0 )
266     IInitLoopMin.Input( 0 )
267     IInitLoopMax.Input( 31 )
268     
269     # Output Ports of the graph
270     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
271     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
272     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
273     #OSwitchEven = Switch.GetOutPort( 'Even' )
274     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
275     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
276     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
277     return GraphSwitchCrash_1
278
279
280 GraphSwitchCrash_1 = DefGraphSwitchCrash_1()