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