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