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