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