Salome HOME
9936451ac722e6f746f0d4feae0b3af3a02c61df
[samples/datafiles.git] / Superv / Python / GraphSwitchGatesdefault_.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 GraphSwitchGatesdefault
23 #
24 from SuperV import *
25
26 # Graph creation of GraphSwitchGatesdefault
27 def DefGraphSwitchGatesdefault() :
28     GraphSwitchGatesdefault = Graph( 'GraphSwitchGatesdefault' )
29     GraphSwitchGatesdefault.SetName( 'GraphSwitchGatesdefault' )
30     GraphSwitchGatesdefault.SetAuthor( 'JR' )
31     GraphSwitchGatesdefault.SetComment( '' )
32     GraphSwitchGatesdefault.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() : ' )
40     PyIsOdd.append( '    sleep(1) ' )
41     PyIsOdd.append( '    return  ' )
42     IsOdd = GraphSwitchGatesdefault.INode( 'IsOdd' , PyIsOdd )
43     IsOdd.SetName( 'IsOdd' )
44     IsOdd.SetAuthor( '' )
45     IsOdd.SetComment( 'Compute Node' )
46     IsOdd.Coords( 424 , 116 )
47     IIsOddGate = IsOdd.GetInPort( 'Gate' )
48     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
49     
50     PyIsEven = []
51     PyIsEven.append( 'from time import * ' )
52     PyIsEven.append( 'def IsEven() :  ' )
53     PyIsEven.append( '    sleep(1) ' )
54     PyIsEven.append( '    return  ' )
55     IsEven = GraphSwitchGatesdefault.INode( 'IsEven' , PyIsEven )
56     IsEven.SetName( 'IsEven' )
57     IsEven.SetAuthor( '' )
58     IsEven.SetComment( 'Compute Node' )
59     IsEven.Coords( 428 , 345 )
60     IIsEvenGate = IsEven.GetInPort( 'Gate' )
61     OIsEvenGate = IsEven.GetOutPort( 'Gate' )
62     
63     # Creation of Loop Nodes
64     PyLoopGates = []
65     PyLoopGates.append( 'def InitLoop(Index,Max,Min) :    ' )
66     PyLoopGates.append( '    Index = Max   ' )
67     PyLoopGates.append( '    return Index,Max,Min    ' )
68     PyMoreLoopGates = []
69     PyMoreLoopGates.append( 'from time import *  ' )
70     PyMoreLoopGates.append( 'def MoreLoop(Index,Max,Min) :  ' )
71     PyMoreLoopGates.append( '    sleep(1)  ' )
72     PyMoreLoopGates.append( '    DoLoop = 0   ' )
73     PyMoreLoopGates.append( '    if Index >= Min :   ' )
74     PyMoreLoopGates.append( '        DoLoop = 1   ' )
75     PyMoreLoopGates.append( '    return DoLoop,Index,Max,Min ' )
76     PyNextLoopGates = []
77     PyNextLoopGates.append( 'def  NextLoop(Index,Max,Min) :   ' )
78     PyNextLoopGates.append( '    Index = Index - 1   ' )
79     PyNextLoopGates.append( '    return Index,Max,Min   ' )
80     LoopGates,EndLoopGates = GraphSwitchGatesdefault.LNode( 'InitLoop' , PyLoopGates , 'MoreLoop' , PyMoreLoopGates , 'NextLoop' , PyNextLoopGates )
81     EndLoopGates.SetName( 'EndLoopGates' )
82     EndLoopGates.SetAuthor( '' )
83     EndLoopGates.SetComment( 'Compute Node' )
84     EndLoopGates.Coords( 875 , 216 )
85     PyEndLoopGates = []
86     EndLoopGates.SetPyFunction( 'EndLoopGates' , PyEndLoopGates )
87     ILoopGatesDoLoop = LoopGates.GetInPort( 'DoLoop' )
88     ILoopGatesIndex = LoopGates.InPort( 'Index' , 'long' )
89     ILoopGatesMax = LoopGates.InPort( 'Max' , 'long' )
90     ILoopGatesMin = LoopGates.InPort( 'Min' , 'long' )
91     ILoopGatesGate = LoopGates.GetInPort( 'Gate' )
92     OLoopGatesDoLoop = LoopGates.GetOutPort( 'DoLoop' )
93     OLoopGatesIndex = LoopGates.GetOutPort( 'Index' )
94     OLoopGatesMax = LoopGates.GetOutPort( 'Max' )
95     OLoopGatesMin = LoopGates.GetOutPort( 'Min' )
96     IEndLoopGatesDoLoop = EndLoopGates.GetInPort( 'DoLoop' )
97     IEndLoopGatesIndex = EndLoopGates.GetInPort( 'Index' )
98     IEndLoopGatesMax = EndLoopGates.GetInPort( 'Max' )
99     IEndLoopGatesMin = EndLoopGates.GetInPort( 'Min' )
100     IEndLoopGatesGate = EndLoopGates.GetInPort( 'Gate' )
101     OEndLoopGatesDoLoop = EndLoopGates.GetOutPort( 'DoLoop' )
102     OEndLoopGatesIndex = EndLoopGates.GetOutPort( 'Index' )
103     OEndLoopGatesMax = EndLoopGates.GetOutPort( 'Max' )
104     OEndLoopGatesMin = EndLoopGates.GetOutPort( 'Min' )
105     OEndLoopGatesGate = EndLoopGates.GetOutPort( 'Gate' )
106     LoopGates.SetName( 'LoopGates' )
107     LoopGates.SetAuthor( '' )
108     LoopGates.SetComment( 'Compute Node' )
109     LoopGates.Coords( 13 , 236 )
110     
111     # Creation of Switch Nodes
112     PySwitchGates = []
113     PySwitchGates.append( 'def SwitchGates(Index) :    ' )
114     PySwitchGates.append( '    Odd = 0    ' )
115     PySwitchGates.append( '    Even = 0    ' )
116     PySwitchGates.append( '    default = 0 ' )
117     PySwitchGates.append( '    if Index > 0 :  ' )
118     PySwitchGates.append( '        if (Index & 1) == 1 :    ' )
119     PySwitchGates.append( '            Odd = 1    ' )
120     PySwitchGates.append( '        if (Index & 1) == 0 :    ' )
121     PySwitchGates.append( '            Even = 1    ' )
122     PySwitchGates.append( '    else : ' )
123     PySwitchGates.append( '        default = 1 ' )
124     PySwitchGates.append( '    return Odd,Even,default ' )
125     SwitchGates,EndSwitchGates = GraphSwitchGatesdefault.SNode( 'SwitchGates' , PySwitchGates )
126     EndSwitchGates.SetName( 'EndSwitchGates' )
127     EndSwitchGates.SetAuthor( '' )
128     EndSwitchGates.SetComment( 'Compute Node' )
129     EndSwitchGates.Coords( 648 , 276 )
130     PyEndSwitchGates = []
131     PyEndSwitchGates.append( 'from time import * ' )
132     PyEndSwitchGates.append( 'def EndSwitchGates() : ' )
133     PyEndSwitchGates.append( '    sleep(1) ' )
134     PyEndSwitchGates.append( '    return ' )
135     PyEndSwitchGates.append( '' )
136     EndSwitchGates.SetPyFunction( 'EndSwitchGates' , PyEndSwitchGates )
137     IEndSwitchGatesDefault = EndSwitchGates.GetInPort( 'Default' )
138     OEndSwitchGatesGate = EndSwitchGates.GetOutPort( 'Gate' )
139     SwitchGates.SetName( 'SwitchGates' )
140     SwitchGates.SetAuthor( '' )
141     SwitchGates.SetComment( 'Compute Node' )
142     SwitchGates.Coords( 204 , 236 )
143     ISwitchGatesIndex = SwitchGates.InPort( 'Index' , 'long' )
144     ISwitchGatesGate = SwitchGates.GetInPort( 'Gate' )
145     OSwitchGatesOdd = SwitchGates.OutPort( 'Odd' , 'long' )
146     OSwitchGatesEven = SwitchGates.OutPort( 'Even' , 'long' )
147     OSwitchGatesdefault = SwitchGates.OutPort( 'default' , 'long' )
148     OSwitchGatesDefault = SwitchGates.GetOutPort( 'Default' )
149     
150     # Creation of Links
151     LLoopGatesIndexEndLoopGatesIndex = GraphSwitchGatesdefault.Link( OLoopGatesIndex , IEndLoopGatesIndex )
152     
153     LLoopGatesIndexSwitchGatesIndex = GraphSwitchGatesdefault.Link( OLoopGatesIndex , ISwitchGatesIndex )
154     
155     LLoopGatesMaxEndLoopGatesMax = GraphSwitchGatesdefault.Link( OLoopGatesMax , IEndLoopGatesMax )
156     
157     LLoopGatesMinEndLoopGatesMin = GraphSwitchGatesdefault.Link( OLoopGatesMin , IEndLoopGatesMin )
158     
159     LSwitchGatesOddIsOddGate = GraphSwitchGatesdefault.Link( OSwitchGatesOdd , IIsOddGate )
160     
161     LSwitchGatesEvenIsEvenGate = GraphSwitchGatesdefault.Link( OSwitchGatesEven , IIsEvenGate )
162     
163     LSwitchGatesdefaultEndSwitchGatesDefault = GraphSwitchGatesdefault.Link( OSwitchGatesdefault , IEndSwitchGatesDefault )
164     
165     LEndSwitchGatesGateEndLoopGatesGate = GraphSwitchGatesdefault.Link( OEndSwitchGatesGate , IEndLoopGatesGate )
166     
167     LIsOddGateEndSwitchGatesDefault = GraphSwitchGatesdefault.Link( OIsOddGate , IEndSwitchGatesDefault )
168     
169     LIsEvenGateEndSwitchGatesDefault = GraphSwitchGatesdefault.Link( OIsEvenGate , IEndSwitchGatesDefault )
170     
171     # Input datas
172     ILoopGatesIndex.Input( 0 )
173     ILoopGatesMax.Input( 13 )
174     ILoopGatesMin.Input( -7 )
175     
176     # Output Ports of the graph
177     #OEndLoopGatesIndex = EndLoopGates.GetOutPort( 'Index' )
178     #OEndLoopGatesMax = EndLoopGates.GetOutPort( 'Max' )
179     #OEndLoopGatesMin = EndLoopGates.GetOutPort( 'Min' )
180     return GraphSwitchGatesdefault
181
182
183 GraphSwitchGatesdefault = DefGraphSwitchGatesdefault()