Salome HOME
DCQ : Merge with Ecole_Ete_a6.
[modules/superv.git] / examples / GraphSyracuseC_Gate.py
index 4034379ba65ba25005ce6e78e01b0425e96892c2..24931807fb1ab5d6647ac7e3a9d901b8d9208110 100644 (file)
@@ -1,5 +1,9 @@
-
-# Generated python file of Graph GraphSyracuseC_Gate
+#  Copyright (C) 2003  CEA/DEN, EDF R&D
+#
+#
+#
+#  File   : GraphSyracuseC_Gate.py
+#  Module : SuperVisionTest
 
 from SuperV import *
 # Graph creation 
@@ -9,68 +13,67 @@ GraphSyracuseC_Gate.SetAuthor( 'JR' )
 GraphSyracuseC_Gate.SetComment( 'Syracuse algorithm' )
 GraphSyracuseC_Gate.Coords( 0 , 0 )
 
-# Creation of Computing Nodes
-test_ISEVEN = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
+# Creation of Factory Nodes
+test_ISEVEN = GraphSyracuseC_Gate.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
 test_ISEVEN.SetName( 'test_ISEVEN' )
 test_ISEVEN.SetAuthor( '' )
 test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
-test_ISEVEN.SetComment( '' )
+test_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
 test_ISEVEN.Coords( 5 , 416 )
-test_ISONE = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
+test_ISONE = GraphSyracuseC_Gate.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
 test_ISONE.SetName( 'test_ISONE' )
 test_ISONE.SetAuthor( '' )
 test_ISONE.SetContainer( 'localhost/FactoryServer' )
-test_ISONE.SetComment( '' )
+test_ISONE.SetComment( 'C_ISONE from SyrComponent' )
 test_ISONE.Coords( 7 , 232 )
-m3p1 = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
+m3p1 = GraphSyracuseC_Gate.FNode( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
 m3p1.SetName( 'm3p1' )
 m3p1.SetAuthor( '' )
 m3p1.SetContainer( 'localhost/FactoryServer' )
-m3p1.SetComment( '' )
+m3p1.SetComment( 'C_M3P1 from SyrComponent' )
 m3p1.Coords( 180 , 417 )
-div2 = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
+div2 = GraphSyracuseC_Gate.FNode( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
 div2.SetName( 'div2' )
 div2.SetAuthor( '' )
 div2.SetContainer( 'localhost/FactoryServer' )
-div2.SetComment( '' )
+div2.SetComment( 'C_DIV2 from SyrComponent' )
 div2.Coords( 435 , 7 )
-div2_ISEVEN = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
+div2_ISEVEN = GraphSyracuseC_Gate.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
 div2_ISEVEN.SetName( 'div2_ISEVEN' )
 div2_ISEVEN.SetAuthor( '' )
 div2_ISEVEN.SetContainer( 'localhost/FactoryServer' )
-div2_ISEVEN.SetComment( '' )
-div2_ISEVEN.Coords( 619 , 191 )
-div2_ISONE = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
+div2_ISEVEN.SetComment( 'C_ISEVEN from SyrComponent' )
+div2_ISEVEN.Coords( 663 , 193 )
+div2_ISONE = GraphSyracuseC_Gate.FNode( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
 div2_ISONE.SetName( 'div2_ISONE' )
 div2_ISONE.SetAuthor( '' )
 div2_ISONE.SetContainer( 'localhost/FactoryServer' )
-div2_ISONE.SetComment( '' )
-div2_ISONE.Coords( 616 , 6 )
-incr = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
+div2_ISONE.SetComment( 'C_ISONE from SyrComponent' )
+div2_ISONE.Coords( 651 , 6 )
+incr = GraphSyracuseC_Gate.FNode( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
 incr.SetName( 'incr' )
 incr.SetAuthor( '' )
 incr.SetContainer( 'localhost/FactoryServer' )
-incr.SetComment( '' )
+incr.SetComment( 'C_INCR from SyrComponent' )
 incr.Coords( 434 , 193 )
 
-# Creation of intermediate Output variables and of Computing Links
+# Creation of intermediate Output variables and of Control Links
 test_ISEVENOutGate = test_ISEVEN.Port( 'OutGate' )
 m3p1InGate = GraphSyracuseC_Gate.Link( test_ISEVENOutGate , m3p1.Port( 'InGate' ) )
 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
 div2anEvenInteger = GraphSyracuseC_Gate.Link( m3p1anEvenInteger , div2.Port( 'anEvenInteger' ) )
-div2anEvenInteger.AddCoord( 1 , 368 , 158 )
-div2anEvenInteger.AddCoord( 2 , 369 , 568 )
+div2anEvenInteger.AddCoord( 1 , 373 , 117 )
+div2anEvenInteger.AddCoord( 2 , 373 , 528 )
 div2anInteger = div2.Port( 'anInteger' )
 div2_ISONEanInteger = GraphSyracuseC_Gate.Link( div2anInteger , div2_ISONE.Port( 'anInteger' ) )
 div2_ISEVENanInteger = GraphSyracuseC_Gate.Link( div2anInteger , div2_ISEVEN.Port( 'anInteger' ) )
-div2_ISEVENanInteger.AddCoord( 1 , 603 , 342 )
-div2_ISEVENanInteger.AddCoord( 2 , 603 , 158 )
+div2_ISEVENanInteger.AddCoord( 1 , 626 , 302 )
+div2_ISEVENanInteger.AddCoord( 2 , 626 , 116 )
 
 # Creation of Input datas
-curM3P1 = m3p1.Input( 'anOddInteger' , 31)
-curtestISEVEN = test_ISEVEN.Input( 'anInteger' , curM3P1.ToAny() )
-curtestISONE = test_ISONE.Input( 'anInteger' , curM3P1.ToAny() )
-div2InanEvenInteger = div2.Port( 'anEvenInteger' )
+test_ISEVENanInteger = test_ISEVEN.Input( 'anInteger' , 31)
+test_ISONEanInteger = test_ISONE.Input( 'anInteger' , 31)
+m3p1anOddInteger = m3p1.Input( 'anOddInteger' , 31)
 incraCount = incr.Input( 'aCount' , 0)
 
 # Creation of Output variables
@@ -80,35 +83,11 @@ div2_ISEVENBoolEven = div2_ISEVEN.Port( 'BoolEven' )
 div2_ISONEBoolOne = div2_ISONE.Port( 'BoolOne' )
 incraNewCount = incr.Port( 'aNewCount' )
 
-GraphSyracuseC_Gate.IsValid()
-
-GraphSyracuseC_Gate.ThreadsMax()
-
-GraphSyracuseC_Gate.LevelMax()
-
-GraphSyracuseC_Gate.GraphsNumber()
-
-GraphSyracuseC_Gate.IsExecutable()
-
-exec GraphSyracuseC_Gate.ListNodes()
-
-curM3P1 = m3p1.Port( 'anOddInteger' )
-m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
-curtestISEVEN = test_ISEVEN.Port( 'anInteger' )
-curtestISONE = test_ISONE.Port( 'anInteger' )
-div2anEvenInteger = div2.Port( 'anEvenInteger' )
-div2anInteger = div2.Port( 'anInteger' )
-incraCount = incr.Port( 'aCount' )
-
-# Creation of Output variables
-test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
-test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
-div2_ISEVENBoolEven = div2_ISEVEN.Port( 'BoolEven' )
-div2_ISONEBoolOne = div2_ISONE.Port( 'BoolOne' )
-incraNewCount = incr.Port( 'aNewCount' )
 
 GraphSyracuseC_Gate.Start()
 
+div2InanInteger = div2.Port( 'anEvenInteger' )
+
 m3p1.Suspend()
 
 div2_ISEVEN.SuspendDone()
@@ -133,30 +112,83 @@ BoolEven = int( test_ISEVENBoolEven.ToString() )
 while BoolOne == 0 :
     if BoolEven == 0 :
         sts = div2_ISONE.ReRunAt('m3p1')
+        if sts == 0 :
+            print 'div2_ISONE.ReRunAt error'
+            break
         sts = incr.ReRun()
+        if sts == 0 :
+            print 'incr.ReRun error'
+            break
         sts = m3p1.DoneW()
+        if sts == 0 :
+            print 'm3p1.DoneW error'
+            break
         sts = incr.DoneW()
+        if sts == 0 :
+            print 'incr.DoneW error'
+            break
         sts = incraCount.Input( int( incraNewCount.ToString() ) + 1 )
+        if sts == 0 :
+            print 'incraCount.Input error'
+            break
         BoolEven = 1 
         BoolOne = 0
         Current = int( m3p1anEvenInteger.ToString() )
         print incraNewCount.ToString(),"m3p1",Current,BoolEven
+        if Current <= 0 :
+            break
+    if Current <= 0 :
+        break
     while BoolEven == 1 :
         sts = incr.ReRun()
+        if sts == 0 :
+            print 'incr.ReRun error'
+            break
         sts = div2.DoneW()
+        if sts == 0 :
+            print 'div2.DoneW error'
+            break
         sts = div2_ISEVEN.DoneW()
+        if sts == 0 :
+            print 'div2_ISEVEN.DoneW error'
+            break
         sts = div2_ISONE.DoneW()
+        if sts == 0 :
+            print 'div2_ISONE.DoneW error'
+            break
         sts = incr.DoneW()
+        if sts == 0 :
+            print 'incr.DoneW error'
+            break
         sts = incraCount.Input( incraNewCount.ToString() )
+        if sts == 0 :
+            print 'incraCount.Input error'
+            break
         BoolOne = int( div2_ISONEBoolOne.ToString() )
         BoolEven = int( div2_ISEVENBoolEven.ToString() )
         Current = int( div2anInteger.ToString() )
         print incraNewCount.ToString(),"div2",Current,BoolEven,BoolOne
+        if Current <= 0 :
+            break
         if BoolEven == 1 :
-            sts = div2InanEvenInteger.Input( Current )
+            sts = div2InanInteger.Input( Current )
+            if sts == 0 :
+                print 'div2InanInteger.Input error'
+                break
             sts = div2_ISONE.ReRunAt('div2')
-    sts = curM3P1.Input( Current )
+            if sts == 0 :
+                print 'div2_ISONE.ReRunAt error'
+                break
+    if Current <= 0 :
+        break
+    sts = m3p1anOddInteger.Input( Current )
+    if sts == 0 :
+        print 'm3p1anOddInteger.Input error'
+        break
     sts = m3p1InGate.InPort().Input( 1 )
+    if sts == 0 :
+        print 'm3p1InGate.InPort error'
+        break
 
 
 GraphSyracuseC_Gate.PrintThreads()