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 GraphSwitchCheckBranch1_1
27 # Graph creation of GraphSwitchCheckBranch1_1
28 def DefGraphSwitchCheckBranch1_1() :
29 GraphSwitchCheckBranch1_1 = Graph( 'GraphSwitchCheckBranch1_1' )
30 GraphSwitchCheckBranch1_1.SetName( 'GraphSwitchCheckBranch1_1' )
31 GraphSwitchCheckBranch1_1.SetAuthor( 'JR' )
32 GraphSwitchCheckBranch1_1.SetComment( 'Switch with two SwitchBranches, One NotSwitchBranch and the DefaultBranch' )
33 GraphSwitchCheckBranch1_1.Coords( 0 , 0 )
35 # Creation of Factory Nodes
37 # Creation of InLine Nodes
39 PyIsOdd.append( 'from time import * ' )
40 PyIsOdd.append( 'def IsOdd(a) : ' )
41 PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' )
42 PyIsOdd.append( ' sleep( 1 ) ' )
43 PyIsOdd.append( ' return a ' )
44 IsOdd = GraphSwitchCheckBranch1_1.INode( 'IsOdd' , PyIsOdd )
45 IsOdd.SetName( 'IsOdd' )
47 IsOdd.SetComment( 'Python function' )
48 IsOdd.Coords( 415 , 7 )
49 IIsOdda = IsOdd.InPort( 'a' , 'long' )
50 IIsOddGate = IsOdd.GetInPort( 'Gate' )
51 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
52 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
55 PyIsEven.append( 'from time import * ' )
56 PyIsEven.append( 'def IsEven(a) : ' )
57 PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' )
58 PyIsEven.append( ' sleep( 1 ) ' )
59 PyIsEven.append( ' return a ' )
60 IsEven = GraphSwitchCheckBranch1_1.INode( 'IsEven' , PyIsEven )
61 IsEven.SetName( 'IsEven' )
62 IsEven.SetAuthor( '' )
63 IsEven.SetComment( 'Compute Node' )
64 IsEven.Coords( 421 , 438 )
65 IIsEvena = IsEven.InPort( 'a' , 'long' )
66 IIsEvenGate = IsEven.GetInPort( 'Gate' )
67 OIsEvena = IsEven.OutPort( 'a' , 'long' )
68 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
71 PyBranchNode.append( 'from time import * ' )
72 PyBranchNode.append( 'def Print_1(Branch) : ' )
73 PyBranchNode.append( ' print "Print ",Branch ' )
74 PyBranchNode.append( ' sleep(1) ' )
75 PyBranchNode.append( ' return Branch ' )
76 BranchNode = GraphSwitchCheckBranch1_1.INode( 'Print_1' , PyBranchNode )
77 BranchNode.SetName( 'BranchNode' )
78 BranchNode.SetAuthor( '' )
79 BranchNode.SetComment( 'Compute Node' )
80 BranchNode.Coords( 529 , 177 )
81 IBranchNodeBranch = BranchNode.InPort( 'Branch' , 'string' )
82 IBranchNodeGate = BranchNode.GetInPort( 'Gate' )
83 OBranchNodeBranch = BranchNode.OutPort( 'Branch' , 'string' )
84 OBranchNodeGate = BranchNode.GetOutPort( 'Gate' )
87 Pydefault.append( 'from time import * ' )
88 Pydefault.append( 'def default(a) : ' )
89 Pydefault.append( ' sleep(1) ' )
90 Pydefault.append( ' return a ' )
91 default = GraphSwitchCheckBranch1_1.INode( 'default' , Pydefault )
92 default.SetName( 'default' )
93 default.SetAuthor( '' )
94 default.SetComment( 'Compute Node' )
95 default.Coords( 428 , 308 )
96 Idefaulta = default.InPort( 'a' , 'long' )
97 IdefaultGate = default.GetInPort( 'Gate' )
98 Odefaulta = default.OutPort( 'a' , 'long' )
99 OdefaultGate = default.GetOutPort( 'Gate' )
101 # Creation of Loop Nodes
102 PyInitLoopSwitch = []
103 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
104 PyInitLoopSwitch.append( ' Index = Max ' )
105 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
106 PyMoreInitLoopSwitch = []
107 PyMoreInitLoopSwitch.append( 'from time import * ' )
108 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
109 PyMoreInitLoopSwitch.append( ' sleep(1) ' )
110 PyMoreInitLoopSwitch.append( ' if Index >= Min : ' )
111 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
112 PyMoreInitLoopSwitch.append( ' else : ' )
113 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
114 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
115 PyNextInitLoopSwitch = []
116 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
117 PyNextInitLoopSwitch.append( ' Index = Index - 1 ' )
118 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
119 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckBranch1_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
120 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
121 EndOfInitLoopSwitch.SetAuthor( '' )
122 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
123 EndOfInitLoopSwitch.Coords( 1073 , 216 )
124 PyEndOfInitLoopSwitch = []
125 PyEndOfInitLoopSwitch.append( 'from time import * ' )
126 PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' )
127 PyEndOfInitLoopSwitch.append( ' sleep(1) ' )
128 PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
129 EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch )
130 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
131 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
132 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
133 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
134 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
135 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
136 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
137 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
138 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
139 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
140 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
141 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
142 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
143 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
144 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
145 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
146 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
147 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
148 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
149 InitLoopSwitch.SetName( 'InitLoopSwitch' )
150 InitLoopSwitch.SetAuthor( '' )
151 InitLoopSwitch.SetComment( 'Compute Node' )
152 InitLoopSwitch.Coords( 10 , 157 )
154 # Creation of Switch Nodes
156 PySwitch.append( 'from time import * ' )
157 PySwitch.append( 'def Switch(a) : ' )
158 PySwitch.append( ' sleep(1) ' )
159 PySwitch.append( ' Branch = "Negative or null" ' )
160 PySwitch.append( ' if a <= 0 : ' )
161 PySwitch.append( ' return 0,0,a,Branch,1 ' )
162 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
163 PySwitch.append( ' Branch = "Even" ' )
164 PySwitch.append( ' else : ' )
165 PySwitch.append( ' Branch = "Odd" ' )
166 PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' )
167 Switch,EndOfSwitch = GraphSwitchCheckBranch1_1.SNode( 'Switch' , PySwitch )
168 EndOfSwitch.SetName( 'EndOfSwitch' )
169 EndOfSwitch.SetAuthor( '' )
170 EndOfSwitch.SetComment( 'Compute Node' )
171 EndOfSwitch.Coords( 880 , 216 )
173 PyEndOfSwitch.append( 'from time import * ' )
174 PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' )
175 PyEndOfSwitch.append( ' sleep(1) ' )
176 PyEndOfSwitch.append( ' return a ' )
177 EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
178 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
179 IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' )
180 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
181 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
182 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
183 Switch.SetName( 'Switch' )
184 Switch.SetAuthor( '' )
185 Switch.SetComment( 'Compute Node' )
186 Switch.Coords( 194 , 157 )
187 ISwitcha = Switch.InPort( 'a' , 'long' )
188 ISwitchGate = Switch.GetInPort( 'Gate' )
189 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
190 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
191 OSwitcha = Switch.OutPort( 'a' , 'int' )
192 OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
193 OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
194 OSwitchDefault = Switch.GetOutPort( 'Default' )
197 LIsOddaEndOfSwitcha = GraphSwitchCheckBranch1_1.Link( OIsOdda , IEndOfSwitcha )
199 LIsEvenaEndOfSwitcha = GraphSwitchCheckBranch1_1.Link( OIsEvena , IEndOfSwitcha )
201 LBranchNodeBranchEndOfSwitchBranch = GraphSwitchCheckBranch1_1.Link( OBranchNodeBranch , IEndOfSwitchBranch )
203 LInitLoopSwitchIndexSwitcha = GraphSwitchCheckBranch1_1.Link( OInitLoopSwitchIndex , ISwitcha )
205 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckBranch1_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
207 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckBranch1_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
209 LSwitchOddIsOddGate = GraphSwitchCheckBranch1_1.Link( OSwitchOdd , IIsOddGate )
210 LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 )
211 LSwitchOddIsOddGate.AddCoord( 2 , 401 , 188 )
213 LSwitchEvenIsEvenGate = GraphSwitchCheckBranch1_1.Link( OSwitchEven , IIsEvenGate )
214 LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 )
215 LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 208 )
217 LSwitchaIsOdda = GraphSwitchCheckBranch1_1.Link( OSwitcha , IIsOdda )
218 LSwitchaIsOdda.AddCoord( 1 , 382 , 78 )
219 LSwitchaIsOdda.AddCoord( 2 , 382 , 229 )
221 LSwitchaIsEvena = GraphSwitchCheckBranch1_1.Link( OSwitcha , IIsEvena )
222 LSwitchaIsEvena.AddCoord( 1 , 381 , 509 )
223 LSwitchaIsEvena.AddCoord( 2 , 381 , 229 )
225 LSwitchadefaulta = GraphSwitchCheckBranch1_1.Link( OSwitcha , Idefaulta )
226 LSwitchadefaulta.AddCoord( 1 , 382 , 377 )
227 LSwitchadefaulta.AddCoord( 2 , 382 , 228 )
229 LSwitchBranchBranchNodeBranch = GraphSwitchCheckBranch1_1.Link( OSwitchBranch , IBranchNodeBranch )
231 LSwitchdefaultdefaultGate = GraphSwitchCheckBranch1_1.Link( OSwitchdefault , IdefaultGate )
232 LSwitchdefaultdefaultGate.AddCoord( 1 , 410 , 403 )
233 LSwitchdefaultdefaultGate.AddCoord( 2 , 410 , 269 )
234 LSwitchdefaultdefaultGate.AddCoord( 3 , 410 , 268 )
236 LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheckBranch1_1.Link( OSwitchDefault , IEndOfSwitchDefault )
238 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckBranch1_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
240 LdefaultaEndOfSwitcha = GraphSwitchCheckBranch1_1.Link( Odefaulta , IEndOfSwitcha )
243 IInitLoopSwitchIndex.Input( 0 )
244 IInitLoopSwitchMin.Input( -5 )
245 IInitLoopSwitchMax.Input( 10 )
247 # Output Ports of the graph
248 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
249 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
250 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
251 return GraphSwitchCheckBranch1_1
254 GraphSwitchCheckBranch1_1 = DefGraphSwitchCheckBranch1_1()