Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphGOTO.py
1
2 # Generated python file of Graph GraphGOTO_2
3
4 from SuperV import *
5
6 # Graph creation of GraphGOTO
7 def DefGraphGOTO() :
8     GraphGOTO = Graph( 'GraphGOTO' )
9     GraphGOTO.SetName( 'GraphGOTO' )
10     GraphGOTO.SetAuthor( 'JR' )
11     GraphGOTO.SetComment( 'Syracuse algorithm' )
12     GraphGOTO.Coords( 0 , 0 )
13     
14     # Creation of Factory Nodes
15     
16     test_ISEVEN = GraphGOTO.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( 204 , 420 )
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 = GraphGOTO.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( 208 , 155 )
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 = GraphGOTO.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 = GraphGOTO.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 = GraphGOTO.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     incr_1 = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
72     incr_1.SetName( 'incr_1' )
73     incr_1.SetAuthor( '' )
74     incr_1.SetContainer( 'localhost/FactoryServer' )
75     incr_1.SetComment( 'C_INCR from SyrComponent' )
76     incr_1.Coords( 859 , 338 )
77     Iincr_1aCount = incr_1.GetInPort( 'aCount' )
78     Iincr_1Gate = incr_1.GetInPort( 'Gate' )
79     Oincr_1aNewCount = incr_1.GetOutPort( 'aNewCount' )
80     Oincr_1Gate = incr_1.GetOutPort( 'Gate' )
81     
82     # Creation of InLine Nodes
83     Pylabel_begin = []
84     Pylabel_begin.append( 'def label_begin( NB , KB ):' )
85     Pylabel_begin.append( '    print "label_begin",NB,KB' )
86     Pylabel_begin.append( '    return NB,KB' )
87     label_begin = GraphGOTO.INode( 'label_begin' , Pylabel_begin )
88     label_begin.SetName( 'label_begin' )
89     label_begin.SetAuthor( '' )
90     label_begin.SetComment( 'Python function' )
91     label_begin.Coords( 10 , 260 )
92     Ilabel_beginNB = label_begin.InPort( 'NB' , 'long' )
93     Ilabel_beginKB = label_begin.InPort( 'KB' , 'long' )
94     Ilabel_beginGate = label_begin.GetInPort( 'Gate' )
95     Olabel_beginNT = label_begin.OutPort( 'NT' , 'long' )
96     Olabel_beginKT = label_begin.OutPort( 'KT' , 'long' )
97     Olabel_beginGate = label_begin.GetOutPort( 'Gate' )
98     
99     Pylabel_test = []
100     Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' )
101     Pylabel_test.append( '    print "label_begin",ValEven,ValOne,NB,KB' )
102     Pylabel_test.append( '    return ValEven,ValOne,NB,KB' )
103     label_test = GraphGOTO.INode( 'label_test' , Pylabel_test )
104     label_test.SetName( 'label_test' )
105     label_test.SetAuthor( '' )
106     label_test.SetComment( 'Python function' )
107     label_test.Coords( 400 , 220 )
108     Ilabel_testValEven = label_test.InPort( 'ValEven' , 'long' )
109     Ilabel_testValOne = label_test.InPort( 'ValOne' , 'long' )
110     Ilabel_testNT = label_test.InPort( 'NT' , 'long' )
111     Ilabel_testKT = label_test.InPort( 'KT' , 'long' )
112     Ilabel_testGate = label_test.GetInPort( 'Gate' )
113     Olabel_testValEven = label_test.OutPort( 'ValEven' , 'long' )
114     Olabel_testValOne = label_test.OutPort( 'ValOne' , 'long' )
115     Olabel_testNT = label_test.OutPort( 'NT' , 'long' )
116     Olabel_testKT = label_test.OutPort( 'KT' , 'long' )
117     Olabel_testGate = label_test.GetOutPort( 'Gate' )
118     
119     # Creation of Switch Nodes
120     Pytest = []
121     Pytest.append( 'def Switch_OneEven( ValOne , ValEven , NT , KT ) :' )
122     Pytest.append( '    Finished = ValOne' )
123     Pytest.append( '    if Finished == 0 :' )
124     Pytest.append( '        Incr = 1' )
125     Pytest.append( '        Even = ValEven' )
126     Pytest.append( '        if Even == 0 :' )
127     Pytest.append( '            Odd = 1' )
128     Pytest.append( '        else :' )
129     Pytest.append( '            Odd = 0' )
130     Pytest.append( '    else :' )
131     Pytest.append( '        Incr = 0' )
132     Pytest.append( '        Even = 0' )
133     Pytest.append( '        Odd = 0' )
134     Pytest.append( '    Even = ValEven' )
135     Pytest.append( '    return Finished,Incr,Even,Odd,NT,KT' )
136     test,EndSwitch_OneEven = GraphGOTO.SNode( 'Switch_OneEven' , Pytest )
137     EndSwitch_OneEven.SetName( 'EndSwitch_OneEven' )
138     EndSwitch_OneEven.SetAuthor( '' )
139     EndSwitch_OneEven.SetComment( 'Compute Node' )
140     EndSwitch_OneEven.Coords( 1331 , 310 )
141     PyEndSwitch_OneEven = []
142     PyEndSwitch_OneEven.append( 'def EndSwitch_OneEven( Finished , K ):' )
143     PyEndSwitch_OneEven.append( '    print "label_begin",Finished,K' )
144     PyEndSwitch_OneEven.append( '    return Finished,K' )
145     EndSwitch_OneEven.SetPyFunction( 'EndSwitch_OneEven' , PyEndSwitch_OneEven )
146     IEndSwitch_OneEvenFinished = EndSwitch_OneEven.InPort( 'Finished' , 'long' )
147     IEndSwitch_OneEvenK = EndSwitch_OneEven.InPort( 'K' , 'long' )
148     IEndSwitch_OneEvenDefault = EndSwitch_OneEven.GetInPort( 'Default' )
149     OEndSwitch_OneEvenFinished = EndSwitch_OneEven.OutPort( 'Finished' , 'long' )
150     OEndSwitch_OneEvenK = EndSwitch_OneEven.OutPort( 'K' , 'long' )
151     OEndSwitch_OneEvenGate = EndSwitch_OneEven.GetOutPort( 'Gate' )
152     test.SetName( 'test' )
153     test.SetAuthor( '' )
154     test.SetComment( 'Compute Node' )
155     test.Coords( 596 , 260 )
156     ItestValOne = test.InPort( 'ValOne' , 'long' )
157     ItestValEven = test.InPort( 'ValEven' , 'long' )
158     ItestNT = test.InPort( 'NT' , 'long' )
159     ItestKT = test.InPort( 'KT' , 'long' )
160     ItestGate = test.GetInPort( 'Gate' )
161     OtestFinished = test.OutPort( 'Finished' , 'long' )
162     OtestIncr = test.OutPort( 'Incr' , 'long' )
163     OtestEven = test.OutPort( 'Even' , 'long' )
164     OtestOdd = test.OutPort( 'Odd' , 'long' )
165     OtestN = test.OutPort( 'N' , 'long' )
166     OtestK = test.OutPort( 'K' , 'long' )
167     OtestDefault = test.GetOutPort( 'Default' )
168     
169     # Creation of GOTO Nodes
170     Pycontrol_m3p1 = []
171     Pycontrol_m3p1.append( 'def control_m3p1( N , K ):' )
172     Pycontrol_m3p1.append( '    return 0,1,N,K' )
173     control_m3p1 = GraphGOTO.GNode( 'control_m3p1' , Pycontrol_m3p1 , 'label_test' )
174     control_m3p1.SetName( 'control_m3p1' )
175     control_m3p1.SetAuthor( '' )
176     control_m3p1.SetComment( 'Compute Node' )
177     control_m3p1.Coords( 1073 , 86 )
178     Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' )
179     Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' )
180     Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' )
181     Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' )
182     Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' )
183     Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' )
184     Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' )
185     Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' )
186     
187     Pycontrol_div2 = []
188     Pycontrol_div2.append( 'def control_div2( N , NB ) :' )
189     Pycontrol_div2.append( '    return N,NB' )
190     control_div2 = GraphGOTO.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
191     control_div2.SetName( 'control_div2' )
192     control_div2.SetAuthor( '' )
193     control_div2.SetComment( 'Compute Node' )
194     control_div2.Coords( 1128 , 453 )
195     Icontrol_div2N = control_div2.InPort( 'N' , 'long' )
196     Icontrol_div2K = control_div2.InPort( 'K' , 'long' )
197     Icontrol_div2Gate = control_div2.GetInPort( 'Gate' )
198     Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' )
199     Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' )
200     Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' )
201     
202     # Creation of Links
203     Ltest_ISEVENBoolEvenlabel_testValEven = GraphGOTO.Link( Otest_ISEVENBoolEven , Ilabel_testValEven )
204     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 374 , 290 )
205     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 374 , 491 )
206     
207     Ltest_ISONEBoolOnelabel_testValOne = GraphGOTO.Link( Otest_ISONEBoolOne , Ilabel_testValOne )
208     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 1 , 385 , 311 )
209     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 2 , 385 , 226 )
210     
211     Lm3p1anEvenIntegercontrol_m3p1N = GraphGOTO.Link( Om3p1anEvenInteger , Icontrol_m3p1N )
212     
213     Ldiv2anIntegercontrol_div2N = GraphGOTO.Link( Odiv2anInteger , Icontrol_div2N )
214     
215     LincraNewCountcontrol_m3p1K = GraphGOTO.Link( OincraNewCount , Icontrol_m3p1K )
216     LincraNewCountcontrol_m3p1K.AddCoord( 1 , 1048 , 135 )
217     LincraNewCountcontrol_m3p1K.AddCoord( 2 , 1048 , 241 )
218     
219     Lincr_1aNewCountcontrol_div2K = GraphGOTO.Link( Oincr_1aNewCount , Icontrol_div2K )
220     
221     Llabel_beginNTlabel_testNT = GraphGOTO.Link( Olabel_beginNT , Ilabel_testNT )
222     
223     Llabel_beginNTtest_ISONEanInteger = GraphGOTO.Link( Olabel_beginNT , Itest_ISONEanInteger )
224     Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 191 , 225 )
225     Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 191 , 331 )
226     
227     Llabel_beginNTtest_ISEVENanInteger = GraphGOTO.Link( Olabel_beginNT , Itest_ISEVENanInteger )
228     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 190 , 491 )
229     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 190 , 331 )
230     
231     Llabel_beginKTlabel_testKT = GraphGOTO.Link( Olabel_beginKT , Ilabel_testKT )
232     
233     Llabel_testValEventestValEven = GraphGOTO.Link( Olabel_testValEven , ItestValEven )
234     
235     Llabel_testValOnetestValOne = GraphGOTO.Link( Olabel_testValOne , ItestValOne )
236     
237     Llabel_testNTtestNT = GraphGOTO.Link( Olabel_testNT , ItestNT )
238     
239     Llabel_testKTtestKT = GraphGOTO.Link( Olabel_testKT , ItestKT )
240     
241     LtestFinishedEndSwitch_OneEvenFinished = GraphGOTO.Link( OtestFinished , IEndSwitch_OneEvenFinished )
242     
243     LtestEvenincr_1Gate = GraphGOTO.Link( OtestEven , Iincr_1Gate )
244     
245     LtestEvendiv2Gate = GraphGOTO.Link( OtestEven , Idiv2Gate )
246     
247     LtestOddincrGate = GraphGOTO.Link( OtestOdd , IincrGate )
248     
249     LtestOddm3p1Gate = GraphGOTO.Link( OtestOdd , Im3p1Gate )
250     
251     LtestNm3p1anOddInteger = GraphGOTO.Link( OtestN , Im3p1anOddInteger )
252     LtestNm3p1anOddInteger.AddCoord( 1 , 808 , 116 )
253     LtestNm3p1anOddInteger.AddCoord( 2 , 806 , 372 )
254     
255     LtestNdiv2anEvenInteger = GraphGOTO.Link( OtestN , Idiv2anEvenInteger )
256     LtestNdiv2anEvenInteger.AddCoord( 1 , 806 , 537 )
257     LtestNdiv2anEvenInteger.AddCoord( 2 , 806 , 373 )
258     
259     LtestKEndSwitch_OneEvenK = GraphGOTO.Link( OtestK , IEndSwitch_OneEvenK )
260     
261     LtestKincraCount = GraphGOTO.Link( OtestK , IincraCount )
262     
263     LtestKincr_1aCount = GraphGOTO.Link( OtestK , Iincr_1aCount )
264     
265     LtestDefaultEndSwitch_OneEvenDefault = GraphGOTO.Link( OtestDefault , IEndSwitch_OneEvenDefault )
266     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 1 , 1319 , 385 )
267     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 2 , 1319 , 577 )
268     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 3 , 779 , 577 )
269     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 4 , 778 , 415 )
270     
271     Lcontrol_m3p1Gatelabel_testGate = GraphGOTO.Link( Ocontrol_m3p1Gate , Ilabel_testGate )
272     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 389 , 375 )
273     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 389 , 597 )
274     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1519 , 602 )
275     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1508 , 201 )
276     
277     Lcontrol_div2Gatelabel_beginGate = GraphGOTO.Link( Ocontrol_div2Gate , Ilabel_beginGate )
278     Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 3 , 373 )
279     Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 3 , 587 )
280     Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 1307 , 586 )
281     Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 1307 , 528 )
282     
283     # Input datas
284     Ilabel_beginNB.Input( 7 )
285     Ilabel_beginKB.Input( 0 )
286     
287     # Output Ports of the graph
288     #OtestIncr = test.GetOutPort( 'Incr' )
289     #OEndSwitch_OneEvenFinished = EndSwitch_OneEven.GetOutPort( 'Finished' )
290     #OEndSwitch_OneEvenK = EndSwitch_OneEven.GetOutPort( 'K' )
291     return GraphGOTO
292
293
294 GraphGOTO = DefGraphGOTO()
295
296 GraphGOTO.Run()
297 GraphGOTO.DoneW()
298 GraphGOTO.State()
299 GraphGOTO.PrintPorts()