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 GraphLoopSwitch
26 # Graph creation of GraphLoopSwitch
27 def DefGraphLoopSwitch() :
28 GraphLoopSwitch = Graph( 'GraphLoopSwitch' )
29 GraphLoopSwitch.SetName( 'GraphLoopSwitch' )
30 GraphLoopSwitch.SetAuthor( 'JR' )
31 GraphLoopSwitch.SetComment( '' )
32 GraphLoopSwitch.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 (GraphLoopSwitch1)" ' )
41 PyIsOdd.append( ' sleep( 1 ) ' )
42 PyIsOdd.append( ' return a ' )
43 IsOdd = GraphLoopSwitch.INode( 'IsOdd' , PyIsOdd )
44 IsOdd.SetName( 'IsOdd' )
46 IsOdd.SetComment( 'Python function' )
47 IsOdd.Coords( 397 , 1 )
48 IIsOdda = IsOdd.InPort( 'a' , 'long' )
49 IIsOddGate = IsOdd.GetInPort( 'Gate' )
50 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
51 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
54 PyValEven.append( 'from time import * ' )
55 PyValEven.append( 'def ValEven(Even) : ' )
56 PyValEven.append( ' sleep(1) ' )
57 PyValEven.append( ' return Even ' )
58 PyValEven.append( '' )
59 ValEven = GraphLoopSwitch.INode( 'ValEven' , PyValEven )
60 ValEven.SetName( 'ValEven' )
61 ValEven.SetAuthor( '' )
62 ValEven.SetComment( 'Compute Node' )
63 ValEven.Coords( 396 , 222 )
64 IValEvenEven = ValEven.InPort( 'Even' , 'long' )
65 IValEvenGate = ValEven.GetInPort( 'Gate' )
66 OValEvenEven = ValEven.OutPort( 'Even' , 'long' )
67 OValEvenGate = ValEven.GetOutPort( 'Gate' )
69 # Creation of Loop Nodes
71 PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
72 PyInitLoop.append( ' Index = Min ' )
73 PyInitLoop.append( ' return Index,Min,Max ' )
74 PyInitLoop.append( '' )
76 PyMoreInitLoop.append( '' )
78 PyNextInitLoop.append( '' )
79 InitLoop,EndOfInitLoop = GraphLoopSwitch.LNode( 'InitLoop' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
80 EndOfInitLoop.SetName( 'EndOfInitLoop' )
81 EndOfInitLoop.SetAuthor( '' )
82 EndOfInitLoop.SetComment( 'Compute Node' )
83 EndOfInitLoop.Coords( 767 , 102 )
85 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
86 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
87 PyEndOfInitLoop.append( ' if Index <= Max : ' )
88 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
89 PyEndOfInitLoop.append( ' else : ' )
90 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
91 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max ' )
92 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
93 IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
94 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
95 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
96 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
97 IInitLoopGate = InitLoop.GetInPort( 'Gate' )
98 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
99 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
100 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
101 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
102 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
103 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
104 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
105 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
106 IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
107 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
108 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
109 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
110 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
111 OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
112 InitLoop.SetName( 'InitLoop' )
113 InitLoop.SetAuthor( '' )
114 InitLoop.SetComment( 'Compute Node' )
115 InitLoop.Coords( 10 , 108 )
117 # Creation of Switch Nodes
119 PySwitch.append( 'from time import * ' )
120 PySwitch.append( 'def Switch(a) : ' )
121 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
122 PySwitch.append( ' sleep(1) ' )
123 PySwitch.append( ' return a & 1,1-(a&1),a ' )
124 Switch,EndSwitch = GraphLoopSwitch.SNode( 'Switch' , PySwitch )
125 EndSwitch.SetName( 'EndSwitch' )
126 EndSwitch.SetAuthor( '' )
127 EndSwitch.SetComment( 'Compute Node' )
128 EndSwitch.Coords( 587 , 103 )
130 PyEndSwitch.append( 'def EndSwitch(a,Even) : ' )
131 PyEndSwitch.append( ' sleep(1) ' )
132 PyEndSwitch.append( ' return a ' )
133 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
134 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
135 IEndSwitchEven = EndSwitch.InPort( 'Even' , 'long' )
136 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
137 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
138 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
139 Switch.SetName( 'Switch' )
140 Switch.SetAuthor( '' )
141 Switch.SetComment( 'Compute Node' )
142 Switch.Coords( 194 , 109 )
143 ISwitcha = Switch.InPort( 'a' , 'long' )
144 ISwitchGate = Switch.GetInPort( 'Gate' )
145 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
146 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
147 OSwitcha = Switch.OutPort( 'a' , 'int' )
148 OSwitchDefault = Switch.GetOutPort( 'Default' )
151 LIsOddaEndSwitcha = GraphLoopSwitch.Link( OIsOdda , IEndSwitcha )
153 LInitLoopIndexSwitcha = GraphLoopSwitch.Link( OInitLoopIndex , ISwitcha )
155 LInitLoopMinEndOfInitLoopMin = GraphLoopSwitch.Link( OInitLoopMin , IEndOfInitLoopMin )
157 LInitLoopMaxEndOfInitLoopMax = GraphLoopSwitch.Link( OInitLoopMax , IEndOfInitLoopMax )
159 LSwitchOddIsOddGate = GraphLoopSwitch.Link( OSwitchOdd , IIsOddGate )
161 LSwitchEvenValEvenEven = GraphLoopSwitch.Link( OSwitchEven , IValEvenEven )
163 LSwitchaIsOdda = GraphLoopSwitch.Link( OSwitcha , IIsOdda )
165 LSwitchDefaultEndSwitchDefault = GraphLoopSwitch.Link( OSwitchDefault , IEndSwitchDefault )
167 LEndSwitchaEndOfInitLoopIndex = GraphLoopSwitch.Link( OEndSwitcha , IEndOfInitLoopIndex )
169 LValEvenEvenEndSwitchEven = GraphLoopSwitch.Link( OValEvenEven , IEndSwitchEven )
172 IInitLoopIndex.Input( 0 )
173 IInitLoopMin.Input( 5 )
174 IInitLoopMax.Input( 23 )
176 # Output Ports of the graph
177 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
178 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
179 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
180 return GraphLoopSwitch
183 GraphLoopSwitch = DefGraphLoopSwitch()