1 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 # File : GraphSyracuseC.py
23 # Module : SuperVisionTest
27 GraphSyracuseC = Graph( 'GraphSyracuseC' )
28 GraphSyracuseC.SetName( 'GraphSyracuseC' )
29 GraphSyracuseC.SetAuthor( 'JR' )
30 GraphSyracuseC.SetComment( 'Syracuse algorithm' )
31 GraphSyracuseC.Coords( 0 , 0 )
33 # Creation of Computing Nodes
34 test_ISEVEN = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
35 test_ISEVEN.SetName( 'test_ISEVEN' )
36 test_ISEVEN.SetAuthor( '' )
37 test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
38 test_ISEVEN.SetComment( '' )
39 test_ISEVEN.Coords( 252 , 266 )
40 test_ISONE = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
41 test_ISONE.SetName( 'test_ISONE' )
42 test_ISONE.SetAuthor( '' )
43 test_ISONE.SetContainer( 'localhost/FactoryServer' )
44 test_ISONE.SetComment( '' )
45 test_ISONE.Coords( 268 , 29 )
46 m3p1 = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
47 m3p1.SetName( 'm3p1' )
49 m3p1.SetContainer( 'localhost/FactoryServer' )
51 m3p1.Coords( 644 , 410 )
52 div2 = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
53 div2.SetName( 'div2' )
55 div2.SetContainer( 'localhost/FactoryServer' )
57 div2.Coords( 648 , 209 )
58 incr = GraphSyracuseC.Node( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
59 incr.SetName( 'incr' )
61 incr.SetContainer( 'localhost/FactoryServer' )
63 incr.Coords( 640 , 2 )
65 # Creation of Input datas
66 test_ISEVENanInteger = test_ISEVEN.Input( 'anInteger' , 7)
67 test_ISONEanInteger = test_ISONE.Input( 'anInteger' , 7)
68 m3p1anOddInteger = m3p1.Input( 'anOddInteger' , 7)
69 div2anEvenInteger = div2.Input( 'anEvenInteger' , 7)
70 incraCount = incr.Input( 'aCount' , 0)
72 # Creation of Output variables
73 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
74 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
75 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
76 div2anInteger = div2.Port( 'anInteger' )
77 incraNewCount = incr.Port( 'aNewCount' )
79 GraphSyracuseC.IsValid()
81 GraphSyracuseC.ThreadsMax()
83 GraphSyracuseC.LevelMax()
85 GraphSyracuseC.GraphsNumber()
87 GraphSyracuseC.IsExecutable()
89 exec GraphSyracuseC.ListNodes()
90 test_ISEVENanInteger = test_ISEVEN.Port( 'anInteger' )
91 test_ISONEanInteger = test_ISONE.Port( 'anInteger' )
92 m3p1anOddInteger = m3p1.Port( 'anOddInteger' )
93 div2anEvenInteger = div2.Port( 'anEvenInteger' )
94 incraCount = incr.Port( 'aCount' )
96 # Creation of Output variables
97 test_ISEVENBoolEven = test_ISEVEN.Port( 'BoolEven' )
98 test_ISONEBoolOne = test_ISONE.Port( 'BoolOne' )
99 m3p1anEvenInteger = m3p1.Port( 'anEvenInteger' )
100 div2anInteger = div2.Port( 'anInteger' )
101 incraNewCount = incr.Port( 'aNewCount' )
104 GraphSyracuseC.Start()
106 test_ISEVEN.SuspendDone()
107 test_ISONE.SuspendDone()
112 # Suspend des nodes de tete des sous-graphes sauf test
117 # Attentes de suspension de m3p1, div2, incr et result.
118 # Puis demandes de suspension après exécution
123 # Attente de fin d'exécution de test
127 # Etats et Threads des nodes
128 GraphSyracuseC.PrintThreads()
130 while int( test_ISONEBoolOne.ToString() ) == 0 :
131 if int( test_ISEVENBoolEven.ToString() ) == 0 :
135 sts = test_ISEVENanInteger.Input( m3p1anEvenInteger.ToString() )
136 sts = test_ISONEanInteger.Input( m3p1anEvenInteger.ToString() )
137 sts = test_ISEVEN.ReRun()
138 sts = test_ISONE.ReRun()
139 sts = test_ISEVEN.DoneW()
140 sts = test_ISONE.DoneW()
142 sts = incraCount.Input( incraNewCount.ToString() )
143 print incraNewCount.ToString(),"m3p1",m3p1anEvenInteger.ToString(),test_ISEVENBoolEven.ToString()
144 while int( test_ISEVENBoolEven.ToString() ) == 1 :
145 sts = div2anEvenInteger.Input( test_ISEVENanInteger.ToString() )
149 sts = test_ISEVENanInteger.Input( div2anInteger.ToString() )
150 sts = test_ISONEanInteger.Input( div2anInteger.ToString() )
151 sts = test_ISEVEN.ReRun()
152 sts = test_ISONE.ReRun()
153 sts = test_ISEVEN.DoneW()
154 sts = test_ISONE.DoneW()
156 sts = incraCount.Input( incraNewCount.ToString() )
157 print incraNewCount.ToString(),"div2",div2anInteger.ToString(),test_ISEVENBoolEven.ToString()
158 sts = m3p1anOddInteger.Input( div2anInteger.ToString() )
161 GraphSyracuseC.PrintThreads()
167 GraphSyracuseC.DoneW()
168 GraphSyracuseC.PrintPorts()
169 GraphSyracuseC.PrintThreads()