1 # Copyright (C) 2007-2015 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, or (at your option) any later version.
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
23 # Generated python file of Graph GraphLoopSwitchOfSwitchNOTValid
27 # Graph creation of GraphLoopSwitchOfSwitchNOTValid
28 def DefGraphLoopSwitchOfSwitchNOTValid() :
29 GraphLoopSwitchOfSwitchNOTValid = Graph( 'GraphLoopSwitchOfSwitchNOTValid' )
30 GraphLoopSwitchOfSwitchNOTValid.SetName( 'GraphLoopSwitchOfSwitchNOTValid' )
31 GraphLoopSwitchOfSwitchNOTValid.SetAuthor( 'JR' )
32 GraphLoopSwitchOfSwitchNOTValid.SetComment( '' )
33 GraphLoopSwitchOfSwitchNOTValid.Coords( 0 , 0 )
35 # Creation of Factory Nodes
37 # Creation of InLine Nodes
39 PyIsEven.append( 'from time import * ' )
40 PyIsEven.append( 'def IsEven(a) : ' )
41 PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' )
42 PyIsEven.append( ' sleep( 1 ) ' )
43 PyIsEven.append( ' return a ' )
44 IsEven = GraphLoopSwitchOfSwitchNOTValid.INode( 'IsEven' , PyIsEven )
45 IsEven.SetName( 'IsEven' )
46 IsEven.SetAuthor( '' )
47 IsEven.SetComment( 'Compute Node' )
48 IsEven.Coords( 437 , 520 )
49 IIsEvena = IsEven.InPort( 'a' , 'long' )
50 IIsEvenGate = IsEven.GetInPort( 'Gate' )
51 OIsEvena = IsEven.OutPort( 'a' , 'long' )
52 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
55 PyPseudoPOne.append( 'from time import * ' )
56 PyPseudoPOne.append( 'def PseudoPOne(POne) : ' )
57 PyPseudoPOne.append( ' sleep(1) ' )
58 PyPseudoPOne.append( ' return 6*POne+1 ' )
59 PseudoPOne = GraphLoopSwitchOfSwitchNOTValid.INode( 'PseudoPOne' , PyPseudoPOne )
60 PseudoPOne.SetName( 'PseudoPOne' )
61 PseudoPOne.SetAuthor( '' )
62 PseudoPOne.SetComment( 'Compute Node' )
63 PseudoPOne.Coords( 612 , 5 )
64 IPseudoPOnePOne = PseudoPOne.InPort( 'POne' , 'long' )
65 IPseudoPOneGate = PseudoPOne.GetInPort( 'Gate' )
66 OPseudoPOnea = PseudoPOne.OutPort( 'a' , 'long' )
67 OPseudoPOneGate = PseudoPOne.GetOutPort( 'Gate' )
70 PyPseudoPThree.append( 'from time import * ' )
71 PyPseudoPThree.append( 'def PseudoPThree_1(PThree) : ' )
72 PyPseudoPThree.append( ' sleep(1) ' )
73 PyPseudoPThree.append( ' return 6*PThree+3 ' )
74 PseudoPThree = GraphLoopSwitchOfSwitchNOTValid.INode( 'PseudoPThree_1' , PyPseudoPThree )
75 PseudoPThree.SetName( 'PseudoPThree' )
76 PseudoPThree.SetAuthor( '' )
77 PseudoPThree.SetComment( 'Compute Node' )
78 PseudoPThree.Coords( 620 , 149 )
79 IPseudoPThreePThree = PseudoPThree.InPort( 'PThree' , 'long' )
80 IPseudoPThreeGate = PseudoPThree.GetInPort( 'Gate' )
81 OPseudoPThreea = PseudoPThree.OutPort( 'a' , 'long' )
82 OPseudoPThreeGate = PseudoPThree.GetOutPort( 'Gate' )
85 PyPseudoPFive.append( 'from time import * ' )
86 PyPseudoPFive.append( 'def PseudoPFive(PFive) : ' )
87 PyPseudoPFive.append( ' sleep(1) ' )
88 PyPseudoPFive.append( ' return 6*PFive+5 ' )
89 PseudoPFive = GraphLoopSwitchOfSwitchNOTValid.INode( 'PseudoPFive' , PyPseudoPFive )
90 PseudoPFive.SetName( 'PseudoPFive' )
91 PseudoPFive.SetAuthor( '' )
92 PseudoPFive.SetComment( 'Compute Node' )
93 PseudoPFive.Coords( 625 , 343 )
94 IPseudoPFivePFive = PseudoPFive.InPort( 'PFive' , 'long' )
95 IPseudoPFiveGate = PseudoPFive.GetInPort( 'Gate' )
96 OPseudoPFivea = PseudoPFive.OutPort( 'a' , 'long' )
97 OPseudoPFiveGate = PseudoPFive.GetOutPort( 'Gate' )
99 # Creation of Loop Nodes
101 PyLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
102 PyLoopSwitch.append( ' Index = Max ' )
103 PyLoopSwitch.append( ' return Index,Min,Max ' )
104 PyMoreLoopSwitch = []
105 PyMoreLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
106 PyMoreLoopSwitch.append( ' if Index >= Min : ' )
107 PyMoreLoopSwitch.append( ' DoLoop = 1 ' )
108 PyMoreLoopSwitch.append( ' else : ' )
109 PyMoreLoopSwitch.append( ' DoLoop = 0 ' )
110 PyMoreLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
111 PyNextLoopSwitch = []
112 PyNextLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
113 PyNextLoopSwitch.append( ' Index = Index - 1 ' )
114 PyNextLoopSwitch.append( ' return Index,Min,Max ' )
115 LoopSwitch,EndOfLoopSwitch = GraphLoopSwitchOfSwitchNOTValid.LNode( 'InitLoop' , PyLoopSwitch , 'MoreLoop' , PyMoreLoopSwitch , 'NextLoop' , PyNextLoopSwitch )
116 EndOfLoopSwitch.SetName( 'EndOfLoopSwitch' )
117 EndOfLoopSwitch.SetAuthor( '' )
118 EndOfLoopSwitch.SetComment( 'Compute Node' )
119 EndOfLoopSwitch.Coords( 1268 , 210 )
120 PyEndOfLoopSwitch = []
121 EndOfLoopSwitch.SetPyFunction( '' , PyEndOfLoopSwitch )
122 ILoopSwitchDoLoop = LoopSwitch.GetInPort( 'DoLoop' )
123 ILoopSwitchIndex = LoopSwitch.InPort( 'Index' , 'long' )
124 ILoopSwitchMin = LoopSwitch.InPort( 'Min' , 'long' )
125 ILoopSwitchMax = LoopSwitch.InPort( 'Max' , 'long' )
126 ILoopSwitchGate = LoopSwitch.GetInPort( 'Gate' )
127 OLoopSwitchDoLoop = LoopSwitch.GetOutPort( 'DoLoop' )
128 OLoopSwitchIndex = LoopSwitch.GetOutPort( 'Index' )
129 OLoopSwitchMin = LoopSwitch.GetOutPort( 'Min' )
130 OLoopSwitchMax = LoopSwitch.GetOutPort( 'Max' )
131 IEndOfLoopSwitchDoLoop = EndOfLoopSwitch.GetInPort( 'DoLoop' )
132 IEndOfLoopSwitchIndex = EndOfLoopSwitch.GetInPort( 'Index' )
133 IEndOfLoopSwitchMin = EndOfLoopSwitch.GetInPort( 'Min' )
134 IEndOfLoopSwitchMax = EndOfLoopSwitch.GetInPort( 'Max' )
135 IEndOfLoopSwitchGate = EndOfLoopSwitch.GetInPort( 'Gate' )
136 OEndOfLoopSwitchDoLoop = EndOfLoopSwitch.GetOutPort( 'DoLoop' )
137 OEndOfLoopSwitchIndex = EndOfLoopSwitch.GetOutPort( 'Index' )
138 OEndOfLoopSwitchMin = EndOfLoopSwitch.GetOutPort( 'Min' )
139 OEndOfLoopSwitchMax = EndOfLoopSwitch.GetOutPort( 'Max' )
140 OEndOfLoopSwitchGate = EndOfLoopSwitch.GetOutPort( 'Gate' )
141 LoopSwitch.SetName( 'LoopSwitch' )
142 LoopSwitch.SetAuthor( '' )
143 LoopSwitch.SetComment( 'Compute Node' )
144 LoopSwitch.Coords( 6 , 233 )
146 # Creation of Switch Nodes
148 PySwitch.append( 'from time import * ' )
149 PySwitch.append( 'def Switch(a) : ' )
150 PySwitch.append( ' sleep(1) ' )
151 PySwitch.append( ' if a <= 0 : ' )
152 PySwitch.append( ' return 0,a,0 ' )
153 PySwitch.append( ' return a & 1,a,1-(a&1) ' )
154 Switch,EndOfSwitch = GraphLoopSwitchOfSwitchNOTValid.SNode( 'Switch' , PySwitch )
155 EndOfSwitch.SetName( 'EndOfSwitch' )
156 EndOfSwitch.SetAuthor( '' )
157 EndOfSwitch.SetComment( 'Compute Node' )
158 EndOfSwitch.Coords( 1075 , 210 )
160 EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch )
161 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
162 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
163 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
164 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
165 Switch.SetName( 'Switch' )
166 Switch.SetAuthor( '' )
167 Switch.SetComment( 'Compute Node' )
168 Switch.Coords( 201 , 233 )
169 ISwitcha = Switch.InPort( 'a' , 'long' )
170 ISwitchGate = Switch.GetInPort( 'Gate' )
171 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
172 OSwitcha = Switch.OutPort( 'a' , 'int' )
173 OSwitchEven = Switch.OutPort( 'Even' , 'boolean' )
174 OSwitchDefault = Switch.GetOutPort( 'Default' )
177 PySwitchOdd.append( 'def SwitchOdd(a) : ' )
178 PySwitchOdd.append( ' n = a/6 ' )
179 PySwitchOdd.append( ' r = a%6 ' )
180 PySwitchOdd.append( ' POne = 0 ' )
181 PySwitchOdd.append( ' PThree = 0 ' )
182 PySwitchOdd.append( ' PFive = 0 ' )
183 PySwitchOdd.append( ' if r == 1 : ' )
184 PySwitchOdd.append( ' POne = 1 ' )
185 PySwitchOdd.append( ' if r == 3 : ' )
186 PySwitchOdd.append( ' PThree = 1 ' )
187 PySwitchOdd.append( ' if r == 5 : ' )
188 PySwitchOdd.append( ' PFive = 1 ' )
189 PySwitchOdd.append( ' return POne,PThree,PFive,n ' )
190 SwitchOdd,EndOfSwitchOdd = GraphLoopSwitchOfSwitchNOTValid.SNode( 'SwitchOdd' , PySwitchOdd )
191 EndOfSwitchOdd.SetName( 'EndOfSwitchOdd' )
192 EndOfSwitchOdd.SetAuthor( '' )
193 EndOfSwitchOdd.SetComment( 'Compute Node' )
194 EndOfSwitchOdd.Coords( 851 , 210 )
195 PyEndOfSwitchOdd = []
196 EndOfSwitchOdd.SetPyFunction( 'EndSwitch' , PyEndOfSwitchOdd )
197 IEndOfSwitchOddn = EndOfSwitchOdd.InPort( 'n' , 'long' )
198 IEndOfSwitchOddDefault = EndOfSwitchOdd.GetInPort( 'Default' )
199 OEndOfSwitchOddn = EndOfSwitchOdd.OutPort( 'n' , 'long' )
200 OEndOfSwitchOddGate = EndOfSwitchOdd.GetOutPort( 'Gate' )
201 SwitchOdd.SetName( 'SwitchOdd' )
202 SwitchOdd.SetAuthor( '' )
203 SwitchOdd.SetComment( 'Compute Node' )
204 SwitchOdd.Coords( 412 , 169 )
205 ISwitchOdda = SwitchOdd.InPort( 'a' , 'long' )
206 ISwitchOddGate = SwitchOdd.GetInPort( 'Gate' )
207 OSwitchOddPOne = SwitchOdd.OutPort( 'POne' , 'boolean' )
208 OSwitchOddPThree = SwitchOdd.OutPort( 'PThree' , 'boolean' )
209 OSwitchOddPFive = SwitchOdd.OutPort( 'PFive' , 'boolean' )
210 OSwitchOddn = SwitchOdd.OutPort( 'n' , 'long' )
211 OSwitchOddDefault = SwitchOdd.GetOutPort( 'Default' )
214 LLoopSwitchIndexSwitcha = GraphLoopSwitchOfSwitchNOTValid.Link( OLoopSwitchIndex , ISwitcha )
216 LLoopSwitchMinEndOfLoopSwitchMin = GraphLoopSwitchOfSwitchNOTValid.Link( OLoopSwitchMin , IEndOfLoopSwitchMin )
218 LLoopSwitchMaxEndOfLoopSwitchMax = GraphLoopSwitchOfSwitchNOTValid.Link( OLoopSwitchMax , IEndOfLoopSwitchMax )
220 LIsEvenaEndOfSwitcha = GraphLoopSwitchOfSwitchNOTValid.Link( OIsEvena , IEndOfSwitcha )
221 LIsEvenaEndOfSwitcha.AddCoord( 1 , 719 , 591 )
223 LSwitchOddSwitchOddGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOdd , ISwitchOddGate )
225 LSwitchaIsEvena = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitcha , IIsEvena )
227 LSwitchaSwitchOdda = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitcha , ISwitchOdda )
229 LSwitchEvenIsEvenGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchEven , IIsEvenGate )
231 LSwitchDefaultEndOfSwitchDefault = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchDefault , IEndOfSwitchDefault )
232 LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 1057 , 267 )
233 LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 1079 , 669 )
234 LSwitchDefaultEndOfSwitchDefault.AddCoord( 3 , 383 , 666 )
236 LEndOfSwitchaEndOfLoopSwitchIndex = GraphLoopSwitchOfSwitchNOTValid.Link( OEndOfSwitcha , IEndOfLoopSwitchIndex )
238 LSwitchOddPOnePseudoPOneGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddPOne , IPseudoPOneGate )
240 LSwitchOddPThreePseudoPThreeGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddPThree , IPseudoPThreeGate )
242 LSwitchOddPFivePseudoPFiveGate = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddPFive , IPseudoPFiveGate )
244 LSwitchOddnPseudoPOnePOne = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddn , IPseudoPOnePOne )
246 LSwitchOddnPseudoPThreePThree = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddn , IPseudoPThreePThree )
248 LSwitchOddnPseudoPFivePFive = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddn , IPseudoPFivePFive )
250 LSwitchOddDefaultEndOfSwitchOddDefault = GraphLoopSwitchOfSwitchNOTValid.Link( OSwitchOddDefault , IEndOfSwitchOddDefault )
252 LPseudoPOneaEndOfSwitchOddn = GraphLoopSwitchOfSwitchNOTValid.Link( OPseudoPOnea , IEndOfSwitchOddn )
254 LPseudoPThreeaEndOfSwitchOddn = GraphLoopSwitchOfSwitchNOTValid.Link( OPseudoPThreea , IEndOfSwitchOddn )
256 LPseudoPFiveaEndOfSwitchOddn = GraphLoopSwitchOfSwitchNOTValid.Link( OPseudoPFivea , IEndOfSwitchOddn )
259 ILoopSwitchIndex.Input( 0 )
260 ILoopSwitchMin.Input( -5 )
261 ILoopSwitchMax.Input( 65 )
263 # Output Ports of the graph
264 #OEndOfLoopSwitchIndex = EndOfLoopSwitch.GetOutPort( 'Index' )
265 #OEndOfLoopSwitchMin = EndOfLoopSwitch.GetOutPort( 'Min' )
266 #OEndOfLoopSwitchMax = EndOfLoopSwitch.GetOutPort( 'Max' )
267 #OEndOfSwitchOddn = EndOfSwitchOdd.GetOutPort( 'n' )
268 return GraphLoopSwitchOfSwitchNOTValid
271 GraphLoopSwitchOfSwitchNOTValid = DefGraphLoopSwitchOfSwitchNOTValid()