Salome HOME
995dfdaf4f7966844927d3b70136c53caf950adf
[modules/superv.git] / examples / GraphSyrControlAve.py
1
2 # Generated python file of Graph GraphSyrControlAve
3
4 from SuperV import *
5 # Graph creation 
6 GraphSyrControlAve = Graph( 'GraphSyrControlAve' )
7 GraphSyrControlAve.SetName( 'GraphSyrControlAve' )
8 GraphSyrControlAve.SetAuthor( 'JR' )
9 GraphSyrControlAve.SetComment( 'Syracuse algorithm' )
10 GraphSyrControlAve.Coords( 0 , 0 )
11
12 # Creation of Factory Nodes
13 test_ISEVEN = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
14 test_ISEVEN.SetName( 'test_ISEVEN' )
15 test_ISEVEN.SetAuthor( '' )
16 test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
17 test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
18 test_ISEVEN.Coords( 190 , 338 )
19 test_ISONE = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
20 test_ISONE.SetName( 'test_ISONE' )
21 test_ISONE.SetAuthor( '' )
22 test_ISONE.SetContainer( 'localhost/FactoryServer' )
23 test_ISONE.SetComment( 'C_ISONE from SyrComponent' )
24 test_ISONE.Coords( 196 , 131 )
25 m3p1 = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
26 m3p1.SetName( 'm3p1' )
27 m3p1.SetAuthor( '' )
28 m3p1.SetContainer( 'localhost/FactoryServer' )
29 m3p1.SetComment( 'C_M3P1 from SyrComponent' )
30 m3p1.Coords( 621 , 29 )
31 div2 = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
32 div2.SetName( 'div2' )
33 div2.SetAuthor( '' )
34 div2.SetContainer( 'localhost/FactoryServer' )
35 div2.SetComment( 'C_DIV2 from SyrComponent' )
36 div2.Coords( 624 , 391 )
37 incr = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
38 incr.SetName( 'incr' )
39 incr.SetAuthor( '' )
40 incr.SetContainer( 'localhost/FactoryServer' )
41 incr.SetComment( 'C_INCR from SyrComponent' )
42 incr.Coords( 623 , 206 )
43 C_MIN = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_MIN' )
44 C_MIN.SetName( 'C_MIN' )
45 C_MIN.SetAuthor( '' )
46 C_MIN.SetContainer( 'localhost/FactoryServer' )
47 C_MIN.SetComment( 'C_MIN from SyrComponent' )
48 C_MIN.Coords( 0 , 0 )
49 C_MAX = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_MAX' )
50 C_MAX.SetName( 'C_MAX' )
51 C_MAX.SetAuthor( '' )
52 C_MAX.SetContainer( 'localhost/FactoryServer' )
53 C_MAX.SetComment( 'C_MAX from SyrComponent' )
54 C_MAX.Coords( 0 , 0 )
55 C_AVERAGE = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_AVERAGE' )
56 C_AVERAGE.SetName( 'C_AVERAGE' )
57 C_AVERAGE.SetAuthor( '' )
58 C_AVERAGE.SetContainer( 'localhost/FactoryServer' )
59 C_AVERAGE.SetComment( 'C_AVERAGE from SyrComponent' )
60 C_AVERAGE.Coords( 0 , 0 )
61 C_LISTOFSYR = GraphSyrControlAve.FNode( 'SyrComponent' , 'SyrComponent' , 'C_LISTOFSYR' )
62 C_LISTOFSYR.SetName( 'C_LISTOFSYR' )
63 C_LISTOFSYR.SetAuthor( '' )
64 C_LISTOFSYR.SetContainer( 'localhost/FactoryServer' )
65 C_LISTOFSYR.SetComment( 'C_LISTOFSYR from SyrComponent' )
66 C_LISTOFSYR.Coords( 0 , 0 )
67
68 # Creation of InLine Nodes
69 Pylabel_begin = []
70 Pylabel_begin.append( 'def label_begin( NB , KB , MINB , MAXB , AVERAGEB , SYRLISTB ) :' )
71 Pylabel_begin.append( '    return NB,KB,MINB,MAXB,AVERAGEB,SYRLISTB' )
72 label_begin = GraphSyrControlAve.INode( 'label_begin' , Pylabel_begin )
73 label_begin.InPort( 'NB' , 'long' )
74 label_begin.InPort( 'KB' , 'long' )
75 label_begin.InPort( 'MINB' , 'long' )
76 label_begin.InPort( 'MAXB' , 'long' )
77 label_begin.InPort( 'AVERAGEB' , 'double' )
78 label_begin.InPort( 'SYRLISTB' , 'ListOfSyr' )
79 label_begin.OutPort( 'NT' , 'long' )
80 label_begin.OutPort( 'KT' , 'long' )
81 label_begin.OutPort( 'MIN' , 'long' )
82 label_begin.OutPort( 'MAX' , 'long' )
83 label_begin.OutPort( 'AVERAGE' , 'double' )
84 label_begin.OutPort( 'SYRLIST' , 'ListOfSyr' )
85 label_begin.SetName( 'label_begin' )
86 label_begin.SetAuthor( '' )
87 label_begin.SetComment( 'Python function' )
88 label_begin.Coords( 7 , 216 )
89
90 # Creation of Switch Nodes
91 Pylabel_test = []
92 Pylabel_test.append( 'def L_OneEven( ValOne , ValEven , NT , KT , MIN , MAX , AVERAGE , SYRLIST ):' )
93 Pylabel_test.append( '    Finished = ValOne' )
94 Pylabel_test.append( '    if Finished == 0 :' )
95 Pylabel_test.append( '        Incr = 1' )
96 Pylabel_test.append( '        Even = ValEven' )
97 Pylabel_test.append( '        if Even == 0 :' )
98 Pylabel_test.append( '            Odd = 1' )
99 Pylabel_test.append( '        else :' )
100 Pylabel_test.append( '            Odd = 0' )
101 Pylabel_test.append( '    else :' )
102 Pylabel_test.append( '        Incr = 0' )
103 Pylabel_test.append( '        Even = 0' )
104 Pylabel_test.append( '        Odd = 0' )
105 Pylabel_test.append( '    Even = ValEven' )
106 Pylabel_test.append( '    return Finished,Incr,Even,Odd,NT,KT,MIN,MAX,AVERAGE,SYRLIST' )
107 label_test,EndL_OneEven = GraphSyrControlAve.SNode( 'L_OneEven' , Pylabel_test )
108 EndL_OneEven.SetName( 'EndL_OneEven' )
109 EndL_OneEven.SetAuthor( '' )
110 EndL_OneEven.SetComment( '' )
111 EndL_OneEven.Coords( 1045 , 278 )
112 PyEndL_OneEven = []
113 EndL_OneEven.SetPyFunction( 'EndL_OneEven' , PyEndL_OneEven )
114 label_test.InPort( 'ValOne' , 'long' )
115 label_test.InPort( 'ValEven' , 'long' )
116 label_test.InPort( 'NT' , 'long' )
117 label_test.InPort( 'KT' , 'long' )
118 label_test.InPort( 'MIN' , 'long' )
119 label_test.InPort( 'MAX' , 'long' )
120 label_test.InPort( 'AVERAGE' , 'double' )
121 label_test.InPort( 'SYRLIST' , 'ListOfSyr' )
122 label_test.OutPort( 'Finished' , 'long' )
123 label_test.OutPort( 'Incr' , 'long' )
124 label_test.OutPort( 'Even' , 'long' )
125 label_test.OutPort( 'Odd' , 'long' )
126 label_test.OutPort( 'N' , 'long' )
127 label_test.OutPort( 'K' , 'long' )
128 label_test.OutPort( 'MINT' , 'long' )
129 label_test.OutPort( 'MAXT' , 'long' )
130 label_test.OutPort( 'AVERAGET' , 'double' )
131 label_test.OutPort( 'SYRLISTT' , 'ListOfSyr' )
132 label_test.SetName( 'label_test' )
133 label_test.SetAuthor( '' )
134 label_test.SetComment( '' )
135 label_test.Coords( 399 , 176 )
136
137 # Creation of GOTO Nodes
138 Pycontrol_m3p1 = []
139 Pycontrol_m3p1.append( 'def C_NotOneIsEven( N , K , MINT , MAXT , AVERAGET , SYRLISTT ):' )
140 Pycontrol_m3p1.append( '    return 0,1,N,K,MINT,MAXT,AVERAGET,SYRLISTT' )
141 control_m3p1 = GraphSyrControlAve.GNode( 'C_NotOneIsEven' , Pycontrol_m3p1 , 'label_test' )
142 control_m3p1.InPort( 'N' , 'long' )
143 control_m3p1.InPort( 'K' , 'long' )
144 control_m3p1.InPort( 'MINT' , 'long' )
145 control_m3p1.InPort( 'MAXT' , 'long' )
146 control_m3p1.InPort( 'AVERAGET' , 'double' )
147 control_m3p1.InPort( 'SYRLISTT' , 'ListOfSyr' )
148 control_m3p1.OutPort( 'ValOne' , 'long' )
149 control_m3p1.OutPort( 'ValEven' , 'long' )
150 control_m3p1.OutPort( 'NT' , 'long' )
151 control_m3p1.OutPort( 'KT' , 'long' )
152 control_m3p1.OutPort( 'MIN' , 'long' )
153 control_m3p1.OutPort( 'MAX' , 'long' )
154 control_m3p1.OutPort( 'AVERAGE' , 'double' )
155 control_m3p1.OutPort( 'SYRLIST' , 'ListOfSyr' )
156 control_m3p1.SetName( 'control_m3p1' )
157 control_m3p1.SetAuthor( '' )
158 control_m3p1.SetComment( '' )
159 control_m3p1.Coords( 808 , 29 )
160 Pycontrol_div2 = []
161 Pycontrol_div2.append( 'def control_div2( N , K , MINT , MAXT , AVERAGET , SYRLISTT ) :' )
162 Pycontrol_div2.append( '    return N,K,MINT,MAXT,AVERAGET,SYRLISTT' )
163 control_div2 = GraphSyrControlAve.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
164 control_div2.InPort( 'N' , 'long' )
165 control_div2.InPort( 'K' , 'long' )
166 control_div2.InPort( 'MINT' , 'long' )
167 control_div2.InPort( 'MAXT' , 'long' )
168 control_div2.InPort( 'AVERAGET' , 'double' )
169 control_div2.InPort( 'SYRLISTT' , 'ListOfSyr' )
170 control_div2.OutPort( 'NB' , 'long' )
171 control_div2.OutPort( 'KB' , 'long' )
172 control_div2.OutPort( 'MINB' , 'long' )
173 control_div2.OutPort( 'MAXB' , 'long' )
174 control_div2.OutPort( 'AVERAGEB' , 'double' )
175 control_div2.OutPort( 'SYRLISTB' , 'ListOfSyr' )
176 control_div2.SetName( 'control_div2' )
177 control_div2.SetAuthor( '' )
178 control_div2.SetComment( '' )
179 control_div2.Coords( 812 , 357 )
180
181 # Creation of intermediate Output variables and of Control Links
182 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
183 label_testValEven = GraphSyrControlAve.Link( test_ISEVENBoolEven , label_test.Port( 'ValEven' ) )
184 label_testValEven.AddCoord( 1 , 385 , 358 )
185 label_testValEven.AddCoord( 2 , 385 , 490 )
186 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
187 label_testValOne = GraphSyrControlAve.Link( test_ISONEBoolOne , label_test.Port( 'ValOne' ) )
188 label_testValOne.AddCoord( 1 , 385 , 328 )
189 label_testValOne.AddCoord( 2 , 385 , 283 )
190 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
191 control_m3p1N = GraphSyrControlAve.Link( m3p1anEvenInteger , control_m3p1.Port( 'N' ) )
192 control_m3p1N.AddCoord( 1 , 786 , 181 )
193 control_m3p1N.AddCoord( 2 , 786 , 182 )
194 div2anInteger = div2.Port( 'anInteger' )
195 control_div2N = GraphSyrControlAve.Link( div2anInteger , control_div2.Port( 'N' ) )
196 control_div2N.AddCoord( 1 , 799 , 509 )
197 control_div2N.AddCoord( 2 , 799 , 543 )
198 incraNewCount = incr.Port( 'aNewCount' )
199 control_div2K = GraphSyrControlAve.Link( incraNewCount , control_div2.Port( 'K' ) )
200 control_div2K.AddCoord( 1 , 787 , 539 )
201 control_div2K.AddCoord( 2 , 787 , 359 )
202 control_m3p1K = GraphSyrControlAve.Link( incraNewCount , control_m3p1.Port( 'K' ) )
203 control_m3p1K.AddCoord( 1 , 790 , 211 )
204 control_m3p1K.AddCoord( 2 , 790 , 358 )
205 C_AVERAGEaCount = GraphSyrControlAve.Link( incraNewCount , C_AVERAGE.Port( 'aCount' ) )
206 label_beginNT = label_begin.Port( 'NT' )
207 test_ISONEanInteger = GraphSyrControlAve.Link( label_beginNT , test_ISONE.Port( 'anInteger' ) )
208 test_ISONEanInteger.AddCoord( 1 , 175 , 283 )
209 test_ISONEanInteger.AddCoord( 2 , 175 , 368 )
210 label_testNT = GraphSyrControlAve.Link( label_beginNT , label_test.Port( 'NT' ) )
211 label_testNT.AddCoord( 1 , 367 , 388 )
212 label_testNT.AddCoord( 2 , 367 , 319 )
213 label_testNT.AddCoord( 3 , 175 , 321 )
214 label_testNT.AddCoord( 4 , 175 , 368 )
215 test_ISEVENanInteger = GraphSyrControlAve.Link( label_beginNT , test_ISEVEN.Port( 'anInteger' ) )
216 test_ISEVENanInteger.AddCoord( 1 , 183 , 486 )
217 test_ISEVENanInteger.AddCoord( 2 , 183 , 368 )
218 label_beginKT = label_begin.Port( 'KT' )
219 label_testKT = GraphSyrControlAve.Link( label_beginKT , label_test.Port( 'KT' ) )
220 label_testKT.AddCoord( 1 , 373 , 418 )
221 label_testKT.AddCoord( 2 , 373 , 518 )
222 label_testKT.AddCoord( 3 , 176 , 519 )
223 label_testKT.AddCoord( 4 , 176 , 398 )
224 label_beginMIN = label_begin.Port( 'MIN' )
225 label_testMIN = GraphSyrControlAve.Link( label_beginMIN , label_test.Port( 'MIN' ) )
226 label_beginMAX = label_begin.Port( 'MAX' )
227 label_testMAX = GraphSyrControlAve.Link( label_beginMAX , label_test.Port( 'MAX' ) )
228 label_beginAVERAGE = label_begin.Port( 'AVERAGE' )
229 label_testAVERAGE = GraphSyrControlAve.Link( label_beginAVERAGE , label_test.Port( 'AVERAGE' ) )
230 label_beginSYRLIST = label_begin.Port( 'SYRLIST' )
231 label_testSYRLIST = GraphSyrControlAve.Link( label_beginSYRLIST , label_test.Port( 'SYRLIST' ) )
232 label_testDefault = label_test.Port( 'Default' )
233 EndL_OneEvenDefault = GraphSyrControlAve.Link( label_testDefault , EndL_OneEven.Port( 'Default' ) )
234 label_testIncr = label_test.Port( 'Incr' )
235 incrInGate = GraphSyrControlAve.Link( label_testIncr , incr.Port( 'InGate' ) )
236 incrInGate.AddCoord( 1 , 578 , 328 )
237 incrInGate.AddCoord( 2 , 578 , 358 )
238 label_testEven = label_test.Port( 'Even' )
239 div2InGate = GraphSyrControlAve.Link( label_testEven , div2.Port( 'InGate' ) )
240 div2InGate.AddCoord( 1 , 578 , 513 )
241 div2InGate.AddCoord( 2 , 578 , 388 )
242 label_testOdd = label_test.Port( 'Odd' )
243 m3p1InGate = GraphSyrControlAve.Link( label_testOdd , m3p1.Port( 'InGate' ) )
244 m3p1InGate.AddCoord( 1 , 565 , 151 )
245 m3p1InGate.AddCoord( 2 , 565 , 418 )
246 label_testN = label_test.Port( 'N' )
247 m3p1anOddInteger = GraphSyrControlAve.Link( label_testN , m3p1.Port( 'anOddInteger' ) )
248 m3p1anOddInteger.AddCoord( 1 , 609 , 181 )
249 m3p1anOddInteger.AddCoord( 2 , 609 , 448 )
250 div2anEvenInteger = GraphSyrControlAve.Link( label_testN , div2.Port( 'anEvenInteger' ) )
251 div2anEvenInteger.AddCoord( 1 , 612 , 543 )
252 div2anEvenInteger.AddCoord( 2 , 612 , 448 )
253 C_MINanInteger = GraphSyrControlAve.Link( label_testN , C_MIN.Port( 'anInteger' ) )
254 C_MAXanInteger = GraphSyrControlAve.Link( label_testN , C_MAX.Port( 'anInteger' ) )
255 C_AVERAGEanInteger = GraphSyrControlAve.Link( label_testN , C_AVERAGE.Port( 'anInteger' ) )
256 label_testK = label_test.Port( 'K' )
257 incraCount = GraphSyrControlAve.Link( label_testK , incr.Port( 'aCount' ) )
258 incraCount.AddCoord( 1 , 594 , 358 )
259 incraCount.AddCoord( 2 , 594 , 478 )
260 label_testMINT = label_test.Port( 'MINT' )
261 C_MINaMinVal = GraphSyrControlAve.Link( label_testMINT , C_MIN.Port( 'aMinVal' ) )
262 label_testMAXT = label_test.Port( 'MAXT' )
263 C_MAXaMaxVal = GraphSyrControlAve.Link( label_testMAXT , C_MAX.Port( 'aMaxVal' ) )
264 label_testSYRLISTT = label_test.Port( 'SYRLISTT' )
265 C_AVERAGEaListOfSyr = GraphSyrControlAve.Link( label_testSYRLISTT , C_AVERAGE.Port( 'aListOfSyr' ) )
266 control_m3p1OutGate = control_m3p1.Port( 'OutGate' )
267 label_testInGate = GraphSyrControlAve.Link( control_m3p1OutGate , label_test.Port( 'InGate' ) )
268 C_MINaNewMinVal = C_MIN.Port( 'aNewMinVal' )
269 control_m3p1MINT = GraphSyrControlAve.Link( C_MINaNewMinVal , control_m3p1.Port( 'MINT' ) )
270 control_div2MINT = GraphSyrControlAve.Link( C_MINaNewMinVal , control_div2.Port( 'MINT' ) )
271 C_MAXaNewMaxVal = C_MAX.Port( 'aNewMaxVal' )
272 control_m3p1MAXT = GraphSyrControlAve.Link( C_MAXaNewMaxVal , control_m3p1.Port( 'MAXT' ) )
273 control_div2MAXT = GraphSyrControlAve.Link( C_MAXaNewMaxVal , control_div2.Port( 'MAXT' ) )
274 C_AVERAGEaNewListOfSyr = C_AVERAGE.Port( 'aNewListOfSyr' )
275 control_m3p1SYRLISTT = GraphSyrControlAve.Link( C_AVERAGEaNewListOfSyr , control_m3p1.Port( 'SYRLISTT' ) )
276 control_div2SYRLISTT = GraphSyrControlAve.Link( C_AVERAGEaNewListOfSyr , control_div2.Port( 'SYRLISTT' ) )
277 C_AVERAGEanAverage = C_AVERAGE.Port( 'anAverage' )
278 control_m3p1AVERAGET = GraphSyrControlAve.Link( C_AVERAGEanAverage , control_m3p1.Port( 'AVERAGET' ) )
279 control_div2AVERAGET = GraphSyrControlAve.Link( C_AVERAGEanAverage , control_div2.Port( 'AVERAGET' ) )
280 C_LISTOFSYRaListOfSyr = C_LISTOFSYR.Port( 'aListOfSyr' )
281 label_beginSYRLISTB = GraphSyrControlAve.Link( C_LISTOFSYRaListOfSyr , label_begin.Port( 'SYRLISTB' ) )
282
283 # Creation of intermediate Output variables and of Loop Links
284 control_div2OutGate = control_div2.Port( 'OutGate' )
285 label_beginInGate = GraphSyrControlAve.Link( control_div2OutGate , label_begin.Port( 'InGate' ) )
286
287 # Creation of Input datas
288 label_beginNB = label_begin.Input( 'NB' , 7)
289 label_beginKB = label_begin.Input( 'KB' , 0)
290 label_beginMINB = label_begin.Input( 'MINB' , 0)
291 label_beginMAXB = label_begin.Input( 'MAXB' , 0)
292 label_beginAVERAGEB = label_begin.Input( 'AVERAGEB' , 0)
293
294 # Creation of Output variables
295 label_testFinished = label_test.Port( 'Finished' )
296 label_testAVERAGET = label_test.Port( 'AVERAGET' )
297
298 GraphSyrControlAve.PrintPorts()
299
300 GraphSyrControlAve.Export('../GraphSyrControlAve')
301
302 GraphSyrControlAve.Run( 7 )
303
304 GraphSyrControlAve.DoneW()
305
306 GraphSyrControlAve.State()
307
308 GraphSyrControlAve.PrintPorts()
309