Salome HOME
Some calls to UnValid() was missing in case of editing of StreamGraphs, StreamLinks...
[modules/superv.git] / examples / GraphSyrControlGUI.py
1
2 # Generated python file of Graph GraphSyrControlGUI
3
4 from SuperV import *
5 # Graph creation 
6 GraphSyrControlGUI = Graph( 'GraphSyrControlGUI' )
7 GraphSyrControlGUI.SetName( 'GraphSyrControlGUI' )
8 GraphSyrControlGUI.SetAuthor( 'JR' )
9 GraphSyrControlGUI.SetComment( 'Syracuse algorithm' )
10 GraphSyrControlGUI.Coords( 0 , 0 )
11
12 # Creation of Factory Nodes
13
14 test_ISEVEN = GraphSyrControlGUI.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
15 test_ISEVEN.SetName( 'test_ISEVEN' )
16 test_ISEVEN.SetAuthor( '' )
17 test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
18 test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
19 test_ISEVEN.Coords( 288 , 337 )
20
21 test_ISONE = GraphSyrControlGUI.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
22 test_ISONE.SetName( 'test_ISONE' )
23 test_ISONE.SetAuthor( '' )
24 test_ISONE.SetContainer( 'localhost/FactoryServer' )
25 test_ISONE.SetComment( 'C_ISONE from SyrComponent' )
26 test_ISONE.Coords( 293 , 130 )
27
28 m3p1 = GraphSyrControlGUI.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
29 m3p1.SetName( 'm3p1' )
30 m3p1.SetAuthor( '' )
31 m3p1.SetContainer( 'localhost/FactoryServer' )
32 m3p1.SetComment( 'C_M3P1 from SyrComponent' )
33 m3p1.Coords( 761 , 19 )
34
35 div2 = GraphSyrControlGUI.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
36 div2.SetName( 'div2' )
37 div2.SetAuthor( '' )
38 div2.SetContainer( 'localhost/FactoryServer' )
39 div2.SetComment( 'C_DIV2 from SyrComponent' )
40 div2.Coords( 770 , 384 )
41
42 incr = GraphSyrControlGUI.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
43 incr.SetName( 'incr' )
44 incr.SetAuthor( '' )
45 incr.SetContainer( 'localhost/FactoryServer' )
46 incr.SetComment( 'C_INCR from SyrComponent' )
47 incr.Coords( 764 , 179 )
48
49 # Creation of InLine Nodes
50 Pylabel_begin = []
51 Pylabel_begin.append( 'def label_begin( NB , KB ) :' )
52 Pylabel_begin.append( '    return NB,KB' )
53 label_begin = GraphSyrControlGUI.INode( 'label_begin' , Pylabel_begin )
54 label_begin.SetName( 'label_begin' )
55 label_begin.SetAuthor( '' )
56 label_begin.SetComment( 'Python function' )
57 label_begin.Coords( 58 , 189 )
58 label_begin.InPort( 'NB' , 'long' )
59 label_begin.InPort( 'KB' , 'long' )
60
61 # Creation of Switch Nodes
62 Pylabel_test = []
63 Pylabel_test.append( 'def L_OneEven( ValOne , ValEven , NT , KT ):' )
64 Pylabel_test.append( '    Finished = ValOne' )
65 Pylabel_test.append( '    if Finished == 0 :' )
66 Pylabel_test.append( '        Incr = 1' )
67 Pylabel_test.append( '        Even = ValEven' )
68 Pylabel_test.append( '        if Even == 0 :' )
69 Pylabel_test.append( '            Odd = 1' )
70 Pylabel_test.append( '        else :' )
71 Pylabel_test.append( '            Odd = 0' )
72 Pylabel_test.append( '    else :' )
73 Pylabel_test.append( '        Incr = 0' )
74 Pylabel_test.append( '        Even = 0' )
75 Pylabel_test.append( '        Odd = 0' )
76 Pylabel_test.append( '    Even = ValEven' )
77 Pylabel_test.append( '    return Finished,Incr,Even,Odd,NT,KT' )
78 label_test,EndL_OneEven = GraphSyrControlGUI.SNode( 'L_OneEven' , Pylabel_test )
79 EndL_OneEven.SetName( 'EndL_OneEven' )
80 EndL_OneEven.SetAuthor( '' )
81 EndL_OneEven.SetComment( '' )
82 EndL_OneEven.Coords( 1068 , 258 )
83 PyEndL_OneEven = []
84 EndL_OneEven.SetPyFunction( 'EndL_OneEven' , PyEndL_OneEven )
85 label_test.SetName( 'label_test' )
86 label_test.SetAuthor( '' )
87 label_test.SetComment( '' )
88 label_test.Coords( 516 , 175 )
89 label_test.InPort( 'ValOne' , 'long' )
90 label_test.InPort( 'ValEven' , 'long' )
91 label_test.InPort( 'NT' , 'long' )
92 label_test.InPort( 'KT' , 'long' )
93
94 # Creation of GOTO Nodes
95 Pycontrol_m3p1 = []
96 Pycontrol_m3p1.append( 'def C_NotOneIsEven( N , K ):' )
97 Pycontrol_m3p1.append( '    return 0,1,N,K' )
98 control_m3p1 = GraphSyrControlGUI.GNode( 'C_NotOneIsEven' , Pycontrol_m3p1 , 'label_test' )
99 control_m3p1.SetName( 'control_m3p1' )
100 control_m3p1.SetAuthor( '' )
101 control_m3p1.SetComment( '' )
102 control_m3p1.Coords( 972 , 64 )
103 control_m3p1.InPort( 'N' , 'long' )
104 control_m3p1.InPort( 'K' , 'long' )
105
106 Pycontrol_div2 = []
107 Pycontrol_div2.append( 'def control_div2( N , K ) :' )
108 Pycontrol_div2.append( '    return N,K' )
109 control_div2 = GraphSyrControlGUI.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
110 control_div2.SetName( 'control_div2' )
111 control_div2.SetAuthor( '' )
112 control_div2.SetComment( '' )
113 control_div2.Coords( 972 , 430 )
114 control_div2.InPort( 'N' , 'long' )
115 control_div2.InPort( 'K' , 'long' )
116
117 # Creation of Links
118 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
119 label_testValEven = GraphSyrControlGUI.Link( test_ISEVENBoolEven , label_test.Port( 'ValEven' ) )
120 label_testValEven.AddCoord( 1 , 493 , 238 )
121 label_testValEven.AddCoord( 2 , 493 , 418 )
122
123 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
124 label_testValOne = GraphSyrControlGUI.Link( test_ISONEBoolOne , label_test.Port( 'ValOne' ) )
125
126 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
127 control_m3p1N = GraphSyrControlGUI.Link( m3p1anEvenInteger , control_m3p1.Port( 'N' ) )
128
129 div2anInteger = div2.Port( 'anInteger' )
130 control_div2N = GraphSyrControlGUI.Link( div2anInteger , control_div2.Port( 'N' ) )
131
132 incraNewCount = incr.Port( 'aNewCount' )
133 control_div2K = GraphSyrControlGUI.Link( incraNewCount , control_div2.Port( 'K' ) )
134 control_div2K.AddCoord( 1 , 954 , 494 )
135 control_div2K.AddCoord( 2 , 954 , 259 )
136
137 control_m3p1K = GraphSyrControlGUI.Link( incraNewCount , control_m3p1.Port( 'K' ) )
138 control_m3p1K.AddCoord( 1 , 955 , 128 )
139 control_m3p1K.AddCoord( 2 , 954 , 258 )
140
141 label_beginNT = label_begin.Port( 'NT' )
142 test_ISONEanInteger = GraphSyrControlGUI.Link( label_beginNT , test_ISONE.Port( 'anInteger' ) )
143 test_ISONEanInteger.AddCoord( 1 , 275 , 211 )
144 test_ISONEanInteger.AddCoord( 2 , 275 , 270 )
145
146 label_testNT = GraphSyrControlGUI.Link( label_beginNT , label_test.Port( 'NT' ) )
147
148 test_ISEVENanInteger = GraphSyrControlGUI.Link( label_beginNT , test_ISEVEN.Port( 'anInteger' ) )
149 test_ISEVENanInteger.AddCoord( 1 , 274 , 417 )
150 test_ISEVENanInteger.AddCoord( 2 , 275 , 270 )
151
152 label_beginKT = label_begin.Port( 'KT' )
153 label_testKT = GraphSyrControlGUI.Link( label_beginKT , label_test.Port( 'KT' ) )
154 label_testKT.AddCoord( 1 , 476 , 294 )
155 label_testKT.AddCoord( 2 , 475 , 515 )
156 label_testKT.AddCoord( 3 , 260 , 515 )
157 label_testKT.AddCoord( 4 , 260 , 298 )
158
159 label_testIncr = label_test.Port( 'Incr' )
160 incrInGate = GraphSyrControlGUI.Link( label_testIncr , incr.Port( 'InGate' ) )
161 incrInGate.AddCoord( 1 , 712 , 292 )
162 incrInGate.AddCoord( 2 , 711 , 238 )
163
164 label_testEven = label_test.Port( 'Even' )
165 div2InGate = GraphSyrControlGUI.Link( label_testEven , div2.Port( 'InGate' ) )
166 div2InGate.AddCoord( 1 , 724 , 498 )
167 div2InGate.AddCoord( 2 , 723 , 268 )
168
169 label_testOdd = label_test.Port( 'Odd' )
170 m3p1InGate = GraphSyrControlGUI.Link( label_testOdd , m3p1.Port( 'InGate' ) )
171 m3p1InGate.AddCoord( 1 , 698 , 132 )
172 m3p1InGate.AddCoord( 2 , 697 , 297 )
173
174 label_testN = label_test.Port( 'N' )
175 m3p1anOddInteger = GraphSyrControlGUI.Link( label_testN , m3p1.Port( 'anOddInteger' ) )
176 m3p1anOddInteger.AddCoord( 1 , 748 , 100 )
177 m3p1anOddInteger.AddCoord( 2 , 747 , 325 )
178
179 div2anEvenInteger = GraphSyrControlGUI.Link( label_testN , div2.Port( 'anEvenInteger' ) )
180 div2anEvenInteger.AddCoord( 1 , 746 , 463 )
181 div2anEvenInteger.AddCoord( 2 , 747 , 327 )
182
183 label_testK = label_test.Port( 'K' )
184 incraCount = GraphSyrControlGUI.Link( label_testK , incr.Port( 'aCount' ) )
185 incraCount.AddCoord( 1 , 732 , 260 )
186 incraCount.AddCoord( 2 , 732 , 354 )
187
188 label_testDefault = label_test.Port( 'Default' )
189 EndL_OneEvenDefault = GraphSyrControlGUI.Link( label_testDefault , EndL_OneEven.Port( 'Default' ) )
190
191 control_m3p1OutGate = control_m3p1.Port( 'OutGate' )
192 label_testInGate = GraphSyrControlGUI.Link( control_m3p1OutGate , label_test.Port( 'InGate' ) )
193 label_testInGate.AddCoord( 1 , 503 , 388 )
194 label_testInGate.AddCoord( 2 , 505 , 5 )
195 label_testInGate.AddCoord( 3 , 1149 , 5 )
196 label_testInGate.AddCoord( 4 , 1150 , 219 )
197
198 control_div2OutGate = control_div2.Port( 'OutGate' )
199 label_beginInGate = GraphSyrControlGUI.Link( control_div2OutGate , label_begin.Port( 'InGate' ) )
200 label_beginInGate.AddCoord( 1 , 34 , 332 )
201 label_beginInGate.AddCoord( 2 , 34 , 592 )
202 label_beginInGate.AddCoord( 3 , 1145 , 586 )
203 label_beginInGate.AddCoord( 4 , 1144 , 527 )
204
205 # Creation of Input datas
206 label_beginNB = label_begin.Input( 'NB' , 7)
207 label_beginKB = label_begin.Input( 'KB' , 0)
208
209 # Creation of Output variables
210 label_testFinished = label_test.Port( 'Finished' )