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 GraphLoopSwitchOddEven
26 # Graph creation of GraphLoopSwitchOddEven
27 def DefGraphLoopSwitchOddEven() :
28 GraphLoopSwitchOddEven = Graph( 'GraphLoopSwitchOddEven' )
29 GraphLoopSwitchOddEven.SetName( 'GraphLoopSwitchOddEven' )
30 GraphLoopSwitchOddEven.SetAuthor( 'JR' )
31 GraphLoopSwitchOddEven.SetComment( '' )
32 GraphLoopSwitchOddEven.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 = GraphLoopSwitchOddEven.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 PyIsEven.append( 'from time import * ' )
55 PyIsEven.append( 'def IsEven(a) : ' )
56 PyIsEven.append( ' sleep(1) ' )
57 PyIsEven.append( ' return a ' )
58 PyIsEven.append( ' ' )
59 IsEven = GraphLoopSwitchOddEven.INode( 'IsEven' , PyIsEven )
60 IsEven.SetName( 'IsEven' )
61 IsEven.SetAuthor( '' )
62 IsEven.SetComment( 'Compute Node' )
63 IsEven.Coords( 400 , 160 )
64 IIsEvena = IsEven.InPort( 'a' , 'long' )
65 IIsEvenGate = IsEven.GetInPort( 'Gate' )
66 OIsEvena = IsEven.OutPort( 'a' , 'long' )
67 OIsEvenGate = IsEven.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 = GraphLoopSwitchOddEven.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 = GraphLoopSwitchOddEven.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) : ' )
131 PyEndSwitch.append( ' sleep(1) ' )
132 PyEndSwitch.append( ' return a ' )
133 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
134 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
135 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
136 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
137 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
138 Switch.SetName( 'Switch' )
139 Switch.SetAuthor( '' )
140 Switch.SetComment( 'Compute Node' )
141 Switch.Coords( 194 , 109 )
142 ISwitcha = Switch.InPort( 'a' , 'long' )
143 ISwitchGate = Switch.GetInPort( 'Gate' )
144 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
145 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
146 OSwitcha = Switch.OutPort( 'a' , 'int' )
147 OSwitchDefault = Switch.GetOutPort( 'Default' )
150 LIsOddaEndSwitcha = GraphLoopSwitchOddEven.Link( OIsOdda , IEndSwitcha )
152 LInitLoopIndexSwitcha = GraphLoopSwitchOddEven.Link( OInitLoopIndex , ISwitcha )
154 LInitLoopMinEndOfInitLoopMin = GraphLoopSwitchOddEven.Link( OInitLoopMin , IEndOfInitLoopMin )
156 LInitLoopMaxEndOfInitLoopMax = GraphLoopSwitchOddEven.Link( OInitLoopMax , IEndOfInitLoopMax )
158 LSwitchOddIsOddGate = GraphLoopSwitchOddEven.Link( OSwitchOdd , IIsOddGate )
160 LSwitchEvenIsEvenGate = GraphLoopSwitchOddEven.Link( OSwitchEven , IIsEvenGate )
162 LSwitchaIsOdda = GraphLoopSwitchOddEven.Link( OSwitcha , IIsOdda )
164 LSwitchaIsEvena = GraphLoopSwitchOddEven.Link( OSwitcha , IIsEvena )
166 LEndSwitchaEndOfInitLoopIndex = GraphLoopSwitchOddEven.Link( OEndSwitcha , IEndOfInitLoopIndex )
168 LIsEvenaEndSwitcha = GraphLoopSwitchOddEven.Link( OIsEvena , IEndSwitcha )
171 IInitLoopIndex.Input( 0 )
172 IInitLoopMin.Input( 5 )
173 IInitLoopMax.Input( 23 )
175 # Output Ports of the graph
176 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
177 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
178 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
179 return GraphLoopSwitchOddEven
182 GraphLoopSwitchOddEven = DefGraphLoopSwitchOddEven()