2 # Generated python file of Graph GraphSyracuseC
6 GraphSyracuseC = Graph( 'GraphSyracuseC' )
7 GraphSyracuseC.SetName( 'GraphSyracuseC' )
8 GraphSyracuseC.SetAuthor( 'JR' )
9 GraphSyracuseC.SetComment( 'Syracuse algorithm' )
10 GraphSyracuseC.Coords( 0 , 0 )
12 # Creation of Computing Nodes
13 test_ISEVEN = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
14 test_ISEVEN.SetName( 'test_ISEVEN' )
15 test_ISEVEN.SetAuthor( '' )
16 test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
17 test_ISEVEN.SetComment( '' )
18 test_ISEVEN.Coords( 252 , 266 )
19 test_ISONE = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
20 test_ISONE.SetName( 'test_ISONE' )
21 test_ISONE.SetAuthor( '' )
22 test_ISONE.SetContainer( 'localhost/FactoryServer' )
23 test_ISONE.SetComment( '' )
24 test_ISONE.Coords( 268 , 29 )
25 m3p1 = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
26 m3p1.SetName( 'm3p1' )
28 m3p1.SetContainer( 'localhost/FactoryServer' )
30 m3p1.Coords( 644 , 410 )
31 div2 = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
32 div2.SetName( 'div2' )
34 div2.SetContainer( 'localhost/FactoryServer' )
36 div2.Coords( 648 , 209 )
37 incr = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
38 incr.SetName( 'incr' )
40 incr.SetContainer( 'localhost/FactoryServer' )
42 incr.Coords( 640 , 2 )
44 # Creation of Input datas
45 test_ISEVENanInteger = test_ISEVEN.Input( 'anInteger' , 7)
46 test_ISONEanInteger = test_ISONE.Input( 'anInteger' , 7)
47 m3p1anOddInteger = m3p1.Input( 'anOddInteger' , 7)
48 div2anEvenInteger = div2.Input( 'anEvenInteger' , 7)
49 incraCount = incr.Input( 'aCount' , 0)
51 # Creation of Output variables
52 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
53 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
54 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
55 div2anInteger = div2.Port( 'anInteger' )
56 incraNewCount = incr.Port( 'aNewCount' )
58 GraphSyracuseC.IsValid()
60 GraphSyracuseC.ThreadsMax()
62 GraphSyracuseC.LevelMax()
64 GraphSyracuseC.GraphsNumber()
66 GraphSyracuseC.IsExecutable()
68 exec GraphSyracuseC.ListNodes()
69 test_ISEVENanInteger = test_ISEVEN.Port( 'anInteger' )
70 test_ISONEanInteger = test_ISONE.Port( 'anInteger' )
71 m3p1anOddInteger = m3p1.Port( 'anOddInteger' )
72 div2anEvenInteger = div2.Port( 'anEvenInteger' )
73 incraCount = incr.Port( 'aCount' )
75 # Creation of Output variables
76 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
77 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
78 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
79 div2anInteger = div2.Port( 'anInteger' )
80 incraNewCount = incr.Port( 'aNewCount' )
83 GraphSyracuseC.Start()
85 test_ISEVEN.SuspendDone()
86 test_ISONE.SuspendDone()
91 # Suspend des nodes de tete des sous-graphes sauf test
96 # Attentes de suspension de m3p1, div2, incr et result.
97 # Puis demandes de suspension après exécution
102 # Attente de fin d'exécution de test
106 # Etats et Threads des nodes
107 GraphSyracuseC.PrintThreads()
109 while int( test_ISONEBoolOne.ToString() ) == 0 :
110 if int( test_ISEVENBoolEven.ToString() ) == 0 :
114 sts = test_ISEVENanInteger.Input( m3p1anEvenInteger.ToString() )
115 sts = test_ISONEanInteger.Input( m3p1anEvenInteger.ToString() )
116 sts = test_ISEVEN.ReRun()
117 sts = test_ISONE.ReRun()
118 sts = test_ISEVEN.DoneW()
119 sts = test_ISONE.DoneW()
121 sts = incraCount.Input( incraNewCount.ToString() )
122 print incraNewCount.ToString(),"m3p1",m3p1anEvenInteger.ToString(),test_ISEVENBoolEven.ToString()
123 while int( test_ISEVENBoolEven.ToString() ) == 1 :
124 sts = div2anEvenInteger.Input( test_ISEVENanInteger.ToString() )
128 sts = test_ISEVENanInteger.Input( div2anInteger.ToString() )
129 sts = test_ISONEanInteger.Input( div2anInteger.ToString() )
130 sts = test_ISEVEN.ReRun()
131 sts = test_ISONE.ReRun()
132 sts = test_ISEVEN.DoneW()
133 sts = test_ISONE.DoneW()
135 sts = incraCount.Input( incraNewCount.ToString() )
136 print incraNewCount.ToString(),"div2",div2anInteger.ToString(),test_ISEVENBoolEven.ToString()
137 sts = m3p1anOddInteger.Input( div2anInteger.ToString() )
140 GraphSyracuseC.PrintThreads()
146 GraphSyracuseC.DoneW()
147 GraphSyracuseC.PrintPorts()
148 GraphSyracuseC.PrintThreads()