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