Salome HOME
PR: avoids unnecessary compilation after regeneration of SALOMEconfig.h, with gcc3.2
[modules/superv.git] / examples / GraphSyracuseC.py
1
2 # Generated python file of Graph GraphSyracuseC
3
4 from SuperV import *
5 # Graph creation 
6 GraphSyracuseC = Graph( 'GraphSyracuseC' )
7 GraphSyracuseC.SetName( 'GraphSyracuseC' )
8 GraphSyracuseC.SetAuthor( 'JR' )
9 GraphSyracuseC.SetComment( 'Syracuse algorithm' )
10 GraphSyracuseC.Coords( 0 , 0 )
11
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' )
27 m3p1.SetAuthor( '' )
28 m3p1.SetContainer( 'localhost/FactoryServer' )
29 m3p1.SetComment( '' )
30 m3p1.Coords( 644 , 410 )
31 div2 = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
32 div2.SetName( 'div2' )
33 div2.SetAuthor( '' )
34 div2.SetContainer( 'localhost/FactoryServer' )
35 div2.SetComment( '' )
36 div2.Coords( 648 , 209 )
37 incr = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
38 incr.SetName( 'incr' )
39 incr.SetAuthor( '' )
40 incr.SetContainer( 'localhost/FactoryServer' )
41 incr.SetComment( '' )
42 incr.Coords( 640 , 2 )
43
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)
50
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' )
57
58 GraphSyracuseC.IsValid()
59
60 GraphSyracuseC.ThreadsMax()
61
62 GraphSyracuseC.LevelMax()
63
64 GraphSyracuseC.GraphsNumber()
65
66 GraphSyracuseC.IsExecutable()
67
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' )
74
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' )
81
82
83 GraphSyracuseC.Start()
84
85 test_ISEVEN.SuspendDone()
86 test_ISONE.SuspendDone()
87
88 test_ISEVEN.Resume()
89 test_ISONE.Resume()
90
91 # Suspend des nodes de tete des sous-graphes sauf test
92 m3p1.Suspend()
93 div2.Suspend()
94 incr.Suspend()
95
96 # Attentes de suspension de m3p1, div2, incr et result.
97 # Puis demandes de suspension après exécution
98 m3p1.SuspendDone()
99 div2.SuspendDone()
100 incr.SuspendDone()
101
102 # Attente de fin d'exécution de test
103 test_ISONE.DoneW()
104 test_ISEVEN.DoneW()
105
106 # Etats et Threads des nodes
107 GraphSyracuseC.PrintThreads()
108
109 while int( test_ISONEBoolOne.ToString() ) == 0 :
110     if int( test_ISEVENBoolEven.ToString() ) == 0 :
111         sts = m3p1.ReRun()
112         sts = incr.ReRun()
113         sts = m3p1.DoneW()
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()
120         sts = incr.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() )
125         sts = div2.ReRun()
126         sts = incr.ReRun()
127         sts = div2.DoneW()
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()
134         sts = incr.DoneW()
135         sts = incraCount.Input( incraNewCount.ToString() )
136         print incraNewCount.ToString(),"div2",div2anInteger.ToString(),test_ISEVENBoolEven.ToString()
137     sts = m3p1anOddInteger.Input( div2anInteger.ToString() )
138
139
140 GraphSyracuseC.PrintThreads()
141 m3p1.Resume()
142 div2.Resume()
143 incr.Resume()
144 test_ISONE.Resume()
145 test_ISEVEN.Resume()
146 GraphSyracuseC.DoneW()
147 GraphSyracuseC.PrintPorts()
148 GraphSyracuseC.PrintThreads()
149