2 # Generated python file of Graph GraphSyracuseC_Gate
6 GraphSyracuseC_Gate = Graph( 'GraphSyracuseC_Gate' )
7 GraphSyracuseC_Gate.SetName( 'GraphSyracuseC_Gate' )
8 GraphSyracuseC_Gate.SetAuthor( 'JR' )
9 GraphSyracuseC_Gate.SetComment( 'Syracuse algorithm' )
10 GraphSyracuseC_Gate.Coords( 0 , 0 )
12 # Creation of Computing Nodes
13 test_ISEVEN = GraphSyracuseC_Gate.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( 5 , 416 )
19 test_ISONE = GraphSyracuseC_Gate.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( 7 , 232 )
25 m3p1 = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
26 m3p1.SetName( 'm3p1' )
28 m3p1.SetContainer( 'localhost/FactoryServer' )
30 m3p1.Coords( 180 , 417 )
31 div2 = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
32 div2.SetName( 'div2' )
34 div2.SetContainer( 'localhost/FactoryServer' )
36 div2.Coords( 435 , 7 )
37 div2_ISEVEN = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
38 div2_ISEVEN.SetName( 'div2_ISEVEN' )
39 div2_ISEVEN.SetAuthor( '' )
40 div2_ISEVEN.SetContainer( 'localhost/FactoryServer' )
41 div2_ISEVEN.SetComment( '' )
42 div2_ISEVEN.Coords( 619 , 191 )
43 div2_ISONE = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
44 div2_ISONE.SetName( 'div2_ISONE' )
45 div2_ISONE.SetAuthor( '' )
46 div2_ISONE.SetContainer( 'localhost/FactoryServer' )
47 div2_ISONE.SetComment( '' )
48 div2_ISONE.Coords( 616 , 6 )
49 incr = GraphSyracuseC_Gate.Node( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
50 incr.SetName( 'incr' )
52 incr.SetContainer( 'localhost/FactoryServer' )
54 incr.Coords( 434 , 193 )
56 # Creation of intermediate Output variables and of Computing Links
57 test_ISEVENOutGate = test_ISEVEN.Port( 'OutGate' )
58 m3p1InGate = GraphSyracuseC_Gate.Link( test_ISEVENOutGate , m3p1.Port( 'InGate' ) )
59 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
60 div2anEvenInteger = GraphSyracuseC_Gate.Link( m3p1anEvenInteger , div2.Port( 'anEvenInteger' ) )
61 div2anEvenInteger.AddCoord( 1 , 368 , 158 )
62 div2anEvenInteger.AddCoord( 2 , 369 , 568 )
63 div2anInteger = div2.Port( 'anInteger' )
64 div2_ISONEanInteger = GraphSyracuseC_Gate.Link( div2anInteger , div2_ISONE.Port( 'anInteger' ) )
65 div2_ISEVENanInteger = GraphSyracuseC_Gate.Link( div2anInteger , div2_ISEVEN.Port( 'anInteger' ) )
66 div2_ISEVENanInteger.AddCoord( 1 , 603 , 342 )
67 div2_ISEVENanInteger.AddCoord( 2 , 603 , 158 )
69 # Creation of Input datas
70 curM3P1 = m3p1.Input( 'anOddInteger' , 31)
71 curtestISEVEN = test_ISEVEN.Input( 'anInteger' , curM3P1.ToAny() )
72 curtestISONE = test_ISONE.Input( 'anInteger' , curM3P1.ToAny() )
73 div2InanEvenInteger = div2.Port( 'anEvenInteger' )
74 incraCount = incr.Input( 'aCount' , 0)
76 # Creation of Output variables
77 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
78 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
79 div2_ISEVENBoolEven = div2_ISEVEN.Port( 'BoolEven' )
80 div2_ISONEBoolOne = div2_ISONE.Port( 'BoolOne' )
81 incraNewCount = incr.Port( 'aNewCount' )
83 GraphSyracuseC_Gate.IsValid()
85 GraphSyracuseC_Gate.ThreadsMax()
87 GraphSyracuseC_Gate.LevelMax()
89 GraphSyracuseC_Gate.GraphsNumber()
91 GraphSyracuseC_Gate.IsExecutable()
93 exec GraphSyracuseC_Gate.ListNodes()
95 curM3P1 = m3p1.Port( 'anOddInteger' )
96 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
97 curtestISEVEN = test_ISEVEN.Port( 'anInteger' )
98 curtestISONE = test_ISONE.Port( 'anInteger' )
99 div2anEvenInteger = div2.Port( 'anEvenInteger' )
100 div2anInteger = div2.Port( 'anInteger' )
101 incraCount = incr.Port( 'aCount' )
103 # Creation of Output variables
104 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
105 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
106 div2_ISEVENBoolEven = div2_ISEVEN.Port( 'BoolEven' )
107 div2_ISONEBoolOne = div2_ISONE.Port( 'BoolOne' )
108 incraNewCount = incr.Port( 'aNewCount' )
110 GraphSyracuseC_Gate.Start()
114 div2_ISEVEN.SuspendDone()
115 div2_ISONE.SuspendDone()
120 # Attente de fin d'execution de test
128 # Etats et Threads des nodes
129 GraphSyracuseC_Gate.PrintThreads()
131 BoolOne = int( test_ISONEBoolOne.ToString() )
132 BoolEven = int( test_ISEVENBoolEven.ToString() )
135 sts = div2_ISONE.ReRunAt('m3p1')
139 sts = incraCount.Input( int( incraNewCount.ToString() ) + 1 )
142 Current = int( m3p1anEvenInteger.ToString() )
143 print incraNewCount.ToString(),"m3p1",Current,BoolEven
144 while BoolEven == 1 :
147 sts = div2_ISEVEN.DoneW()
148 sts = div2_ISONE.DoneW()
150 sts = incraCount.Input( incraNewCount.ToString() )
151 BoolOne = int( div2_ISONEBoolOne.ToString() )
152 BoolEven = int( div2_ISEVENBoolEven.ToString() )
153 Current = int( div2anInteger.ToString() )
154 print incraNewCount.ToString(),"div2",Current,BoolEven,BoolOne
156 sts = div2InanEvenInteger.Input( Current )
157 sts = div2_ISONE.ReRunAt('div2')
158 sts = curM3P1.Input( Current )
159 sts = m3p1InGate.InPort().Input( 1 )
162 GraphSyracuseC_Gate.PrintThreads()
168 GraphSyracuseC_Gate.DoneW()
169 GraphSyracuseC_Gate.PrintPorts()
170 GraphSyracuseC_Gate.PrintThreads()