Salome HOME
Copyrights update 2015.
[samples/datafiles.git] / Superv / Python / GraphSyrControl1.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 GraphSyrControl1
24 #
25 from SuperV import *
26
27 # Graph creation of GraphSyrControl1
28 def DefGraphSyrControl1() :
29     GraphSyrControl1 = Graph( 'GraphSyrControl1' )
30     GraphSyrControl1.SetName( 'GraphSyrControl1' )
31     GraphSyrControl1.SetAuthor( 'JR' )
32     GraphSyrControl1.SetComment( 'Syracuse algorithm' )
33     GraphSyrControl1.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     test_ISEVEN = GraphSyrControl1.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( 190 , 338 )
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 = GraphSyrControl1.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( 196 , 131 )
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 = GraphSyrControl1.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( 615 , 30 )
65     Im3p1anOddInteger = m3p1.GetInPort( 'anOddInteger' )
66     Im3p1Gate = m3p1.GetInPort( 'Gate' )
67     Om3p1anEvenInteger = m3p1.GetOutPort( 'anEvenInteger' )
68     Om3p1Gate = m3p1.GetOutPort( 'Gate' )
69     
70     div2 = GraphSyrControl1.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( 624 , 391 )
76     Idiv2anEvenInteger = div2.GetInPort( 'anEvenInteger' )
77     Idiv2Gate = div2.GetInPort( 'Gate' )
78     Odiv2anInteger = div2.GetOutPort( 'anInteger' )
79     Odiv2Gate = div2.GetOutPort( 'Gate' )
80     
81     incr = GraphSyrControl1.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( 623 , 206 )
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( '    return NB,KB' )
96     label_begin = GraphSyrControl1.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( 5 , 190 )
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     # Creation of Switch Nodes
109     Pylabel_test = []
110     Pylabel_test.append( 'def L_OneEven( ValOne , ValEven , NT , KT ):' )
111     Pylabel_test.append( '    Finished = ValOne' )
112     Pylabel_test.append( '    if Finished == 0 :' )
113     Pylabel_test.append( '        Incr = 1' )
114     Pylabel_test.append( '        Even = ValEven' )
115     Pylabel_test.append( '        if Even == 0 :' )
116     Pylabel_test.append( '            Odd = 1' )
117     Pylabel_test.append( '        else :' )
118     Pylabel_test.append( '            Odd = 0' )
119     Pylabel_test.append( '    else :' )
120     Pylabel_test.append( '        Incr = 0' )
121     Pylabel_test.append( '        Even = 0' )
122     Pylabel_test.append( '        Odd = 0' )
123     Pylabel_test.append( '    Even = ValEven' )
124     Pylabel_test.append( '    return Finished,Incr,Even,Odd,NT,KT' )
125     label_test,EndL_OneEven = GraphSyrControl1.SNode( 'L_OneEven' , Pylabel_test )
126     EndL_OneEven.SetName( 'EndL_OneEven' )
127     EndL_OneEven.SetAuthor( '' )
128     EndL_OneEven.SetComment( 'Compute Node' )
129     EndL_OneEven.Coords( 1017 , 247 )
130     PyEndL_OneEven = []
131     EndL_OneEven.SetPyFunction( '' , PyEndL_OneEven )
132     IEndL_OneEvenDefault = EndL_OneEven.GetInPort( 'Default' )
133     OEndL_OneEvenGate = EndL_OneEven.GetOutPort( 'Gate' )
134     label_test.SetName( 'label_test' )
135     label_test.SetAuthor( '' )
136     label_test.SetComment( 'Compute Node' )
137     label_test.Coords( 399 , 177 )
138     Ilabel_testValOne = label_test.InPort( 'ValOne' , 'long' )
139     Ilabel_testValEven = label_test.InPort( 'ValEven' , 'long' )
140     Ilabel_testNT = label_test.InPort( 'NT' , 'long' )
141     Ilabel_testKT = label_test.InPort( 'KT' , 'long' )
142     Ilabel_testGate = label_test.GetInPort( 'Gate' )
143     Olabel_testFinished = label_test.OutPort( 'Finished' , 'long' )
144     Olabel_testIncr = label_test.OutPort( 'Incr' , 'long' )
145     Olabel_testEven = label_test.OutPort( 'Even' , 'long' )
146     Olabel_testOdd = label_test.OutPort( 'Odd' , 'long' )
147     Olabel_testN = label_test.OutPort( 'N' , 'long' )
148     Olabel_testK = label_test.OutPort( 'K' , 'long' )
149     Olabel_testDefault = label_test.GetOutPort( 'Default' )
150     
151     # Creation of GOTO Nodes
152     Pycontrol_m3p1 = []
153     Pycontrol_m3p1.append( 'def C_NotOneIsEven( N , K ):' )
154     Pycontrol_m3p1.append( '    return 0,1,N,K' )
155     control_m3p1 = GraphSyrControl1.GNode( 'C_NotOneIsEven' , Pycontrol_m3p1 , 'label_test' )
156     control_m3p1.SetName( 'control_m3p1' )
157     control_m3p1.SetAuthor( '' )
158     control_m3p1.SetComment( 'Compute Node' )
159     control_m3p1.Coords( 821 , 28 )
160     Icontrol_m3p1N = control_m3p1.InPort( 'N' , 'long' )
161     Icontrol_m3p1K = control_m3p1.InPort( 'K' , 'long' )
162     Icontrol_m3p1Gate = control_m3p1.GetInPort( 'Gate' )
163     Ocontrol_m3p1ValOne = control_m3p1.OutPort( 'ValOne' , 'long' )
164     Ocontrol_m3p1ValEven = control_m3p1.OutPort( 'ValEven' , 'long' )
165     Ocontrol_m3p1NT = control_m3p1.OutPort( 'NT' , 'long' )
166     Ocontrol_m3p1KT = control_m3p1.OutPort( 'KT' , 'long' )
167     Ocontrol_m3p1Gate = control_m3p1.GetOutPort( 'Gate' )
168     
169     Pycontrol_div2 = []
170     Pycontrol_div2.append( 'def control_div2( N , K ) :' )
171     Pycontrol_div2.append( '    return N,K' )
172     control_div2 = GraphSyrControl1.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
173     control_div2.SetName( 'control_div2' )
174     control_div2.SetAuthor( '' )
175     control_div2.SetComment( 'Compute Node' )
176     control_div2.Coords( 818 , 358 )
177     Icontrol_div2N = control_div2.InPort( 'N' , 'long' )
178     Icontrol_div2K = control_div2.InPort( 'K' , 'long' )
179     Icontrol_div2Gate = control_div2.GetInPort( 'Gate' )
180     Ocontrol_div2NB = control_div2.OutPort( 'NB' , 'long' )
181     Ocontrol_div2KB = control_div2.OutPort( 'KB' , 'long' )
182     Ocontrol_div2Gate = control_div2.GetOutPort( 'Gate' )
183     
184     # Creation of Links
185     Ltest_ISEVENBoolEvenlabel_testValEven = GraphSyrControl1.Link( Otest_ISEVENBoolEven , Ilabel_testValEven )
186     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 1 , 383 , 239 )
187     Ltest_ISEVENBoolEvenlabel_testValEven.AddCoord( 2 , 382 , 417 )
188     
189     Ltest_ISONEBoolOnelabel_testValOne = GraphSyrControl1.Link( Otest_ISONEBoolOne , Ilabel_testValOne )
190     
191     Lm3p1anEvenIntegercontrol_m3p1N = GraphSyrControl1.Link( Om3p1anEvenInteger , Icontrol_m3p1N )
192     Lm3p1anEvenIntegercontrol_m3p1N.AddCoord( 1 , 793 , 62 )
193     Lm3p1anEvenIntegercontrol_m3p1N.AddCoord( 2 , 792 , 111 )
194     
195     Ldiv2anIntegercontrol_div2N = GraphSyrControl1.Link( Odiv2anInteger , Icontrol_div2N )
196     Ldiv2anIntegercontrol_div2N.AddCoord( 1 , 797 , 392 )
197     Ldiv2anIntegercontrol_div2N.AddCoord( 2 , 798 , 471 )
198     
199     LincraNewCountcontrol_div2K = GraphSyrControl1.Link( OincraNewCount , Icontrol_div2K )
200     LincraNewCountcontrol_div2K.AddCoord( 1 , 809 , 420 )
201     LincraNewCountcontrol_div2K.AddCoord( 2 , 808 , 288 )
202     
203     LincraNewCountcontrol_m3p1K = GraphSyrControl1.Link( OincraNewCount , Icontrol_m3p1K )
204     LincraNewCountcontrol_m3p1K.AddCoord( 1 , 807 , 91 )
205     LincraNewCountcontrol_m3p1K.AddCoord( 2 , 808 , 286 )
206     
207     Llabel_beginNTtest_ISONEanInteger = GraphSyrControl1.Link( Olabel_beginNT , Itest_ISONEanInteger )
208     Llabel_beginNTtest_ISONEanInteger.AddCoord( 1 , 180 , 211 )
209     Llabel_beginNTtest_ISONEanInteger.AddCoord( 2 , 179 , 269 )
210     
211     Llabel_beginNTlabel_testNT = GraphSyrControl1.Link( Olabel_beginNT , Ilabel_testNT )
212     
213     Llabel_beginNTtest_ISEVENanInteger = GraphSyrControl1.Link( Olabel_beginNT , Itest_ISEVENanInteger )
214     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 1 , 179 , 417 )
215     Llabel_beginNTtest_ISEVENanInteger.AddCoord( 2 , 179 , 271 )
216     
217     Llabel_beginKTlabel_testKT = GraphSyrControl1.Link( Olabel_beginKT , Ilabel_testKT )
218     
219     Llabel_testEvendiv2Gate = GraphSyrControl1.Link( Olabel_testEven , Idiv2Gate )
220     Llabel_testEvendiv2Gate.AddCoord( 1 , 583 , 500 )
221     Llabel_testEvendiv2Gate.AddCoord( 2 , 582 , 269 )
222     
223     Llabel_testOddm3p1Gate = GraphSyrControl1.Link( Olabel_testOdd , Im3p1Gate )
224     Llabel_testOddm3p1Gate.AddCoord( 1 , 571 , 138 )
225     Llabel_testOddm3p1Gate.AddCoord( 2 , 573 , 298 )
226     
227     Llabel_testNm3p1anOddInteger = GraphSyrControl1.Link( Olabel_testN , Im3p1anOddInteger )
228     Llabel_testNm3p1anOddInteger.AddCoord( 1 , 604 , 110 )
229     Llabel_testNm3p1anOddInteger.AddCoord( 2 , 605 , 328 )
230     
231     Llabel_testNdiv2anEvenInteger = GraphSyrControl1.Link( Olabel_testN , Idiv2anEvenInteger )
232     Llabel_testNdiv2anEvenInteger.AddCoord( 1 , 606 , 471 )
233     Llabel_testNdiv2anEvenInteger.AddCoord( 2 , 605 , 328 )
234     
235     Llabel_testKincraCount = GraphSyrControl1.Link( Olabel_testK , IincraCount )
236     Llabel_testKincraCount.AddCoord( 1 , 594 , 287 )
237     Llabel_testKincraCount.AddCoord( 2 , 595 , 356 )
238     
239     Llabel_testDefaultEndL_OneEvenDefault = GraphSyrControl1.Link( Olabel_testDefault , IEndL_OneEvenDefault )
240     Llabel_testDefaultEndL_OneEvenDefault.AddCoord( 1 , 1008 , 281 )
241     Llabel_testDefaultEndL_OneEvenDefault.AddCoord( 2 , 1008 , 560 )
242     Llabel_testDefaultEndL_OneEvenDefault.AddCoord( 3 , 565 , 559 )
243     Llabel_testDefaultEndL_OneEvenDefault.AddCoord( 4 , 564 , 385 )
244     
245     Lcontrol_m3p1Gatelabel_testGate = GraphSyrControl1.Link( Ocontrol_m3p1Gate , Ilabel_testGate )
246     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 1 , 368 , 327 )
247     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 2 , 369 , 7 )
248     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 3 , 1009 , 8 )
249     Lcontrol_m3p1Gatelabel_testGate.AddCoord( 4 , 1009 , 179 )
250     
251     Lcontrol_div2Gatelabel_beginGate = GraphSyrControl1.Link( Ocontrol_div2Gate , Ilabel_beginGate )
252     Lcontrol_div2Gatelabel_beginGate.AddCoord( 1 , 3 , 327 )
253     Lcontrol_div2Gatelabel_beginGate.AddCoord( 2 , 2 , 582 )
254     Lcontrol_div2Gatelabel_beginGate.AddCoord( 3 , 991 , 583 )
255     Lcontrol_div2Gatelabel_beginGate.AddCoord( 4 , 991 , 451 )
256     
257     # Input datas
258     Ilabel_beginNB.Input( 7 )
259     Ilabel_beginKB.Input( 0 )
260     
261     # Output Ports of the graph
262     #Olabel_testFinished = label_test.GetOutPort( 'Finished' )
263     #Olabel_testIncr = label_test.GetOutPort( 'Incr' )
264     return GraphSyrControl1
265
266
267 GraphSyrControl1 = DefGraphSyrControl1()