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