1 # Copyright (C) 2007-2014 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, or (at your option) any later version.
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
23 # Generated python file of Graph GraphWrongPythonFunctions_1
27 # Graph creation of GraphWrongPythonFunctions_1
28 def DefGraphWrongPythonFunctions_1() :
29 GraphWrongPythonFunctions_1 = Graph( 'GraphWrongPythonFunctions_1' )
30 GraphWrongPythonFunctions_1.SetName( 'GraphWrongPythonFunctions_1' )
31 GraphWrongPythonFunctions_1.SetAuthor( 'JR' )
32 GraphWrongPythonFunctions_1.SetComment( '' )
33 GraphWrongPythonFunctions_1.Coords( 0 , 0 )
35 # Creation of Factory Nodes
37 # Creation of InLine Nodes
39 PyIsOdd.append( 'from timed import * ' )
40 PyIsOdd.append( 'def IsOdd(a) : ' )
41 PyIsOdd.append( ' print a,"IsOdd (GraphLoopSwitch1)" ' )
42 PyIsOdd.append( ' sleep( 1 ) ' )
43 PyIsOdd.append( ' return a ' )
44 IsOdd = GraphWrongPythonFunctions_1.INode( 'IsOdd' , PyIsOdd )
45 IsOdd.SetName( 'IsOdd' )
47 IsOdd.SetComment( 'Python function' )
48 IsOdd.Coords( 397 , 1 )
49 IIsOdda = IsOdd.InPort( 'a' , 'long' )
50 IIsOddGate = IsOdd.GetInPort( 'Gate' )
51 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
52 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
55 PyValEven.append( 'from timed import * ' )
56 PyValEven.append( 'def ValEven(Even) : ' )
57 PyValEven.append( ' sleep(1) ' )
58 PyValEven.append( ' return Even ' )
59 PyValEven.append( '' )
60 ValEven = GraphWrongPythonFunctions_1.INode( 'ValEven' , PyValEven )
61 ValEven.SetName( 'ValEven' )
62 ValEven.SetAuthor( '' )
63 ValEven.SetComment( 'Compute Node' )
64 ValEven.Coords( 396 , 222 )
65 IValEvenEven = ValEven.InPort( 'Even' , 'long' )
66 IValEvenGate = ValEven.GetInPort( 'Gate' )
67 OValEvenEven = ValEven.OutPort( 'Even' , 'long' )
68 OValEvenGate = ValEven.GetOutPort( 'Gate' )
70 # Creation of Loop Nodes
72 PyInitLoop.append( 'def InitLoop(Index,Min,Max) ' )
73 PyInitLoop.append( ' Index = Min ' )
74 PyInitLoop.append( ' return Index,Min,Max ' )
75 PyInitLoop.append( ' ' )
77 PyMoreInitLoop.append( 'def More() ' )
78 PyMoreInitLoop.append( ' return toto ' )
80 PyNextInitLoop.append( 'def Next(...) ' )
81 PyNextInitLoop.append( ' return Ok ' )
82 InitLoop,EndOfInitLoop = GraphWrongPythonFunctions_1.LNode( 'InitLoop' , PyInitLoop , 'More' , PyMoreInitLoop , 'Next' , PyNextInitLoop )
83 EndOfInitLoop.SetName( 'EndOfInitLoop' )
84 EndOfInitLoop.SetAuthor( '' )
85 EndOfInitLoop.SetComment( 'Compute Node' )
86 EndOfInitLoop.Coords( 767 , 102 )
88 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) : ' )
89 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
90 PyEndOfInitLoop.append( ' if Index <= Max : ' )
91 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
92 PyEndOfInitLoop.append( ' else : ' )
93 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
94 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max : ' )
95 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
96 IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
97 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
98 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
99 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
100 IInitLoopGate = InitLoop.GetInPort( 'Gate' )
101 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
102 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
103 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
104 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
105 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
106 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
107 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
108 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
109 IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
110 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
111 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
112 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
113 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
114 OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
115 InitLoop.SetName( 'InitLoop' )
116 InitLoop.SetAuthor( '' )
117 InitLoop.SetComment( 'Compute Node' )
118 InitLoop.Coords( 10 , 108 )
120 # Creation of Switch Nodes
122 PySwitch.append( 'from time import * ' )
123 PySwitch.append( 'def Switch(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,EndSwitch = GraphWrongPythonFunctions_1.SNode( 'Switch' , PySwitch )
128 EndSwitch.SetName( 'EndSwitch' )
129 EndSwitch.SetAuthor( '' )
130 EndSwitch.SetComment( 'Compute Node' )
131 EndSwitch.Coords( 587 , 103 )
133 PyEndSwitch.append( 'def EndSwitch(a,Even) ' )
134 PyEndSwitch.append( ' sleep(1) ' )
135 PyEndSwitch.append( ' return a, ' )
136 EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
137 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
138 IEndSwitchEven = EndSwitch.InPort( 'Even' , 'long' )
139 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
140 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
141 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
142 Switch.SetName( 'Switch' )
143 Switch.SetAuthor( '' )
144 Switch.SetComment( 'Compute Node' )
145 Switch.Coords( 194 , 109 )
146 ISwitcha = Switch.InPort( 'a' , 'long' )
147 ISwitchGate = Switch.GetInPort( 'Gate' )
148 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
149 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
150 OSwitcha = Switch.OutPort( 'a' , 'int' )
151 OSwitchDefault = Switch.GetOutPort( 'Default' )
154 LIsOddaEndSwitcha = GraphWrongPythonFunctions_1.Link( OIsOdda , IEndSwitcha )
156 LInitLoopIndexSwitcha = GraphWrongPythonFunctions_1.Link( OInitLoopIndex , ISwitcha )
158 LInitLoopMinEndOfInitLoopMin = GraphWrongPythonFunctions_1.Link( OInitLoopMin , IEndOfInitLoopMin )
160 LInitLoopMaxEndOfInitLoopMax = GraphWrongPythonFunctions_1.Link( OInitLoopMax , IEndOfInitLoopMax )
162 LSwitchOddIsOddGate = GraphWrongPythonFunctions_1.Link( OSwitchOdd , IIsOddGate )
164 LSwitchEvenValEvenEven = GraphWrongPythonFunctions_1.Link( OSwitchEven , IValEvenEven )
166 LSwitchaIsOdda = GraphWrongPythonFunctions_1.Link( OSwitcha , IIsOdda )
168 LSwitchDefaultEndSwitchDefault = GraphWrongPythonFunctions_1.Link( OSwitchDefault , IEndSwitchDefault )
170 LEndSwitchaEndOfInitLoopIndex = GraphWrongPythonFunctions_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
172 LValEvenEvenEndSwitchEven = GraphWrongPythonFunctions_1.Link( OValEvenEven , IEndSwitchEven )
175 IInitLoopIndex.Input( 0 )
176 IInitLoopMin.Input( 5 )
177 IInitLoopMax.Input( 23 )
179 # Output Ports of the graph
180 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
181 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
182 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
183 return GraphWrongPythonFunctions_1
186 GraphWrongPythonFunctions_1 = DefGraphWrongPythonFunctions_1()