Salome HOME
009aadc21c87bdba2d1e2fb34f5286fd35ab108a
[samples/datafiles.git] / Superv / Python / GraphStreamInLines.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 GraphStreamInLines
23 #
24 from SuperV import *
25
26 # Graph creation of GraphStreamInLines
27 def DefGraphStreamInLines() :
28     GraphStreamInLines = StreamGraph( 'GraphStreamInLines' )
29     GraphStreamInLines.SetStreamParams( 300 , SUPERV.WithoutTrace , 0 )
30     GraphStreamInLines.SetName( 'GraphStreamInLines' )
31     GraphStreamInLines.SetAuthor( '' )
32     GraphStreamInLines.SetComment( '' )
33     GraphStreamInLines.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,Even) :        ' )
41     PyIsOdd.append( '    print a,"IsOdd (GraphStreamInLines1)"       ' )
42     PyIsOdd.append( '    sleep( 1 )    ' )
43     PyIsOdd.append( '    return a      ' )
44     IsOdd = GraphStreamInLines.INode( 'IsOdd' , PyIsOdd )
45     IsOdd.SetName( 'IsOdd' )
46     IsOdd.SetAuthor( '' )
47     IsOdd.SetComment( 'Python function' )
48     IsOdd.Coords( 404 , 7 )
49     IIsOdda = IsOdd.InPort( 'a' , 'long' )
50     IIsOddEven = IsOdd.InPort( 'Even' , 'boolean' )
51     IIsOddGate = IsOdd.GetInPort( 'Gate' )
52     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
53     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
54     IIsOddistream = IsOdd.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
55     IIsOddistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
56     OIsOddostream = IsOdd.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
57     OIsOddostream.SetNumberOfValues( 0 )
58     
59     # Creation of Loop Nodes
60     PyInitLoop = []
61     PyMoreInitLoop = []
62     PyMoreInitLoop.append( '' )
63     PyNextInitLoop = []
64     PyNextInitLoop.append( '' )
65     InitLoop,EndOfInitLoop = GraphStreamInLines.LNode( '' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
66     EndOfInitLoop.SetName( 'EndOfInitLoop' )
67     EndOfInitLoop.SetAuthor( '' )
68     EndOfInitLoop.SetComment( 'Compute Node' )
69     EndOfInitLoop.Coords( 807 , 104 )
70     PyEndOfInitLoop = []
71     PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
72     PyEndOfInitLoop.append( '   Index = Index + 1     ' )
73     PyEndOfInitLoop.append( '   if Index <= Max :   ' )
74     PyEndOfInitLoop.append( '           DoLoop = 1     ' )
75     PyEndOfInitLoop.append( '   else :     ' )
76     PyEndOfInitLoop.append( '           DoLoop = 0     ' )
77     PyEndOfInitLoop.append( '   return DoLoop,Index,Min,Max     ' )
78     EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
79     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
80     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
81     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
82     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
83     IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
84     IInitLoopistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
85     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
86     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
87     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
88     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
89     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
90     OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
91     OInitLoopostream.SetNumberOfValues( 0 )
92     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
93     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
94     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
95     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
96     IEndOfInitLoopistream = EndOfInitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
97     IEndOfInitLoopistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
98     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
99     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
100     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
101     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
102     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
103     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
104     OEndOfInitLoopostream = EndOfInitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
105     OEndOfInitLoopostream.SetNumberOfValues( 0 )
106     InitLoop.SetName( 'InitLoop' )
107     InitLoop.SetAuthor( '' )
108     InitLoop.SetComment( 'Compute Node' )
109     InitLoop.Coords( 11 , 119 )
110     IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
111     IInitLoopistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
112     OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
113     OInitLoopostream.SetNumberOfValues( 0 )
114     
115     # Creation of Switch Nodes
116     PySwitch = []
117     PySwitch.append( 'from time import *  ' )
118     PySwitch.append( 'def Switch(a) :    ' )
119     PySwitch.append( '    if ( a & 1 ) == 0 :  ' )
120     PySwitch.append( '        sleep(1)  ' )
121     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
122     Switch,EndSwitch = GraphStreamInLines.SNode( 'Switch' , PySwitch )
123     EndSwitch.SetName( 'EndSwitch' )
124     EndSwitch.SetAuthor( '' )
125     EndSwitch.SetComment( 'Compute Node' )
126     EndSwitch.Coords( 604 , 105 )
127     PyEndSwitch = []
128     PyEndSwitch.append( 'def EndOfSwitch(a) :    ' )
129     PyEndSwitch.append( '    if ( a & 1 ) == 0 :  ' )
130     PyEndSwitch.append( '        sleep(1)  ' )
131     PyEndSwitch.append( '    return a    ' )
132     EndSwitch.SetPyFunction( 'EndOfSwitch' , PyEndSwitch )
133     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
134     IEndSwitchistream = EndSwitch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
135     IEndSwitchistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
136     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
137     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
138     OEndSwitchostream = EndSwitch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
139     OEndSwitchostream.SetNumberOfValues( 0 )
140     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
141     Switch.SetName( 'Switch' )
142     Switch.SetAuthor( '' )
143     Switch.SetComment( 'Compute Node' )
144     Switch.Coords( 198 , 115 )
145     ISwitcha = Switch.InPort( 'a' , 'long' )
146     ISwitchGate = Switch.GetInPort( 'Gate' )
147     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
148     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
149     OSwitcha = Switch.OutPort( 'a' , 'int' )
150     OSwitchDefault = Switch.GetOutPort( 'Default' )
151     ISwitchistream = Switch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
152     ISwitchistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
153     OSwitchostream = Switch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
154     OSwitchostream.SetNumberOfValues( 0 )
155     
156     # Creation of Links
157     LIsOddaEndSwitcha = GraphStreamInLines.Link( OIsOdda , IEndSwitcha )
158     
159     LIsOddostreamInitLoopistream = GraphStreamInLines.StreamLink( OIsOddostream , IInitLoopistream )
160     LIsOddostreamInitLoopistream.AddCoord( 1 , 3 , 240 )
161     LIsOddostreamInitLoopistream.AddCoord( 2 , 3 , 395 )
162     LIsOddostreamInitLoopistream.AddCoord( 3 , 571 , 394 )
163     LIsOddostreamInitLoopistream.AddCoord( 4 , 577 , 122 )
164     
165     LInitLoopIndexSwitcha = GraphStreamInLines.Link( OInitLoopIndex , ISwitcha )
166     
167     LInitLoopMinEndOfInitLoopMin = GraphStreamInLines.Link( OInitLoopMin , IEndOfInitLoopMin )
168     
169     LInitLoopMaxEndOfInitLoopMax = GraphStreamInLines.Link( OInitLoopMax , IEndOfInitLoopMax )
170     
171     LInitLoopostreamEndSwitchistream = GraphStreamInLines.StreamLink( OInitLoopostream , IEndSwitchistream )
172     LInitLoopostreamEndSwitchistream.AddCoord( 1 , 586 , 158 )
173     LInitLoopostreamEndSwitchistream.AddCoord( 2 , 586 , 362 )
174     LInitLoopostreamEndSwitchistream.AddCoord( 3 , 591 , 362 )
175     LInitLoopostreamEndSwitchistream.AddCoord( 4 , 591 , 359 )
176     LInitLoopostreamEndSwitchistream.AddCoord( 5 , 180 , 359 )
177     LInitLoopostreamEndSwitchistream.AddCoord( 6 , 180 , 212 )
178     LInitLoopostreamEndSwitchistream.AddCoord( 7 , 181 , 212 )
179     LInitLoopostreamEndSwitchistream.AddCoord( 8 , 181 , 214 )
180     LInitLoopostreamEndSwitchistream.AddCoord( 9 , 584 , 167 )
181     LInitLoopostreamEndSwitchistream.AddCoord( 10 , 584 , 369 )
182     LInitLoopostreamEndSwitchistream.AddCoord( 11 , 184 , 368 )
183     LInitLoopostreamEndSwitchistream.AddCoord( 12 , 185 , 240 )
184     
185     LSwitchOddIsOddGate = GraphStreamInLines.Link( OSwitchOdd , IIsOddGate )
186     
187     LSwitchEvenIsOddEven = GraphStreamInLines.Link( OSwitchEven , IIsOddEven )
188     
189     LSwitchaIsOdda = GraphStreamInLines.Link( OSwitcha , IIsOdda )
190     
191     LSwitchostreamIsOddistream = GraphStreamInLines.StreamLink( OSwitchostream , IIsOddistream )
192     
193     LSwitchostreamEndOfInitLoopistream = GraphStreamInLines.StreamLink( OSwitchostream , IEndOfInitLoopistream )
194     LSwitchostreamEndOfInitLoopistream.AddCoord( 1 , 779 , 203 )
195     LSwitchostreamEndOfInitLoopistream.AddCoord( 2 , 775 , 261 )
196     LSwitchostreamEndOfInitLoopistream.AddCoord( 3 , 397 , 260 )
197     LSwitchostreamEndOfInitLoopistream.AddCoord( 4 , 403 , 217 )
198     
199     LSwitchDefaultEndSwitchDefault = GraphStreamInLines.Link( OSwitchDefault , IEndSwitchDefault )
200     
201     LEndSwitchaEndOfInitLoopIndex = GraphStreamInLines.Link( OEndSwitcha , IEndOfInitLoopIndex )
202     
203     LEndSwitchostreamSwitchistream = GraphStreamInLines.StreamLink( OEndSwitchostream , ISwitchistream )
204     LEndSwitchostreamSwitchistream.AddCoord( 1 , 186 , 240 )
205     LEndSwitchostreamSwitchistream.AddCoord( 2 , 186 , 331 )
206     LEndSwitchostreamSwitchistream.AddCoord( 3 , 790 , 329 )
207     LEndSwitchostreamSwitchistream.AddCoord( 4 , 786 , 161 )
208     
209     # Input datas
210     IInitLoopIndex.Input( 0 )
211     IInitLoopMin.Input( 0 )
212     IInitLoopMax.Input( 35 )
213     
214     # Output Ports of the graph
215     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
216     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
217     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
218     return GraphStreamInLines
219
220
221 GraphStreamInLines = DefGraphStreamInLines()