# Generated python file of Graph GraphSwitch1
from SuperV import *
-# Graph creation
-GraphSwitch1 = Graph( 'GraphSwitch1' )
-GraphSwitch1.SetName( 'GraphSwitch1' )
-GraphSwitch1.SetAuthor( '' )
-GraphSwitch1.SetComment( '' )
-GraphSwitch1.Coords( 0 , 0 )
-# Creation of Factory Nodes
-
-# Creation of InLine Nodes
-PyIsOdd = []
-PyIsOdd.append( 'from time import * ' )
-PyIsOdd.append( 'def IsOdd(a) : ' )
-PyIsOdd.append( ' print a,"IsOdd (GraphSwitch1)" ' )
-PyIsOdd.append( ' sleep( 1 ) ' )
-PyIsOdd.append( ' return a ' )
-IsOdd = GraphSwitch1.INode( 'IsOdd' , PyIsOdd )
-IsOdd.SetName( 'IsOdd' )
-IsOdd.SetAuthor( '' )
-IsOdd.SetComment( 'Python function' )
-IsOdd.Coords( 388 , 50 )
-IsOdd.InPort( 'a' , 'long' )
-IsOdd.OutPort( 'a' , 'long' )
-
-# Creation of Loop Nodes
-PyInitLoop = []
-PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
-PyInitLoop.append( ' return Index,Min,Max ' )
-PyMoreInitLoop = []
-PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) : ' )
-PyMoreInitLoop.append( ' if Index <= Max : ' )
-PyMoreInitLoop.append( ' DoLoop = 1 ' )
-PyMoreInitLoop.append( ' else : ' )
-PyMoreInitLoop.append( ' DoLoop = 0 ' )
-PyMoreInitLoop.append( ' return DoLoop,Index,Min,Max ' )
-PyNextInitLoop = []
-PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) : ' )
-PyNextInitLoop.append( ' Index = Index + 1 ' )
-PyNextInitLoop.append( ' return Index,Min,Max ' )
-InitLoop,EndOfInitLoop = GraphSwitch1.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
-EndOfInitLoop.SetName( 'EndOfInitLoop' )
-EndOfInitLoop.SetAuthor( '' )
-EndOfInitLoop.SetComment( '' )
-EndOfInitLoop.Coords( 766 , 127 )
-InitLoop.SetName( 'InitLoop' )
-InitLoop.SetAuthor( '' )
-InitLoop.SetComment( '' )
-InitLoop.Coords( 10 , 129 )
-InitLoop.InPort( 'Index' , 'long' )
-InitLoop.InPort( 'Min' , 'long' )
-InitLoop.InPort( 'Max' , 'long' )
-InitLoop.OutPort( 'Index' , 'long' )
-InitLoop.OutPort( 'Min' , 'long' )
-InitLoop.OutPort( 'Max' , 'long' )
-
-# Creation of Switch Nodes
-PySwitch = []
-PySwitch.append( 'from time import * ' )
-PySwitch.append( 'def Switch(a) : ' )
-PySwitch.append( ' if ( a & 1 ) == 0 : ' )
-PySwitch.append( ' sleep(1) ' )
-PySwitch.append( ' return a & 1,1-(a&1),a ' )
-Switch,EndOfSwitch = GraphSwitch1.SNode( 'Switch' , PySwitch )
-EndOfSwitch.SetName( 'EndOfSwitch' )
-EndOfSwitch.SetAuthor( '' )
-EndOfSwitch.SetComment( '' )
-EndOfSwitch.Coords( 587 , 126 )
-PyEndOfSwitch = []
-EndOfSwitch.SetPyFunction( 'EndSwitch' , PyEndOfSwitch )
-EndOfSwitch.InPort( 'a' , 'long' )
-EndOfSwitch.OutPort( 'a' , 'long' )
-Switch.SetName( 'Switch' )
-Switch.SetAuthor( '' )
-Switch.SetComment( '' )
-Switch.Coords( 186 , 130 )
-Switch.InPort( 'a' , 'long' )
-Switch.OutPort( 'Odd' , 'long' )
-Switch.OutPort( 'Even' , 'int' )
-Switch.OutPort( 'a' , 'int' )
-
-# Creation of Links
-IsOdda = IsOdd.Port( 'a' )
-EndOfSwitcha = GraphSwitch1.Link( IsOdda , EndOfSwitch.Port( 'a' ) )
-EndOfSwitcha.AddCoord( 1 , 571 , 161 )
-EndOfSwitcha.AddCoord( 2 , 571 , 131 )
-
-InitLoopIndex = InitLoop.Port( 'Index' )
-Switcha = GraphSwitch1.Link( InitLoopIndex , Switch.Port( 'a' ) )
-
-InitLoopMin = InitLoop.Port( 'Min' )
-EndOfInitLoopMin = GraphSwitch1.Link( InitLoopMin , EndOfInitLoop.Port( 'Min' ) )
-
-InitLoopMax = InitLoop.Port( 'Max' )
-EndOfInitLoopMax = GraphSwitch1.Link( InitLoopMax , EndOfInitLoop.Port( 'Max' ) )
-
-SwitchOdd = Switch.Port( 'Odd' )
-IsOddInGate = GraphSwitch1.Link( SwitchOdd , IsOdd.Port( 'InGate' ) )
-
-SwitchEven = Switch.Port( 'Even' )
-EndOfSwitchDefault = GraphSwitch1.Link( SwitchEven , EndOfSwitch.Port( 'Default' ) )
-
-Switcha = Switch.Port( 'a' )
-IsOdda = GraphSwitch1.Link( Switcha , IsOdd.Port( 'a' ) )
-IsOdda.AddCoord( 1 , 372 , 129 )
-IsOdda.AddCoord( 2 , 371 , 223 )
-
-EndOfSwitcha = GraphSwitch1.Link( Switcha , EndOfSwitch.Port( 'a' ) )
-EndOfSwitcha.AddCoord( 1 , 571 , 161 )
-EndOfSwitcha.AddCoord( 2 , 570 , 221 )
-
-EndOfSwitcha = EndOfSwitch.Port( 'a' )
-EndOfInitLoopIndex = GraphSwitch1.Link( EndOfSwitcha , EndOfInitLoop.Port( 'Index' ) )
-
-# Creation of Input datas
-InitLoopIndex = InitLoop.Input( 'Index' , 0)
-InitLoopMin = InitLoop.Input( 'Min' , 0)
-InitLoopMax = InitLoop.Input( 'Max' , 100)
-
-# Creation of Output variables
-EndOfInitLoopIndex = EndOfInitLoop.Port( 'Index' )
-EndOfInitLoopMin = EndOfInitLoop.Port( 'Min' )
-EndOfInitLoopMax = EndOfInitLoop.Port( 'Max' )
-
-GraphSwitch1.Run()
-GraphSwitch1.DoneW()
-GraphSwitch1.State()
-GraphSwitch1.PrintPorts()
+# Graph creation of GraphSwitch1
+def DefGraphSwitch1() :
+ GraphSwitch1 = Graph( 'GraphSwitch1' )
+ GraphSwitch1.SetName( 'GraphSwitch1' )
+ GraphSwitch1.SetAuthor( '' )
+ GraphSwitch1.SetComment( '' )
+ GraphSwitch1.Coords( 0 , 0 )
+
+ # Creation of Factory Nodes
+
+ # Creation of InLine Nodes
+ PyIsOdd = []
+ PyIsOdd.append( 'from time import * ' )
+ PyIsOdd.append( 'def IsOdd(a) : ' )
+ PyIsOdd.append( ' print a,"IsOdd (GraphSwitch1)" ' )
+ PyIsOdd.append( ' sleep( 1 ) ' )
+ PyIsOdd.append( ' return a ' )
+ IsOdd = GraphSwitch1.INode( 'IsOdd' , PyIsOdd )
+ IsOdd.SetName( 'IsOdd' )
+ IsOdd.SetAuthor( '' )
+ IsOdd.SetComment( 'Python function' )
+ IsOdd.Coords( 389 , 65 )
+ IIsOdda = IsOdd.InPort( 'a' , 'long' )
+ IIsOddGate = IsOdd.GetInPort( 'Gate' )
+ OIsOdda = IsOdd.OutPort( 'a' , 'long' )
+ OIsOddGate = IsOdd.GetOutPort( 'Gate' )
+
+ # Creation of Loop Nodes
+ PyInitLoop = []
+ PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
+ PyInitLoop.append( ' return Index,Min,Max ' )
+ PyMoreInitLoop = []
+ PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) : ' )
+ PyMoreInitLoop.append( ' if Index <= Max : ' )
+ PyMoreInitLoop.append( ' DoLoop = 1 ' )
+ PyMoreInitLoop.append( ' else : ' )
+ PyMoreInitLoop.append( ' DoLoop = 0 ' )
+ PyMoreInitLoop.append( ' return DoLoop,Index,Min,Max ' )
+ PyNextInitLoop = []
+ PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) : ' )
+ PyNextInitLoop.append( ' Index = Index + 1 ' )
+ PyNextInitLoop.append( ' return Index,Min,Max ' )
+ InitLoop,EndOfInitLoop = GraphSwitch1.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
+ EndOfInitLoop.SetName( 'EndOfInitLoop' )
+ EndOfInitLoop.SetAuthor( '' )
+ EndOfInitLoop.SetComment( 'Compute Node' )
+ EndOfInitLoop.Coords( 768 , 126 )
+ PyEndOfInitLoop = []
+ EndOfInitLoop.SetPyFunction( '' , PyEndOfInitLoop )
+ IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
+ IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
+ IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
+ IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
+ IInitLoopGate = InitLoop.GetInPort( 'Gate' )
+ OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
+ OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
+ OInitLoopMin = InitLoop.GetOutPort( 'Min' )
+ OInitLoopMax = InitLoop.GetOutPort( 'Max' )
+ IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
+ IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
+ IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
+ IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
+ IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
+ OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
+ OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
+ OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
+ OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
+ OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
+ InitLoop.SetName( 'InitLoop' )
+ InitLoop.SetAuthor( '' )
+ InitLoop.SetComment( 'Compute Node' )
+ InitLoop.Coords( 10 , 129 )
+
+ # Creation of Switch Nodes
+ PySwitch = []
+ PySwitch.append( 'from time import * ' )
+ PySwitch.append( 'def Switch(a) : ' )
+ PySwitch.append( ' if ( a & 1 ) == 0 : ' )
+ PySwitch.append( ' sleep(1) ' )
+ PySwitch.append( ' return a & 1,1-(a&1),a ' )
+ Switch,EndOfSwitch = GraphSwitch1.SNode( 'Switch' , PySwitch )
+ EndOfSwitch.SetName( 'EndOfSwitch' )
+ EndOfSwitch.SetAuthor( '' )
+ EndOfSwitch.SetComment( 'Compute Node' )
+ EndOfSwitch.Coords( 587 , 126 )
+ PyEndOfSwitch = []
+ EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
+ IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
+ IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
+ OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
+ OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
+ Switch.SetName( 'Switch' )
+ Switch.SetAuthor( '' )
+ Switch.SetComment( 'Compute Node' )
+ Switch.Coords( 195 , 130 )
+ ISwitcha = Switch.InPort( 'a' , 'long' )
+ ISwitchGate = Switch.GetInPort( 'Gate' )
+ OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
+ OSwitchEven = Switch.OutPort( 'Even' , 'int' )
+ OSwitcha = Switch.OutPort( 'a' , 'int' )
+ OSwitchDefault = Switch.GetOutPort( 'Default' )
+
+ # Creation of Links
+ LIsOddaEndOfSwitcha = GraphSwitch1.Link( OIsOdda , IEndOfSwitcha )
+ LIsOddaEndOfSwitcha.AddCoord( 1 , 571 , 158 )
+ LIsOddaEndOfSwitcha.AddCoord( 2 , 571 , 136 )
+
+ LInitLoopIndexSwitcha = GraphSwitch1.Link( OInitLoopIndex , ISwitcha )
+
+ LInitLoopMinEndOfInitLoopMin = GraphSwitch1.Link( OInitLoopMin , IEndOfInitLoopMin )
+
+ LInitLoopMaxEndOfInitLoopMax = GraphSwitch1.Link( OInitLoopMax , IEndOfInitLoopMax )
+
+ LSwitchOddIsOddGate = GraphSwitch1.Link( OSwitchOdd , IIsOddGate )
+
+ LSwitchEvenEndOfSwitchDefault = GraphSwitch1.Link( OSwitchEven , IEndOfSwitchDefault )
+
+ LSwitchaIsOdda = GraphSwitch1.Link( OSwitcha , IIsOdda )
+ LSwitchaIsOdda.AddCoord( 1 , 375 , 136 )
+ LSwitchaIsOdda.AddCoord( 2 , 375 , 201 )
+
+ LSwitchaEndOfSwitcha = GraphSwitch1.Link( OSwitcha , IEndOfSwitcha )
+ LSwitchaEndOfSwitcha.AddCoord( 1 , 571 , 161 )
+ LSwitchaEndOfSwitcha.AddCoord( 2 , 570 , 221 )
+
+ LEndOfSwitchaEndOfInitLoopIndex = GraphSwitch1.Link( OEndOfSwitcha , IEndOfInitLoopIndex )
+
+ # Input datas
+ 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' )
+ return GraphSwitch1
+
+
+GraphSwitch1 = DefGraphSwitch1()