2 # Generated python file of Graph GraphStreamInLines
6 GraphStreamInLines = StreamGraph( 'GraphStreamInLines' )
7 GraphStreamInLines.SetName( 'GraphStreamInLines' )
8 GraphStreamInLines.SetAuthor( '' )
9 GraphStreamInLines.SetComment( '' )
10 GraphStreamInLines.Coords( 0 , 0 )
12 # Creation of Factory Nodes
14 # Creation of InLine Nodes
16 PyIsOdd.append( 'from time import * ' )
17 PyIsOdd.append( 'def IsOdd(a,Even) : ' )
18 PyIsOdd.append( ' print a,"IsOdd (GraphStreamInLines1)" ' )
19 PyIsOdd.append( ' sleep( 1 ) ' )
20 PyIsOdd.append( ' return a ' )
21 IsOdd = GraphStreamInLines.INode( 'IsOdd' , PyIsOdd )
22 IsOdd.SetName( 'IsOdd' )
24 IsOdd.SetComment( 'Python function' )
25 IsOdd.Coords( 394 , 59 )
26 IIsOdda = IsOdd.InPort( 'a' , 'long' )
27 IIsOddistream = IsOdd.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
28 IIsOddEven = IsOdd.InPort( 'Even' , 'boolean' )
29 IIsOddInGate = IsOdd.GetInPort( 'InGate' )
30 OIsOddostream = IsOdd.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
31 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
32 OIsOddOutGate = IsOdd.GetOutPort( 'OutGate' )
35 # Creation of Loop Nodes
38 PyMoreInitLoop.append( '' )
40 PyNextInitLoop.append( '' )
41 InitLoop,EndOfInitLoop = GraphStreamInLines.LNode( '' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
42 EndOfInitLoop.SetName( 'EndOfInitLoop' )
43 EndOfInitLoop.SetAuthor( '' )
44 EndOfInitLoop.SetComment( '' )
45 EndOfInitLoop.Coords( 776 , 105 )
47 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
48 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
49 PyEndOfInitLoop.append( ' if Index <= Max : ' )
50 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
51 PyEndOfInitLoop.append( ' else : ' )
52 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
53 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max ' )
54 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
55 IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
56 OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
57 IInitLoopInitLoop = InitLoop.GetInPort( 'InitLoop' )
58 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
59 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
60 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
61 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
62 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
63 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
64 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
65 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
66 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
67 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
68 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
69 IEndOfInitLoopInGate = EndOfInitLoop.GetInPort( 'InGate' )
70 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
71 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
72 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
73 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
74 InitLoop.SetName( 'InitLoop' )
75 InitLoop.SetAuthor( '' )
76 InitLoop.SetComment( '' )
77 InitLoop.Coords( 11 , 119 )
78 IInitLoopistream = InitLoop.GetInStreamPort( 'istream' )
79 OInitLoopostream = InitLoop.GetOutStreamPort( 'ostream' )
81 EndOfInitLoop.PrintPorts()
82 IEndOfInitLoopistream = EndOfInitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
83 OEndOfInitLoopostream = EndOfInitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
84 EndOfInitLoop.PrintPorts()
86 # Creation of Switch Nodes
88 PySwitch.append( 'from time import * ' )
89 PySwitch.append( 'def Switch(a) : ' )
90 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
91 PySwitch.append( ' sleep(1) ' )
92 PySwitch.append( ' return a & 1,1-(a&1),a ' )
93 Switch,EndSwitch = GraphStreamInLines.SNode( 'Switch' , PySwitch )
94 EndSwitch.SetName( 'EndSwitch' )
95 EndSwitch.SetAuthor( '' )
96 EndSwitch.SetComment( '' )
97 EndSwitch.Coords( 587 , 104 )
99 PyEndSwitch.append( 'def EndOfSwitch(a) : ' )
100 PyEndSwitch.append( ' if ( a & 1 ) == 0 : ' )
101 PyEndSwitch.append( ' sleep(1) ' )
102 PyEndSwitch.append( ' return a ' )
103 EndSwitch.SetPyFunction( 'EndOfSwitch' , PyEndSwitch )
104 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
105 IEndSwitchistream = EndSwitch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
106 IEndSwitchDefault = EndSwitch.InPort( 'Default' , 'long' )
107 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
108 OEndSwitchostream = EndSwitch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
109 OEndSwitchOutGate = EndSwitch.OutPort( 'OutGate' , 'long' )
110 Switch.SetName( 'Switch' )
111 Switch.SetAuthor( '' )
112 Switch.SetComment( '' )
113 Switch.Coords( 197 , 119 )
114 ISwitcha = Switch.InPort( 'a' , 'long' )
115 ISwitchInGate = Switch.InPort( 'InGate' , 'long' )
116 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
117 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
118 OSwitcha = Switch.OutPort( 'a' , 'int' )
119 OSwitchDefault = Switch.OutPort( 'Default' , 'long' )
120 ISwitchistream = Switch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
121 OSwitchostream = Switch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
123 EndSwitch.PrintPorts()
126 LEndSwitcha = GraphStreamInLines.Link( OIsOdda , IEndSwitcha )
128 LInitLoopistream = GraphStreamInLines.StreamLink( OIsOddostream , IInitLoopistream )
129 LInitLoopistream.AddCoord( 1 , 3 , 240 )
130 LInitLoopistream.AddCoord( 2 , 3 , 395 )
131 LInitLoopistream.AddCoord( 3 , 571 , 394 )
132 LInitLoopistream.AddCoord( 4 , 570 , 168 )
134 LSwitcha = GraphStreamInLines.Link( OInitLoopIndex , ISwitcha )
136 LEndOfInitLoopMin = GraphStreamInLines.Link( OInitLoopMin , IEndOfInitLoopMin )
138 LEndOfInitLoopMax = GraphStreamInLines.Link( OInitLoopMax , IEndOfInitLoopMax )
140 LEndSwitchistream = GraphStreamInLines.StreamLink( OInitLoopostream , IEndSwitchistream )
141 LEndSwitchistream.AddCoord( 1 , 584 , 167 )
142 LEndSwitchistream.AddCoord( 2 , 584 , 369 )
143 LEndSwitchistream.AddCoord( 3 , 184 , 368 )
144 LEndSwitchistream.AddCoord( 4 , 185 , 240 )
146 LIsOddInGate = GraphStreamInLines.Link( OSwitchOdd , IIsOddInGate )
147 LIsOddInGate.AddCoord( 1 , 372 , 231 )
148 LIsOddInGate.AddCoord( 2 , 373 , 154 )
150 LEndSwitchDefault = GraphStreamInLines.Link( OSwitchEven , IEndSwitchDefault )
152 LIsOddEven = GraphStreamInLines.Link( OSwitchEven , IIsOddEven )
153 LIsOddEven.AddCoord( 1 , 363 , 169 )
154 LIsOddEven.AddCoord( 2 , 362 , 181 )
156 LIsOdda = GraphStreamInLines.Link( OSwitcha , IIsOdda )
157 LIsOdda.AddCoord( 1 , 385 , 141 )
158 LIsOdda.AddCoord( 2 , 386 , 212 )
160 LIsOddistream = GraphStreamInLines.StreamLink( OSwitchostream , IIsOddistream )
161 LIsOddistream.AddCoord( 1 , 362 , 198 )
162 LIsOddistream.AddCoord( 2 , 361 , 240 )
164 LEndOfInitLoopistream = GraphStreamInLines.StreamLink( OSwitchostream , IEndOfInitLoopistream )
165 LEndOfInitLoopistream.AddCoord( 1 , 775 , 226 )
166 LEndOfInitLoopistream.AddCoord( 2 , 775 , 261 )
167 LEndOfInitLoopistream.AddCoord( 3 , 361 , 261 )
168 LEndOfInitLoopistream.AddCoord( 4 , 361 , 240 )
170 LEndOfInitLoopIndex = GraphStreamInLines.Link( OEndSwitcha , IEndOfInitLoopIndex )
172 LSwitchistream = GraphStreamInLines.StreamLink( OEndSwitchostream , ISwitchistream )
173 LSwitchistream.AddCoord( 1 , 187 , 181 )
174 LSwitchistream.AddCoord( 2 , 186 , 331 )
175 LSwitchistream.AddCoord( 3 , 766 , 330 )
176 LSwitchistream.AddCoord( 4 , 766 , 167 )
179 IInitLoopIndex = InitLoop.Input( 'Index' , 0)
180 IInitLoopMin = InitLoop.Input( 'Min' , 0)
181 IInitLoopMax = InitLoop.Input( 'Max' , 100)
183 # Output Ports of the graph
184 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
185 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
186 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
187 OEndOfInitLoopostream = EndOfInitLoop.GetOutStreamPort( 'ostream' )
189 GraphStreamInLines.Run()
190 GraphStreamInLines.DoneW()
191 GraphStreamInLines.State()
193 GraphStreamInLines.PrintPorts()
196 subgraphs = GraphStreamInLines.SubGraphsNumber()
198 while i <= subgraphs :
199 nodes = GraphStreamInLines.SubGraphsNodes( i )
201 while j < len(nodes) :
202 print 'SubGraph',i,nodes[j].Name()
207 substreamgraphs = GraphStreamInLines.SubStreamGraphsNumber()
209 while i <= substreamgraphs :
210 nodes = GraphStreamInLines.SubStreamGraphsNodes( i )
212 while j < len(nodes) :
213 print 'SubStreamGraph',i,nodes[j].Name()
217 GraphStreamInLines.Export('/tmp/GraphStreamInLines.xml')
220 GraphStreamInLines = StreamGraph('/tmp/GraphStreamInLines.xml')
223 GraphStreamInLines.Run()
224 GraphStreamInLines.DoneW()
225 GraphStreamInLines.State()
227 subgraphs = GraphStreamInLines.SubGraphsNumber()
229 while i <= subgraphs :
230 nodes = GraphStreamInLines.SubGraphsNodes( i )
232 while j < len(nodes) :
233 print 'SubGraph',i,nodes[j].Name()
238 substreamgraphs = GraphStreamInLines.SubStreamGraphsNumber()
240 while i <= substreamgraphs :
241 nodes = GraphStreamInLines.SubStreamGraphsNodes( i )
243 while j < len(nodes) :
244 print 'SubStreamGraph',i,nodes[j].Name()