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