Salome HOME
b9d18a891e580f51495d8e6bd3325b5b1986b99c
[samples/datafiles.git] / Superv / Python / GraphGOTO.py
1 # Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 # Generated python file of Graph GraphGOTO_2
24 #
25 from SuperV import *
26
27 # Graph creation of GraphGOTO
28 def DefGraphGOTO() :
29     GraphGOTO = Graph( 'GraphGOTO' )
30     GraphGOTO.SetName( 'GraphGOTO' )
31     GraphGOTO.SetAuthor( 'JR' )
32     GraphGOTO.SetComment( 'Syracuse algorithm' )
33     GraphGOTO.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     test_ISEVEN = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
38     test_ISEVEN.SetName( 'test_ISEVEN' )
39     test_ISEVEN.SetAuthor( '' )
40     test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
41     test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
42     test_ISEVEN.Coords( 204 , 420 )
43     Itest_ISEVENanInteger = test_ISEVEN.GetInPort( 'anInteger' )
44     Itest_ISEVENGate = test_ISEVEN.GetInPort( 'Gate' )
45     Otest_ISEVENBoolEven = test_ISEVEN.GetOutPort( 'BoolEven' )
46     Otest_ISEVENGate = test_ISEVEN.GetOutPort( 'Gate' )
47     
48     test_ISONE = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
49     test_ISONE.SetName( 'test_ISONE' )
50     test_ISONE.SetAuthor( '' )
51     test_ISONE.SetContainer( 'localhost/FactoryServer' )
52     test_ISONE.SetComment( 'C_ISONE from SyrComponent' )
53     test_ISONE.Coords( 208 , 155 )
54     Itest_ISONEanInteger = test_ISONE.GetInPort( 'anInteger' )
55     Itest_ISONEGate = test_ISONE.GetInPort( 'Gate' )
56     Otest_ISONEBoolOne = test_ISONE.GetOutPort( 'BoolOne' )
57     Otest_ISONEGate = test_ISONE.GetOutPort( 'Gate' )
58     
59     m3p1 = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
60     m3p1.SetName( 'm3p1' )
61     m3p1.SetAuthor( '' )
62     m3p1.SetContainer( 'localhost/FactoryServer' )
63     m3p1.SetComment( 'C_M3P1 from SyrComponent' )
64     m3p1.Coords( 861 , 46 )
65     Im3p1anOddInteger = m3p1.GetInPort( 'anOddInteger' )
66     Im3p1Gate = m3p1.GetInPort( 'Gate' )
67     Om3p1anEvenInteger = m3p1.GetOutPort( 'anEvenInteger' )
68     Om3p1Gate = m3p1.GetOutPort( 'Gate' )
69     
70     div2 = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
71     div2.SetName( 'div2' )
72     div2.SetAuthor( '' )
73     div2.SetContainer( 'localhost/FactoryServer' )
74     div2.SetComment( 'C_DIV2 from SyrComponent' )
75     div2.Coords( 858 , 466 )
76     Idiv2anEvenInteger = div2.GetInPort( 'anEvenInteger' )
77     Idiv2Gate = div2.GetInPort( 'Gate' )
78     Odiv2anInteger = div2.GetOutPort( 'anInteger' )
79     Odiv2Gate = div2.GetOutPort( 'Gate' )
80     
81     incr = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
82     incr.SetName( 'incr' )
83     incr.SetAuthor( '' )
84     incr.SetContainer( 'localhost/FactoryServer' )
85     incr.SetComment( 'C_INCR from SyrComponent' )
86     incr.Coords( 865 , 169 )
87     IincraCount = incr.GetInPort( 'aCount' )
88     IincrGate = incr.GetInPort( 'Gate' )
89     OincraNewCount = incr.GetOutPort( 'aNewCount' )
90     OincrGate = incr.GetOutPort( 'Gate' )
91     
92     incr_1 = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
93     incr_1.SetName( 'incr_1' )
94     incr_1.SetAuthor( '' )
95     incr_1.SetContainer( 'localhost/FactoryServer' )
96     incr_1.SetComment( 'C_INCR from SyrComponent' )
97     incr_1.Coords( 859 , 338 )
98     Iincr_1aCount = incr_1.GetInPort( 'aCount' )
99     Iincr_1Gate = incr_1.GetInPort( 'Gate' )
100     Oincr_1aNewCount = incr_1.GetOutPort( 'aNewCount' )
101     Oincr_1Gate = incr_1.GetOutPort( 'Gate' )
102     
103     # Creation of InLine Nodes
104     Pylabel_begin = []
105     Pylabel_begin.append( 'def label_begin( NB , KB ):' )
106     Pylabel_begin.append( '    print "label_begin",NB,KB' )
107     Pylabel_begin.append( '    return NB,KB' )
108     label_begin = GraphGOTO.INode( 'label_begin' , Pylabel_begin )
109     label_begin.SetName( 'label_begin' )
110     label_begin.SetAuthor( '' )
111     label_begin.SetComment( 'Python function' )
112     label_begin.Coords( 10 , 260 )
113     Ilabel_beginNB = label_begin.InPort( 'NB' , 'long' )
114     Ilabel_beginKB = label_begin.InPort( 'KB' , 'long' )
115     Ilabel_beginGate = label_begin.GetInPort( 'Gate' )
116     Olabel_beginNT = label_begin.OutPort( 'NT' , 'long' )
117     Olabel_beginKT = label_begin.OutPort( 'KT' , 'long' )
118     Olabel_beginGate = label_begin.GetOutPort( 'Gate' )
119     
120     Pylabel_test = []
121     Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' )
122     Pylabel_test.append( '    print "label_begin",ValEven,ValOne,NB,KB' )
123     Pylabel_test.append( '    return ValEven,ValOne,NB,KB' )
124     label_test = GraphGOTO.INode( 'label_test' , Pylabel_test )
125     label_test.SetName( 'label_test' )
126     label_test.SetAuthor( '' )
127     label_test.SetComment( 'Python function' )
128     label_test.Coords( 400 , 220 )
129     Ilabel_testValEven = label_test.InPort( 'ValEven' , 'long' )
130     Ilabel_testValOne = label_test.InPort( 'ValOne' , 'long' )
131     Ilabel_testNT = label_test.InPort( 'NT' , 'long' )
132     Ilabel_testKT = label_test.InPort( 'KT' , 'long' )
133     Ilabel_testGate = label_test.GetInPort( 'Gate' )
134     Olabel_testValEven = label_test.OutPort( 'ValEven' , 'long' )
135     Olabel_testValOne = label_test.OutPort( 'ValOne' , 'long' )
136     Olabel_testNT = label_test.OutPort( 'NT' , 'long' )
137     Olabel_testKT = label_test.OutPort( 'KT' , 'long' )
138     Olabel_testGate = label_test.GetOutPort( 'Gate' )
139     
140     # Creation of Switch Nodes
141     Pytest = []
142     Pytest.append( 'def Switch_OneEven( ValOne , ValEven , NT , KT ) :' )
143     Pytest.append( '    Finished = ValOne' )
144     Pytest.append( '    if Finished == 0 :' )
145     Pytest.append( '        Incr = 1' )
146     Pytest.append( '        Even = ValEven' )
147     Pytest.append( '        if Even == 0 :' )
148     Pytest.append( '            Odd = 1' )
149     Pytest.append( '        else :' )
150     Pytest.append( '            Odd = 0' )
151     Pytest.append( '    else :' )
152     Pytest.append( '        Incr = 0' )
153     Pytest.append( '        Even = 0' )
154     Pytest.append( '        Odd = 0' )
155     Pytest.append( '    Even = ValEven' )
156     Pytest.append( '    return Finished,Incr,Even,Odd,NT,KT' )
157     test,EndSwitch_OneEven = GraphGOTO.SNode( 'Switch_OneEven' , Pytest )
158     EndSwitch_OneEven.SetName( 'EndSwitch_OneEven' )
159     EndSwitch_OneEven.SetAuthor( '' )
160     EndSwitch_OneEven.SetComment( 'Compute Node' )
161     EndSwitch_OneEven.Coords( 1331 , 310 )
162     PyEndSwitch_OneEven = []
163     PyEndSwitch_OneEven.append( 'def EndSwitch_OneEven( Finished , K ):' )
164     PyEndSwitch_OneEven.append( '    print "label_begin",Finished,K' )
165     PyEndSwitch_OneEven.append( '    return Finished,K' )
166     EndSwitch_OneEven.SetPyFunction( 'EndSwitch_OneEven' , PyEndSwitch_OneEven )
167     IEndSwitch_OneEvenFinished = EndSwitch_OneEven.InPort( 'Finished' , 'long' )
168     IEndSwitch_OneEvenK = EndSwitch_OneEven.InPort( 'K' , 'long' )
169     IEndSwitch_OneEvenDefault = EndSwitch_OneEven.GetInPort( 'Default' )
170     OEndSwitch_OneEvenFinished = EndSwitch_OneEven.OutPort( 'Finished' , 'long' )
171     OEndSwitch_OneEvenK = EndSwitch_OneEven.OutPort( 'K' , 'long' )
172     OEndSwitch_OneEvenGate = EndSwitch_OneEven.GetOutPort( 'Gate' )
173     test.SetName( 'test' )
174     test.SetAuthor( '' )
175     test.SetComment( 'Compute Node' )
176     test.Coords( 596 , 260 )
177     ItestValOne = test.InPort( 'ValOne' , 'long' )
178     ItestValEven = test.InPort( 'ValEven' , 'long' )
179     ItestNT = test.InPort( 'NT' , 'long' )
180     ItestKT = test.InPort( 'KT' , 'long' )
181     ItestGate = test.GetInPort( 'Gate' )
182     OtestFinished = test.OutPort( 'Finished' , 'long' )
183     OtestIncr = test.OutPort( 'Incr' , 'long' )
184     OtestEven = test.OutPort( 'Even' , 'long' )
185     OtestOdd = test.OutPort( 'Odd' , 'long' )
186     OtestN = test.OutPort( 'N' , 'long' )
187     OtestK = test.OutPort( 'K' , 'long' )
188     OtestDefault = test.GetOutPort( 'Default' )
189     
190     # Creation of GOTO Nodes
191     Pycontrol_m3p1 = []
192     Pycontrol_m3p1.append( 'def control_m3p1( N , K ):' )
193     Pycontrol_m3p1.append( '    return 0,1,N,K' )
194     control_m3p1 = GraphGOTO.GNode( 'control_m3p1' , Pycontrol_m3p1 , 'label_test' )
195     control_m3p1.SetName( 'control_m3p1' )
196     control_m3p1.SetAuthor( '' )
197     control_m3p1.SetComment( 'Compute Node' )
198     control_m3p1.Coords( 1073 , 86 )
199     Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' )
200     Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' )
201     Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' )
202     Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' )
203     Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' )
204     Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' )
205     Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' )
206     Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' )
207     
208     Pycontrol_div2 = []
209     Pycontrol_div2.append( 'def control_div2( N , NB ) :' )
210     Pycontrol_div2.append( '    return N,NB' )
211     control_div2 = GraphGOTO.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
212     control_div2.SetName( 'control_div2' )
213     control_div2.SetAuthor( '' )
214     control_div2.SetComment( 'Compute Node' )
215     control_div2.Coords( 1128 , 453 )
216     Icontrol_div2N = control_div2.InPort( 'N' , 'long' )
217     Icontrol_div2K = control_div2.InPort( 'K' , 'long' )
218     Icontrol_div2Gate = control_div2.GetInPort( 'Gate' )
219     Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' )
220     Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' )
221     Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' )
222     
223     # Creation of Links
224     Ltest_ISEVENBoolEvenlabel_testValEven = GraphGOTO.Link( Otest_ISEVENBoolEven , Ilabel_testValEven )
225     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 374 , 290 )
226     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 374 , 491 )
227     
228     Ltest_ISONEBoolOnelabel_testValOne = GraphGOTO.Link( Otest_ISONEBoolOne , Ilabel_testValOne )
229     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 1 , 385 , 311 )
230     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 2 , 385 , 226 )
231     
232     Lm3p1anEvenIntegercontrol_m3p1N = GraphGOTO.Link( Om3p1anEvenInteger , Icontrol_m3p1N )
233     
234     Ldiv2anIntegercontrol_div2N = GraphGOTO.Link( Odiv2anInteger , Icontrol_div2N )
235     
236     LincraNewCountcontrol_m3p1K = GraphGOTO.Link( OincraNewCount , Icontrol_m3p1K )
237     LincraNewCountcontrol_m3p1K.AddCoord( 1 , 1048 , 135 )
238     LincraNewCountcontrol_m3p1K.AddCoord( 2 , 1048 , 241 )
239     
240     Lincr_1aNewCountcontrol_div2K = GraphGOTO.Link( Oincr_1aNewCount , Icontrol_div2K )
241     
242     Llabel_beginNTlabel_testNT = GraphGOTO.Link( Olabel_beginNT , Ilabel_testNT )
243     
244     Llabel_beginNTtest_ISONEanInteger = GraphGOTO.Link( Olabel_beginNT , Itest_ISONEanInteger )
245     Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 191 , 225 )
246     Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 191 , 331 )
247     
248     Llabel_beginNTtest_ISEVENanInteger = GraphGOTO.Link( Olabel_beginNT , Itest_ISEVENanInteger )
249     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 190 , 491 )
250     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 190 , 331 )
251     
252     Llabel_beginKTlabel_testKT = GraphGOTO.Link( Olabel_beginKT , Ilabel_testKT )
253     
254     Llabel_testValEventestValEven = GraphGOTO.Link( Olabel_testValEven , ItestValEven )
255     
256     Llabel_testValOnetestValOne = GraphGOTO.Link( Olabel_testValOne , ItestValOne )
257     
258     Llabel_testNTtestNT = GraphGOTO.Link( Olabel_testNT , ItestNT )
259     
260     Llabel_testKTtestKT = GraphGOTO.Link( Olabel_testKT , ItestKT )
261     
262     LtestFinishedEndSwitch_OneEvenFinished = GraphGOTO.Link( OtestFinished , IEndSwitch_OneEvenFinished )
263     
264     LtestEvenincr_1Gate = GraphGOTO.Link( OtestEven , Iincr_1Gate )
265     
266     LtestEvendiv2Gate = GraphGOTO.Link( OtestEven , Idiv2Gate )
267     
268     LtestOddincrGate = GraphGOTO.Link( OtestOdd , IincrGate )
269     
270     LtestOddm3p1Gate = GraphGOTO.Link( OtestOdd , Im3p1Gate )
271     
272     LtestNm3p1anOddInteger = GraphGOTO.Link( OtestN , Im3p1anOddInteger )
273     LtestNm3p1anOddInteger.AddCoord( 1 , 808 , 116 )
274     LtestNm3p1anOddInteger.AddCoord( 2 , 806 , 372 )
275     
276     LtestNdiv2anEvenInteger = GraphGOTO.Link( OtestN , Idiv2anEvenInteger )
277     LtestNdiv2anEvenInteger.AddCoord( 1 , 806 , 537 )
278     LtestNdiv2anEvenInteger.AddCoord( 2 , 806 , 373 )
279     
280     LtestKEndSwitch_OneEvenK = GraphGOTO.Link( OtestK , IEndSwitch_OneEvenK )
281     
282     LtestKincraCount = GraphGOTO.Link( OtestK , IincraCount )
283     
284     LtestKincr_1aCount = GraphGOTO.Link( OtestK , Iincr_1aCount )
285     
286     LtestDefaultEndSwitch_OneEvenDefault = GraphGOTO.Link( OtestDefault , IEndSwitch_OneEvenDefault )
287     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 1 , 1319 , 385 )
288     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 2 , 1319 , 577 )
289     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 3 , 779 , 577 )
290     LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 4 , 778 , 415 )
291     
292     Lcontrol_m3p1Gatelabel_testGate = GraphGOTO.Link( Ocontrol_m3p1Gate , Ilabel_testGate )
293     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 389 , 375 )
294     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 389 , 597 )
295     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1519 , 602 )
296     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1508 , 201 )
297     
298     Lcontrol_div2Gatelabel_beginGate = GraphGOTO.Link( Ocontrol_div2Gate , Ilabel_beginGate )
299     Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 3 , 373 )
300     Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 3 , 587 )
301     Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 1307 , 586 )
302     Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 1307 , 528 )
303     
304     # Input datas
305     Ilabel_beginNB.Input( 7 )
306     Ilabel_beginKB.Input( 0 )
307     
308     # Output Ports of the graph
309     #OtestIncr = test.GetOutPort( 'Incr' )
310     #OEndSwitch_OneEvenFinished = EndSwitch_OneEven.GetOutPort( 'Finished' )
311     #OEndSwitch_OneEvenK = EndSwitch_OneEven.GetOutPort( 'K' )
312     return GraphGOTO
313
314
315 GraphGOTO = DefGraphGOTO()
316
317 GraphGOTO.Run()
318 GraphGOTO.DoneW()
319 GraphGOTO.State()
320 GraphGOTO.PrintPorts()