]> SALOME platform Git repositories - modules/superv.git/blobdiff - examples/GraphStreamInLines.py
Salome HOME
For better "look" of streamlinks in the GUI
[modules/superv.git] / examples / GraphStreamInLines.py
index afd56e7e69e471d4a337e858823d60d8be9a8670..b46483a8e4ebf08a213167eeee800e3c47dc612b 100644 (file)
@@ -4,6 +4,7 @@
 from SuperV import *
 # Graph creation 
 GraphStreamInLines = StreamGraph( 'GraphStreamInLines' )
+GraphStreamInLines.SetStreamParams( 300 , SUPERV.WithoutTrace , 0 )
 GraphStreamInLines.SetName( 'GraphStreamInLines' )
 GraphStreamInLines.SetAuthor( '' )
 GraphStreamInLines.SetComment( '' )
@@ -24,13 +25,14 @@ IsOdd.SetAuthor( '' )
 IsOdd.SetComment( 'Python function' )
 IsOdd.Coords( 394 , 59 )
 IIsOdda = IsOdd.InPort( 'a' , 'long' )
-IIsOddistream = IsOdd.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
 IIsOddEven = IsOdd.InPort( 'Even' , 'boolean' )
-IIsOddInGate = IsOdd.GetInPort( 'InGate' )
-OIsOddostream = IsOdd.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
+IIsOddGate = IsOdd.GetInPort( 'Gate' )
 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
-OIsOddOutGate = IsOdd.GetOutPort( 'OutGate' )
-IsOdd.PrintPorts()
+OIsOddGate = IsOdd.GetOutPort( 'Gate' )
+IIsOddistream = IsOdd.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
+IIsOddistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
+OIsOddostream = IsOdd.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
+OIsOddostream.SetNumberOfValues( 0 )
 
 # Creation of Loop Nodes
 PyInitLoop = []
@@ -52,36 +54,40 @@ PyEndOfInitLoop.append( '   else :     ' )
 PyEndOfInitLoop.append( '              DoLoop = 0     ' )
 PyEndOfInitLoop.append( '      return DoLoop,Index,Min,Max     ' )
 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
-IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
-OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
 IInitLoopInitLoop = InitLoop.GetInPort( 'InitLoop' )
 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
+IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
+IInitLoopistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
+IInitLoopGate = InitLoop.GetInPort( 'Gate' )
 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
+OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
+OInitLoopostream.SetNumberOfValues( 0 )
 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
-IEndOfInitLoopInGate = EndOfInitLoop.GetInPort( 'InGate' )
+IEndOfInitLoopistream = EndOfInitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
+IEndOfInitLoopistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
+IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
+OEndOfInitLoopostream = EndOfInitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
+OEndOfInitLoopostream.SetNumberOfValues( 0 )
 InitLoop.SetName( 'InitLoop' )
 InitLoop.SetAuthor( '' )
 InitLoop.SetComment( '' )
 InitLoop.Coords( 11 , 119 )
-IInitLoopistream = InitLoop.GetInStreamPort( 'istream' )
-OInitLoopostream = InitLoop.GetOutStreamPort( 'ostream' )
-InitLoop.PrintPorts()
-EndOfInitLoop.PrintPorts()
-IEndOfInitLoopistream = EndOfInitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
-OEndOfInitLoopostream = EndOfInitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
-EndOfInitLoop.PrintPorts()
+IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
+IInitLoopistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
+OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
+OInitLoopostream.SetNumberOfValues( 0 )
 
 # Creation of Switch Nodes
 PySwitch = []
@@ -103,92 +109,95 @@ PyEndSwitch.append( '    return a    ' )
 EndSwitch.SetPyFunction( 'EndOfSwitch' , PyEndSwitch )
 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
 IEndSwitchistream = EndSwitch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
-IEndSwitchDefault = EndSwitch.InPort( 'Default' , 'long' )
+IEndSwitchistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
+IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
 OEndSwitchostream = EndSwitch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
-OEndSwitchOutGate = EndSwitch.OutPort( 'OutGate' , 'long' )
+OEndSwitchostream.SetNumberOfValues( 0 )
+OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
 Switch.SetName( 'Switch' )
 Switch.SetAuthor( '' )
 Switch.SetComment( '' )
 Switch.Coords( 197 , 119 )
 ISwitcha = Switch.InPort( 'a' , 'long' )
-ISwitchInGate = Switch.InPort( 'InGate' , 'long' )
+ISwitchGate = Switch.GetInPort( 'Gate' )
 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
 OSwitcha = Switch.OutPort( 'a' , 'int' )
-OSwitchDefault = Switch.OutPort( 'Default' , 'long' )
+OSwitchDefault = Switch.GetOutPort( 'Default' )
 ISwitchistream = Switch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
+ISwitchistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
 OSwitchostream = Switch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
-Switch.PrintPorts()
-EndSwitch.PrintPorts()
+OSwitchostream.SetNumberOfValues( 0 )
 
 # Creation of Links
-LEndSwitcha = GraphStreamInLines.Link( OIsOdda , IEndSwitcha )
+LIsOddaEndSwitcha = GraphStreamInLines.Link( OIsOdda , IEndSwitcha )
 
-LInitLoopistream = GraphStreamInLines.StreamLink( OIsOddostream , IInitLoopistream )
-LInitLoopistream.AddCoord( 1 , 3 , 240 )
-LInitLoopistream.AddCoord( 2 , 3 , 395 )
-LInitLoopistream.AddCoord( 3 , 571 , 394 )
-LInitLoopistream.AddCoord( 4 , 570 , 168 )
+LIsOddostreamInitLoopistream = GraphStreamInLines.StreamLink( OIsOddostream , IInitLoopistream )
+LIsOddostreamInitLoopistream.AddCoord( 1 , 3 , 240 )
+LIsOddostreamInitLoopistream.AddCoord( 2 , 3 , 395 )
+LIsOddostreamInitLoopistream.AddCoord( 3 , 571 , 394 )
+LIsOddostreamInitLoopistream.AddCoord( 4 , 571 , 187 )
 
-LSwitcha = GraphStreamInLines.Link( OInitLoopIndex , ISwitcha )
+LInitLoopIndexSwitcha = GraphStreamInLines.Link( OInitLoopIndex , ISwitcha )
 
-LEndOfInitLoopMin = GraphStreamInLines.Link( OInitLoopMin , IEndOfInitLoopMin )
+LInitLoopMinEndOfInitLoopMin = GraphStreamInLines.Link( OInitLoopMin , IEndOfInitLoopMin )
 
-LEndOfInitLoopMax = GraphStreamInLines.Link( OInitLoopMax , IEndOfInitLoopMax )
+LInitLoopMaxEndOfInitLoopMax = GraphStreamInLines.Link( OInitLoopMax , IEndOfInitLoopMax )
 
-LEndSwitchistream = GraphStreamInLines.StreamLink( OInitLoopostream , IEndSwitchistream )
-LEndSwitchistream.AddCoord( 1 , 584 , 167 )
-LEndSwitchistream.AddCoord( 2 , 584 , 369 )
-LEndSwitchistream.AddCoord( 3 , 184 , 368 )
-LEndSwitchistream.AddCoord( 4 , 185 , 240 )
+LInitLoopostreamEndSwitchistream = GraphStreamInLines.StreamLink( OInitLoopostream , IEndSwitchistream )
+LInitLoopostreamEndSwitchistream.AddCoord( 1 , 584 , 167 )
+LInitLoopostreamEndSwitchistream.AddCoord( 2 , 584 , 369 )
+LInitLoopostreamEndSwitchistream.AddCoord( 3 , 184 , 368 )
+LInitLoopostreamEndSwitchistream.AddCoord( 4 , 185 , 240 )
 
-LIsOddInGate = GraphStreamInLines.Link( OSwitchOdd , IIsOddInGate )
-LIsOddInGate.AddCoord( 1 , 372 , 231 )
-LIsOddInGate.AddCoord( 2 , 373 , 154 )
+LSwitchOddIsOddGate = GraphStreamInLines.Link( OSwitchOdd , IIsOddGate )
+LSwitchOddIsOddGate.AddCoord( 1 , 373 , 222 )
+LSwitchOddIsOddGate.AddCoord( 2 , 373 , 147 )
 
-LEndSwitchDefault = GraphStreamInLines.Link( OSwitchEven , IEndSwitchDefault )
+LSwitchEvenEndSwitchDefault = GraphStreamInLines.Link( OSwitchEven , IEndSwitchDefault )
 
-LIsOddEven = GraphStreamInLines.Link( OSwitchEven , IIsOddEven )
-LIsOddEven.AddCoord( 1 , 363 , 169 )
-LIsOddEven.AddCoord( 2 , 362 , 181 )
+LSwitchEvenIsOddEven = GraphStreamInLines.Link( OSwitchEven , IIsOddEven )
+LSwitchEvenIsOddEven.AddCoord( 1 , 363 , 154 )
+LSwitchEvenIsOddEven.AddCoord( 2 , 362 , 177 )
 
-LIsOdda = GraphStreamInLines.Link( OSwitcha , IIsOdda )
-LIsOdda.AddCoord( 1 , 385 , 141 )
-LIsOdda.AddCoord( 2 , 386 , 212 )
+LSwitchaIsOdda = GraphStreamInLines.Link( OSwitcha , IIsOdda )
+LSwitchaIsOdda.AddCoord( 1 , 385 , 123 )
+LSwitchaIsOdda.AddCoord( 2 , 386 , 206 )
 
-LIsOddistream = GraphStreamInLines.StreamLink( OSwitchostream , IIsOddistream )
-LIsOddistream.AddCoord( 1 , 362 , 198 )
-LIsOddistream.AddCoord( 2 , 361 , 240 )
+LSwitchostreamIsOddistream = GraphStreamInLines.StreamLink( OSwitchostream , IIsOddistream )
+LSwitchostreamIsOddistream.AddCoord( 1 , 360 , 185 )
+LSwitchostreamIsOddistream.AddCoord( 2 , 361 , 240 )
 
-LEndOfInitLoopistream = GraphStreamInLines.StreamLink( OSwitchostream , IEndOfInitLoopistream )
-LEndOfInitLoopistream.AddCoord( 1 , 775 , 226 )
-LEndOfInitLoopistream.AddCoord( 2 , 775 , 261 )
-LEndOfInitLoopistream.AddCoord( 3 , 361 , 261 )
-LEndOfInitLoopistream.AddCoord( 4 , 361 , 240 )
+LSwitchostreamEndOfInitLoopistream = GraphStreamInLines.StreamLink( OSwitchostream , IEndOfInitLoopistream )
+LSwitchostreamEndOfInitLoopistream.AddCoord( 1 , 775 , 226 )
+LSwitchostreamEndOfInitLoopistream.AddCoord( 2 , 775 , 261 )
+LSwitchostreamEndOfInitLoopistream.AddCoord( 3 , 361 , 261 )
+LSwitchostreamEndOfInitLoopistream.AddCoord( 4 , 361 , 240 )
 
-LEndOfInitLoopIndex = GraphStreamInLines.Link( OEndSwitcha , IEndOfInitLoopIndex )
+LEndSwitchaEndOfInitLoopIndex = GraphStreamInLines.Link( OEndSwitcha , IEndOfInitLoopIndex )
 
-LSwitchistream = GraphStreamInLines.StreamLink( OEndSwitchostream , ISwitchistream )
-LSwitchistream.AddCoord( 1 , 187 , 181 )
-LSwitchistream.AddCoord( 2 , 186 , 331 )
-LSwitchistream.AddCoord( 3 , 766 , 330 )
-LSwitchistream.AddCoord( 4 , 766 , 167 )
+LEndSwitchostreamSwitchistream = GraphStreamInLines.StreamLink( OEndSwitchostream , ISwitchistream )
+LEndSwitchostreamSwitchistream.AddCoord( 1 , 186 , 240 )
+LEndSwitchostreamSwitchistream.AddCoord( 2 , 186 , 331 )
+LEndSwitchostreamSwitchistream.AddCoord( 3 , 766 , 330 )
+LEndSwitchostreamSwitchistream.AddCoord( 4 , 766 , 167 )
 
 # Input datas
-IInitLoopIndex = InitLoop.Input( 'Index' , 0)
-IInitLoopMin = InitLoop.Input( 'Min' , 0)
-IInitLoopMax = InitLoop.Input( 'Max' , 100)
+IInitLoopIndex.Input( 0 )
+IInitLoopMin.Input( 0 )
+IInitLoopMax.Input( 100 )
 
 # Output Ports of the graph
-OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
-OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
-OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
-OEndOfInitLoopostream = EndOfInitLoop.GetOutStreamPort( 'ostream' )
+#OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
+#OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
+#OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
+
+
 
 GraphStreamInLines.Run()
 GraphStreamInLines.DoneW()
-GraphStreamInLines.State()
+print GraphStreamInLines.State()
 
 GraphStreamInLines.PrintPorts()
 
@@ -222,7 +231,7 @@ GraphStreamInLines = StreamGraph('/tmp/GraphStreamInLines.xml')
 
 GraphStreamInLines.Run()
 GraphStreamInLines.DoneW()
-GraphStreamInLines.State()
+print GraphStreamInLines.State()
 
 subgraphs = GraphStreamInLines.SubGraphsNumber()
 i = 1