Salome HOME
NRI : Add documentation.
[modules/superv.git] / examples / GraphSyracuseC_Void.py
1
2 # Generated python file of Graph GraphSyracuseC_Void
3
4 from SuperV import *
5 # Graph creation 
6 GraphSyracuseC_Void = Graph( 'GraphSyracuseC_Void' )
7 print GraphSyracuseC_Void.SetName( 'GraphSyracuseC_Void' )
8 print GraphSyracuseC_Void.SetAuthor( 'JR' )
9 print GraphSyracuseC_Void.SetContainer( 'localhost/FactoryServer' )
10 print GraphSyracuseC_Void.SetComment( 'Syracuse algorithm' )
11 GraphSyracuseC_Void.Coords( 0 , 0 )
12
13 # Creation of Nodes
14 test_ISEVEN = GraphSyracuseC_Void.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
15 print test_ISEVEN.SetName( 'test_ISEVEN' )
16 print test_ISEVEN.SetAuthor( '' )
17 print test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
18 print test_ISEVEN.SetComment( '' )
19 test_ISEVEN.Coords( 5 , 416 )
20 test_ISONE = GraphSyracuseC_Void.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
21 print test_ISONE.SetName( 'test_ISONE' )
22 print test_ISONE.SetAuthor( '' )
23 print test_ISONE.SetContainer( 'localhost/FactoryServer' )
24 print test_ISONE.SetComment( '' )
25 test_ISONE.Coords( 7 , 232 )
26 m3p1 = GraphSyracuseC_Void.Node( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
27 print m3p1.SetName( 'm3p1' )
28 print m3p1.SetAuthor( '' )
29 print m3p1.SetContainer( 'localhost/FactoryServer' )
30 print m3p1.SetComment( '' )
31 m3p1.Coords( 180 , 417 )
32 div2 = GraphSyracuseC_Void.Node( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
33 print div2.SetName( 'div2' )
34 print div2.SetAuthor( '' )
35 print div2.SetContainer( 'localhost/FactoryServer' )
36 print div2.SetComment( '' )
37 div2.Coords( 435 , 7 )
38 div2_ISEVEN = GraphSyracuseC_Void.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
39 print div2_ISEVEN.SetName( 'div2_ISEVEN' )
40 print div2_ISEVEN.SetAuthor( '' )
41 print div2_ISEVEN.SetContainer( 'localhost/FactoryServer' )
42 print div2_ISEVEN.SetComment( '' )
43 div2_ISEVEN.Coords( 619 , 191 )
44 div2_ISONE = GraphSyracuseC_Void.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
45 print div2_ISONE.SetName( 'div2_ISONE' )
46 print div2_ISONE.SetAuthor( '' )
47 print div2_ISONE.SetContainer( 'localhost/FactoryServer' )
48 print div2_ISONE.SetComment( '' )
49 div2_ISONE.Coords( 616 , 6 )
50 incr = GraphSyracuseC_Void.Node( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
51 print incr.SetName( 'incr' )
52 print incr.SetAuthor( '' )
53 print incr.SetContainer( 'localhost/FactoryServer' )
54 print incr.SetComment( '' )
55 incr.Coords( 434 , 193 )
56
57 # Creation of intermediate Output variables and of links
58 test_ISEVENOutVoid = test_ISEVEN.Port( 'OutVoid' )
59 m3p1InVoid = GraphSyracuseC_Void.Link( test_ISEVENOutVoid , m3p1.Port( 'InVoid' ) )
60 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
61 div2anEvenInteger = GraphSyracuseC_Void.Link( m3p1anEvenInteger , div2.Port( 'anEvenInteger' ) )
62 print div2anEvenInteger.AddCoord( 1 , 368 , 158 )
63 print div2anEvenInteger.AddCoord( 2 , 369 , 568 )
64 div2anInteger = div2.Port( 'anInteger' )
65 div2_ISONEanInteger = GraphSyracuseC_Void.Link( div2anInteger , div2_ISONE.Port( 'anInteger' ) )
66 div2_ISEVENanInteger = GraphSyracuseC_Void.Link( div2anInteger , div2_ISEVEN.Port( 'anInteger' ) )
67 print div2_ISEVENanInteger.AddCoord( 1 , 603 , 342 )
68 print div2_ISEVENanInteger.AddCoord( 2 , 603 , 158 )
69
70 # Creation of Input datas
71 test_ISEVENanInteger = test_ISEVEN.Input( 'anInteger' , 31)
72 test_ISONEanInteger = test_ISONE.Input( 'anInteger' , 31)
73 m3p1anOddInteger = m3p1.Input( 'anOddInteger' , 31)
74 div2InanEvenInteger = div2.Port( 'anEvenInteger' )
75 incraCount = incr.Input( 'aCount' , 0)
76
77 # Missing Input datas
78
79 # Creation of Output variables
80 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
81 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
82 div2_ISEVENBoolEven = div2_ISEVEN.Port( 'BoolEven' )
83 div2_ISONEBoolOne = div2_ISONE.Port( 'BoolOne' )
84 incraNewCount = incr.Port( 'aNewCount' )
85
86 GraphSyracuseC_Void.IsValid()
87
88 GraphSyracuseC_Void.ThreadsMax()
89
90 GraphSyracuseC_Void.LevelMax()
91
92 GraphSyracuseC_Void.GraphsNumber()
93
94 curM3P1 = m3p1.Input( 'anOddInteger' , 31 )
95 curtestISEVEN = test_ISEVEN.Input( 'anInteger' , curM3P1.ToAny() )
96 curtestISONE = test_ISONE.Input( 'anInteger' , curM3P1.ToAny() )
97
98 GraphSyracuseC_Void.IsExecutable()
99
100 GraphSyracuseC_Void.Start()
101
102 m3p1.Suspend()
103
104 div2_ISEVEN.SuspendDone()
105 div2_ISONE.SuspendDone()
106
107 test_ISEVEN.Resume()
108 test_ISONE.Resume()
109
110 # Attente de fin d'exĂ©cution de test
111 test_ISONE.DoneW()
112 test_ISEVEN.DoneW()
113
114 m3p1.SuspendedW()
115 incr.SuspendedW()
116 incr.SuspendDone()
117
118 # Etats et Threads des nodes
119 GraphSyracuseC_Void.PrintThreads()
120
121 BoolOne = int( test_ISONEBoolOne.ToString() )
122 BoolEven = int( test_ISEVENBoolEven.ToString() )
123 while BoolOne == 0 :
124     if BoolEven == 0 :
125         sts = div2_ISONE.ReRunAt('m3p1')
126         sts = incr.ReRun()
127         sts = m3p1.DoneW()
128         sts = incr.DoneW()
129         sts = incraCount.Input( int( incraNewCount.ToString() ) + 1 )
130         BoolEven = 1 
131         BoolOne = 0
132         Current = int( m3p1anEvenInteger.ToString() )
133         print "m3p1",Current,BoolEven
134     while BoolEven == 1 :
135         sts = incr.ReRun()
136         sts = div2.DoneW()
137         sts = div2_ISEVEN.DoneW()
138         sts = div2_ISONE.DoneW()
139         sts = incr.DoneW()
140         sts = incraCount.Input( incraNewCount.ToString() )
141         BoolOne = int( div2_ISONEBoolOne.ToString() )
142         BoolEven = int( div2_ISEVENBoolEven.ToString() )
143         Current = int( div2anInteger.ToString() )
144         print "div2",Current,BoolEven,BoolOne
145         if BoolEven == 1 :
146             div2InanEvenInteger.Input( Current )
147             sts = div2_ISONE.ReRunAt('div2')
148     sts = curM3P1.Input( Current )
149
150
151 GraphSyracuseC_Void.PrintThreads()
152 m3p1.Resume()
153 div2.Resume()
154 incr.Resume()
155 div2_ISONE.Resume()
156 div2_ISEVEN.Resume()
157 GraphSyracuseC_Void.DoneW()
158 GraphSyracuseC_Void.PrintPorts()
159 GraphSyracuseC_Void.PrintThreads()
160