Salome HOME
Copyrights update 2015.
[samples/datafiles.git] / Superv / Python / GraphSyrControlDefault.py
1 # Copyright (C) 2007-2015  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 GraphSyrControlDefault
24 #
25 from SuperV import *
26
27 # Graph creation of GraphSyrControlDefault
28 def DefGraphSyrControlDefault() :
29     GraphSyrControlDefault = Graph( 'GraphSyrControlDefault' )
30     GraphSyrControlDefault.SetName( 'GraphSyrControlDefault' )
31     GraphSyrControlDefault.SetAuthor( 'JR' )
32     GraphSyrControlDefault.SetComment( 'Syracuse algorithm' )
33     GraphSyrControlDefault.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     test_ISEVEN = GraphSyrControlDefault.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 , 444 )
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 = GraphSyrControlDefault.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( 201 , 52 )
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 = GraphSyrControlDefault.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( 806 , 19 )
65     Im3p1anOddInteger = m3p1.GetInPort( 'anOddInteger' )
66     Im3p1Gate = m3p1.GetInPort( 'Gate' )
67     Om3p1anEvenInteger = m3p1.GetOutPort( 'anEvenInteger' )
68     Om3p1Gate = m3p1.GetOutPort( 'Gate' )
69     
70     div2 = GraphSyrControlDefault.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( 803 , 451 )
76     Idiv2anEvenInteger = div2.GetInPort( 'anEvenInteger' )
77     Idiv2Gate = div2.GetInPort( 'Gate' )
78     Odiv2anInteger = div2.GetOutPort( 'anInteger' )
79     Odiv2Gate = div2.GetOutPort( 'Gate' )
80     
81     incr = GraphSyrControlDefault.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( 802 , 170 )
87     IincraCount = incr.GetInPort( 'aCount' )
88     IincrGate = incr.GetInPort( 'Gate' )
89     OincraNewCount = incr.GetOutPort( 'aNewCount' )
90     OincrGate = incr.GetOutPort( 'Gate' )
91     
92     # Creation of InLine Nodes
93     Pylabel_begin = []
94     Pylabel_begin.append( 'def label_begin( NB , KB ):' )
95     Pylabel_begin.append( '    print "label_begin",NB,KB' )
96     Pylabel_begin.append( '    return NB,KB' )
97     label_begin = GraphSyrControlDefault.INode( 'label_begin' , Pylabel_begin )
98     label_begin.SetName( 'label_begin' )
99     label_begin.SetAuthor( '' )
100     label_begin.SetComment( 'Python function' )
101     label_begin.Coords( 12 , 264 )
102     Ilabel_beginNB = label_begin.InPort( 'NB' , 'long' )
103     Ilabel_beginKB = label_begin.InPort( 'KB' , 'long' )
104     Ilabel_beginGate = label_begin.GetInPort( 'Gate' )
105     Olabel_beginNT = label_begin.OutPort( 'NT' , 'long' )
106     Olabel_beginKT = label_begin.OutPort( 'KT' , 'long' )
107     Olabel_beginGate = label_begin.GetOutPort( 'Gate' )
108     
109     Pylabel_test = []
110     Pylabel_test.append( 'def label_test( ValEven , ValOne , NB , KB ):' )
111     Pylabel_test.append( '    print "label_begin",ValEven,ValOne,NB,KB' )
112     Pylabel_test.append( '    return ValEven,ValOne,NB,KB' )
113     label_test = GraphSyrControlDefault.INode( 'label_test' , Pylabel_test )
114     label_test.SetName( 'label_test' )
115     label_test.SetAuthor( '' )
116     label_test.SetComment( 'Python function' )
117     label_test.Coords( 415 , 206 )
118     Ilabel_testValEven = label_test.InPort( 'ValEven' , 'long' )
119     Ilabel_testValOne = label_test.InPort( 'ValOne' , 'long' )
120     Ilabel_testNT = label_test.InPort( 'NT' , 'long' )
121     Ilabel_testKT = label_test.InPort( 'KT' , 'long' )
122     Ilabel_testGate = label_test.GetInPort( 'Gate' )
123     Olabel_testValEven = label_test.OutPort( 'ValEven' , 'long' )
124     Olabel_testValOne = label_test.OutPort( 'ValOne' , 'long' )
125     Olabel_testNT = label_test.OutPort( 'NT' , 'long' )
126     Olabel_testKT = label_test.OutPort( 'KT' , 'long' )
127     Olabel_testGate = label_test.GetOutPort( 'Gate' )
128     
129     # Creation of Switch Nodes
130     Pytest = []
131     Pytest.append( 'def Switch_OneEven( ValOne , ValEven , NT , KT ) :' )
132     Pytest.append( '    Finished = ValOne' )
133     Pytest.append( '    if Finished == 0 :' )
134     Pytest.append( '        Incr = 1' )
135     Pytest.append( '        Even = ValEven' )
136     Pytest.append( '        if Even == 0 :' )
137     Pytest.append( '            Odd = 1' )
138     Pytest.append( '        else :' )
139     Pytest.append( '            Odd = 0' )
140     Pytest.append( '    else :' )
141     Pytest.append( '        Incr = 0' )
142     Pytest.append( '        Even = 0' )
143     Pytest.append( '        Odd = 0' )
144     Pytest.append( '    Even = ValEven' )
145     Pytest.append( '    return Incr,Even,Odd,NT,KT' )
146     test,EndSwitch_OneEven = GraphSyrControlDefault.SNode( 'Switch_OneEven' , Pytest )
147     EndSwitch_OneEven.SetName( 'EndSwitch_OneEven' )
148     EndSwitch_OneEven.SetAuthor( '' )
149     EndSwitch_OneEven.SetComment( 'Compute Node' )
150     EndSwitch_OneEven.Coords( 1074 , 367 )
151     PyEndSwitch_OneEven = []
152     EndSwitch_OneEven.SetPyFunction( '' , PyEndSwitch_OneEven )
153     IEndSwitch_OneEvenK = EndSwitch_OneEven.InPort( 'K' , 'long' )
154     IEndSwitch_OneEvenDefault = EndSwitch_OneEven.GetInPort( 'Default' )
155     OEndSwitch_OneEvenK = EndSwitch_OneEven.OutPort( 'K' , 'long' )
156     OEndSwitch_OneEvenGate = EndSwitch_OneEven.GetOutPort( 'Gate' )
157     test.SetName( 'test' )
158     test.SetAuthor( '' )
159     test.SetComment( 'Compute Node' )
160     test.Coords( 597 , 251 )
161     ItestValOne = test.InPort( 'ValOne' , 'long' )
162     ItestValEven = test.InPort( 'ValEven' , 'long' )
163     ItestNT = test.InPort( 'NT' , 'long' )
164     ItestKT = test.InPort( 'KT' , 'long' )
165     ItestGate = test.GetInPort( 'Gate' )
166     OtestIncr = test.OutPort( 'Incr' , 'long' )
167     OtestEven = test.OutPort( 'Even' , 'long' )
168     OtestOdd = test.OutPort( 'Odd' , 'long' )
169     OtestN = test.OutPort( 'N' , 'long' )
170     OtestK = test.OutPort( 'K' , 'long' )
171     OtestDefault = test.GetOutPort( 'Default' )
172     
173     # Creation of GOTO Nodes
174     Pycontrol_m3p1 = []
175     Pycontrol_m3p1.append( 'def control_m3p1( N , K ):' )
176     Pycontrol_m3p1.append( '    return 0,1,N,K' )
177     control_m3p1 = GraphSyrControlDefault.GNode( 'control_m3p1' , Pycontrol_m3p1 , 'label_test' )
178     control_m3p1.SetName( 'control_m3p1' )
179     control_m3p1.SetAuthor( '' )
180     control_m3p1.SetComment( 'Compute Node' )
181     control_m3p1.Coords( 1002 , 64 )
182     Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' )
183     Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' )
184     Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' )
185     Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' )
186     Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' )
187     Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' )
188     Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' )
189     Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' )
190     
191     Pycontrol_div2 = []
192     Pycontrol_div2.append( 'def control_div2( N , NB ) :' )
193     Pycontrol_div2.append( '    return N,NB' )
194     control_div2 = GraphSyrControlDefault.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
195     control_div2.SetName( 'control_div2' )
196     control_div2.SetAuthor( '' )
197     control_div2.SetComment( 'Compute Node' )
198     control_div2.Coords( 1013 , 496 )
199     Icontrol_div2N = control_div2.InPort( 'N' , 'long' )
200     Icontrol_div2K = control_div2.InPort( 'K' , 'long' )
201     Icontrol_div2Gate = control_div2.GetInPort( 'Gate' )
202     Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' )
203     Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' )
204     Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' )
205     
206     # Creation of Links
207     Ltest_ISEVENBoolEvenlabel_testValEven = GraphSyrControlDefault.Link( Otest_ISEVENBoolEven , Ilabel_testValEven )
208     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 381 , 286 )
209     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 382 , 524 )
210     
211     Ltest_ISONEBoolOnelabel_testValOne = GraphSyrControlDefault.Link( Otest_ISONEBoolOne , Ilabel_testValOne )
212     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 1 , 393 , 314 )
213     Ltest_ISONEBoolOnelabel_testValOne.AddCoord( 2 , 393 , 133 )
214     
215     Lm3p1anEvenIntegercontrol_m3p1N = GraphSyrControlDefault.Link( Om3p1anEvenInteger , Icontrol_m3p1N )
216     
217     Ldiv2anIntegercontrol_div2N = GraphSyrControlDefault.Link( Odiv2anInteger , Icontrol_div2N )
218     
219     LincraNewCountcontrol_m3p1K = GraphSyrControlDefault.Link( OincraNewCount , Icontrol_m3p1K )
220     LincraNewCountcontrol_m3p1K.AddCoord( 1 , 985 , 128 )
221     LincraNewCountcontrol_m3p1K.AddCoord( 2 , 985 , 250 )
222     
223     LincraNewCountcontrol_div2K = GraphSyrControlDefault.Link( OincraNewCount , Icontrol_div2K )
224     LincraNewCountcontrol_div2K.AddCoord( 1 , 987 , 559 )
225     LincraNewCountcontrol_div2K.AddCoord( 2 , 985 , 250 )
226     
227     Llabel_beginNTlabel_testNT = GraphSyrControlDefault.Link( Olabel_beginNT , Ilabel_testNT )
228     
229     Llabel_beginNTtest_ISEVENanInteger = GraphSyrControlDefault.Link( Olabel_beginNT , Itest_ISEVENanInteger )
230     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 191 , 524 )
231     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 192 , 345 )
232     
233     Llabel_beginNTtest_ISONEanInteger = GraphSyrControlDefault.Link( Olabel_beginNT , Itest_ISONEanInteger )
234     Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 192 , 131 )
235     Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 193 , 345 )
236     
237     Llabel_beginKTlabel_testKT = GraphSyrControlDefault.Link( Olabel_beginKT , Ilabel_testKT )
238     
239     Llabel_testValEventestValEven = GraphSyrControlDefault.Link( Olabel_testValEven , ItestValEven )
240     
241     Llabel_testValOnetestValOne = GraphSyrControlDefault.Link( Olabel_testValOne , ItestValOne )
242     
243     Llabel_testNTtestNT = GraphSyrControlDefault.Link( Olabel_testNT , ItestNT )
244     
245     Llabel_testKTtestKT = GraphSyrControlDefault.Link( Olabel_testKT , ItestKT )
246     
247     LtestEvendiv2Gate = GraphSyrControlDefault.Link( OtestEven , Idiv2Gate )
248     LtestEvendiv2Gate.AddCoord( 1 , 793 , 567 )
249     LtestEvendiv2Gate.AddCoord( 2 , 792 , 314 )
250     
251     LtestOddm3p1Gate = GraphSyrControlDefault.Link( OtestOdd , Im3p1Gate )
252     LtestOddm3p1Gate.AddCoord( 1 , 786 , 132 )
253     LtestOddm3p1Gate.AddCoord( 2 , 785 , 343 )
254     
255     LtestNm3p1anOddInteger = GraphSyrControlDefault.Link( OtestN , Im3p1anOddInteger )
256     LtestNm3p1anOddInteger.AddCoord( 1 , 767 , 100 )
257     LtestNm3p1anOddInteger.AddCoord( 2 , 767 , 371 )
258     
259     LtestNdiv2anEvenInteger = GraphSyrControlDefault.Link( OtestN , Idiv2anEvenInteger )
260     LtestNdiv2anEvenInteger.AddCoord( 1 , 768 , 531 )
261     LtestNdiv2anEvenInteger.AddCoord( 2 , 767 , 371 )
262     
263     LtestKEndSwitch_OneEvenK = GraphSyrControlDefault.Link( OtestK , IEndSwitch_OneEvenK )
264     
265     LtestKincraCount = GraphSyrControlDefault.Link( OtestK , IincraCount )
266     LtestKincraCount.AddCoord( 1 , 773 , 251 )
267     LtestKincraCount.AddCoord( 2 , 774 , 400 )
268     
269     LtestDefaultEndSwitch_OneEvenDefault = GraphSyrControlDefault.Link( OtestDefault , IEndSwitch_OneEvenDefault )
270     
271     Lcontrol_m3p1Gatelabel_testGate = GraphSyrControlDefault.Link( Ocontrol_m3p1Gate , Ilabel_testGate )
272     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 402 , 406 )
273     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 403 , 4 )
274     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1174 , 5 )
275     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1175 , 219 )
276     
277     Lcontrol_div2Gatelabel_beginGate = GraphSyrControlDefault.Link( Ocontrol_div2Gate , Ilabel_beginGate )
278     Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 3 , 409 )
279     Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 2 , 671 )
280     Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 1199 , 670 )
281     Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 1198 , 592 )
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_OneEvenK = EndSwitch_OneEven.GetOutPort( 'K' )
290     return GraphSyrControlDefault
291
292
293 GraphSyrControlDefault = DefGraphSyrControlDefault()