From: rahuel Date: Wed, 12 Jan 2005 13:51:03 +0000 (+0000) Subject: Loop with negative values X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e8882b7ec999aa902615d6e0038ac57e5722ed34;p=modules%2Fsuperv.git Loop with negative values --- diff --git a/examples/GraphSwitch2.py b/examples/GraphSwitch2.py index 62f3d75..3bdae8d 100644 --- a/examples/GraphSwitch2.py +++ b/examples/GraphSwitch2.py @@ -1,15 +1,15 @@ -# Generated python file of Graph GraphSwitch_1 +# Generated python file of Graph GraphSwitch_1_1 from SuperV import * -# Graph creation of GraphSwitch_1 -def DefGraphSwitch_1() : - GraphSwitch_1 = Graph( 'GraphSwitch_1' ) - GraphSwitch_1.SetName( 'GraphSwitch_1' ) - GraphSwitch_1.SetAuthor( '' ) - GraphSwitch_1.SetComment( '' ) - GraphSwitch_1.Coords( 0 , 0 ) +# Graph creation of GraphSwitch_1_1 +def DefGraphSwitch_1_1() : + GraphSwitch_1_1 = Graph( 'GraphSwitch_1_1' ) + GraphSwitch_1_1.SetName( 'GraphSwitch_1_1' ) + GraphSwitch_1_1.SetAuthor( '' ) + GraphSwitch_1_1.SetComment( '' ) + GraphSwitch_1_1.Coords( 0 , 0 ) # Creation of Factory Nodes @@ -20,7 +20,7 @@ def DefGraphSwitch_1() : PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' ) PyIsOdd.append( ' sleep( 1 ) ' ) PyIsOdd.append( ' return a ' ) - IsOdd = GraphSwitch_1.INode( 'IsOdd' , PyIsOdd ) + IsOdd = GraphSwitch_1_1.INode( 'IsOdd' , PyIsOdd ) IsOdd.SetName( 'IsOdd' ) IsOdd.SetAuthor( '' ) IsOdd.SetComment( 'Python function' ) @@ -36,7 +36,7 @@ def DefGraphSwitch_1() : PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' ) PyIsEven.append( ' sleep( 1 ) ' ) PyIsEven.append( ' return a ' ) - IsEven = GraphSwitch_1.INode( 'IsEven' , PyIsEven ) + IsEven = GraphSwitch_1_1.INode( 'IsEven' , PyIsEven ) IsEven.SetName( 'IsEven' ) IsEven.SetAuthor( '' ) IsEven.SetComment( 'Compute Node' ) @@ -62,7 +62,7 @@ def DefGraphSwitch_1() : PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' ) PyNextInitLoopSwitch.append( ' Index = Index - 1 ' ) PyNextInitLoopSwitch.append( ' return Index,Min,Max ' ) - InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitch_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) + InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitch_1_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch ) EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' ) EndOfInitLoopSwitch.SetAuthor( '' ) EndOfInitLoopSwitch.SetComment( 'Compute Node' ) @@ -95,14 +95,14 @@ def DefGraphSwitch_1() : # Creation of Switch Nodes PySwitch = [] - PySwitch.append( 'from time import * ' ) - PySwitch.append( 'def Switch(a) : ' ) - PySwitch.append( ' if a == 0 : ' ) - PySwitch.append( ' return 0,0,a ' ) - PySwitch.append( ' if ( a & 1 ) == 0 : ' ) - PySwitch.append( ' sleep(1) ' ) - PySwitch.append( ' return a & 1,1-(a&1),a ' ) - Switch,EndOfSwitch = GraphSwitch_1.SNode( 'Switch' , PySwitch ) + PySwitch.append( 'from time import * ' ) + PySwitch.append( 'def Switch(a) : ' ) + PySwitch.append( ' if a <= 0 : ' ) + PySwitch.append( ' return 0,0,a ' ) + PySwitch.append( ' if ( a & 1 ) == 0 : ' ) + PySwitch.append( ' sleep(1) ' ) + PySwitch.append( ' return a & 1,1-(a&1),a ' ) + Switch,EndOfSwitch = GraphSwitch_1_1.SNode( 'Switch' , PySwitch ) EndOfSwitch.SetName( 'EndOfSwitch' ) EndOfSwitch.SetAuthor( '' ) EndOfSwitch.SetComment( 'Compute Node' ) @@ -125,38 +125,38 @@ def DefGraphSwitch_1() : OSwitchDefault = Switch.GetOutPort( 'Default' ) # Creation of Links - LIsOddaEndOfSwitcha = GraphSwitch_1.Link( OIsOdda , IEndOfSwitcha ) + LIsOddaEndOfSwitcha = GraphSwitch_1_1.Link( OIsOdda , IEndOfSwitcha ) - LInitLoopSwitchIndexSwitcha = GraphSwitch_1.Link( OInitLoopSwitchIndex , ISwitcha ) + LInitLoopSwitchIndexSwitcha = GraphSwitch_1_1.Link( OInitLoopSwitchIndex , ISwitcha ) - LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitch_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) + LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitch_1_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin ) - LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitch_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) + LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitch_1_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax ) - LIsEvenaEndOfSwitcha = GraphSwitch_1.Link( OIsEvena , IEndOfSwitcha ) + LIsEvenaEndOfSwitcha = GraphSwitch_1_1.Link( OIsEvena , IEndOfSwitcha ) - LSwitchOddIsOddGate = GraphSwitch_1.Link( OSwitchOdd , IIsOddGate ) + LSwitchOddIsOddGate = GraphSwitch_1_1.Link( OSwitchOdd , IIsOddGate ) - LSwitchEvenIsEvenGate = GraphSwitch_1.Link( OSwitchEven , IIsEvenGate ) + LSwitchEvenIsEvenGate = GraphSwitch_1_1.Link( OSwitchEven , IIsEvenGate ) - LSwitchaIsOdda = GraphSwitch_1.Link( OSwitcha , IIsOdda ) + LSwitchaIsOdda = GraphSwitch_1_1.Link( OSwitcha , IIsOdda ) - LSwitchaIsEvena = GraphSwitch_1.Link( OSwitcha , IIsEvena ) + LSwitchaIsEvena = GraphSwitch_1_1.Link( OSwitcha , IIsEvena ) - LSwitchDefaultEndOfSwitchDefault = GraphSwitch_1.Link( OSwitchDefault , IEndOfSwitchDefault ) + LSwitchDefaultEndOfSwitchDefault = GraphSwitch_1_1.Link( OSwitchDefault , IEndOfSwitchDefault ) - LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitch_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) + LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitch_1_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex ) # Input datas IInitLoopSwitchIndex.Input( 0 ) - IInitLoopSwitchMin.Input( 0 ) + IInitLoopSwitchMin.Input( -5 ) IInitLoopSwitchMax.Input( 10 ) # Output Ports of the graph #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' ) #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' ) #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' ) - return GraphSwitch_1 + return GraphSwitch_1_1 -GraphSwitch_1 = DefGraphSwitch_1() +GraphSwitch_1_1 = DefGraphSwitch_1_1() diff --git a/examples/GraphSwitch2.xml b/examples/GraphSwitch2.xml index bb2c0f2..98d34c1 100644 --- a/examples/GraphSwitch2.xml +++ b/examples/GraphSwitch2.xml @@ -5,11 +5,11 @@ ? ? - GraphSwitch_1 + GraphSwitch_1_1 1 ? -GraphSwitch_1 +GraphSwitch_1_1 long @@ -33,7 +33,7 @@ 1/10/2003 - 17:23:54 - 11/1/2005 - 18:44:50 + 12/1/2005 - 17:7:20 1.05 ? ? @@ -66,8 +66,8 @@ - 11/1/2005 - 18:44:50 - 11/1/2005 - 18:44:50 + 12/1/2005 - 17:7:20 + 12/1/2005 - 17:7:20 1.05 ? ? @@ -122,8 +122,8 @@ - 11/1/2005 - 18:44:50 - 11/1/2005 - 18:44:50 + 12/1/2005 - 17:7:20 + 12/1/2005 - 17:7:20 1.05 ? ? @@ -163,8 +163,8 @@ ? - 11/1/2005 - 18:44:50 - 11/1/2005 - 18:44:50 + 12/1/2005 - 17:7:20 + 12/1/2005 - 17:7:20 1.05 ? ? @@ -196,8 +196,8 @@ - 11/1/2005 - 18:44:50 - 11/1/2005 - 18:44:50 + 12/1/2005 - 17:7:20 + 12/1/2005 - 17:7:20 2.0 ? ? @@ -230,15 +230,15 @@ Switch - - - - - - - - 11/1/2005 - 18:44:50 - 11/1/2005 - 18:44:50 + + + + + + + + 12/1/2005 - 17:7:20 + 12/1/2005 - 17:7:20 2.0 ? ? @@ -266,8 +266,8 @@ EndSwitch_1 - 11/1/2005 - 18:44:50 - 11/1/2005 - 18:44:50 + 12/1/2005 - 17:7:20 + 12/1/2005 - 17:7:20 2.0 ? ? @@ -355,7 +355,7 @@ -GraphSwitch_1 +GraphSwitch_1_1 InitLoopSwitch__Index InitLoopSwitch Index @@ -364,16 +364,16 @@ 0 -GraphSwitch_1 +GraphSwitch_1_1 InitLoopSwitch__Min InitLoopSwitch Min 3 - 0 + -5 -GraphSwitch_1 +GraphSwitch_1_1 InitLoopSwitch__Max InitLoopSwitch Max