1 # Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Generated python file of Graph GraphLoopSwitchOfSwitch1
26 # Graph creation of GraphLoopSwitchOfSwitch1
27 def DefGraphLoopSwitchOfSwitch1() :
28 GraphLoopSwitchOfSwitch1 = Graph( 'GraphLoopSwitchOfSwitch1' )
29 GraphLoopSwitchOfSwitch1.SetName( 'GraphLoopSwitchOfSwitch1' )
30 GraphLoopSwitchOfSwitch1.SetAuthor( 'JR' )
31 GraphLoopSwitchOfSwitch1.SetComment( 'DefaultPorts of SwitchOdd and EndSwitchOdd are not connected but that link was not used' )
32 GraphLoopSwitchOfSwitch1.Coords( 0 , 0 )
34 # Creation of Factory Nodes
36 # Creation of InLine Nodes
38 PyIsEven.append( 'from time import * ' )
39 PyIsEven.append( 'def IsEven(a) : ' )
40 PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' )
41 PyIsEven.append( ' sleep( 1 ) ' )
42 PyIsEven.append( ' return a ' )
43 IsEven = GraphLoopSwitchOfSwitch1.INode( 'IsEven' , PyIsEven )
44 IsEven.SetName( 'IsEven' )
45 IsEven.SetAuthor( '' )
46 IsEven.SetComment( 'Compute Node' )
47 IsEven.Coords( 437 , 520 )
48 IIsEvena = IsEven.InPort( 'a' , 'long' )
49 IIsEvenGate = IsEven.GetInPort( 'Gate' )
50 OIsEvena = IsEven.OutPort( 'a' , 'long' )
51 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
54 PyPseudoPOne.append( 'from time import * ' )
55 PyPseudoPOne.append( 'def PseudoPOne(POne) : ' )
56 PyPseudoPOne.append( ' sleep(1) ' )
57 PyPseudoPOne.append( ' return 6*POne+1 ' )
58 PseudoPOne = GraphLoopSwitchOfSwitch1.INode( 'PseudoPOne' , PyPseudoPOne )
59 PseudoPOne.SetName( 'PseudoPOne' )
60 PseudoPOne.SetAuthor( '' )
61 PseudoPOne.SetComment( 'Compute Node' )
62 PseudoPOne.Coords( 612 , 5 )
63 IPseudoPOnePOne = PseudoPOne.InPort( 'POne' , 'long' )
64 IPseudoPOneGate = PseudoPOne.GetInPort( 'Gate' )
65 OPseudoPOnea = PseudoPOne.OutPort( 'a' , 'long' )
66 OPseudoPOneGate = PseudoPOne.GetOutPort( 'Gate' )
69 PyPseudoPThree.append( 'from time import * ' )
70 PyPseudoPThree.append( 'def PseudoPThree_1(PThree) : ' )
71 PyPseudoPThree.append( ' sleep(1) ' )
72 PyPseudoPThree.append( ' return 6*PThree+3 ' )
73 PseudoPThree = GraphLoopSwitchOfSwitch1.INode( 'PseudoPThree_1' , PyPseudoPThree )
74 PseudoPThree.SetName( 'PseudoPThree' )
75 PseudoPThree.SetAuthor( '' )
76 PseudoPThree.SetComment( 'Compute Node' )
77 PseudoPThree.Coords( 620 , 149 )
78 IPseudoPThreePThree = PseudoPThree.InPort( 'PThree' , 'long' )
79 IPseudoPThreeGate = PseudoPThree.GetInPort( 'Gate' )
80 OPseudoPThreea = PseudoPThree.OutPort( 'a' , 'long' )
81 OPseudoPThreeGate = PseudoPThree.GetOutPort( 'Gate' )
84 PyPseudoPFive.append( 'from time import * ' )
85 PyPseudoPFive.append( 'def PseudoPFive(PFive) : ' )
86 PyPseudoPFive.append( ' sleep(1) ' )
87 PyPseudoPFive.append( ' return 6*PFive+5 ' )
88 PseudoPFive = GraphLoopSwitchOfSwitch1.INode( 'PseudoPFive' , PyPseudoPFive )
89 PseudoPFive.SetName( 'PseudoPFive' )
90 PseudoPFive.SetAuthor( '' )
91 PseudoPFive.SetComment( 'Compute Node' )
92 PseudoPFive.Coords( 625 , 343 )
93 IPseudoPFivePFive = PseudoPFive.InPort( 'PFive' , 'long' )
94 IPseudoPFiveGate = PseudoPFive.GetInPort( 'Gate' )
95 OPseudoPFivea = PseudoPFive.OutPort( 'a' , 'long' )
96 OPseudoPFiveGate = PseudoPFive.GetOutPort( 'Gate' )
98 # Creation of Loop Nodes
100 PyLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
101 PyLoopSwitch.append( ' Index = Max ' )
102 PyLoopSwitch.append( ' return Index,Min,Max ' )
103 PyMoreLoopSwitch = []
104 PyMoreLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
105 PyMoreLoopSwitch.append( ' if Index >= Min : ' )
106 PyMoreLoopSwitch.append( ' DoLoop = 1 ' )
107 PyMoreLoopSwitch.append( ' else : ' )
108 PyMoreLoopSwitch.append( ' DoLoop = 0 ' )
109 PyMoreLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
110 PyNextLoopSwitch = []
111 PyNextLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
112 PyNextLoopSwitch.append( ' Index = Index - 1 ' )
113 PyNextLoopSwitch.append( ' return Index,Min,Max ' )
114 LoopSwitch,EndOfLoopSwitch = GraphLoopSwitchOfSwitch1.LNode( 'InitLoop' , PyLoopSwitch , 'MoreLoop' , PyMoreLoopSwitch , 'NextLoop' , PyNextLoopSwitch )
115 EndOfLoopSwitch.SetName( 'EndOfLoopSwitch' )
116 EndOfLoopSwitch.SetAuthor( '' )
117 EndOfLoopSwitch.SetComment( 'Compute Node' )
118 EndOfLoopSwitch.Coords( 1268 , 210 )
119 PyEndOfLoopSwitch = []
120 EndOfLoopSwitch.SetPyFunction( '' , PyEndOfLoopSwitch )
121 ILoopSwitchDoLoop = LoopSwitch.GetInPort( 'DoLoop' )
122 ILoopSwitchIndex = LoopSwitch.InPort( 'Index' , 'long' )
123 ILoopSwitchMin = LoopSwitch.InPort( 'Min' , 'long' )
124 ILoopSwitchMax = LoopSwitch.InPort( 'Max' , 'long' )
125 ILoopSwitchGate = LoopSwitch.GetInPort( 'Gate' )
126 OLoopSwitchDoLoop = LoopSwitch.GetOutPort( 'DoLoop' )
127 OLoopSwitchIndex = LoopSwitch.GetOutPort( 'Index' )
128 OLoopSwitchMin = LoopSwitch.GetOutPort( 'Min' )
129 OLoopSwitchMax = LoopSwitch.GetOutPort( 'Max' )
130 IEndOfLoopSwitchDoLoop = EndOfLoopSwitch.GetInPort( 'DoLoop' )
131 IEndOfLoopSwitchIndex = EndOfLoopSwitch.GetInPort( 'Index' )
132 IEndOfLoopSwitchMin = EndOfLoopSwitch.GetInPort( 'Min' )
133 IEndOfLoopSwitchMax = EndOfLoopSwitch.GetInPort( 'Max' )
134 IEndOfLoopSwitchGate = EndOfLoopSwitch.GetInPort( 'Gate' )
135 OEndOfLoopSwitchDoLoop = EndOfLoopSwitch.GetOutPort( 'DoLoop' )
136 OEndOfLoopSwitchIndex = EndOfLoopSwitch.GetOutPort( 'Index' )
137 OEndOfLoopSwitchMin = EndOfLoopSwitch.GetOutPort( 'Min' )
138 OEndOfLoopSwitchMax = EndOfLoopSwitch.GetOutPort( 'Max' )
139 OEndOfLoopSwitchGate = EndOfLoopSwitch.GetOutPort( 'Gate' )
140 LoopSwitch.SetName( 'LoopSwitch' )
141 LoopSwitch.SetAuthor( '' )
142 LoopSwitch.SetComment( 'Compute Node' )
143 LoopSwitch.Coords( 6 , 233 )
145 # Creation of Switch Nodes
147 PySwitch.append( 'from time import * ' )
148 PySwitch.append( 'def Switch(a) : ' )
149 PySwitch.append( ' sleep(1) ' )
150 PySwitch.append( ' if a <= 0 : ' )
151 PySwitch.append( ' return 0,a,0 ' )
152 PySwitch.append( ' return a & 1,a,1-(a&1) ' )
153 Switch,EndOfSwitch = GraphLoopSwitchOfSwitch1.SNode( 'Switch' , PySwitch )
154 EndOfSwitch.SetName( 'EndOfSwitch' )
155 EndOfSwitch.SetAuthor( '' )
156 EndOfSwitch.SetComment( 'Compute Node' )
157 EndOfSwitch.Coords( 1075 , 210 )
159 EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch )
160 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
161 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
162 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
163 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
164 Switch.SetName( 'Switch' )
165 Switch.SetAuthor( '' )
166 Switch.SetComment( 'Compute Node' )
167 Switch.Coords( 201 , 233 )
168 ISwitcha = Switch.InPort( 'a' , 'long' )
169 ISwitchGate = Switch.GetInPort( 'Gate' )
170 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
171 OSwitcha = Switch.OutPort( 'a' , 'int' )
172 OSwitchEven = Switch.OutPort( 'Even' , 'boolean' )
173 OSwitchDefault = Switch.GetOutPort( 'Default' )
176 PySwitchOdd.append( 'def SwitchOdd(a) : ' )
177 PySwitchOdd.append( ' n = a/6 ' )
178 PySwitchOdd.append( ' r = a%6 ' )
179 PySwitchOdd.append( ' POne = 0 ' )
180 PySwitchOdd.append( ' PThree = 0 ' )
181 PySwitchOdd.append( ' PFive = 0 ' )
182 PySwitchOdd.append( ' if r == 1 : ' )
183 PySwitchOdd.append( ' POne = 1 ' )
184 PySwitchOdd.append( ' if r == 3 : ' )
185 PySwitchOdd.append( ' PThree = 1 ' )
186 PySwitchOdd.append( ' if r == 5 : ' )
187 PySwitchOdd.append( ' PFive = 1 ' )
188 PySwitchOdd.append( ' return POne,PThree,PFive,n ' )
189 SwitchOdd,EndOfSwitchOdd = GraphLoopSwitchOfSwitch1.SNode( 'SwitchOdd' , PySwitchOdd )
190 EndOfSwitchOdd.SetName( 'EndOfSwitchOdd' )
191 EndOfSwitchOdd.SetAuthor( '' )
192 EndOfSwitchOdd.SetComment( 'Compute Node' )
193 EndOfSwitchOdd.Coords( 851 , 210 )
194 PyEndOfSwitchOdd = []
195 EndOfSwitchOdd.SetPyFunction( 'EndSwitch' , PyEndOfSwitchOdd )
196 IEndOfSwitchOddn = EndOfSwitchOdd.InPort( 'n' , 'long' )
197 IEndOfSwitchOddDefault = EndOfSwitchOdd.GetInPort( 'Default' )
198 OEndOfSwitchOddn = EndOfSwitchOdd.OutPort( 'n' , 'long' )
199 OEndOfSwitchOddGate = EndOfSwitchOdd.GetOutPort( 'Gate' )
200 SwitchOdd.SetName( 'SwitchOdd' )
201 SwitchOdd.SetAuthor( '' )
202 SwitchOdd.SetComment( 'Compute Node' )
203 SwitchOdd.Coords( 412 , 169 )
204 ISwitchOdda = SwitchOdd.InPort( 'a' , 'long' )
205 ISwitchOddGate = SwitchOdd.GetInPort( 'Gate' )
206 OSwitchOddPOne = SwitchOdd.OutPort( 'POne' , 'boolean' )
207 OSwitchOddPThree = SwitchOdd.OutPort( 'PThree' , 'boolean' )
208 OSwitchOddPFive = SwitchOdd.OutPort( 'PFive' , 'boolean' )
209 OSwitchOddn = SwitchOdd.OutPort( 'n' , 'long' )
210 OSwitchOddDefault = SwitchOdd.GetOutPort( 'Default' )
213 LLoopSwitchIndexSwitcha = GraphLoopSwitchOfSwitch1.Link( OLoopSwitchIndex , ISwitcha )
215 LLoopSwitchMinEndOfLoopSwitchMin = GraphLoopSwitchOfSwitch1.Link( OLoopSwitchMin , IEndOfLoopSwitchMin )
217 LLoopSwitchMaxEndOfLoopSwitchMax = GraphLoopSwitchOfSwitch1.Link( OLoopSwitchMax , IEndOfLoopSwitchMax )
219 LIsEvenaEndOfSwitcha = GraphLoopSwitchOfSwitch1.Link( OIsEvena , IEndOfSwitcha )
220 LIsEvenaEndOfSwitcha.AddCoord( 1 , 719 , 591 )
222 LSwitchOddSwitchOddGate = GraphLoopSwitchOfSwitch1.Link( OSwitchOdd , ISwitchOddGate )
224 LSwitchaIsEvena = GraphLoopSwitchOfSwitch1.Link( OSwitcha , IIsEvena )
226 LSwitchaSwitchOdda = GraphLoopSwitchOfSwitch1.Link( OSwitcha , ISwitchOdda )
228 LSwitchEvenIsEvenGate = GraphLoopSwitchOfSwitch1.Link( OSwitchEven , IIsEvenGate )
230 LSwitchDefaultEndOfSwitchDefault = GraphLoopSwitchOfSwitch1.Link( OSwitchDefault , IEndOfSwitchDefault )
231 LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 1057 , 267 )
232 LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 1079 , 669 )
233 LSwitchDefaultEndOfSwitchDefault.AddCoord( 3 , 383 , 666 )
235 LEndOfSwitchaEndOfLoopSwitchIndex = GraphLoopSwitchOfSwitch1.Link( OEndOfSwitcha , IEndOfLoopSwitchIndex )
237 LSwitchOddPOnePseudoPOneGate = GraphLoopSwitchOfSwitch1.Link( OSwitchOddPOne , IPseudoPOneGate )
239 LSwitchOddPThreePseudoPThreeGate = GraphLoopSwitchOfSwitch1.Link( OSwitchOddPThree , IPseudoPThreeGate )
241 LSwitchOddPFivePseudoPFiveGate = GraphLoopSwitchOfSwitch1.Link( OSwitchOddPFive , IPseudoPFiveGate )
243 LSwitchOddnPseudoPOnePOne = GraphLoopSwitchOfSwitch1.Link( OSwitchOddn , IPseudoPOnePOne )
245 LSwitchOddnPseudoPThreePThree = GraphLoopSwitchOfSwitch1.Link( OSwitchOddn , IPseudoPThreePThree )
247 LSwitchOddnPseudoPFivePFive = GraphLoopSwitchOfSwitch1.Link( OSwitchOddn , IPseudoPFivePFive )
249 LEndOfSwitchOddnEndOfSwitcha = GraphLoopSwitchOfSwitch1.Link( OEndOfSwitchOddn , IEndOfSwitcha )
251 LPseudoPOneaEndOfSwitchOddn = GraphLoopSwitchOfSwitch1.Link( OPseudoPOnea , IEndOfSwitchOddn )
253 LPseudoPThreeaEndOfSwitchOddn = GraphLoopSwitchOfSwitch1.Link( OPseudoPThreea , IEndOfSwitchOddn )
255 LPseudoPFiveaEndOfSwitchOddn = GraphLoopSwitchOfSwitch1.Link( OPseudoPFivea , IEndOfSwitchOddn )
258 ILoopSwitchIndex.Input( 0 )
259 ILoopSwitchMin.Input( -5 )
260 ILoopSwitchMax.Input( 17 )
262 # Output Ports of the graph
263 #OEndOfLoopSwitchIndex = EndOfLoopSwitch.GetOutPort( 'Index' )
264 #OEndOfLoopSwitchMin = EndOfLoopSwitch.GetOutPort( 'Min' )
265 #OEndOfLoopSwitchMax = EndOfLoopSwitch.GetOutPort( 'Max' )
266 return GraphLoopSwitchOfSwitch1
269 GraphLoopSwitchOfSwitch1 = DefGraphLoopSwitchOfSwitch1()