Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/datafiles.git] / Superv / Python / GraphSwitchOutputNOTValid.py
1 #  Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
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.
10 #
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.
15 #
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
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # Generated python file of Graph GraphSwitchOutputNOTValid
23 #
24 from SuperV import *
25
26 # Graph creation of GraphSwitchOutputNOTValid
27 def DefGraphSwitchOutputNOTValid() :
28     GraphSwitchOutputNOTValid = Graph( 'GraphSwitchOutputNOTValid' )
29     GraphSwitchOutputNOTValid.SetName( 'GraphSwitchOutputNOTValid' )
30     GraphSwitchOutputNOTValid.SetAuthor( 'JR' )
31     GraphSwitchOutputNOTValid.SetComment( '' )
32     GraphSwitchOutputNOTValid.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     # Creation of InLine Nodes
37     PyIsOdd = []
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 = GraphSwitchOutputNOTValid.INode( 'IsOdd' , PyIsOdd )
44     IsOdd.SetName( 'IsOdd' )
45     IsOdd.SetAuthor( '' )
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' )
52     
53     PyIsEven = []
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 = GraphSwitchOutputNOTValid.INode( 'IsEven' , PyIsEven )
60     IsEven.SetName( 'IsEven' )
61     IsEven.SetAuthor( '' )
62     IsEven.SetComment( 'Compute Node' )
63     IsEven.Coords( 432 , 337 )
64     IIsEvena = IsEven.InPort( 'a' , 'long' )
65     IIsEvenGate = IsEven.GetInPort( 'Gate' )
66     OIsEvena = IsEven.OutPort( 'a' , 'long' )
67     OIsEvenGate = IsEven.GetOutPort( 'Gate' )
68     
69     PyPrint = []
70     PyPrint.append( 'def Print(a,Branch) :   ' )
71     PyPrint.append( '    print "Print ",Branch   ' )
72     PyPrint.append( '    return a,Branch   ' )
73     Print = GraphSwitchOutputNOTValid.INode( 'Print' , PyPrint )
74     Print.SetName( 'Print' )
75     Print.SetAuthor( '' )
76     Print.SetComment( 'Compute Node' )
77     Print.Coords( 639 , 50 )
78     IPrinta = Print.InPort( 'a' , 'long' )
79     IPrintBranch = Print.InPort( 'Branch' , 'string' )
80     IPrintGate = Print.GetInPort( 'Gate' )
81     OPrinta = Print.OutPort( 'a' , 'long' )
82     OPrintBranch = Print.OutPort( 'Branch' , 'string' )
83     OPrintGate = Print.GetOutPort( 'Gate' )
84     
85     PyPrint_1 = []
86     PyPrint_1.append( 'def Print_1(a,Branch) :   ' )
87     PyPrint_1.append( '    print "Print ",Branch   ' )
88     PyPrint_1.append( '    return a,Branch   ' )
89     Print_1 = GraphSwitchOutputNOTValid.INode( 'Print_1' , PyPrint_1 )
90     Print_1.SetName( 'Print_1' )
91     Print_1.SetAuthor( '' )
92     Print_1.SetComment( 'Compute Node' )
93     Print_1.Coords( 645 , 250 )
94     IPrint_1a = Print_1.InPort( 'a' , 'long' )
95     IPrint_1Branch = Print_1.InPort( 'Branch' , 'string' )
96     IPrint_1Gate = Print_1.GetInPort( 'Gate' )
97     OPrint_1a = Print_1.OutPort( 'a' , 'long' )
98     OPrint_1Branch = Print_1.OutPort( 'Branch' , 'string' )
99     OPrint_1Gate = Print_1.GetOutPort( 'Gate' )
100     
101     # Creation of Loop Nodes
102     PyInitLoopSwitch = []
103     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :       ' )
104     PyInitLoopSwitch.append( '  Index = Max ' )
105     PyInitLoopSwitch.append( '  return Index,Min,Max      ' )
106     PyMoreInitLoopSwitch = []
107     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :      ' )
108     PyMoreInitLoopSwitch.append( '      if Index >= Min :    ' )
109     PyMoreInitLoopSwitch.append( '              DoLoop = 1      ' )
110     PyMoreInitLoopSwitch.append( '      else :      ' )
111     PyMoreInitLoopSwitch.append( '              DoLoop = 0      ' )
112     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max      ' )
113     PyNextInitLoopSwitch = []
114     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :      ' )
115     PyNextInitLoopSwitch.append( '      Index = Index - 1      ' )
116     PyNextInitLoopSwitch.append( '      return Index,Min,Max      ' )
117     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchOutputNOTValid.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
118     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
119     EndOfInitLoopSwitch.SetAuthor( '' )
120     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
121     EndOfInitLoopSwitch.Coords( 1082 , 150 )
122     PyEndOfInitLoopSwitch = []
123     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
124     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
125     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
126     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
127     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
128     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
129     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
130     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
131     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
132     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
133     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
134     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
135     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
136     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
137     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
138     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
139     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
140     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
141     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
142     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
143     InitLoopSwitch.SetName( 'InitLoopSwitch' )
144     InitLoopSwitch.SetAuthor( '' )
145     InitLoopSwitch.SetComment( 'Compute Node' )
146     InitLoopSwitch.Coords( 10 , 129 )
147     
148     # Creation of Switch Nodes
149     PySwitch = []
150     PySwitch.append( 'from time import *       ' )
151     PySwitch.append( 'def Switch(a) :   ' )
152     PySwitch.append( '    Branch = 'Negative or null'   ' )
153     PySwitch.append( '    if a <= 0 :      ' )
154     PySwitch.append( '        return 0,0,a,Branch,1 ' )
155     PySwitch.append( '    if ( a & 1 ) == 0 :   ' )
156     PySwitch.append( '        Branch = 'Even'   ' )
157     PySwitch.append( '    else :   ' )
158     PySwitch.append( '        Branch = 'Odd'   ' )
159     PySwitch.append( '    sleep(1)   ' )
160     PySwitch.append( '    return a & 1,1-(a&1),a,Branch,0 ' )
161     Switch,EndOfSwitch = GraphSwitchOutputNOTValid.SNode( 'Switch' , PySwitch )
162     EndOfSwitch.SetName( 'EndOfSwitch' )
163     EndOfSwitch.SetAuthor( '' )
164     EndOfSwitch.SetComment( 'Compute Node' )
165     EndOfSwitch.Coords( 880 , 150 )
166     PyEndOfSwitch = []
167     EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch )
168     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
169     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
170     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
171     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
172     Switch.SetName( 'Switch' )
173     Switch.SetAuthor( '' )
174     Switch.SetComment( 'Compute Node' )
175     Switch.Coords( 195 , 129 )
176     ISwitcha = Switch.InPort( 'a' , 'long' )
177     ISwitchGate = Switch.GetInPort( 'Gate' )
178     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
179     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
180     OSwitcha = Switch.OutPort( 'a' , 'int' )
181     OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
182     OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
183     OSwitchDefault = Switch.GetOutPort( 'Default' )
184     
185     # Creation of Links
186     LIsOddaPrinta = GraphSwitchOutputNOTValid.Link( OIsOdda , IPrinta )
187     
188     LInitLoopSwitchIndexSwitcha = GraphSwitchOutputNOTValid.Link( OInitLoopSwitchIndex , ISwitcha )
189     
190     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchOutputNOTValid.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
191     
192     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchOutputNOTValid.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
193     
194     LIsEvenaPrint_1a = GraphSwitchOutputNOTValid.Link( OIsEvena , IPrint_1a )
195     
196     LSwitchOddIsOddGate = GraphSwitchOutputNOTValid.Link( OSwitchOdd , IIsOddGate )
197     
198     LSwitchEvenIsEvenGate = GraphSwitchOutputNOTValid.Link( OSwitchEven , IIsEvenGate )
199     
200     LSwitchaIsOdda = GraphSwitchOutputNOTValid.Link( OSwitcha , IIsOdda )
201     
202     LSwitchaIsEvena = GraphSwitchOutputNOTValid.Link( OSwitcha , IIsEvena )
203     
204     LSwitchBranchPrintBranch = GraphSwitchOutputNOTValid.Link( OSwitchBranch , IPrintBranch )
205     
206     LSwitchBranchPrint_1Branch = GraphSwitchOutputNOTValid.Link( OSwitchBranch , IPrint_1Branch )
207     
208     LSwitchDefaultEndOfSwitchDefault = GraphSwitchOutputNOTValid.Link( OSwitchDefault , IEndOfSwitchDefault )
209     
210     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchOutputNOTValid.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
211     
212     LPrintaEndOfSwitcha = GraphSwitchOutputNOTValid.Link( OPrinta , IEndOfSwitcha )
213     
214     LPrint_1aEndOfSwitcha = GraphSwitchOutputNOTValid.Link( OPrint_1a , IEndOfSwitcha )
215     
216     # Input datas
217     IInitLoopSwitchIndex.Input( 0 )
218     IInitLoopSwitchMin.Input( -5 )
219     IInitLoopSwitchMax.Input( 10 )
220     
221     # Output Ports of the graph
222     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
223     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
224     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
225     #OSwitchdefault = Switch.GetOutPort( 'default' )
226     #OPrintBranch = Print.GetOutPort( 'Branch' )
227     #OPrint_1Branch = Print_1.GetOutPort( 'Branch' )
228     return GraphSwitchOutputNOTValid
229
230
231 GraphSwitchOutputNOTValid = DefGraphSwitchOutputNOTValid()