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