1 # Copyright (C) 2007-2008 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 GraphSwitchErrExec
26 # Graph creation of GraphSwitchErrExec
27 def DefGraphSwitchErrExec() :
28 GraphSwitchErrExec = Graph( 'GraphSwitchErrExec' )
29 GraphSwitchErrExec.SetName( 'GraphSwitchErrExec' )
30 GraphSwitchErrExec.SetAuthor( '' )
31 GraphSwitchErrExec.SetComment( '' )
32 GraphSwitchErrExec.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 = GraphSwitchErrExec.INode( 'IsOdd' , PyIsOdd )
44 IsOdd.SetName( 'IsOdd' )
46 IsOdd.SetComment( 'Python function' )
47 IsOdd.Coords( 388 , 50 )
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 = GraphSwitchErrExec.INode( 'IsEven' , PyIsEven )
60 IsEven.SetName( 'IsEven' )
61 IsEven.SetAuthor( '' )
62 IsEven.SetComment( 'Compute Node' )
63 IsEven.Coords( 397 , 279 )
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 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
72 PyInitLoopSwitch.append( ' Index = Max ' )
73 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
74 PyMoreInitLoopSwitch = []
75 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
76 PyMoreInitLoopSwitch.append( ' if Index >= Min : ' )
77 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
78 PyMoreInitLoopSwitch.append( ' else : ' )
79 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
80 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
81 PyNextInitLoopSwitch = []
82 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
83 PyNextInitLoopSwitch.append( ' Index = Index - 1 ' )
84 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
85 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchErrExec.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
86 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
87 EndOfInitLoopSwitch.SetAuthor( '' )
88 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
89 EndOfInitLoopSwitch.Coords( 766 , 127 )
90 PyEndOfInitLoopSwitch = []
91 EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
92 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
93 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
94 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
95 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
96 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
97 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
98 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
99 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
100 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
101 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
102 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
103 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
104 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
105 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
106 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
107 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
108 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
109 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
110 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
111 InitLoopSwitch.SetName( 'InitLoopSwitch' )
112 InitLoopSwitch.SetAuthor( '' )
113 InitLoopSwitch.SetComment( 'Compute Node' )
114 InitLoopSwitch.Coords( 10 , 129 )
116 # Creation of Switch Nodes
118 PySwitch.append( 'from time import * ' )
119 PySwitch.append( 'def Switch(a) : ' )
120 PySwitch.append( ' if a == 0 : ' )
121 PySwitch.append( ' return 0,0,a ' )
122 PySwitch.append( ' if a < 0 : ' )
123 PySwitch.append( ' return 1,1,a ' )
124 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
125 PySwitch.append( ' sleep(1) ' )
126 PySwitch.append( ' return a & 1,1-(a&1),a ' )
127 Switch,EndOfSwitch = GraphSwitchErrExec.SNode( 'Switch' , PySwitch )
128 EndOfSwitch.SetName( 'EndOfSwitch' )
129 EndOfSwitch.SetAuthor( '' )
130 EndOfSwitch.SetComment( 'Compute Node' )
131 EndOfSwitch.Coords( 580 , 147 )
133 EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch )
134 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
135 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
136 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
137 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
138 Switch.SetName( 'Switch' )
139 Switch.SetAuthor( '' )
140 Switch.SetComment( 'Compute Node' )
141 Switch.Coords( 195 , 129 )
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 LIsOddaEndOfSwitcha = GraphSwitchErrExec.Link( OIsOdda , IEndOfSwitcha )
152 LInitLoopSwitchIndexSwitcha = GraphSwitchErrExec.Link( OInitLoopSwitchIndex , ISwitcha )
154 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchErrExec.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
156 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchErrExec.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
158 LIsEvenaEndOfSwitcha = GraphSwitchErrExec.Link( OIsEvena , IEndOfSwitcha )
160 LSwitchOddIsOddGate = GraphSwitchErrExec.Link( OSwitchOdd , IIsOddGate )
162 LSwitchEvenIsEvenGate = GraphSwitchErrExec.Link( OSwitchEven , IIsEvenGate )
164 LSwitchaIsOdda = GraphSwitchErrExec.Link( OSwitcha , IIsOdda )
166 LSwitchaIsEvena = GraphSwitchErrExec.Link( OSwitcha , IIsEvena )
168 LSwitchDefaultEndOfSwitchDefault = GraphSwitchErrExec.Link( OSwitchDefault , IEndOfSwitchDefault )
170 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchErrExec.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
173 IInitLoopSwitchIndex.Input( 0 )
174 IInitLoopSwitchMin.Input( -5 )
175 IInitLoopSwitchMax.Input( 10 )
177 # Output Ports of the graph
178 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
179 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
180 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
181 return GraphSwitchErrExec
184 GraphSwitchErrExec = DefGraphSwitchErrExec()