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