Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/datafiles.git] / Superv / Python / GraphSwitchManyCasesNOTValid.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 GraphSwitchManyCasesNOTValid
23 #
24 from SuperV import *
25
26 # Graph creation of GraphSwitchManyCasesNOTValid
27 def DefGraphSwitchManyCasesNOTValid() :
28     GraphSwitchManyCasesNOTValid = Graph( 'GraphSwitchManyCasesNOTValid' )
29     GraphSwitchManyCasesNOTValid.SetName( 'GraphSwitchManyCasesNOTValid' )
30     GraphSwitchManyCasesNOTValid.SetAuthor( 'JR' )
31     GraphSwitchManyCasesNOTValid.SetComment( '' )
32     GraphSwitchManyCasesNOTValid.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     # Creation of InLine Nodes
37     PyCase1 = []
38     PyCase1.append( 'from time import *  ' )
39     PyCase1.append( 'def Case1(a) :  ' )
40     PyCase1.append( '    sleep(1)  ' )
41     PyCase1.append( '    return a ' )
42     Case1 = GraphSwitchManyCasesNOTValid.INode( 'Case1' , PyCase1 )
43     Case1.SetName( 'Case1' )
44     Case1.SetAuthor( '' )
45     Case1.SetComment( 'Compute Node' )
46     Case1.Coords( 448 , 13 )
47     ICase1a = Case1.InPort( 'a' , 'long' )
48     ICase1Gate = Case1.GetInPort( 'Gate' )
49     OCase1a = Case1.OutPort( 'a' , 'long' )
50     OCase1Gate = Case1.GetOutPort( 'Gate' )
51     
52     PyCase3 = []
53     PyCase3.append( 'from time import *  ' )
54     PyCase3.append( 'def Case3(b) :  ' )
55     PyCase3.append( '    sleep(1)  ' )
56     PyCase3.append( '    return b  ' )
57     Case3 = GraphSwitchManyCasesNOTValid.INode( 'Case3' , PyCase3 )
58     Case3.SetName( 'Case3' )
59     Case3.SetAuthor( '' )
60     Case3.SetComment( 'Compute Node' )
61     Case3.Coords( 461 , 500 )
62     ICase3b = Case3.InPort( 'b' , 'long' )
63     ICase3Gate = Case3.GetInPort( 'Gate' )
64     OCase3b = Case3.OutPort( 'b' , 'long' )
65     OCase3Gate = Case3.GetOutPort( 'Gate' )
66     
67     PyCase4 = []
68     PyCase4.append( 'from time import *  ' )
69     PyCase4.append( 'def Case4(c) :  ' )
70     PyCase4.append( '    sleep(1)  ' )
71     PyCase4.append( '    return   ' )
72     Case4 = GraphSwitchManyCasesNOTValid.INode( 'Case4' , PyCase4 )
73     Case4.SetName( 'Case4' )
74     Case4.SetAuthor( '' )
75     Case4.SetComment( 'Compute Node' )
76     Case4.Coords( 455 , 647 )
77     ICase4c = Case4.InPort( 'c' , 'long' )
78     ICase4Gate = Case4.GetInPort( 'Gate' )
79     OCase4Gate = Case4.GetOutPort( 'Gate' )
80     
81     PyCase2 = []
82     PyCase2.append( 'from time import *  ' )
83     PyCase2.append( 'def Case2() :  ' )
84     PyCase2.append( '    sleep(1)  ' )
85     PyCase2.append( '    return  ' )
86     Case2 = GraphSwitchManyCasesNOTValid.INode( 'Case2' , PyCase2 )
87     Case2.SetName( 'Case2' )
88     Case2.SetAuthor( '' )
89     Case2.SetComment( 'Compute Node' )
90     Case2.Coords( 455 , 179 )
91     ICase2Gate = Case2.GetInPort( 'Gate' )
92     OCase2Gate = Case2.GetOutPort( 'Gate' )
93     
94     PyCase2a = []
95     PyCase2a.append( 'from time import *  ' )
96     PyCase2a.append( 'def Case2a(a) :  ' )
97     PyCase2a.append( '    sleep(1)  ' )
98     PyCase2a.append( '    return a  ' )
99     Case2a = GraphSwitchManyCasesNOTValid.INode( 'Case2a' , PyCase2a )
100     Case2a.SetName( 'Case2a' )
101     Case2a.SetAuthor( '' )
102     Case2a.SetComment( 'Compute Node' )
103     Case2a.Coords( 456 , 304 )
104     ICase2aa = Case2a.InPort( 'a' , 'long' )
105     ICase2aGate = Case2a.GetInPort( 'Gate' )
106     OCase2aa = Case2a.OutPort( 'a' , 'long' )
107     OCase2aGate = Case2a.GetOutPort( 'Gate' )
108     
109     # Creation of Loop Nodes
110     PyLoop = []
111     PyLoop.append( 'def Init(Index,Max,Min) : ' )
112     PyLoop.append( '    Index = Max ' )
113     PyLoop.append( '    return Index,Max,Min ' )
114     PyMoreLoop = []
115     PyMoreLoop.append( 'def More(Index,Max,Min) : ' )
116     PyMoreLoop.append( '    if Index >= Min : ' )
117     PyMoreLoop.append( '        DoLoop = 1 ' )
118     PyMoreLoop.append( '    else : ' )
119     PyMoreLoop.append( '        DoLoop = 0 ' )
120     PyMoreLoop.append( '    return DoLoop,Index,Max,Min ' )
121     PyNextLoop = []
122     PyNextLoop.append( 'def Next(Index,Max,Min) : ' )
123     PyNextLoop.append( '    Index = Index - 1 ' )
124     PyNextLoop.append( '    return Index,Max,Min ' )
125     Loop,EndLoop = GraphSwitchManyCasesNOTValid.LNode( 'Init' , PyLoop , 'More' , PyMoreLoop , 'Next' , PyNextLoop )
126     EndLoop.SetName( 'EndLoop' )
127     EndLoop.SetAuthor( '' )
128     EndLoop.SetComment( 'Compute Node' )
129     EndLoop.Coords( 972 , 344 )
130     PyEndLoop = []
131     EndLoop.SetPyFunction( 'EndLoop' , PyEndLoop )
132     ILoopDoLoop = Loop.GetInPort( 'DoLoop' )
133     ILoopIndex = Loop.InPort( 'Index' , 'long' )
134     ILoopMax = Loop.InPort( 'Max' , 'long' )
135     ILoopMin = Loop.InPort( 'Min' , 'long' )
136     ILoopGate = Loop.GetInPort( 'Gate' )
137     OLoopDoLoop = Loop.GetOutPort( 'DoLoop' )
138     OLoopIndex = Loop.GetOutPort( 'Index' )
139     OLoopMax = Loop.GetOutPort( 'Max' )
140     OLoopMin = Loop.GetOutPort( 'Min' )
141     IEndLoopDoLoop = EndLoop.GetInPort( 'DoLoop' )
142     IEndLoopIndex = EndLoop.GetInPort( 'Index' )
143     IEndLoopMax = EndLoop.GetInPort( 'Max' )
144     IEndLoopMin = EndLoop.GetInPort( 'Min' )
145     IEndLoopGate = EndLoop.GetInPort( 'Gate' )
146     OEndLoopDoLoop = EndLoop.GetOutPort( 'DoLoop' )
147     OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
148     OEndLoopMax = EndLoop.GetOutPort( 'Max' )
149     OEndLoopMin = EndLoop.GetOutPort( 'Min' )
150     OEndLoopGate = EndLoop.GetOutPort( 'Gate' )
151     Loop.SetName( 'Loop' )
152     Loop.SetAuthor( '' )
153     Loop.SetComment( 'Compute Node' )
154     Loop.Coords( 15 , 336 )
155     
156     # Creation of Switch Nodes
157     PySwitch = []
158     PySwitch.append( 'from time import *    ' )
159     PySwitch.append( 'def Switch(Index) :    ' )
160     PySwitch.append( '    sleep(1)   ' )
161     PySwitch.append( '    SB1 = 0   ' )
162     PySwitch.append( '    SB2 = 0   ' )
163     PySwitch.append( '    if (Index & 3) == 3 :     ' )
164     PySwitch.append( '        SB1 = 1   ' )
165     PySwitch.append( '    elif (Index & 3) == 0 :     ' )
166     PySwitch.append( '        SB2 = 1   ' )
167     PySwitch.append( '    return SB1,SB2,Index,Index+1,Index+2,Index+3,Index+4,Index+5     ' )
168     Switch,EndSwitch = GraphSwitchManyCasesNOTValid.SNode( 'Switch' , PySwitch )
169     EndSwitch.SetName( 'EndSwitch' )
170     EndSwitch.SetAuthor( '' )
171     EndSwitch.SetComment( 'Compute Node' )
172     EndSwitch.Coords( 732 , 344 )
173     PyEndSwitch = []
174     PyEndSwitch.append( 'from time import *   ' )
175     PyEndSwitch.append( 'def EndSwitch(a,b,dd,e,f) :   ' )
176     PyEndSwitch.append( '    sleep(1)   ' )
177     PyEndSwitch.append( '    if b != (a+1) :  ' )
178     PyEndSwitch.append( '        print 'EndSwitch ERROR' ' )
179     PyEndSwitch.append( '        pass  ' )
180     PyEndSwitch.append( '    if dd != (a+3) :  ' )
181     PyEndSwitch.append( '        print 'EndSwitch ERROR' ' )
182     PyEndSwitch.append( '        pass  ' )
183     PyEndSwitch.append( '    if e != (a+4) :  ' )
184     PyEndSwitch.append( '        print 'EndSwitch ERROR' ' )
185     PyEndSwitch.append( '        pass  ' )
186     PyEndSwitch.append( '    if f != (a+5) :  ' )
187     PyEndSwitch.append( '        print 'EndSwitch ERROR' ' )
188     PyEndSwitch.append( '        pass  ' )
189     PyEndSwitch.append( '    return a    ' )
190     EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
191     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
192     IEndSwitchb = EndSwitch.InPort( 'b' , 'long' )
193     IEndSwitchdd = EndSwitch.InPort( 'dd' , 'long' )
194     IEndSwitche = EndSwitch.InPort( 'e' , 'long' )
195     IEndSwitchf = EndSwitch.InPort( 'f' , 'long' )
196     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
197     OEndSwitchIndex = EndSwitch.OutPort( 'Index' , 'long' )
198     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
199     Switch.SetName( 'Switch' )
200     Switch.SetAuthor( '' )
201     Switch.SetComment( 'Compute Node' )
202     Switch.Coords( 232 , 285 )
203     ISwitchIndex = Switch.InPort( 'Index' , 'long' )
204     ISwitchGate = Switch.GetInPort( 'Gate' )
205     OSwitchSB1 = Switch.OutPort( 'SB1' , 'long' )
206     OSwitchSB2 = Switch.OutPort( 'SB2' , 'long' )
207     OSwitcha = Switch.OutPort( 'a' , 'long' )
208     OSwitchb = Switch.OutPort( 'b' , 'long' )
209     OSwitchc = Switch.OutPort( 'c' , 'long' )
210     OSwitchd = Switch.OutPort( 'd' , 'long' )
211     OSwitche = Switch.OutPort( 'e' , 'long' )
212     OSwitchf = Switch.OutPort( 'f' , 'long' )
213     OSwitchDefault = Switch.GetOutPort( 'Default' )
214     
215     # Creation of Links
216     LLoopIndexSwitchIndex = GraphSwitchManyCasesNOTValid.Link( OLoopIndex , ISwitchIndex )
217     
218     LLoopMaxEndLoopMax = GraphSwitchManyCasesNOTValid.Link( OLoopMax , IEndLoopMax )
219     
220     LLoopMinEndLoopMin = GraphSwitchManyCasesNOTValid.Link( OLoopMin , IEndLoopMin )
221     
222     LSwitchSB1Case1Gate = GraphSwitchManyCasesNOTValid.Link( OSwitchSB1 , ICase1Gate )
223     
224     LSwitchSB2Case2Gate = GraphSwitchManyCasesNOTValid.Link( OSwitchSB2 , ICase2Gate )
225     
226     LSwitchSB2Case2aGate = GraphSwitchManyCasesNOTValid.Link( OSwitchSB2 , ICase2aGate )
227     
228     LSwitchaCase1a = GraphSwitchManyCasesNOTValid.Link( OSwitcha , ICase1a )
229     
230     LSwitchaCase2aa = GraphSwitchManyCasesNOTValid.Link( OSwitcha , ICase2aa )
231     
232     LSwitchbCase3b = GraphSwitchManyCasesNOTValid.Link( OSwitchb , ICase3b )
233     
234     LSwitchcCase4c = GraphSwitchManyCasesNOTValid.Link( OSwitchc , ICase4c )
235     
236     LSwitchdEndSwitchdd = GraphSwitchManyCasesNOTValid.Link( OSwitchd , IEndSwitchdd )
237     
238     LSwitcheEndSwitche = GraphSwitchManyCasesNOTValid.Link( OSwitche , IEndSwitche )
239     
240     LSwitchDefaultEndSwitchDefault = GraphSwitchManyCasesNOTValid.Link( OSwitchDefault , IEndSwitchDefault )
241     
242     LEndSwitchIndexEndLoopIndex = GraphSwitchManyCasesNOTValid.Link( OEndSwitchIndex , IEndLoopIndex )
243     
244     LCase1aEndSwitcha = GraphSwitchManyCasesNOTValid.Link( OCase1a , IEndSwitcha )
245     
246     LCase3bEndSwitchb = GraphSwitchManyCasesNOTValid.Link( OCase3b , IEndSwitchb )
247     
248     LCase4GateEndSwitchDefault = GraphSwitchManyCasesNOTValid.Link( OCase4Gate , IEndSwitchDefault )
249     
250     LCase2GateEndSwitchDefault = GraphSwitchManyCasesNOTValid.Link( OCase2Gate , IEndSwitchDefault )
251     
252     LCase2aaEndSwitcha = GraphSwitchManyCasesNOTValid.Link( OCase2aa , IEndSwitcha )
253     
254     # Input datas
255     ILoopIndex.Input( 0 )
256     ILoopMax.Input( 23 )
257     ILoopMin.Input( -7 )
258     
259     # Input Ports of the graph
260     #IEndSwitchf = EndSwitch.GetInPort( 'f' )
261     
262     # Output Ports of the graph
263     #OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
264     #OEndLoopMax = EndLoop.GetOutPort( 'Max' )
265     #OEndLoopMin = EndLoop.GetOutPort( 'Min' )
266     #OSwitchf = Switch.GetOutPort( 'f' )
267     return GraphSwitchManyCasesNOTValid
268
269
270 GraphSwitchManyCasesNOTValid = DefGraphSwitchManyCasesNOTValid()