]> SALOME platform Git repositories - modules/superv.git/blobdiff - examples/GraphSyrControl1.py
Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[modules/superv.git] / examples / GraphSyrControl1.py
diff --git a/examples/GraphSyrControl1.py b/examples/GraphSyrControl1.py
new file mode 100755 (executable)
index 0000000..97b63e5
--- /dev/null
@@ -0,0 +1,237 @@
+
+# Generated python file of Graph GraphSyrControlGUI
+
+from SuperV import *
+# Graph creation 
+GraphSyrControl1 = Graph( 'GraphSyrControl1' )
+GraphSyrControl1.SetName( 'GraphSyrControl1' )
+GraphSyrControl1.SetAuthor( 'JR' )
+GraphSyrControl1.SetComment( 'Syracuse algorithm' )
+GraphSyrControl1.Coords( 0 , 0 )
+
+# Creation of Factory Nodes
+
+test_ISEVEN = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
+test_ISEVEN.SetName( 'test_ISEVEN' )
+test_ISEVEN.SetAuthor( '' )
+test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
+test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
+test_ISEVEN.Coords( 190 , 338 )
+
+test_ISONE = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
+test_ISONE.SetName( 'test_ISONE' )
+test_ISONE.SetAuthor( '' )
+test_ISONE.SetContainer( 'localhost/FactoryServer' )
+test_ISONE.SetComment( 'C_ISONE from SyrComponent' )
+test_ISONE.Coords( 196 , 131 )
+
+m3p1 = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
+m3p1.SetName( 'm3p1' )
+m3p1.SetAuthor( '' )
+m3p1.SetContainer( 'localhost/FactoryServer' )
+m3p1.SetComment( 'C_M3P1 from SyrComponent' )
+m3p1.Coords( 615 , 30 )
+
+div2 = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
+div2.SetName( 'div2' )
+div2.SetAuthor( '' )
+div2.SetContainer( 'localhost/FactoryServer' )
+div2.SetComment( 'C_DIV2 from SyrComponent' )
+div2.Coords( 624 , 391 )
+
+incr = GraphSyrControl1.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
+incr.SetName( 'incr' )
+incr.SetAuthor( '' )
+incr.SetContainer( 'localhost/FactoryServer' )
+incr.SetComment( 'C_INCR from SyrComponent' )
+incr.Coords( 623 , 206 )
+
+# Creation of InLine Nodes
+Pylabel_begin = []
+Pylabel_begin.append( 'def label_begin( NB , KB ) :' )
+Pylabel_begin.append( '    return NB,KB' )
+label_begin = GraphSyrControl1.INode( 'label_begin' , Pylabel_begin )
+label_begin.InPort( 'NB' , 'long' )
+label_begin.InPort( 'KB' , 'long' )
+label_begin.OutPort( 'NT' , 'long' )
+label_begin.OutPort( 'KT' , 'long' )
+label_begin.SetName( 'label_begin' )
+label_begin.SetAuthor( '' )
+label_begin.SetComment( 'Python function' )
+label_begin.Coords( 5 , 190 )
+
+# Creation of Switch Nodes
+Pylabel_test = []
+Pylabel_test.append( 'def L_OneEven( ValOne , ValEven , NT , KT ):' )
+Pylabel_test.append( '    Finished = ValOne' )
+Pylabel_test.append( '    if Finished == 0 :' )
+Pylabel_test.append( '        Incr = 1' )
+Pylabel_test.append( '        Even = ValEven' )
+Pylabel_test.append( '        if Even == 0 :' )
+Pylabel_test.append( '            Odd = 1' )
+Pylabel_test.append( '        else :' )
+Pylabel_test.append( '            Odd = 0' )
+Pylabel_test.append( '    else :' )
+Pylabel_test.append( '        Incr = 0' )
+Pylabel_test.append( '        Even = 0' )
+Pylabel_test.append( '        Odd = 0' )
+Pylabel_test.append( '    Even = ValEven' )
+Pylabel_test.append( '    return Finished,Incr,Even,Odd,NT,KT' )
+label_test,EndL_OneEven = GraphSyrControl1.SNode( 'L_OneEven' , Pylabel_test )
+EndL_OneEven.SetName( 'EndL_OneEven' )
+EndL_OneEven.SetAuthor( '' )
+EndL_OneEven.SetComment( '' )
+EndL_OneEven.Coords( 1017 , 247 )
+PyEndL_OneEven = []
+EndL_OneEven.SetPyFunction( 'EndL_OneEven' , PyEndL_OneEven )
+label_test.InPort( 'ValOne' , 'long' )
+label_test.InPort( 'ValEven' , 'long' )
+label_test.InPort( 'NT' , 'long' )
+label_test.InPort( 'KT' , 'long' )
+label_test.OutPort( 'Finished' , 'long' )
+label_test.OutPort( 'Incr' , 'long' )
+label_test.OutPort( 'Even' , 'long' )
+label_test.OutPort( 'Odd' , 'long' )
+label_test.OutPort( 'N' , 'long' )
+label_test.OutPort( 'K' , 'long' )
+label_test.SetName( 'label_test' )
+label_test.SetAuthor( '' )
+label_test.SetComment( '' )
+label_test.Coords( 399 , 177 )
+
+# Creation of GOTO Nodes
+Pycontrol_m3p1 = []
+Pycontrol_m3p1.append( 'def C_NotOneIsEven( N , K ):' )
+Pycontrol_m3p1.append( '    return 0,1,N,K' )
+control_m3p1 = GraphSyrControl1.GNode( 'C_NotOneIsEven' , Pycontrol_m3p1 , 'label_test' )
+control_m3p1.InPort( 'N' , 'long' )
+control_m3p1.InPort( 'K' , 'long' )
+control_m3p1.OutPort( 'ValOne' , 'long' )
+control_m3p1.OutPort( 'ValEven' , 'long' )
+control_m3p1.OutPort( 'NT' , 'long' )
+control_m3p1.OutPort( 'KT' , 'long' )
+control_m3p1.SetName( 'control_m3p1' )
+control_m3p1.SetAuthor( '' )
+control_m3p1.SetComment( '' )
+control_m3p1.Coords( 821 , 28 )
+
+Pycontrol_div2 = []
+Pycontrol_div2.append( 'def control_div2( N , K ) :' )
+Pycontrol_div2.append( '    return N,K' )
+control_div2 = GraphSyrControl1.GNode( 'control_div2' , Pycontrol_div2 , 'label_begin' )
+control_div2.InPort( 'N' , 'long' )
+control_div2.InPort( 'K' , 'long' )
+control_div2.OutPort( 'NB' , 'long' )
+control_div2.OutPort( 'KB' , 'long' )
+control_div2.SetName( 'control_div2' )
+control_div2.SetAuthor( '' )
+control_div2.SetComment( '' )
+control_div2.Coords( 818 , 358 )
+
+# Creation of Links
+test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
+label_testValEven = GraphSyrControl1.Link( test_ISEVENBoolEven , label_test.Port( 'ValEven' ) )
+label_testValEven.AddCoord( 1 , 383 , 239 )
+label_testValEven.AddCoord( 2 , 382 , 417 )
+
+test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
+label_testValOne = GraphSyrControl1.Link( test_ISONEBoolOne , label_test.Port( 'ValOne' ) )
+
+m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
+control_m3p1N = GraphSyrControl1.Link( m3p1anEvenInteger , control_m3p1.Port( 'N' ) )
+control_m3p1N.AddCoord( 1 , 793 , 62 )
+control_m3p1N.AddCoord( 2 , 792 , 111 )
+
+div2anInteger = div2.Port( 'anInteger' )
+control_div2N = GraphSyrControl1.Link( div2anInteger , control_div2.Port( 'N' ) )
+control_div2N.AddCoord( 1 , 797 , 392 )
+control_div2N.AddCoord( 2 , 798 , 471 )
+
+incraNewCount = incr.Port( 'aNewCount' )
+control_div2K = GraphSyrControl1.Link( incraNewCount , control_div2.Port( 'K' ) )
+control_div2K.AddCoord( 1 , 809 , 420 )
+control_div2K.AddCoord( 2 , 808 , 288 )
+
+control_m3p1K = GraphSyrControl1.Link( incraNewCount , control_m3p1.Port( 'K' ) )
+control_m3p1K.AddCoord( 1 , 807 , 91 )
+control_m3p1K.AddCoord( 2 , 808 , 286 )
+
+label_beginNT = label_begin.Port( 'NT' )
+test_ISONEanInteger = GraphSyrControl1.Link( label_beginNT , test_ISONE.Port( 'anInteger' ) )
+test_ISONEanInteger.AddCoord( 1 , 180 , 211 )
+test_ISONEanInteger.AddCoord( 2 , 179 , 269 )
+
+label_testNT = GraphSyrControl1.Link( label_beginNT , label_test.Port( 'NT' ) )
+
+test_ISEVENanInteger = GraphSyrControl1.Link( label_beginNT , test_ISEVEN.Port( 'anInteger' ) )
+test_ISEVENanInteger.AddCoord( 1 , 179 , 417 )
+test_ISEVENanInteger.AddCoord( 2 , 179 , 271 )
+
+label_beginKT = label_begin.Port( 'KT' )
+label_testKT = GraphSyrControl1.Link( label_beginKT , label_test.Port( 'KT' ) )
+
+label_testIncr = label_test.Port( 'Incr' )
+incrInGate = GraphSyrControl1.Link( label_testIncr , incr.Port( 'InGate' ) )
+incrInGate.AddCoord( 1 , 565 , 315 )
+incrInGate.AddCoord( 2 , 564 , 240 )
+
+label_testEven = label_test.Port( 'Even' )
+div2InGate = GraphSyrControl1.Link( label_testEven , div2.Port( 'InGate' ) )
+div2InGate.AddCoord( 1 , 583 , 500 )
+div2InGate.AddCoord( 2 , 582 , 269 )
+
+label_testOdd = label_test.Port( 'Odd' )
+m3p1InGate = GraphSyrControl1.Link( label_testOdd , m3p1.Port( 'InGate' ) )
+m3p1InGate.AddCoord( 1 , 571 , 138 )
+m3p1InGate.AddCoord( 2 , 573 , 298 )
+
+label_testN = label_test.Port( 'N' )
+m3p1anOddInteger = GraphSyrControl1.Link( label_testN , m3p1.Port( 'anOddInteger' ) )
+m3p1anOddInteger.AddCoord( 1 , 604 , 110 )
+m3p1anOddInteger.AddCoord( 2 , 605 , 328 )
+
+div2anEvenInteger = GraphSyrControl1.Link( label_testN , div2.Port( 'anEvenInteger' ) )
+div2anEvenInteger.AddCoord( 1 , 606 , 471 )
+div2anEvenInteger.AddCoord( 2 , 605 , 328 )
+
+label_testK = label_test.Port( 'K' )
+incraCount = GraphSyrControl1.Link( label_testK , incr.Port( 'aCount' ) )
+incraCount.AddCoord( 1 , 594 , 287 )
+incraCount.AddCoord( 2 , 595 , 356 )
+
+label_testDefault = label_test.Port( 'Default' )
+EndL_OneEvenDefault = GraphSyrControl1.Link( label_testDefault , EndL_OneEven.Port( 'Default' ) )
+EndL_OneEvenDefault.AddCoord( 1 , 1008 , 281 )
+EndL_OneEvenDefault.AddCoord( 2 , 1008 , 560 )
+EndL_OneEvenDefault.AddCoord( 3 , 565 , 559 )
+EndL_OneEvenDefault.AddCoord( 4 , 564 , 385 )
+
+control_m3p1OutGate = control_m3p1.Port( 'OutGate' )
+label_testInGate = GraphSyrControl1.Link( control_m3p1OutGate , label_test.Port( 'InGate' ) )
+label_testInGate.AddCoord( 1 , 368 , 327 )
+label_testInGate.AddCoord( 2 , 369 , 7 )
+label_testInGate.AddCoord( 3 , 1009 , 8 )
+label_testInGate.AddCoord( 4 , 1009 , 179 )
+
+control_div2OutGate = control_div2.Port( 'OutGate' )
+label_beginInGate = GraphSyrControl1.Link( control_div2OutGate , label_begin.Port( 'InGate' ) )
+label_beginInGate.AddCoord( 1 , 3 , 327 )
+label_beginInGate.AddCoord( 2 , 2 , 582 )
+label_beginInGate.AddCoord( 3 , 991 , 583 )
+label_beginInGate.AddCoord( 4 , 991 , 451 )
+
+# Creation of Input datas
+label_beginNB = label_begin.Input( 'NB' , 7)
+label_beginKB = label_begin.Input( 'KB' , 0)
+
+# Creation of Output variables
+label_testFinished = label_test.Port( 'Finished' )
+
+GraphSyrControl1.Run( 7 )
+
+GraphSyrControl1.DoneW()
+
+GraphSyrControl1.State()
+
+GraphSyrControl1.PrintPorts()
+