1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Generated python file of Graph GraphGOTO_2
26 # Graph creation of GraphGOTO
28 GraphGOTO = Graph( 'GraphGOTO' )
29 GraphGOTO.SetName( 'GraphGOTO' )
30 GraphGOTO.SetAuthor( 'JR' )
31 GraphGOTO.SetComment( 'Syracuse algorithm' )
32 GraphGOTO.Coords( 0 , 0 )
34 # Creation of Factory Nodes
36 test_ISEVEN = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
37 test_ISEVEN.SetName( 'test_ISEVEN' )
38 test_ISEVEN.SetAuthor( '' )
39 test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
40 test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
41 test_ISEVEN.Coords( 204 , 420 )
42 Itest_ISEVENanInteger = test_ISEVEN.GetInPort( 'anInteger' )
43 Itest_ISEVENGate = test_ISEVEN.GetInPort( 'Gate' )
44 Otest_ISEVENBoolEven = test_ISEVEN.GetOutPort( 'BoolEven' )
45 Otest_ISEVENGate = test_ISEVEN.GetOutPort( 'Gate' )
47 test_ISONE = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
48 test_ISONE.SetName( 'test_ISONE' )
49 test_ISONE.SetAuthor( '' )
50 test_ISONE.SetContainer( 'localhost/FactoryServer' )
51 test_ISONE.SetComment( 'C_ISONE from SyrComponent' )
52 test_ISONE.Coords( 208 , 155 )
53 Itest_ISONEanInteger = test_ISONE.GetInPort( 'anInteger' )
54 Itest_ISONEGate = test_ISONE.GetInPort( 'Gate' )
55 Otest_ISONEBoolOne = test_ISONE.GetOutPort( 'BoolOne' )
56 Otest_ISONEGate = test_ISONE.GetOutPort( 'Gate' )
58 m3p1 = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
59 m3p1.SetName( 'm3p1' )
61 m3p1.SetContainer( 'localhost/FactoryServer' )
62 m3p1.SetComment( 'C_M3P1 from SyrComponent' )
63 m3p1.Coords( 861 , 46 )
64 Im3p1anOddInteger = m3p1.GetInPort( 'anOddInteger' )
65 Im3p1Gate = m3p1.GetInPort( 'Gate' )
66 Om3p1anEvenInteger = m3p1.GetOutPort( 'anEvenInteger' )
67 Om3p1Gate = m3p1.GetOutPort( 'Gate' )
69 div2 = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
70 div2.SetName( 'div2' )
72 div2.SetContainer( 'localhost/FactoryServer' )
73 div2.SetComment( 'C_DIV2 from SyrComponent' )
74 div2.Coords( 858 , 466 )
75 Idiv2anEvenInteger = div2.GetInPort( 'anEvenInteger' )
76 Idiv2Gate = div2.GetInPort( 'Gate' )
77 Odiv2anInteger = div2.GetOutPort( 'anInteger' )
78 Odiv2Gate = div2.GetOutPort( 'Gate' )
80 incr = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
81 incr.SetName( 'incr' )
83 incr.SetContainer( 'localhost/FactoryServer' )
84 incr.SetComment( 'C_INCR from SyrComponent' )
85 incr.Coords( 865 , 169 )
86 IincraCount = incr.GetInPort( 'aCount' )
87 IincrGate = incr.GetInPort( 'Gate' )
88 OincraNewCount = incr.GetOutPort( 'aNewCount' )
89 OincrGate = incr.GetOutPort( 'Gate' )
91 incr_1 = GraphGOTO.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
92 incr_1.SetName( 'incr_1' )
93 incr_1.SetAuthor( '' )
94 incr_1.SetContainer( 'localhost/FactoryServer' )
95 incr_1.SetComment( 'C_INCR from SyrComponent' )
96 incr_1.Coords( 859 , 338 )
97 Iincr_1aCount = incr_1.GetInPort( 'aCount' )
98 Iincr_1Gate = incr_1.GetInPort( 'Gate' )
99 Oincr_1aNewCount = incr_1.GetOutPort( 'aNewCount' )
100 Oincr_1Gate = incr_1.GetOutPort( 'Gate' )
102 # Creation of InLine Nodes
104 Pylabel_begin.append( 'def label_begin( NB , KB ):' )
105 Pylabel_begin.append( ' print "label_begin",NB,KB' )
106 Pylabel_begin.append( ' return NB,KB' )
107 label_begin = GraphGOTO.INode( 'label_begin' , Pylabel_begin )
108 label_begin.SetName( 'label_begin' )
109 label_begin.SetAuthor( '' )
110 label_begin.SetComment( 'Python function' )
111 label_begin.Coords( 10 , 260 )
112 Ilabel_beginNB = label_begin.InPort( 'NB' , 'long' )
113 Ilabel_beginKB = label_begin.InPort( 'KB' , 'long' )
114 Ilabel_beginGate = label_begin.GetInPort( 'Gate' )
115 Olabel_beginNT = label_begin.OutPort( 'NT' , 'long' )
116 Olabel_beginKT = label_begin.OutPort( 'KT' , 'long' )
117 Olabel_beginGate = label_begin.GetOutPort( 'Gate' )
120 Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' )
121 Pylabel_test.append( ' print "label_begin",ValEven,ValOne,NB,KB' )
122 Pylabel_test.append( ' return ValEven,ValOne,NB,KB' )
123 label_test = GraphGOTO.INode( 'label_test' , Pylabel_test )
124 label_test.SetName( 'label_test' )
125 label_test.SetAuthor( '' )
126 label_test.SetComment( 'Python function' )
127 label_test.Coords( 400 , 220 )
128 Ilabel_testValEven = label_test.InPort( 'ValEven' , 'long' )
129 Ilabel_testValOne = label_test.InPort( 'ValOne' , 'long' )
130 Ilabel_testNT = label_test.InPort( 'NT' , 'long' )
131 Ilabel_testKT = label_test.InPort( 'KT' , 'long' )
132 Ilabel_testGate = label_test.GetInPort( 'Gate' )
133 Olabel_testValEven = label_test.OutPort( 'ValEven' , 'long' )
134 Olabel_testValOne = label_test.OutPort( 'ValOne' , 'long' )
135 Olabel_testNT = label_test.OutPort( 'NT' , 'long' )
136 Olabel_testKT = label_test.OutPort( 'KT' , 'long' )
137 Olabel_testGate = label_test.GetOutPort( 'Gate' )
139 # Creation of Switch Nodes
141 Pytest.append( 'def Switch_OneEven( ValOne , ValEven , NT , KT ) :' )
142 Pytest.append( ' Finished = ValOne' )
143 Pytest.append( ' if Finished == 0 :' )
144 Pytest.append( ' Incr = 1' )
145 Pytest.append( ' Even = ValEven' )
146 Pytest.append( ' if Even == 0 :' )
147 Pytest.append( ' Odd = 1' )
148 Pytest.append( ' else :' )
149 Pytest.append( ' Odd = 0' )
150 Pytest.append( ' else :' )
151 Pytest.append( ' Incr = 0' )
152 Pytest.append( ' Even = 0' )
153 Pytest.append( ' Odd = 0' )
154 Pytest.append( ' Even = ValEven' )
155 Pytest.append( ' return Finished,Incr,Even,Odd,NT,KT' )
156 test,EndSwitch_OneEven = GraphGOTO.SNode( 'Switch_OneEven' , Pytest )
157 EndSwitch_OneEven.SetName( 'EndSwitch_OneEven' )
158 EndSwitch_OneEven.SetAuthor( '' )
159 EndSwitch_OneEven.SetComment( 'Compute Node' )
160 EndSwitch_OneEven.Coords( 1331 , 310 )
161 PyEndSwitch_OneEven = []
162 PyEndSwitch_OneEven.append( 'def EndSwitch_OneEven( Finished , K ):' )
163 PyEndSwitch_OneEven.append( ' print "label_begin",Finished,K' )
164 PyEndSwitch_OneEven.append( ' return Finished,K' )
165 EndSwitch_OneEven.SetPyFunction( 'EndSwitch_OneEven' , PyEndSwitch_OneEven )
166 IEndSwitch_OneEvenFinished = EndSwitch_OneEven.InPort( 'Finished' , 'long' )
167 IEndSwitch_OneEvenK = EndSwitch_OneEven.InPort( 'K' , 'long' )
168 IEndSwitch_OneEvenDefault = EndSwitch_OneEven.GetInPort( 'Default' )
169 OEndSwitch_OneEvenFinished = EndSwitch_OneEven.OutPort( 'Finished' , 'long' )
170 OEndSwitch_OneEvenK = EndSwitch_OneEven.OutPort( 'K' , 'long' )
171 OEndSwitch_OneEvenGate = EndSwitch_OneEven.GetOutPort( 'Gate' )
172 test.SetName( 'test' )
174 test.SetComment( 'Compute Node' )
175 test.Coords( 596 , 260 )
176 ItestValOne = test.InPort( 'ValOne' , 'long' )
177 ItestValEven = test.InPort( 'ValEven' , 'long' )
178 ItestNT = test.InPort( 'NT' , 'long' )
179 ItestKT = test.InPort( 'KT' , 'long' )
180 ItestGate = test.GetInPort( 'Gate' )
181 OtestFinished = test.OutPort( 'Finished' , 'long' )
182 OtestIncr = test.OutPort( 'Incr' , 'long' )
183 OtestEven = test.OutPort( 'Even' , 'long' )
184 OtestOdd = test.OutPort( 'Odd' , 'long' )
185 OtestN = test.OutPort( 'N' , 'long' )
186 OtestK = test.OutPort( 'K' , 'long' )
187 OtestDefault = test.GetOutPort( 'Default' )
189 # Creation of GOTO Nodes
191 Pycontrol_m3p1.append( 'def control_m3p1( N , K ):' )
192 Pycontrol_m3p1.append( ' return 0,1,N,K' )
193 control_m3p1 = GraphGOTO.GNode( 'control_m3p1' , Pycontrol_m3p1 , 'label_test' )
194 control_m3p1.SetName( 'control_m3p1' )
195 control_m3p1.SetAuthor( '' )
196 control_m3p1.SetComment( 'Compute Node' )
197 control_m3p1.Coords( 1073 , 86 )
198 Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' )
199 Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' )
200 Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' )
201 Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' )
202 Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' )
203 Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' )
204 Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' )
205 Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' )
208 Pycontrol_div2.append( 'def control_div2( N , NB ) :' )
209 Pycontrol_div2.append( ' return N,NB' )
210 control_div2 = GraphGOTO.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
211 control_div2.SetName( 'control_div2' )
212 control_div2.SetAuthor( '' )
213 control_div2.SetComment( 'Compute Node' )
214 control_div2.Coords( 1128 , 453 )
215 Icontrol_div2N = control_div2.InPort( 'N' , 'long' )
216 Icontrol_div2K = control_div2.InPort( 'K' , 'long' )
217 Icontrol_div2Gate = control_div2.GetInPort( 'Gate' )
218 Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' )
219 Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' )
220 Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' )
223 Ltest_ISEVENBoolEvenlabel_testValEven = GraphGOTO.Link( Otest_ISEVENBoolEven , Ilabel_testValEven )
224 Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 374 , 290 )
225 Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 374 , 491 )
227 Ltest_ISONEBoolOnelabel_testValOne = GraphGOTO.Link( Otest_ISONEBoolOne , Ilabel_testValOne )
228 Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 1 , 385 , 311 )
229 Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 2 , 385 , 226 )
231 Lm3p1anEvenIntegercontrol_m3p1N = GraphGOTO.Link( Om3p1anEvenInteger , Icontrol_m3p1N )
233 Ldiv2anIntegercontrol_div2N = GraphGOTO.Link( Odiv2anInteger , Icontrol_div2N )
235 LincraNewCountcontrol_m3p1K = GraphGOTO.Link( OincraNewCount , Icontrol_m3p1K )
236 LincraNewCountcontrol_m3p1K.AddCoord( 1 , 1048 , 135 )
237 LincraNewCountcontrol_m3p1K.AddCoord( 2 , 1048 , 241 )
239 Lincr_1aNewCountcontrol_div2K = GraphGOTO.Link( Oincr_1aNewCount , Icontrol_div2K )
241 Llabel_beginNTlabel_testNT = GraphGOTO.Link( Olabel_beginNT , Ilabel_testNT )
243 Llabel_beginNTtest_ISONEanInteger = GraphGOTO.Link( Olabel_beginNT , Itest_ISONEanInteger )
244 Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 191 , 225 )
245 Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 191 , 331 )
247 Llabel_beginNTtest_ISEVENanInteger = GraphGOTO.Link( Olabel_beginNT , Itest_ISEVENanInteger )
248 Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 190 , 491 )
249 Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 190 , 331 )
251 Llabel_beginKTlabel_testKT = GraphGOTO.Link( Olabel_beginKT , Ilabel_testKT )
253 Llabel_testValEventestValEven = GraphGOTO.Link( Olabel_testValEven , ItestValEven )
255 Llabel_testValOnetestValOne = GraphGOTO.Link( Olabel_testValOne , ItestValOne )
257 Llabel_testNTtestNT = GraphGOTO.Link( Olabel_testNT , ItestNT )
259 Llabel_testKTtestKT = GraphGOTO.Link( Olabel_testKT , ItestKT )
261 LtestFinishedEndSwitch_OneEvenFinished = GraphGOTO.Link( OtestFinished , IEndSwitch_OneEvenFinished )
263 LtestEvenincr_1Gate = GraphGOTO.Link( OtestEven , Iincr_1Gate )
265 LtestEvendiv2Gate = GraphGOTO.Link( OtestEven , Idiv2Gate )
267 LtestOddincrGate = GraphGOTO.Link( OtestOdd , IincrGate )
269 LtestOddm3p1Gate = GraphGOTO.Link( OtestOdd , Im3p1Gate )
271 LtestNm3p1anOddInteger = GraphGOTO.Link( OtestN , Im3p1anOddInteger )
272 LtestNm3p1anOddInteger.AddCoord( 1 , 808 , 116 )
273 LtestNm3p1anOddInteger.AddCoord( 2 , 806 , 372 )
275 LtestNdiv2anEvenInteger = GraphGOTO.Link( OtestN , Idiv2anEvenInteger )
276 LtestNdiv2anEvenInteger.AddCoord( 1 , 806 , 537 )
277 LtestNdiv2anEvenInteger.AddCoord( 2 , 806 , 373 )
279 LtestKEndSwitch_OneEvenK = GraphGOTO.Link( OtestK , IEndSwitch_OneEvenK )
281 LtestKincraCount = GraphGOTO.Link( OtestK , IincraCount )
283 LtestKincr_1aCount = GraphGOTO.Link( OtestK , Iincr_1aCount )
285 LtestDefaultEndSwitch_OneEvenDefault = GraphGOTO.Link( OtestDefault , IEndSwitch_OneEvenDefault )
286 LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 1 , 1319 , 385 )
287 LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 2 , 1319 , 577 )
288 LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 3 , 779 , 577 )
289 LtestDefaultEndSwitch_OneEvenDefault.AddCoord( 4 , 778 , 415 )
291 Lcontrol_m3p1Gatelabel_testGate = GraphGOTO.Link( Ocontrol_m3p1Gate , Ilabel_testGate )
292 Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 389 , 375 )
293 Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 389 , 597 )
294 Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1519 , 602 )
295 Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1508 , 201 )
297 Lcontrol_div2Gatelabel_beginGate = GraphGOTO.Link( Ocontrol_div2Gate , Ilabel_beginGate )
298 Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 3 , 373 )
299 Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 3 , 587 )
300 Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 1307 , 586 )
301 Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 1307 , 528 )
304 Ilabel_beginNB.Input( 7 )
305 Ilabel_beginKB.Input( 0 )
307 # Output Ports of the graph
308 #OtestIncr = test.GetOutPort( 'Incr' )
309 #OEndSwitch_OneEvenFinished = EndSwitch_OneEven.GetOutPort( 'Finished' )
310 #OEndSwitch_OneEvenK = EndSwitch_OneEven.GetOutPort( 'K' )
314 GraphGOTO = DefGraphGOTO()
319 GraphGOTO.PrintPorts()