Salome HOME
72ac806ff7c800613033136df3ee392543694db9
[samples/datafiles.git] / Superv / Python / GraphLoopSwitchGatesDefaultNOTValid.py
1 #  Copyright (C) 2007-2008  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 GraphLoopSwitchGatesDefaultNOTValid
23 #
24 from SuperV import *
25
26 # Graph creation of GraphLoopSwitchGatesDefaultNOTValid
27 def DefGraphLoopSwitchGatesDefaultNOTValid() :
28     GraphLoopSwitchGatesDefaultNOTValid = Graph( 'GraphLoopSwitchGatesDefaultNOTValid' )
29     GraphLoopSwitchGatesDefaultNOTValid.SetName( 'GraphLoopSwitchGatesDefaultNOTValid' )
30     GraphLoopSwitchGatesDefaultNOTValid.SetAuthor( 'JR' )
31     GraphLoopSwitchGatesDefaultNOTValid.SetComment( '' )
32     GraphLoopSwitchGatesDefaultNOTValid.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 (GraphLoopSwitch1)"        ' )
41     PyIsOdd.append( '    sleep( 1 )     ' )
42     PyIsOdd.append( '    return a       ' )
43     IsOdd = GraphLoopSwitchGatesDefaultNOTValid.INode( 'IsOdd' , PyIsOdd )
44     IsOdd.SetName( 'IsOdd' )
45     IsOdd.SetAuthor( '' )
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' )
52     
53     PyValEven = []
54     PyValEven.append( 'from time import * ' )
55     PyValEven.append( 'def ValEven(Even) : ' )
56     PyValEven.append( '    sleep(1) ' )
57     PyValEven.append( '    return Even   ' )
58     PyValEven.append( '' )
59     ValEven = GraphLoopSwitchGatesDefaultNOTValid.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' )
68     
69     # Creation of Loop Nodes
70     PyInitLoop = []
71     PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
72     PyInitLoop.append( '        Index = Min ' )
73     PyInitLoop.append( '        return Index,Min,Max ' )
74     PyInitLoop.append( '' )
75     PyMoreInitLoop = []
76     PyMoreInitLoop.append( '' )
77     PyNextInitLoop = []
78     PyNextInitLoop.append( '' )
79     InitLoop,EndOfInitLoop = GraphLoopSwitchGatesDefaultNOTValid.LNode( 'InitLoop' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
80     EndOfInitLoop.SetName( 'EndOfInitLoop' )
81     EndOfInitLoop.SetAuthor( '' )
82     EndOfInitLoop.SetComment( 'Compute Node' )
83     EndOfInitLoop.Coords( 767 , 102 )
84     PyEndOfInitLoop = []
85     PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
86     PyEndOfInitLoop.append( '   Index = Index + 1     ' )
87     PyEndOfInitLoop.append( '   if Index <= Max :   ' )
88     PyEndOfInitLoop.append( '           DoLoop = 1     ' )
89     PyEndOfInitLoop.append( '   else :     ' )
90     PyEndOfInitLoop.append( '           DoLoop = 0     ' )
91     PyEndOfInitLoop.append( '   return DoLoop,Index,Min,Max     ' )
92     EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
93     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
94     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
95     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
96     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
97     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
98     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
99     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
100     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
101     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
102     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
103     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
104     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
105     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
106     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
107     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
108     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
109     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
110     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
111     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
112     InitLoop.SetName( 'InitLoop' )
113     InitLoop.SetAuthor( '' )
114     InitLoop.SetComment( 'Compute Node' )
115     InitLoop.Coords( 10 , 108 )
116     
117     # Creation of Switch Nodes
118     PySwitch = []
119     PySwitch.append( 'from time import *  ' )
120     PySwitch.append( 'def Switch(a) :    ' )
121     PySwitch.append( '    if ( a & 1 ) == 0 :  ' )
122     PySwitch.append( '        sleep(1)  ' )
123     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
124     Switch,EndSwitch = GraphLoopSwitchGatesDefaultNOTValid.SNode( 'Switch' , PySwitch )
125     EndSwitch.SetName( 'EndSwitch' )
126     EndSwitch.SetAuthor( '' )
127     EndSwitch.SetComment( 'Compute Node' )
128     EndSwitch.Coords( 587 , 103 )
129     PyEndSwitch = []
130     PyEndSwitch.append( 'def EndSwitch(a,Even) : ' )
131     PyEndSwitch.append( '    sleep(1)     ' )
132     PyEndSwitch.append( '    return a       ' )
133     EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
134     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
135     IEndSwitchEven = EndSwitch.InPort( 'Even' , 'long' )
136     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
137     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
138     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
139     Switch.SetName( 'Switch' )
140     Switch.SetAuthor( '' )
141     Switch.SetComment( 'Compute Node' )
142     Switch.Coords( 194 , 109 )
143     ISwitcha = Switch.InPort( 'a' , 'long' )
144     ISwitchGate = Switch.GetInPort( 'Gate' )
145     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
146     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
147     OSwitcha = Switch.OutPort( 'a' , 'int' )
148     OSwitchDefault = Switch.GetOutPort( 'Default' )
149     
150     # Creation of Links
151     LIsOddaEndSwitcha = GraphLoopSwitchGatesDefaultNOTValid.Link( OIsOdda , IEndSwitcha )
152     
153     LIsOddGateEndSwitchDefault = GraphLoopSwitchGatesDefaultNOTValid.Link( OIsOddGate , IEndSwitchDefault )
154     
155     LInitLoopIndexSwitcha = GraphLoopSwitchGatesDefaultNOTValid.Link( OInitLoopIndex , ISwitcha )
156     
157     LInitLoopMinEndOfInitLoopMin = GraphLoopSwitchGatesDefaultNOTValid.Link( OInitLoopMin , IEndOfInitLoopMin )
158     
159     LInitLoopMaxEndOfInitLoopMax = GraphLoopSwitchGatesDefaultNOTValid.Link( OInitLoopMax , IEndOfInitLoopMax )
160     
161     LSwitchOddIsOddGate = GraphLoopSwitchGatesDefaultNOTValid.Link( OSwitchOdd , IIsOddGate )
162     
163     LSwitchEvenValEvenEven = GraphLoopSwitchGatesDefaultNOTValid.Link( OSwitchEven , IValEvenEven )
164     
165     LSwitchaIsOdda = GraphLoopSwitchGatesDefaultNOTValid.Link( OSwitcha , IIsOdda )
166     
167     LSwitchDefaultEndSwitchDefault = GraphLoopSwitchGatesDefaultNOTValid.Link( OSwitchDefault , IEndSwitchDefault )
168     
169     LEndSwitchaEndOfInitLoopIndex = GraphLoopSwitchGatesDefaultNOTValid.Link( OEndSwitcha , IEndOfInitLoopIndex )
170     
171     LValEvenEvenEndSwitchEven = GraphLoopSwitchGatesDefaultNOTValid.Link( OValEvenEven , IEndSwitchEven )
172     
173     LValEvenGateEndSwitchDefault = GraphLoopSwitchGatesDefaultNOTValid.Link( OValEvenGate , IEndSwitchDefault )
174     
175     # Input datas
176     IInitLoopIndex.Input( 0 )
177     IInitLoopMin.Input( 5 )
178     IInitLoopMax.Input( 23 )
179     
180     # Output Ports of the graph
181     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
182     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
183     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
184     return GraphLoopSwitchGatesDefaultNOTValid
185
186
187 GraphLoopSwitchGatesDefaultNOTValid = DefGraphLoopSwitchGatesDefaultNOTValid()