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 GraphLoopSwitchDefault
26 # Graph creation of GraphLoopSwitchDefault
27 def DefGraphLoopSwitchDefault() :
28 GraphLoopSwitchDefault = Graph( 'GraphLoopSwitchDefault' )
29 GraphLoopSwitchDefault.SetName( 'GraphLoopSwitchDefault' )
30 GraphLoopSwitchDefault.SetAuthor( 'JR' )
31 GraphLoopSwitchDefault.SetComment( '' )
32 GraphLoopSwitchDefault.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 = GraphLoopSwitchDefault.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' )
53 # Creation of Loop Nodes
55 PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
56 PyInitLoop.append( ' Index = Min ' )
57 PyInitLoop.append( ' return Index,Min,Max ' )
58 PyInitLoop.append( '' )
60 PyMoreInitLoop.append( '' )
62 PyNextInitLoop.append( '' )
63 InitLoop,EndOfInitLoop = GraphLoopSwitchDefault.LNode( 'InitLoop' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
64 EndOfInitLoop.SetName( 'EndOfInitLoop' )
65 EndOfInitLoop.SetAuthor( '' )
66 EndOfInitLoop.SetComment( 'Compute Node' )
67 EndOfInitLoop.Coords( 767 , 102 )
69 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
70 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
71 PyEndOfInitLoop.append( ' if Index <= Max : ' )
72 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
73 PyEndOfInitLoop.append( ' else : ' )
74 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
75 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max ' )
76 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
77 IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
78 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
79 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
80 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
81 IInitLoopGate = InitLoop.GetInPort( 'Gate' )
82 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
83 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
84 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
85 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
86 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
87 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
88 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
89 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
90 IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
91 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
92 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
93 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
94 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
95 OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
96 InitLoop.SetName( 'InitLoop' )
97 InitLoop.SetAuthor( '' )
98 InitLoop.SetComment( 'Compute Node' )
99 InitLoop.Coords( 10 , 108 )
101 # Creation of Switch Nodes
103 PySwitch.append( 'from time import * ' )
104 PySwitch.append( 'def Switch(a) : ' )
105 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
106 PySwitch.append( ' sleep(1) ' )
107 PySwitch.append( ' return a & 1,1-(a&1),a ' )
108 Switch,EndSwitch = GraphLoopSwitchDefault.SNode( 'Switch' , PySwitch )
109 EndSwitch.SetName( 'EndSwitch' )
110 EndSwitch.SetAuthor( '' )
111 EndSwitch.SetComment( 'Compute Node' )
112 EndSwitch.Coords( 587 , 103 )
114 PyEndSwitch.append( 'def EndSwitch(a) : ' )
115 PyEndSwitch.append( ' if ( a & 1 ) == 0 : ' )
116 PyEndSwitch.append( ' sleep(1) ' )
117 PyEndSwitch.append( ' return a ' )
118 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
119 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
120 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
121 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
122 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
123 Switch.SetName( 'Switch' )
124 Switch.SetAuthor( '' )
125 Switch.SetComment( 'Compute Node' )
126 Switch.Coords( 194 , 109 )
127 ISwitcha = Switch.InPort( 'a' , 'long' )
128 ISwitchGate = Switch.GetInPort( 'Gate' )
129 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
130 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
131 OSwitcha = Switch.OutPort( 'a' , 'int' )
132 OSwitchDefault = Switch.GetOutPort( 'Default' )
135 LIsOddaEndSwitcha = GraphLoopSwitchDefault.Link( OIsOdda , IEndSwitcha )
137 LInitLoopIndexSwitcha = GraphLoopSwitchDefault.Link( OInitLoopIndex , ISwitcha )
139 LInitLoopMinEndOfInitLoopMin = GraphLoopSwitchDefault.Link( OInitLoopMin , IEndOfInitLoopMin )
141 LInitLoopMaxEndOfInitLoopMax = GraphLoopSwitchDefault.Link( OInitLoopMax , IEndOfInitLoopMax )
143 LSwitchOddIsOddGate = GraphLoopSwitchDefault.Link( OSwitchOdd , IIsOddGate )
145 LSwitchaIsOdda = GraphLoopSwitchDefault.Link( OSwitcha , IIsOdda )
147 LSwitchDefaultEndSwitchDefault = GraphLoopSwitchDefault.Link( OSwitchDefault , IEndSwitchDefault )
149 LEndSwitchaEndOfInitLoopIndex = GraphLoopSwitchDefault.Link( OEndSwitcha , IEndOfInitLoopIndex )
152 IInitLoopIndex.Input( 0 )
153 IInitLoopMin.Input( 5 )
154 IInitLoopMax.Input( 23 )
156 # Output Ports of the graph
157 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
158 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
159 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
160 #OSwitchEven = Switch.GetOutPort( 'Even' )
161 return GraphLoopSwitchDefault
164 GraphLoopSwitchDefault = DefGraphLoopSwitchDefault()