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 GraphSwitchExecutable
26 # Graph creation of GraphSwitchExecutable
27 def DefGraphSwitchExecutable() :
28 GraphSwitchExecutable = Graph( 'GraphSwitchExecutable' )
29 GraphSwitchExecutable.SetName( 'GraphSwitchExecutable' )
30 GraphSwitchExecutable.SetAuthor( '' )
31 GraphSwitchExecutable.SetComment( '' )
32 GraphSwitchExecutable.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 = GraphSwitchExecutable.INode( 'IsOdd' , PyIsOdd )
44 IsOdd.SetName( 'IsOdd' )
46 IsOdd.SetComment( 'Python function' )
47 IsOdd.Coords( 389 , 65 )
48 IIsOdda = IsOdd.InPort( 'a' , 'long' )
49 IIsOddGate = IsOdd.GetInPort( 'Gate' )
50 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
51 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
53 # Creation of Loop Nodes
55 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
56 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
57 PyMoreInitLoopSwitch = []
58 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
59 PyMoreInitLoopSwitch.append( ' if Index <= Max : ' )
60 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
61 PyMoreInitLoopSwitch.append( ' else : ' )
62 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
63 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
64 PyNextInitLoopSwitch = []
65 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
66 PyNextInitLoopSwitch.append( ' Index = Index + 1 ' )
67 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
68 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchExecutable.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
69 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
70 EndOfInitLoopSwitch.SetAuthor( '' )
71 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
72 EndOfInitLoopSwitch.Coords( 772 , 132 )
73 PyEndOfInitLoopSwitch = []
74 EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
75 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
76 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
77 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
78 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
79 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
80 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
81 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
82 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
83 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
84 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
85 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
86 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
87 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
88 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
89 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
90 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
91 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
92 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
93 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
94 InitLoopSwitch.SetName( 'InitLoopSwitch' )
95 InitLoopSwitch.SetAuthor( '' )
96 InitLoopSwitch.SetComment( 'Compute Node' )
97 InitLoopSwitch.Coords( 10 , 129 )
99 # Creation of Switch Nodes
101 PySwitch.append( 'from time import * ' )
102 PySwitch.append( 'def Switch(a) : ' )
103 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
104 PySwitch.append( ' sleep(1) ' )
105 PySwitch.append( ' return a & 1,1-(a&1),a,a ' )
106 Switch,EndOfSwitch = GraphSwitchExecutable.SNode( 'Switch' , PySwitch )
107 EndOfSwitch.SetName( 'EndOfSwitch' )
108 EndOfSwitch.SetAuthor( '' )
109 EndOfSwitch.SetComment( 'Compute Node' )
110 EndOfSwitch.Coords( 581 , 132 )
112 PyEndOfSwitch.append( 'def EndOfSwitch( a , Even , k ) : ' )
113 PyEndOfSwitch.append( ' return a ' )
114 EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
115 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
116 IEndOfSwitchEven = EndOfSwitch.InPort( 'Even' , 'long' )
117 IEndOfSwitchk = EndOfSwitch.InPort( 'k' , 'long' )
118 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
119 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
120 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
121 Switch.SetName( 'Switch' )
122 Switch.SetAuthor( '' )
123 Switch.SetComment( 'Compute Node' )
124 Switch.Coords( 194 , 129 )
125 ISwitcha = Switch.InPort( 'a' , 'long' )
126 ISwitchGate = Switch.GetInPort( 'Gate' )
127 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
128 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
129 OSwitcha = Switch.OutPort( 'a' , 'int' )
130 OSwitchi = Switch.OutPort( 'i' , 'long' )
131 OSwitchDefault = Switch.GetOutPort( 'Default' )
134 LIsOddaEndOfSwitcha = GraphSwitchExecutable.Link( OIsOdda , IEndOfSwitcha )
136 LInitLoopSwitchIndexSwitcha = GraphSwitchExecutable.Link( OInitLoopSwitchIndex , ISwitcha )
138 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchExecutable.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
140 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchExecutable.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
142 LSwitchOddIsOddGate = GraphSwitchExecutable.Link( OSwitchOdd , IIsOddGate )
144 LSwitchaIsOdda = GraphSwitchExecutable.Link( OSwitcha , IIsOdda )
146 LSwitchiEndOfSwitchk = GraphSwitchExecutable.Link( OSwitchi , IEndOfSwitchk )
148 LSwitchDefaultEndOfSwitchDefault = GraphSwitchExecutable.Link( OSwitchDefault , IEndOfSwitchDefault )
150 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchExecutable.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
153 IInitLoopSwitchIndex.Input( 0 )
154 IInitLoopSwitchMin.Input( 0 )
155 IInitLoopSwitchMax.Input( 35 )
157 # Input Ports of the graph
158 #IEndOfSwitchEven = EndOfSwitch.GetInPort( 'Even' )
160 # Output Ports of the graph
161 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
162 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
163 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
164 #OSwitchEven = Switch.GetOutPort( 'Even' )
165 return GraphSwitchExecutable
168 GraphSwitchExecutable = DefGraphSwitchExecutable()