Salome HOME
6731b6b9caad4085eea71bef7d6adb9e5d011c9e
[modules/superv.git] / examples / GraphGOTO1.py
1
2 # Generated python file of Graph GraphGOTO1
3
4 from SuperV import *
5
6 # Graph creation of GraphGOTO1
7 def DefGraphGOTO1() :
8     GraphGOTO1 = Graph( 'GraphGOTO1' )
9     GraphGOTO1.SetName( 'GraphGOTO1' )
10     GraphGOTO1.SetAuthor( 'JR' )
11     GraphGOTO1.SetComment( 'Syracuse algorithm' )
12     GraphGOTO1.Coords( 0 , 0 )
13     
14     # Creation of Factory Nodes
15     
16     test_ISEVEN = GraphGOTO1.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( 195 , 417 )
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 = GraphGOTO1.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( 201 , 145 )
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 = GraphGOTO1.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( 861 , 46 )
44     Im3p1anOddInteger = m3p1.GetInPort( 'anOddInteger' )
45     Im3p1Gate = m3p1.GetInPort( 'Gate' )
46     Om3p1anEvenInteger = m3p1.GetOutPort( 'anEvenInteger' )
47     Om3p1Gate = m3p1.GetOutPort( 'Gate' )
48     
49     div2 = GraphGOTO1.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( 858 , 466 )
55     Idiv2anEvenInteger = div2.GetInPort( 'anEvenInteger' )
56     Idiv2Gate = div2.GetInPort( 'Gate' )
57     Odiv2anInteger = div2.GetOutPort( 'anInteger' )
58     Odiv2Gate = div2.GetOutPort( 'Gate' )
59     
60     incr = GraphGOTO1.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( 865 , 169 )
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 = GraphGOTO1.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( 9 , 250 )
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 = GraphGOTO1.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( 396 , 193 )
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 = GraphGOTO1.SNode( 'Switch_OneEven' , Pytest )
126     EndSwitch_OneEven.SetName( 'EndSwitch_OneEven' )
127     EndSwitch_OneEven.SetAuthor( '' )
128     EndSwitch_OneEven.SetComment( 'Compute Node' )
129     EndSwitch_OneEven.Coords( 1256 , 305 )
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( 595 , 239 )
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( 'def control_m3p1( N , K ):' )
161     Pycontrol_m3p1.append( '    return 0,1,N,K' )
162     control_m3p1 = GraphGOTO1.GNode( 'control_m3p1' , Pycontrol_m3p1 , 'label_test' )
163     control_m3p1.SetName( 'control_m3p1' )
164     control_m3p1.SetAuthor( '' )
165     control_m3p1.SetComment( 'Compute Node' )
166     control_m3p1.Coords( 1073 , 87 )
167     Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' )
168     Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' )
169     Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' )
170     Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' )
171     Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' )
172     Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' )
173     Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' )
174     Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' )
175     
176     Pycontrol_div2 = []
177     Pycontrol_div2.append( 'def control_div2( N , NB ) :' )
178     Pycontrol_div2.append( '    return N,NB' )
179     control_div2 = GraphGOTO1.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
180     control_div2.SetName( 'control_div2' )
181     control_div2.SetAuthor( '' )
182     control_div2.SetComment( 'Compute Node' )
183     control_div2.Coords( 1128 , 453 )
184     Icontrol_div2N = control_div2.InPort( 'N' , 'long' )
185     Icontrol_div2K = control_div2.InPort( 'K' , 'long' )
186     Icontrol_div2Gate = control_div2.GetInPort( 'Gate' )
187     Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' )
188     Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' )
189     Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' )
190     
191     # Creation of Links
192     Ltest_ISEVENBoolEvenlabel_testValEven = GraphGOTO1.Link( Otest_ISEVENBoolEven , Ilabel_testValEven )
193     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 369 , 273 )
194     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 370 , 498 )
195     
196     Ltest_ISONEBoolOnelabel_testValOne = GraphGOTO1.Link( Otest_ISONEBoolOne , Ilabel_testValOne )
197     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 1 , 384 , 281 )
198     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 2 , 384 , 225 )
199     
200     Lm3p1anEvenIntegercontrol_m3p1N = GraphGOTO1.Link( Om3p1anEvenInteger , Icontrol_m3p1N )
201     
202     Ldiv2anIntegercontrol_div2N = GraphGOTO1.Link( Odiv2anInteger , Icontrol_div2N )
203     
204     LincraNewCountcontrol_m3p1K = GraphGOTO1.Link( OincraNewCount , Icontrol_m3p1K )
205     LincraNewCountcontrol_m3p1K.AddCoord( 1 , 1048 , 139 )
206     LincraNewCountcontrol_m3p1K.AddCoord( 2 , 1048 , 241 )
207     
208     LincraNewCountcontrol_div2K = GraphGOTO1.Link( OincraNewCount , Icontrol_div2K )
209     LincraNewCountcontrol_div2K.AddCoord( 1 , 1052 , 504 )
210     LincraNewCountcontrol_div2K.AddCoord( 2 , 1049 , 239 )
211     
212     Llabel_beginNTlabel_testNT = GraphGOTO1.Link( Olabel_beginNT , Ilabel_testNT )
213     
214     Llabel_beginNTtest_ISONEanInteger = GraphGOTO1.Link( Olabel_beginNT , Itest_ISONEanInteger )
215     Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 192 , 226 )
216     Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 191 , 331 )
217     
218     Llabel_beginNTtest_ISEVENanInteger = GraphGOTO1.Link( Olabel_beginNT , Itest_ISEVENanInteger )
219     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 191 , 494 )
220     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 192 , 331 )
221     
222     Llabel_beginKTlabel_testKT = GraphGOTO1.Link( Olabel_beginKT , Ilabel_testKT )
223     
224     Llabel_testValEventestValEven = GraphGOTO1.Link( Olabel_testValEven , ItestValEven )
225     
226     Llabel_testValOnetestValOne = GraphGOTO1.Link( Olabel_testValOne , ItestValOne )
227     
228     Llabel_testNTtestNT = GraphGOTO1.Link( Olabel_testNT , ItestNT )
229     
230     Llabel_testKTtestKT = GraphGOTO1.Link( Olabel_testKT , ItestKT )
231     
232     LtestFinishedEndSwitch_OneEvenFinished = GraphGOTO1.Link( OtestFinished , IEndSwitch_OneEvenFinished )
233     
234     LtestEvendiv2Gate = GraphGOTO1.Link( OtestEven , Idiv2Gate )
235     LtestEvendiv2Gate.AddCoord( 1 , 793 , 561 )
236     LtestEvendiv2Gate.AddCoord( 2 , 794 , 310 )
237     
238     LtestOddm3p1Gate = GraphGOTO1.Link( OtestOdd , Im3p1Gate )
239     LtestOddm3p1Gate.AddCoord( 1 , 778 , 138 )
240     LtestOddm3p1Gate.AddCoord( 2 , 780 , 328 )
241     
242     LtestNm3p1anOddInteger = GraphGOTO1.Link( OtestN , Im3p1anOddInteger )
243     LtestNm3p1anOddInteger.AddCoord( 1 , 808 , 113 )
244     LtestNm3p1anOddInteger.AddCoord( 2 , 807 , 352 )
245     
246     LtestNdiv2anEvenInteger = GraphGOTO1.Link( OtestN , Idiv2anEvenInteger )
247     LtestNdiv2anEvenInteger.AddCoord( 1 , 806 , 537 )
248     LtestNdiv2anEvenInteger.AddCoord( 2 , 807 , 351 )
249     
250     LtestKEndSwitch_OneEvenK = GraphGOTO1.Link( OtestK , IEndSwitch_OneEvenK )
251     
252     LtestKincraCount = GraphGOTO1.Link( OtestK , IincraCount )
253     LtestKincraCount.AddCoord( 1 , 773 , 236 )
254     LtestKincraCount.AddCoord( 2 , 773 , 370 )
255     
256     LtestDefaultEndSwitch_OneEvenDefault = GraphGOTO1.Link( OtestDefault , IEndSwitch_OneEvenDefault )
257     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 1 , 840 , 381 )
258     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 2 , 839 , 394 )
259     
260     Lcontrol_m3p1Gatelabel_testGate = GraphGOTO1.Link( Ocontrol_m3p1Gate , Ilabel_testGate )
261     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 388 , 388 )
262     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 389 , 597 )
263     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1441 , 604 )
264     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1441 , 199 )
265     
266     Lcontrol_div2Gatelabel_beginGate = GraphGOTO1.Link( Ocontrol_div2Gate , Ilabel_beginGate )
267     Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 4 , 388 )
268     Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 3 , 587 )
269     Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 1307 , 586 )
270     Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 1307 , 528 )
271     
272     # Input datas
273     Ilabel_beginNB.Input( 7 )
274     Ilabel_beginKB.Input( 0 )
275     
276     # Output Ports of the graph
277     #OtestIncr = test.GetOutPort( 'Incr' )
278     #OEndSwitch_OneEvenFinished = EndSwitch_OneEven.GetOutPort( 'Finished' )
279     #OEndSwitch_OneEvenK = EndSwitch_OneEven.GetOutPort( 'K' )
280     return GraphGOTO1
281
282
283 GraphGOTO1 = DefGraphGOTO1()