Salome HOME
NRI : Add documentation.
[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 test_ISEVEN = GraphSyrControlGUI.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 = GraphSyrControlGUI.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 = GraphSyrControlGUI.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 = GraphSyrControlGUI.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 = GraphSyrControlGUI.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
44 # Creation of InLine Nodes
45 Pylabel_begin = []
46 Pylabel_begin.append( 'def label_begin( NB , KB ) :' )
47 Pylabel_begin.append( '    return NB,KB' )
48 label_begin = GraphSyrControlGUI.INode( 'label_begin' , Pylabel_begin )
49 label_begin.InPort( 'NB' , 'long' )
50 label_begin.InPort( 'KB' , 'long' )
51 label_begin.OutPort( 'NT' , 'long' )
52 label_begin.OutPort( 'KT' , 'long' )
53 label_begin.SetName( 'label_begin' )
54 label_begin.SetAuthor( '' )
55 label_begin.SetComment( 'Python function' )
56 label_begin.Coords( 7 , 216 )
57
58 # Creation of Switch Nodes
59 Pylabel_test = []
60 Pylabel_test.append( 'def L_OneEven( ValOne , ValEven , NT , KT ):' )
61 Pylabel_test.append( '    Finished = ValOne' )
62 Pylabel_test.append( '    if Finished == 0 :' )
63 Pylabel_test.append( '        Incr = 1' )
64 Pylabel_test.append( '        Even = ValEven' )
65 Pylabel_test.append( '        if Even == 0 :' )
66 Pylabel_test.append( '            Odd = 1' )
67 Pylabel_test.append( '        else :' )
68 Pylabel_test.append( '            Odd = 0' )
69 Pylabel_test.append( '    else :' )
70 Pylabel_test.append( '        Incr = 0' )
71 Pylabel_test.append( '        Even = 0' )
72 Pylabel_test.append( '        Odd = 0' )
73 Pylabel_test.append( '    Even = ValEven' )
74 Pylabel_test.append( '    return Finished,Incr,Even,Odd,NT,KT' )
75 label_test,EndL_OneEven = GraphSyrControlGUI.SNode( 'L_OneEven' , Pylabel_test )
76 EndL_OneEven.SetName( 'EndL_OneEven' )
77 EndL_OneEven.SetAuthor( '' )
78 EndL_OneEven.SetComment( '' )
79 EndL_OneEven.Coords( 1034 , 252 )
80 PyEndL_OneEven = []
81 EndL_OneEven.SetPyFunction( 'EndL_OneEven' , PyEndL_OneEven )
82 label_test.InPort( 'ValOne' , 'long' )
83 label_test.InPort( 'ValEven' , 'long' )
84 label_test.InPort( 'NT' , 'long' )
85 label_test.InPort( 'KT' , 'long' )
86 label_test.OutPort( 'Finished' , 'long' )
87 label_test.OutPort( 'Incr' , 'long' )
88 label_test.OutPort( 'Even' , 'long' )
89 label_test.OutPort( 'Odd' , 'long' )
90 label_test.OutPort( 'N' , 'long' )
91 label_test.OutPort( 'K' , 'long' )
92 label_test.SetName( 'label_test' )
93 label_test.SetAuthor( '' )
94 label_test.SetComment( '' )
95 label_test.Coords( 399 , 176 )
96
97 # Creation of GOTO Nodes
98 Pycontrol_m3p1 = []
99 Pycontrol_m3p1.append( 'def C_NotOneIsEven( N , K ):' )
100 Pycontrol_m3p1.append( '    return 0,1,N,K' )
101 control_m3p1 = GraphSyrControlGUI.GNode( 'C_NotOneIsEven' , Pycontrol_m3p1 , 'label_test' )
102 control_m3p1.InPort( 'N' , 'long' )
103 control_m3p1.InPort( 'K' , 'long' )
104 control_m3p1.OutPort( 'ValOne' , 'long' )
105 control_m3p1.OutPort( 'ValEven' , 'long' )
106 control_m3p1.OutPort( 'NT' , 'long' )
107 control_m3p1.OutPort( 'KT' , 'long' )
108 control_m3p1.SetName( 'control_m3p1' )
109 control_m3p1.SetAuthor( '' )
110 control_m3p1.SetComment( '' )
111 control_m3p1.Coords( 808 , 29 )
112 Pycontrol_div2 = []
113 Pycontrol_div2.append( 'def control_div2( N , K ) :' )
114 Pycontrol_div2.append( '    return N,K' )
115 control_div2 = GraphSyrControlGUI.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
116 control_div2.InPort( 'N' , 'long' )
117 control_div2.InPort( 'K' , 'long' )
118 control_div2.OutPort( 'NB' , 'long' )
119 control_div2.OutPort( 'KB' , 'long' )
120 control_div2.SetName( 'control_div2' )
121 control_div2.SetAuthor( '' )
122 control_div2.SetComment( '' )
123 control_div2.Coords( 812 , 357 )
124
125 # Creation of intermediate Output variables and of Control Links
126 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
127 label_testValEven = GraphSyrControlGUI.Link( test_ISEVENBoolEven , label_test.Port( 'ValEven' ) )
128 label_testValEven.AddCoord( 1 , 385 , 358 )
129 label_testValEven.AddCoord( 2 , 385 , 490 )
130 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
131 label_testValOne = GraphSyrControlGUI.Link( test_ISONEBoolOne , label_test.Port( 'ValOne' ) )
132 label_testValOne.AddCoord( 1 , 385 , 328 )
133 label_testValOne.AddCoord( 2 , 385 , 283 )
134 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
135 control_m3p1N = GraphSyrControlGUI.Link( m3p1anEvenInteger , control_m3p1.Port( 'N' ) )
136 control_m3p1N.AddCoord( 1 , 786 , 181 )
137 control_m3p1N.AddCoord( 2 , 786 , 182 )
138 div2anInteger = div2.Port( 'anInteger' )
139 control_div2N = GraphSyrControlGUI.Link( div2anInteger , control_div2.Port( 'N' ) )
140 control_div2N.AddCoord( 1 , 799 , 509 )
141 control_div2N.AddCoord( 2 , 799 , 543 )
142 incraNewCount = incr.Port( 'aNewCount' )
143 control_div2K = GraphSyrControlGUI.Link( incraNewCount , control_div2.Port( 'K' ) )
144 control_div2K.AddCoord( 1 , 787 , 539 )
145 control_div2K.AddCoord( 2 , 787 , 359 )
146 control_m3p1K = GraphSyrControlGUI.Link( incraNewCount , control_m3p1.Port( 'K' ) )
147 control_m3p1K.AddCoord( 1 , 790 , 211 )
148 control_m3p1K.AddCoord( 2 , 790 , 358 )
149 label_beginNT = label_begin.Port( 'NT' )
150 test_ISONEanInteger = GraphSyrControlGUI.Link( label_beginNT , test_ISONE.Port( 'anInteger' ) )
151 test_ISONEanInteger.AddCoord( 1 , 175 , 283 )
152 test_ISONEanInteger.AddCoord( 2 , 175 , 368 )
153 label_testNT = GraphSyrControlGUI.Link( label_beginNT , label_test.Port( 'NT' ) )
154 label_testNT.AddCoord( 1 , 367 , 388 )
155 label_testNT.AddCoord( 2 , 367 , 319 )
156 label_testNT.AddCoord( 3 , 175 , 321 )
157 label_testNT.AddCoord( 4 , 175 , 368 )
158 test_ISEVENanInteger = GraphSyrControlGUI.Link( label_beginNT , test_ISEVEN.Port( 'anInteger' ) )
159 test_ISEVENanInteger.AddCoord( 1 , 183 , 486 )
160 test_ISEVENanInteger.AddCoord( 2 , 183 , 368 )
161 label_beginKT = label_begin.Port( 'KT' )
162 label_testKT = GraphSyrControlGUI.Link( label_beginKT , label_test.Port( 'KT' ) )
163 label_testKT.AddCoord( 1 , 373 , 418 )
164 label_testKT.AddCoord( 2 , 373 , 518 )
165 label_testKT.AddCoord( 3 , 176 , 519 )
166 label_testKT.AddCoord( 4 , 176 , 398 )
167 label_testDefault = label_test.Port( 'Default' )
168 EndL_OneEvenDefault = GraphSyrControlGUI.Link( label_testDefault , EndL_OneEven.Port( 'Default' ) )
169 label_testIncr = label_test.Port( 'Incr' )
170 incrInGate = GraphSyrControlGUI.Link( label_testIncr , incr.Port( 'InGate' ) )
171 incrInGate.AddCoord( 1 , 578 , 328 )
172 incrInGate.AddCoord( 2 , 578 , 358 )
173 label_testEven = label_test.Port( 'Even' )
174 div2InGate = GraphSyrControlGUI.Link( label_testEven , div2.Port( 'InGate' ) )
175 div2InGate.AddCoord( 1 , 578 , 513 )
176 div2InGate.AddCoord( 2 , 578 , 388 )
177 label_testOdd = label_test.Port( 'Odd' )
178 m3p1InGate = GraphSyrControlGUI.Link( label_testOdd , m3p1.Port( 'InGate' ) )
179 m3p1InGate.AddCoord( 1 , 565 , 151 )
180 m3p1InGate.AddCoord( 2 , 565 , 418 )
181 label_testN = label_test.Port( 'N' )
182 m3p1anOddInteger = GraphSyrControlGUI.Link( label_testN , m3p1.Port( 'anOddInteger' ) )
183 m3p1anOddInteger.AddCoord( 1 , 609 , 181 )
184 m3p1anOddInteger.AddCoord( 2 , 609 , 448 )
185 div2anEvenInteger = GraphSyrControlGUI.Link( label_testN , div2.Port( 'anEvenInteger' ) )
186 div2anEvenInteger.AddCoord( 1 , 612 , 543 )
187 div2anEvenInteger.AddCoord( 2 , 612 , 448 )
188 label_testK = label_test.Port( 'K' )
189 incraCount = GraphSyrControlGUI.Link( label_testK , incr.Port( 'aCount' ) )
190 incraCount.AddCoord( 1 , 594 , 358 )
191 incraCount.AddCoord( 2 , 594 , 478 )
192 control_m3p1OutGate = control_m3p1.Port( 'OutGate' )
193 label_testInGate = GraphSyrControlGUI.Link( control_m3p1OutGate , label_test.Port( 'InGate' ) )
194
195 # Creation of intermediate Output variables and of Loop Links
196 control_div2OutGate = control_div2.Port( 'OutGate' )
197 label_beginInGate = GraphSyrControlGUI.Link( control_div2OutGate , label_begin.Port( 'InGate' ) )
198
199 # Creation of Input datas
200 label_beginNB = label_begin.Input( 'NB' , 7)
201 label_beginKB = label_begin.Input( 'KB' , 0)
202
203 # Creation of Output variables
204 label_testFinished = label_test.Port( 'Finished' )
205
206 GraphSyrControlGUI.Run( 7 )
207
208 GraphSyrControlGUI.DoneW()
209
210 GraphSyrControlGUI.State()
211
212 GraphSyrControlGUI.PrintPorts()
213