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 GraphWrongPythonFunctions_1
26 # Graph creation of GraphWrongPythonFunctions_1
27 def DefGraphWrongPythonFunctions_1() :
28 GraphWrongPythonFunctions_1 = Graph( 'GraphWrongPythonFunctions_1' )
29 GraphWrongPythonFunctions_1.SetName( 'GraphWrongPythonFunctions_1' )
30 GraphWrongPythonFunctions_1.SetAuthor( 'JR' )
31 GraphWrongPythonFunctions_1.SetComment( '' )
32 GraphWrongPythonFunctions_1.Coords( 0 , 0 )
34 # Creation of Factory Nodes
36 # Creation of InLine Nodes
38 PyIsOdd.append( 'from timed 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 = GraphWrongPythonFunctions_1.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 timed import * ' )
55 PyValEven.append( 'def ValEven(Even) : ' )
56 PyValEven.append( ' sleep(1) ' )
57 PyValEven.append( ' return Even ' )
58 PyValEven.append( '' )
59 ValEven = GraphWrongPythonFunctions_1.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( 'def More() ' )
77 PyMoreInitLoop.append( ' return toto ' )
79 PyNextInitLoop.append( 'def Next(...) ' )
80 PyNextInitLoop.append( ' return Ok ' )
81 InitLoop,EndOfInitLoop = GraphWrongPythonFunctions_1.LNode( 'InitLoop' , PyInitLoop , 'More' , PyMoreInitLoop , 'Next' , PyNextInitLoop )
82 EndOfInitLoop.SetName( 'EndOfInitLoop' )
83 EndOfInitLoop.SetAuthor( '' )
84 EndOfInitLoop.SetComment( 'Compute Node' )
85 EndOfInitLoop.Coords( 767 , 102 )
87 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) : ' )
88 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
89 PyEndOfInitLoop.append( ' if Index <= Max : ' )
90 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
91 PyEndOfInitLoop.append( ' else : ' )
92 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
93 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max : ' )
94 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
95 IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
96 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
97 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
98 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
99 IInitLoopGate = InitLoop.GetInPort( 'Gate' )
100 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
101 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
102 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
103 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
104 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
105 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
106 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
107 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
108 IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
109 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
110 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
111 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
112 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
113 OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
114 InitLoop.SetName( 'InitLoop' )
115 InitLoop.SetAuthor( '' )
116 InitLoop.SetComment( 'Compute Node' )
117 InitLoop.Coords( 10 , 108 )
119 # Creation of Switch Nodes
121 PySwitch.append( 'from time import * ' )
122 PySwitch.append( 'def Switch(a) ' )
123 PySwitch.append( ' if a & 1 == 0 : ' )
124 PySwitch.append( ' sleep(1) ' )
125 PySwitch.append( ' return a & 1,1-(a&1),a ' )
126 Switch,EndSwitch = GraphWrongPythonFunctions_1.SNode( 'Switch' , PySwitch )
127 EndSwitch.SetName( 'EndSwitch' )
128 EndSwitch.SetAuthor( '' )
129 EndSwitch.SetComment( 'Compute Node' )
130 EndSwitch.Coords( 587 , 103 )
132 PyEndSwitch.append( 'def EndSwitch(a,Even) ' )
133 PyEndSwitch.append( ' sleep(1) ' )
134 PyEndSwitch.append( ' return a, ' )
135 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
136 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
137 IEndSwitchEven = EndSwitch.InPort( 'Even' , 'long' )
138 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
139 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
140 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
141 Switch.SetName( 'Switch' )
142 Switch.SetAuthor( '' )
143 Switch.SetComment( 'Compute Node' )
144 Switch.Coords( 194 , 109 )
145 ISwitcha = Switch.InPort( 'a' , 'long' )
146 ISwitchGate = Switch.GetInPort( 'Gate' )
147 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
148 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
149 OSwitcha = Switch.OutPort( 'a' , 'int' )
150 OSwitchDefault = Switch.GetOutPort( 'Default' )
153 LIsOddaEndSwitcha = GraphWrongPythonFunctions_1.Link( OIsOdda , IEndSwitcha )
155 LInitLoopIndexSwitcha = GraphWrongPythonFunctions_1.Link( OInitLoopIndex , ISwitcha )
157 LInitLoopMinEndOfInitLoopMin = GraphWrongPythonFunctions_1.Link( OInitLoopMin , IEndOfInitLoopMin )
159 LInitLoopMaxEndOfInitLoopMax = GraphWrongPythonFunctions_1.Link( OInitLoopMax , IEndOfInitLoopMax )
161 LSwitchOddIsOddGate = GraphWrongPythonFunctions_1.Link( OSwitchOdd , IIsOddGate )
163 LSwitchEvenValEvenEven = GraphWrongPythonFunctions_1.Link( OSwitchEven , IValEvenEven )
165 LSwitchaIsOdda = GraphWrongPythonFunctions_1.Link( OSwitcha , IIsOdda )
167 LSwitchDefaultEndSwitchDefault = GraphWrongPythonFunctions_1.Link( OSwitchDefault , IEndSwitchDefault )
169 LEndSwitchaEndOfInitLoopIndex = GraphWrongPythonFunctions_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
171 LValEvenEvenEndSwitchEven = GraphWrongPythonFunctions_1.Link( OValEvenEven , IEndSwitchEven )
174 IInitLoopIndex.Input( 0 )
175 IInitLoopMin.Input( 5 )
176 IInitLoopMax.Input( 23 )
178 # Output Ports of the graph
179 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
180 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
181 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
182 return GraphWrongPythonFunctions_1
185 GraphWrongPythonFunctions_1 = DefGraphWrongPythonFunctions_1()