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 GraphSwitch_1_1_2
27 # Graph creation of GraphSwitch_1_1_2
28 def DefGraphSwitch_1_1_2() :
29 GraphSwitch_1_1_2 = Graph( 'GraphSwitch_1_1_2' )
30 GraphSwitch_1_1_2.SetName( 'GraphSwitch_1_1_2' )
31 GraphSwitch_1_1_2.SetAuthor( '' )
32 GraphSwitch_1_1_2.SetComment( '' )
33 GraphSwitch_1_1_2.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,Branch) : ' )
41 PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' )
42 PyIsOdd.append( ' sleep( 1 ) ' )
43 PyIsOdd.append( ' return a,Branch ' )
44 IsOdd = GraphSwitch_1_1_2.INode( 'IsOdd' , PyIsOdd )
45 IsOdd.SetName( 'IsOdd' )
47 IsOdd.SetComment( 'Python function' )
48 IsOdd.Coords( 388 , 50 )
49 IIsOdda = IsOdd.InPort( 'a' , 'long' )
50 IIsOddBranch = IsOdd.InPort( 'Branch' , 'string' )
51 IIsOddGate = IsOdd.GetInPort( 'Gate' )
52 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
53 OIsOddBranch = IsOdd.OutPort( 'Branch' , 'string' )
54 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
57 PyIsEven.append( 'from time import * ' )
58 PyIsEven.append( 'def IsEven(a,Branch) : ' )
59 PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' )
60 PyIsEven.append( ' sleep( 1 ) ' )
61 PyIsEven.append( ' return a,Branch ' )
62 IsEven = GraphSwitch_1_1_2.INode( 'IsEven' , PyIsEven )
63 IsEven.SetName( 'IsEven' )
64 IsEven.SetAuthor( '' )
65 IsEven.SetComment( 'Compute Node' )
66 IsEven.Coords( 395 , 334 )
67 IIsEvena = IsEven.InPort( 'a' , 'long' )
68 IIsEvenBranch = IsEven.InPort( 'Branch' , 'string' )
69 IIsEvenGate = IsEven.GetInPort( 'Gate' )
70 OIsEvena = IsEven.OutPort( 'a' , 'long' )
71 OIsEvenBranch = IsEven.OutPort( 'Branch' , 'string' )
72 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
75 PyPrint.append( 'def Print(a,Branch) : ' )
76 PyPrint.append( ' print "Print ",Branch ' )
77 PyPrint.append( ' return a,Branch ' )
78 Print = GraphSwitch_1_1_2.INode( 'Print' , PyPrint )
79 Print.SetName( 'Print' )
81 Print.SetComment( 'Compute Node' )
82 Print.Coords( 639 , 63 )
83 IPrinta = Print.InPort( 'a' , 'long' )
84 IPrintBranch = Print.InPort( 'Branch' , 'string' )
85 IPrintGate = Print.GetInPort( 'Gate' )
86 OPrinta = Print.OutPort( 'a' , 'long' )
87 OPrintBranch = Print.OutPort( 'Branch' , 'string' )
88 OPrintGate = Print.GetOutPort( 'Gate' )
91 PyPrint_1.append( 'def Print_1(a,Branch) : ' )
92 PyPrint_1.append( ' print "Print ",Branch ' )
93 PyPrint_1.append( ' return a,Branch ' )
94 Print_1 = GraphSwitch_1_1_2.INode( 'Print_1' , PyPrint_1 )
95 Print_1.SetName( 'Print_1' )
96 Print_1.SetAuthor( '' )
97 Print_1.SetComment( 'Compute Node' )
98 Print_1.Coords( 639 , 263 )
99 IPrint_1a = Print_1.InPort( 'a' , 'long' )
100 IPrint_1Branch = Print_1.InPort( 'Branch' , 'string' )
101 IPrint_1Gate = Print_1.GetInPort( 'Gate' )
102 OPrint_1a = Print_1.OutPort( 'a' , 'long' )
103 OPrint_1Branch = Print_1.OutPort( 'Branch' , 'string' )
104 OPrint_1Gate = Print_1.GetOutPort( 'Gate' )
106 # Creation of Loop Nodes
107 PyInitLoopSwitch = []
108 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
109 PyInitLoopSwitch.append( ' Index = Max ' )
110 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
111 PyMoreInitLoopSwitch = []
112 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
113 PyMoreInitLoopSwitch.append( ' if Index >= Min : ' )
114 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
115 PyMoreInitLoopSwitch.append( ' else : ' )
116 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
117 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
118 PyNextInitLoopSwitch = []
119 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
120 PyNextInitLoopSwitch.append( ' Index = Index - 1 ' )
121 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
122 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitch_1_1_2.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
123 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
124 EndOfInitLoopSwitch.SetAuthor( '' )
125 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
126 EndOfInitLoopSwitch.Coords( 1082 , 150 )
127 PyEndOfInitLoopSwitch = []
128 EndOfInitLoopSwitch.SetPyFunction( '' , 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 , 129 )
153 # Creation of Switch Nodes
155 PySwitch.append( 'from time import * ' )
156 PySwitch.append( 'def Switch(a) : ' )
157 PySwitch.append( ' Branch = 'Negative or null' ' )
158 PySwitch.append( ' if a <= 0 : ' )
159 PySwitch.append( ' return 0,0,a,Branch,1 ' )
160 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
161 PySwitch.append( ' Branch = 'Even' ' )
162 PySwitch.append( ' else : ' )
163 PySwitch.append( ' Branch = 'Odd' ' )
164 PySwitch.append( ' sleep(1) ' )
165 PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' )
166 Switch,EndOfSwitch = GraphSwitch_1_1_2.SNode( 'Switch' , PySwitch )
167 EndOfSwitch.SetName( 'EndOfSwitch' )
168 EndOfSwitch.SetAuthor( '' )
169 EndOfSwitch.SetComment( 'Compute Node' )
170 EndOfSwitch.Coords( 880 , 150 )
172 EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch )
173 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
174 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
175 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
176 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
177 Switch.SetName( 'Switch' )
178 Switch.SetAuthor( '' )
179 Switch.SetComment( 'Compute Node' )
180 Switch.Coords( 195 , 129 )
181 ISwitcha = Switch.InPort( 'a' , 'long' )
182 ISwitchGate = Switch.GetInPort( 'Gate' )
183 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
184 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
185 OSwitcha = Switch.OutPort( 'a' , 'int' )
186 OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
187 OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
188 OSwitchDefault = Switch.GetOutPort( 'Default' )
191 LIsOddaPrinta = GraphSwitch_1_1_2.Link( OIsOdda , IPrinta )
193 LIsOddBranchPrintBranch = GraphSwitch_1_1_2.Link( OIsOddBranch , IPrintBranch )
195 LInitLoopSwitchIndexSwitcha = GraphSwitch_1_1_2.Link( OInitLoopSwitchIndex , ISwitcha )
197 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitch_1_1_2.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
199 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitch_1_1_2.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
201 LIsEvenaPrint_1a = GraphSwitch_1_1_2.Link( OIsEvena , IPrint_1a )
203 LIsEvenBranchPrint_1Branch = GraphSwitch_1_1_2.Link( OIsEvenBranch , IPrint_1Branch )
205 LSwitchOddIsOddGate = GraphSwitch_1_1_2.Link( OSwitchOdd , IIsOddGate )
207 LSwitchEvenIsEvenGate = GraphSwitch_1_1_2.Link( OSwitchEven , IIsEvenGate )
209 LSwitchaIsOdda = GraphSwitch_1_1_2.Link( OSwitcha , IIsOdda )
211 LSwitchaIsEvena = GraphSwitch_1_1_2.Link( OSwitcha , IIsEvena )
213 LSwitchBranchIsOddBranch = GraphSwitch_1_1_2.Link( OSwitchBranch , IIsOddBranch )
215 LSwitchBranchIsEvenBranch = GraphSwitch_1_1_2.Link( OSwitchBranch , IIsEvenBranch )
217 LSwitchDefaultEndOfSwitchDefault = GraphSwitch_1_1_2.Link( OSwitchDefault , IEndOfSwitchDefault )
219 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitch_1_1_2.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
221 LPrintaEndOfSwitcha = GraphSwitch_1_1_2.Link( OPrinta , IEndOfSwitcha )
223 LPrint_1aEndOfSwitcha = GraphSwitch_1_1_2.Link( OPrint_1a , IEndOfSwitcha )
226 IInitLoopSwitchIndex.Input( 0 )
227 IInitLoopSwitchMin.Input( -5 )
228 IInitLoopSwitchMax.Input( 10 )
230 # Output Ports of the graph
231 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
232 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
233 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
234 #OSwitchdefault = Switch.GetOutPort( 'default' )
235 #OPrintBranch = Print.GetOutPort( 'Branch' )
236 #OPrint_1Branch = Print_1.GetOutPort( 'Branch' )
237 return GraphSwitch_1_1_2
240 GraphSwitch_1_1_2 = DefGraphSwitch_1_1_2()