Salome HOME
Fix for bug IPAL9983 : Object browser is not updated after dataflow run.
[modules/superv.git] / examples / GraphSyrControl.py
1
2 # Generated python file of Graph GraphSyrControl
3
4 from SuperV import *
5
6 # Graph creation of GraphSyrControl
7 def DefGraphSyrControl() :
8     GraphSyrControl = Graph( 'GraphSyrControl' )
9     GraphSyrControl.SetName( 'GraphSyrControl' )
10     GraphSyrControl.SetAuthor( 'JR' )
11     GraphSyrControl.SetComment( 'Syracuse algorithm' )
12     GraphSyrControl.Coords( 0 , 0 )
13     
14     # Creation of Factory Nodes
15     
16     test_ISEVEN = GraphSyrControl.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
17     test_ISEVEN.SetName( 'test_ISEVEN' )
18     test_ISEVEN.SetAuthor( '' )
19     test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
20     test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
21     test_ISEVEN.Coords( 190 , 338 )
22     Itest_ISEVENanInteger = test_ISEVEN.GetInPort( 'anInteger' )
23     Itest_ISEVENGate = test_ISEVEN.GetInPort( 'Gate' )
24     Otest_ISEVENBoolEven = test_ISEVEN.GetOutPort( 'BoolEven' )
25     Otest_ISEVENGate = test_ISEVEN.GetOutPort( 'Gate' )
26     
27     test_ISONE = GraphSyrControl.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
28     test_ISONE.SetName( 'test_ISONE' )
29     test_ISONE.SetAuthor( '' )
30     test_ISONE.SetContainer( 'localhost/FactoryServer' )
31     test_ISONE.SetComment( 'C_ISONE from SyrComponent' )
32     test_ISONE.Coords( 196 , 131 )
33     Itest_ISONEanInteger = test_ISONE.GetInPort( 'anInteger' )
34     Itest_ISONEGate = test_ISONE.GetInPort( 'Gate' )
35     Otest_ISONEBoolOne = test_ISONE.GetOutPort( 'BoolOne' )
36     Otest_ISONEGate = test_ISONE.GetOutPort( 'Gate' )
37     
38     m3p1 = GraphSyrControl.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
39     m3p1.SetName( 'm3p1' )
40     m3p1.SetAuthor( '' )
41     m3p1.SetContainer( 'localhost/FactoryServer' )
42     m3p1.SetComment( 'C_M3P1 from SyrComponent' )
43     m3p1.Coords( 788 , 22 )
44     Im3p1anOddInteger = m3p1.GetInPort( 'anOddInteger' )
45     Im3p1Gate = m3p1.GetInPort( 'Gate' )
46     Om3p1anEvenInteger = m3p1.GetOutPort( 'anEvenInteger' )
47     Om3p1Gate = m3p1.GetOutPort( 'Gate' )
48     
49     div2 = GraphSyrControl.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
50     div2.SetName( 'div2' )
51     div2.SetAuthor( '' )
52     div2.SetContainer( 'localhost/FactoryServer' )
53     div2.SetComment( 'C_DIV2 from SyrComponent' )
54     div2.Coords( 794 , 427 )
55     Idiv2anEvenInteger = div2.GetInPort( 'anEvenInteger' )
56     Idiv2Gate = div2.GetInPort( 'Gate' )
57     Odiv2anInteger = div2.GetOutPort( 'anInteger' )
58     Odiv2Gate = div2.GetOutPort( 'Gate' )
59     
60     incr = GraphSyrControl.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
61     incr.SetName( 'incr' )
62     incr.SetAuthor( '' )
63     incr.SetContainer( 'localhost/FactoryServer' )
64     incr.SetComment( 'C_INCR from SyrComponent' )
65     incr.Coords( 790 , 158 )
66     IincraCount = incr.GetInPort( 'aCount' )
67     IincrGate = incr.GetInPort( 'Gate' )
68     OincraNewCount = incr.GetOutPort( 'aNewCount' )
69     OincrGate = incr.GetOutPort( 'Gate' )
70     
71     # Creation of InLine Nodes
72     Pylabel_begin = []
73     Pylabel_begin.append( 'def label_begin( NB , KB ):' )
74     Pylabel_begin.append( '    print "label_begin",NB,KB' )
75     Pylabel_begin.append( '    return NB,KB' )
76     label_begin = GraphSyrControl.INode( 'label_begin' , Pylabel_begin )
77     label_begin.SetName( 'label_begin' )
78     label_begin.SetAuthor( '' )
79     label_begin.SetComment( 'Python function' )
80     label_begin.Coords( 7 , 216 )
81     Ilabel_beginNB = label_begin.InPort( 'NB' , 'long' )
82     Ilabel_beginKB = label_begin.InPort( 'KB' , 'long' )
83     Ilabel_beginGate = label_begin.GetInPort( 'Gate' )
84     Olabel_beginNT = label_begin.OutPort( 'NT' , 'long' )
85     Olabel_beginKT = label_begin.OutPort( 'KT' , 'long' )
86     Olabel_beginGate = label_begin.GetOutPort( 'Gate' )
87     
88     Pylabel_test = []
89     Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' )
90     Pylabel_test.append( '    print "label_begin",ValEven,ValOne,NB,KB' )
91     Pylabel_test.append( '    return ValEven,ValOne,NB,KB' )
92     label_test = GraphSyrControl.INode( 'label_test' , Pylabel_test )
93     label_test.SetName( 'label_test' )
94     label_test.SetAuthor( '' )
95     label_test.SetComment( 'Python function' )
96     label_test.Coords( 385 , 159 )
97     Ilabel_testValEven = label_test.InPort( 'ValEven' , 'long' )
98     Ilabel_testValOne = label_test.InPort( 'ValOne' , 'long' )
99     Ilabel_testNT = label_test.InPort( 'NT' , 'long' )
100     Ilabel_testKT = label_test.InPort( 'KT' , 'long' )
101     Ilabel_testGate = label_test.GetInPort( 'Gate' )
102     Olabel_testValEven = label_test.OutPort( 'ValEven' , 'long' )
103     Olabel_testValOne = label_test.OutPort( 'ValOne' , 'long' )
104     Olabel_testNT = label_test.OutPort( 'NT' , 'long' )
105     Olabel_testKT = label_test.OutPort( 'KT' , 'long' )
106     Olabel_testGate = label_test.GetOutPort( 'Gate' )
107     
108     # Creation of Switch Nodes
109     Pytest = []
110     Pytest.append( 'def Switch_OneEven( ValOne , ValEven , NT , KT ) :' )
111     Pytest.append( '    Finished = ValOne' )
112     Pytest.append( '    if Finished == 0 :' )
113     Pytest.append( '        Incr = 1' )
114     Pytest.append( '        Even = ValEven' )
115     Pytest.append( '        if Even == 0 :' )
116     Pytest.append( '            Odd = 1' )
117     Pytest.append( '        else :' )
118     Pytest.append( '            Odd = 0' )
119     Pytest.append( '    else :' )
120     Pytest.append( '        Incr = 0' )
121     Pytest.append( '        Even = 0' )
122     Pytest.append( '        Odd = 0' )
123     Pytest.append( '    Even = ValEven' )
124     Pytest.append( '    return Finished,Incr,Even,Odd,NT,KT' )
125     test,EndSwitch_OneEven = GraphSyrControl.SNode( 'Switch_OneEven' , Pytest )
126     EndSwitch_OneEven.SetName( 'EndSwitch_OneEven' )
127     EndSwitch_OneEven.SetAuthor( '' )
128     EndSwitch_OneEven.SetComment( 'Compute Node' )
129     EndSwitch_OneEven.Coords( 1065 , 321 )
130     PyEndSwitch_OneEven = []
131     PyEndSwitch_OneEven.append( 'def EndSwitch_OneEven( Finished , K ):' )
132     PyEndSwitch_OneEven.append( '    print "label_begin",Finished,K' )
133     PyEndSwitch_OneEven.append( '    return Finished,K' )
134     EndSwitch_OneEven.SetPyFunction( 'EndSwitch_OneEven' , PyEndSwitch_OneEven )
135     IEndSwitch_OneEvenFinished = EndSwitch_OneEven.InPort( 'Finished' , 'long' )
136     IEndSwitch_OneEvenK = EndSwitch_OneEven.InPort( 'K' , 'long' )
137     IEndSwitch_OneEvenDefault = EndSwitch_OneEven.GetInPort( 'Default' )
138     OEndSwitch_OneEvenFinished = EndSwitch_OneEven.OutPort( 'Finished' , 'long' )
139     OEndSwitch_OneEvenK = EndSwitch_OneEven.OutPort( 'K' , 'long' )
140     OEndSwitch_OneEvenGate = EndSwitch_OneEven.GetOutPort( 'Gate' )
141     test.SetName( 'test' )
142     test.SetAuthor( '' )
143     test.SetComment( 'Compute Node' )
144     test.Coords( 592 , 205 )
145     ItestValOne = test.InPort( 'ValOne' , 'long' )
146     ItestValEven = test.InPort( 'ValEven' , 'long' )
147     ItestNT = test.InPort( 'NT' , 'long' )
148     ItestKT = test.InPort( 'KT' , 'long' )
149     ItestGate = test.GetInPort( 'Gate' )
150     OtestFinished = test.OutPort( 'Finished' , 'long' )
151     OtestIncr = test.OutPort( 'Incr' , 'long' )
152     OtestEven = test.OutPort( 'Even' , 'long' )
153     OtestOdd = test.OutPort( 'Odd' , 'long' )
154     OtestN = test.OutPort( 'N' , 'long' )
155     OtestK = test.OutPort( 'K' , 'long' )
156     OtestDefault = test.GetOutPort( 'Default' )
157     
158     # Creation of GOTO Nodes
159     Pycontrol_m3p1 = []
160     Pycontrol_m3p1.append( 'from time import * ' )
161     Pycontrol_m3p1.append( 'def control_m3p1( N , K ): ' )
162     Pycontrol_m3p1.append( '    sleep(1) ' )
163     Pycontrol_m3p1.append( '    return 0,1,N,K ' )
164     control_m3p1 = GraphSyrControl.GNode( 'control_m3p1' , Pycontrol_m3p1 , 'label_test' )
165     control_m3p1.SetName( 'control_m3p1' )
166     control_m3p1.SetAuthor( '' )
167     control_m3p1.SetComment( 'Compute Node' )
168     control_m3p1.Coords( 1012 , 68 )
169     Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' )
170     Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' )
171     Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' )
172     Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' )
173     Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' )
174     Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' )
175     Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' )
176     Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' )
177     
178     Pycontrol_div2 = []
179     Pycontrol_div2.append( 'from time import * ' )
180     Pycontrol_div2.append( 'def control_div2( N , NB ) : ' )
181     Pycontrol_div2.append( '    sleep(1) ' )
182     Pycontrol_div2.append( '    return N,NB ' )
183     control_div2 = GraphSyrControl.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
184     control_div2.SetName( 'control_div2' )
185     control_div2.SetAuthor( '' )
186     control_div2.SetComment( 'Compute Node' )
187     control_div2.Coords( 1010 , 473 )
188     Icontrol_div2N = control_div2.InPort( 'N' , 'long' )
189     Icontrol_div2K = control_div2.InPort( 'K' , 'long' )
190     Icontrol_div2Gate = control_div2.GetInPort( 'Gate' )
191     Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' )
192     Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' )
193     Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' )
194     
195     # Creation of Links
196     Ltest_ISEVENBoolEvenlabel_testValEven = GraphSyrControl.Link( Otest_ISEVENBoolEven , Ilabel_testValEven )
197     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 380 , 236 )
198     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 379 , 419 )
199     
200     Ltest_ISONEBoolOnelabel_testValOne = GraphSyrControl.Link( Otest_ISONEBoolOne , Ilabel_testValOne )
201     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 1 , 367 , 269 )
202     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 2 , 367 , 213 )
203     
204     Lm3p1anEvenIntegercontrol_m3p1N = GraphSyrControl.Link( Om3p1anEvenInteger , Icontrol_m3p1N )
205     
206     Ldiv2anIntegercontrol_div2N = GraphSyrControl.Link( Odiv2anInteger , Icontrol_div2N )
207     
208     LincraNewCountcontrol_m3p1K = GraphSyrControl.Link( OincraNewCount , Icontrol_m3p1K )
209     LincraNewCountcontrol_m3p1K.AddCoord( 1 , 978 , 132 )
210     LincraNewCountcontrol_m3p1K.AddCoord( 2 , 978 , 239 )
211     
212     LincraNewCountcontrol_div2K = GraphSyrControl.Link( OincraNewCount , Icontrol_div2K )
213     LincraNewCountcontrol_div2K.AddCoord( 1 , 979 , 536 )
214     LincraNewCountcontrol_div2K.AddCoord( 2 , 978 , 240 )
215     
216     Llabel_beginNTlabel_testNT = GraphSyrControl.Link( Olabel_beginNT , Ilabel_testNT )
217     
218     Llabel_beginNTtest_ISEVENanInteger = GraphSyrControl.Link( Olabel_beginNT , Itest_ISEVENanInteger )
219     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 184 , 416 )
220     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 185 , 298 )
221     
222     Llabel_beginNTtest_ISONEanInteger = GraphSyrControl.Link( Olabel_beginNT , Itest_ISONEanInteger )
223     Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 186 , 211 )
224     Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 185 , 297 )
225     
226     Llabel_beginKTlabel_testKT = GraphSyrControl.Link( Olabel_beginKT , Ilabel_testKT )
227     
228     Llabel_testValEventestValEven = GraphSyrControl.Link( Olabel_testValEven , ItestValEven )
229     
230     Llabel_testValOnetestValOne = GraphSyrControl.Link( Olabel_testValOne , ItestValOne )
231     
232     Llabel_testNTtestNT = GraphSyrControl.Link( Olabel_testNT , ItestNT )
233     
234     Llabel_testKTtestKT = GraphSyrControl.Link( Olabel_testKT , ItestKT )
235     
236     LtestFinishedEndSwitch_OneEvenFinished = GraphSyrControl.Link( OtestFinished , IEndSwitch_OneEvenFinished )
237     
238     LtestEvendiv2Gate = GraphSyrControl.Link( OtestEven , Idiv2Gate )
239     LtestEvendiv2Gate.AddCoord( 1 , 764 , 536 )
240     LtestEvendiv2Gate.AddCoord( 2 , 763 , 297 )
241     
242     LtestOddm3p1Gate = GraphSyrControl.Link( OtestOdd , Im3p1Gate )
243     LtestOddm3p1Gate.AddCoord( 1 , 773 , 133 )
244     LtestOddm3p1Gate.AddCoord( 2 , 773 , 326 )
245     
246     LtestNm3p1anOddInteger = GraphSyrControl.Link( OtestN , Im3p1anOddInteger )
247     LtestNm3p1anOddInteger.AddCoord( 1 , 753 , 102 )
248     LtestNm3p1anOddInteger.AddCoord( 2 , 752 , 355 )
249     
250     LtestNdiv2anEvenInteger = GraphSyrControl.Link( OtestN , Idiv2anEvenInteger )
251     LtestNdiv2anEvenInteger.AddCoord( 1 , 753 , 508 )
252     LtestNdiv2anEvenInteger.AddCoord( 2 , 752 , 356 )
253     
254     LtestKEndSwitch_OneEvenK = GraphSyrControl.Link( OtestK , IEndSwitch_OneEvenK )
255     
256     LtestKincraCount = GraphSyrControl.Link( OtestK , IincraCount )
257     LtestKincraCount.AddCoord( 1 , 779 , 239 )
258     LtestKincraCount.AddCoord( 2 , 780 , 385 )
259     
260     LtestDefaultEndSwitch_OneEvenDefault = GraphSyrControl.Link( OtestDefault , IEndSwitch_OneEvenDefault )
261     
262     Lcontrol_m3p1Gatelabel_testGate = GraphSyrControl.Link( Ocontrol_m3p1Gate , Ilabel_testGate )
263     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 373 , 354 )
264     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 372 , 10 )
265     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1180 , 9 )
266     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1181 , 217 )
267     
268     Lcontrol_div2Gatelabel_beginGate = GraphSyrControl.Link( Ocontrol_div2Gate , Ilabel_beginGate )
269     Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 5 , 355 )
270     Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 4 , 608 )
271     Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 1177 , 608 )
272     Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 1177 , 563 )
273     
274     # Input datas
275     Ilabel_beginNB.Input( 7 )
276     Ilabel_beginKB.Input( 0 )
277     
278     # Output Ports of the graph
279     #OtestIncr = test.GetOutPort( 'Incr' )
280     #OEndSwitch_OneEvenFinished = EndSwitch_OneEven.GetOutPort( 'Finished' )
281     #OEndSwitch_OneEvenK = EndSwitch_OneEven.GetOutPort( 'K' )
282     return GraphSyrControl
283
284
285 GraphSyrControl = DefGraphSyrControl()