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