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