Salome HOME
0022763: [EDF] Shape processing
[samples/datafiles.git] / Superv / Python / GraphEditGraphSwitchs_3.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
23 # Generated python file of Graph GraphEditSwitchs
24 #
25 from SuperV import *
26
27 # Graph creation of GraphEditSwitchs
28 def DefGraphEditSwitchs() :
29     GraphEditSwitchs = Graph( 'GraphEditSwitchs' )
30     GraphEditSwitchs.SetName( 'GraphEditSwitchs' )
31     GraphEditSwitchs.SetAuthor( '' )
32     GraphEditSwitchs.SetComment( '' )
33     GraphEditSwitchs.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     # Creation of InLine Nodes
38     PyIsOdd = []
39     PyIsOdd.append( 'from time import *   ' )
40     PyIsOdd.append( 'def IsOdd(a) :       ' )
41     PyIsOdd.append( '    print a,"IsOdd (GraphSwitchs)"      ' )
42     PyIsOdd.append( '    sleep( 1 )   ' )
43     PyIsOdd.append( '    return a     ' )
44     IsOdd = GraphEditSwitchs.INode( 'IsOdd' , PyIsOdd )
45     IsOdd.SetName( 'IsOdd' )
46     IsOdd.SetAuthor( '' )
47     IsOdd.SetComment( 'Python function' )
48     IsOdd.Coords( 388 , 50 )
49     IIsOdda = IsOdd.InPort( 'a' , 'long' )
50     IIsOddGate = IsOdd.GetInPort( 'Gate' )
51     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
52     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
53     
54     PyIsOdd_1 = []
55     PyIsOdd_1.append( 'from time import *   ' )
56     PyIsOdd_1.append( 'def IsOdd(a) :       ' )
57     PyIsOdd_1.append( '    print a,"IsOdd_1 (GraphSwitchs)"      ' )
58     PyIsOdd_1.append( '    sleep( 1 )   ' )
59     PyIsOdd_1.append( '    return a     ' )
60     IsOdd_1 = GraphEditSwitchs.INode( 'IsOdd' , PyIsOdd_1 )
61     IsOdd_1.SetName( 'IsOdd_1' )
62     IsOdd_1.SetAuthor( '' )
63     IsOdd_1.SetComment( 'Python function' )
64     IsOdd_1.Coords( 419 , 308 )
65     IIsOdd_1a = IsOdd_1.InPort( 'a' , 'long' )
66     IIsOdd_1Gate = IsOdd_1.GetInPort( 'Gate' )
67     OIsOdd_1a = IsOdd_1.OutPort( 'a' , 'long' )
68     OIsOdd_1Gate = IsOdd_1.GetOutPort( 'Gate' )
69     
70     # Creation of Loop Nodes
71     PyInitLoop = []
72     PyInitLoop.append( 'def InitLoop(Index,Min,Max) :      ' )
73     PyInitLoop.append( '        return Index,Min,Max     ' )
74     PyMoreInitLoop = []
75     PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) :     ' )
76     PyMoreInitLoop.append( '    if Index <= Max :   ' )
77     PyMoreInitLoop.append( '            DoLoop = 1     ' )
78     PyMoreInitLoop.append( '    else :     ' )
79     PyMoreInitLoop.append( '            DoLoop = 0     ' )
80     PyMoreInitLoop.append( '    return DoLoop,Index,Min,Max     ' )
81     PyNextInitLoop = []
82     PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) :     ' )
83     PyNextInitLoop.append( '    Index = Index + 1     ' )
84     PyNextInitLoop.append( '    return Index,Min,Max     ' )
85     InitLoop,EndOfInitLoop = GraphEditSwitchs.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
86     EndOfInitLoop.SetName( 'EndOfInitLoop' )
87     EndOfInitLoop.SetAuthor( '' )
88     EndOfInitLoop.SetComment( 'Compute Node' )
89     EndOfInitLoop.Coords( 783 , 381 )
90     PyEndOfInitLoop = []
91     EndOfInitLoop.SetPyFunction( '' , PyEndOfInitLoop )
92     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
93     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
94     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
95     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
96     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
97     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
98     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
99     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
100     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
101     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
102     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
103     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
104     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
105     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
106     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
107     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
108     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
109     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
110     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
111     InitLoop.SetName( 'InitLoop' )
112     InitLoop.SetAuthor( '' )
113     InitLoop.SetComment( 'Compute Node' )
114     InitLoop.Coords( 10 , 388 )
115     
116     # Creation of Switch Nodes
117     PySwitch = []
118     PySwitch.append( 'from time import * ' )
119     PySwitch.append( 'def Switch(a) :   ' )
120     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
121     PySwitch.append( '        sleep(1)    ' )
122     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
123     Switch,EndOfSwitch = GraphEditSwitchs.SNode( 'Switch' , PySwitch )
124     EndOfSwitch.SetName( 'EndOfSwitch' )
125     EndOfSwitch.SetAuthor( '' )
126     EndOfSwitch.SetComment( 'Compute Node' )
127     EndOfSwitch.Coords( 587 , 126 )
128     PyEndOfSwitch = []
129     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
130     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
131     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
132     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
133     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
134     Switch.SetName( 'Switch' )
135     Switch.SetAuthor( '' )
136     Switch.SetComment( 'Compute Node' )
137     Switch.Coords( 186 , 130 )
138     ISwitcha = Switch.InPort( 'a' , 'long' )
139     ISwitchGate = Switch.GetInPort( 'Gate' )
140     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
141     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
142     OSwitcha = Switch.OutPort( 'a' , 'int' )
143     OSwitchDefault = Switch.GetOutPort( 'Default' )
144     
145     PySwitch_1 = []
146     PySwitch_1.append( 'from time import *  ' )
147     PySwitch_1.append( 'def Switch(a) :    ' )
148     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
149     PySwitch_1.append( '        sleep(1)  ' )
150     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
151     Switch_1,EndSwitch = GraphEditSwitchs.SNode( 'Switch' , PySwitch_1 )
152     EndSwitch.SetName( 'EndSwitch' )
153     EndSwitch.SetAuthor( '' )
154     EndSwitch.SetComment( 'Compute Node' )
155     EndSwitch.Coords( 605 , 382 )
156     PyEndSwitch = []
157     EndSwitch.SetPyFunction( '' , PyEndSwitch )
158     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
159     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
160     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
161     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
162     Switch_1.SetName( 'Switch_1' )
163     Switch_1.SetAuthor( '' )
164     Switch_1.SetComment( 'Compute Node' )
165     Switch_1.Coords( 193 , 388 )
166     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
167     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
168     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
169     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
170     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
171     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
172     
173     # Creation of Links
174     LIsOddaEndOfSwitcha = GraphEditSwitchs.Link( OIsOdda , IEndOfSwitcha )
175     LIsOddaEndOfSwitcha.AddCoord( 1 , 573 , 160 )
176     LIsOddaEndOfSwitcha.AddCoord( 2 , 572 , 130 )
177     
178     LIsOdd_1aEndSwitcha = GraphEditSwitchs.Link( OIsOdd_1a , IEndSwitcha )
179     LIsOdd_1aEndSwitcha.AddCoord( 1 , 599 , 416 )
180     LIsOdd_1aEndSwitcha.AddCoord( 2 , 598 , 389 )
181     
182     LInitLoopIndexSwitch_1a = GraphEditSwitchs.Link( OInitLoopIndex , ISwitch_1a )
183     
184     LInitLoopIndexSwitcha = GraphEditSwitchs.Link( OInitLoopIndex , ISwitcha )
185     
186     LInitLoopMinEndOfInitLoopMin = GraphEditSwitchs.Link( OInitLoopMin , IEndOfInitLoopMin )
187     
188     LInitLoopMaxEndOfInitLoopMax = GraphEditSwitchs.Link( OInitLoopMax , IEndOfInitLoopMax )
189     
190     LSwitchOddIsOddGate = GraphEditSwitchs.Link( OSwitchOdd , IIsOddGate )
191     
192     LSwitchaIsOdda = GraphEditSwitchs.Link( OSwitcha , IIsOdda )
193     LSwitchaIsOdda.AddCoord( 1 , 365 , 129 )
194     LSwitchaIsOdda.AddCoord( 2 , 365 , 222 )
195     
196     LSwitchDefaultEndOfSwitchDefault = GraphEditSwitchs.Link( OSwitchDefault , IEndOfSwitchDefault )
197     LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 572 , 194 )
198     LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 571 , 257 )
199     
200     LEndOfSwitchaEndOfInitLoopIndex = GraphEditSwitchs.Link( OEndOfSwitcha , IEndOfInitLoopIndex )
201     
202     LSwitch_1OddIsOdd_1Gate = GraphEditSwitchs.Link( OSwitch_1Odd , IIsOdd_1Gate )
203     
204     LSwitch_1EvenEndSwitchDefault = GraphEditSwitchs.Link( OSwitch_1Even , IEndSwitchDefault )
205     
206     LSwitch_1aIsOdd_1a = GraphEditSwitchs.Link( OSwitch_1a , IIsOdd_1a )
207     LSwitch_1aIsOdd_1a.AddCoord( 1 , 379 , 387 )
208     LSwitch_1aIsOdd_1a.AddCoord( 2 , 378 , 481 )
209     
210     LEndSwitchGateEndOfInitLoopGate = GraphEditSwitchs.Link( OEndSwitchGate , IEndOfInitLoopGate )
211     
212     # Input datas
213     IInitLoopIndex.Input( 0 )
214     IInitLoopMin.Input( 0 )
215     IInitLoopMax.Input( 20 )
216     
217     # Output Ports of the graph
218     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
219     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
220     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
221     #OSwitchEven = Switch.GetOutPort( 'Even' )
222     #OEndSwitcha = EndSwitch.GetOutPort( 'a' )
223     return GraphEditSwitchs
224
225
226 GraphEditSwitchs = DefGraphEditSwitchs()