Salome HOME
0022763: [EDF] Shape processing
[samples/datafiles.git] / Superv / Python / GraphSyracuseControl.py
1 # Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 from SuperV import *
23
24 GraphSyracuseControl = Graph( 'GraphSyracuseControl' )
25 print GraphSyracuseControl.SetName( 'GraphSyracuseControl' )
26 print GraphSyracuseControl.SetAuthor( 'JR' )
27 print GraphSyracuseControl.SetComment( 'Syracuse algorithm' )
28 GraphSyracuseControl.Coords( 0 , 0 )
29
30
31 test_ISEVEN = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISEVEN' )
32 print test_ISEVEN.SetName( 'test_ISEVEN' )
33 print test_ISEVEN.SetAuthor( '' )
34 print test_ISEVEN.SetContainer( 'localhost/FactoryServer' )
35 print test_ISEVEN.SetComment( '' )
36 test_ISEVEN.Coords( 190 , 338 )
37 test_ISONE = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_ISONE' )
38 print test_ISONE.SetName( 'test_ISONE' )
39 print test_ISONE.SetAuthor( '' )
40 print test_ISONE.SetContainer( 'localhost/FactoryServer' )
41 print test_ISONE.SetComment( '' )
42 test_ISONE.Coords( 196 , 131 )
43 m3p1 = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_M3P1' )
44 print m3p1.SetName( 'm3p1' )
45 print m3p1.SetAuthor( '' )
46 print m3p1.SetContainer( 'localhost/FactoryServer' )
47 print m3p1.SetComment( '' )
48 m3p1.Coords( 621 , 14 )
49 div2 = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_DIV2' )
50 print div2.SetName( 'div2' )
51 print div2.SetAuthor( '' )
52 print div2.SetContainer( 'localhost/FactoryServer' )
53 print div2.SetComment( '' )
54 div2.Coords( 624 , 391 )
55 incr = GraphSyracuseControl.Node( 'SyrComponent' , 'SyrComponent' , 'C_INCR' )
56 print incr.SetName( 'incr' )
57 print incr.SetAuthor( '' )
58 print incr.SetContainer( 'localhost/FactoryServer' )
59 print incr.SetComment( '' )
60 incr.Coords( 622 , 199 )
61 label_begin = GraphSyracuseControl.LNode( 'label_begin' )
62 print label_begin.SetName( 'label_begin' )
63 print label_begin.SetAuthor( '' )
64 print label_begin.SetContainer( 'localhost/FactoryServerPy' )
65 print label_begin.SetComment( '' )
66 label_begin.Coords( 7 , 216 )
67 label_test = GraphSyracuseControl.LService( 'SyrControlComponent' , 'SyrControlComponent' , 'L_OneEven' )
68 print label_test.SetName( 'label_test' )
69 print label_test.SetAuthor( '' )
70 print label_test.SetContainer( 'localhost/FactoryServerPy' )
71 print label_test.SetComment( '' )
72 label_test.Coords( 399 , 176 )
73 control_m3p1 = GraphSyracuseControl.CService( 'SyrControlComponent' , 'SyrControlComponent' , 'C_NotOneIsEven' )
74 print control_m3p1.SetName( 'control_m3p1' )
75 print control_m3p1.SetAuthor( '' )
76 print control_m3p1.SetContainer( 'localhost/FactoryServerPy' )
77 print control_m3p1.SetComment( '' )
78 control_m3p1.Coords( 814 , 13 )
79 control_div2 = GraphSyracuseControl.CNode( 'control_div2' )
80 print control_div2.SetName( 'control_div2' )
81 print control_div2.SetAuthor( '' )
82 print control_div2.SetContainer( 'localhost/FactoryServerPy' )
83 print control_div2.SetComment( '' )
84 control_div2.Coords( 812 , 414 )
85
86
87 label_begin.BusPorts( 'NB' , 'long' , 'NT' , 'long' )
88 label_begin.BusPorts( 'KB' , 'long' , 'KT' , 'long' )
89 label_test.BusPorts( 'NT' , 'long' , 'N' , 'long' )
90 label_test.BusPorts( 'KT' , 'long' , 'K' , 'long' )
91 control_m3p1.BusPorts( 'N' , 'long' , 'NT' , 'long' )
92 control_m3p1.BusPorts( 'K' , 'long' , 'KT' , 'long' )
93 control_div2.BusPorts( 'N' , 'long' , 'NB' , 'long' )
94 control_div2.BusPorts( 'K' , 'long' , 'KB' , 'long' )
95
96
97 GraphSyracuseControl.Link( label_begin.Port( 'NT' ) , label_test.Port( 'NT' ) )
98 GraphSyracuseControl.Link( label_begin.Port( 'KT' ) , label_test.Port( 'KT' ) )
99 GraphSyracuseControl.Link( label_begin.Port( 'NT' ) , test_ISEVEN.Port( 'anInteger' ) )
100 GraphSyracuseControl.Link( label_begin.Port( 'NT' ) , test_ISONE.Port( 'anInteger' ) )
101
102 GraphSyracuseControl.Link( test_ISEVEN.Port( 'BoolEven' ) , label_test.Port( 'ValEven' ) )
103 GraphSyracuseControl.Link( test_ISONE.Port( 'BoolOne' ) , label_test.Port( 'ValOne' ) )
104 GraphSyracuseControl.Link( label_test.Port( 'N' ) , m3p1.Port( 'anOddInteger' ) )
105 GraphSyracuseControl.Link( label_test.Port( 'N' ) , div2.Port( 'anEvenInteger' ) )
106 GraphSyracuseControl.Link( label_test.Port( 'K' ) , incr.Port( 'aCount' ) )
107 GraphSyracuseControl.Link( label_test.Port( 'Incr' ) , incr.Port( 'InGate' ) )
108 GraphSyracuseControl.Link( label_test.Port( 'Even' ) , div2.Port( 'InGate' ) )
109 GraphSyracuseControl.Link( label_test.Port( 'Odd' ) , m3p1.Port( 'InGate' ) )
110
111 GraphSyracuseControl.Link( m3p1.Port( 'anEvenInteger' ) , control_m3p1.Port( 'N' ) )
112 GraphSyracuseControl.Link( div2.Port( 'anInteger' ) , control_div2.Port( 'N' ) )
113 GraphSyracuseControl.Link( incr.Port( 'aNewCount' ) , control_m3p1.Port( 'K' ) )
114 GraphSyracuseControl.Link( incr.Port( 'aNewCount' ) , control_div2.Port( 'K' ) )
115
116 GraphSyracuseControl.Link( control_m3p1.Port( 'OutGate' ) , label_test.Port( 'InGate' ) )
117 GraphSyracuseControl.Link( control_div2.Port( 'OutGate' ) , label_begin.Port( 'InGate' ) )
118
119 GraphSyracuseControl.IsValid()
120
121 GraphSyracuseControl.ThreadsMax()
122
123 GraphSyracuseControl.LevelMax()
124
125 GraphSyracuseControl.GraphsNumber()
126
127 label_begin.Input( 'NB' , 31 )
128 label_begin.Input( 'KB' , 0 )
129
130 GraphSyracuseControl.IsExecutable()
131
132 GraphSyracuseControl.Export('../GraphSyrControl')
133
134
135 GraphSyracuseControl.Run()
136
137 GraphSyracuseControl.DoneW()
138
139 print GraphSyracuseControl.State()
140
141 GraphSyracuseControl.PrintPorts()
142
143 label_test.PrintPorts()