Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[samples/datafiles.git] / Superv / Python / GraphNotClosedChainInsideLoop.py
1
2 # Generated python file of Graph GraphSwitch
3
4 from SuperV import *
5
6 # Graph creation of GraphSwitch
7 def DefGraphSwitch() :
8     GraphSwitch = Graph( 'GraphSwitch' )
9     GraphSwitch.SetName( 'GraphSwitch' )
10     GraphSwitch.SetAuthor( '' )
11     GraphSwitch.SetComment( '' )
12     GraphSwitch.Coords( 0 , 0 )
13     
14     # Creation of Factory Nodes
15     
16     # Creation of InLine Nodes
17     PyIsOdd = []
18     PyIsOdd.append( 'from time import *   ' )
19     PyIsOdd.append( 'def IsOdd(a) :       ' )
20     PyIsOdd.append( '    print a,"IsOdd (GraphSwitch)"      ' )
21     PyIsOdd.append( '    sleep( 1 )   ' )
22     PyIsOdd.append( '    return a     ' )
23     IsOdd = GraphSwitch.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 389 , 65 )
28     IIsOdda = IsOdd.InPort( 'a' , 'long' )
29     IIsOddGate = IsOdd.GetInPort( 'Gate' )
30     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
32     
33     # Creation of Loop Nodes
34     PyInitLoopSwitch = []
35     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :      ' )
36     PyInitLoopSwitch.append( '  return Index,Min,Max     ' )
37     PyMoreInitLoopSwitch = []
38     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :     ' )
39     PyMoreInitLoopSwitch.append( '      if Index <= Max :   ' )
40     PyMoreInitLoopSwitch.append( '              DoLoop = 1     ' )
41     PyMoreInitLoopSwitch.append( '      else :     ' )
42     PyMoreInitLoopSwitch.append( '              DoLoop = 0     ' )
43     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max     ' )
44     PyNextInitLoopSwitch = []
45     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :     ' )
46     PyNextInitLoopSwitch.append( '      Index = Index + 1     ' )
47     PyNextInitLoopSwitch.append( '      return Index,Min,Max     ' )
48     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitch.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
49     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
50     EndOfInitLoopSwitch.SetAuthor( '' )
51     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
52     EndOfInitLoopSwitch.Coords( 776 , 170 )
53     PyEndOfInitLoopSwitch = []
54     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
55     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
56     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
57     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
58     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
59     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
60     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
61     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
62     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
63     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
64     OInitLoopSwitchGate = InitLoopSwitch.GetOutPort( 'Gate' )
65     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
66     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
67     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
68     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
69     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
70     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
71     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
72     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
73     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
74     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
75     InitLoopSwitch.SetName( 'InitLoopSwitch' )
76     InitLoopSwitch.SetAuthor( '' )
77     InitLoopSwitch.SetComment( 'Compute Node' )
78     InitLoopSwitch.Coords( 10 , 129 )
79     
80     # Creation of Switch Nodes
81     PySwitch = []
82     PySwitch.append( 'from time import * ' )
83     PySwitch.append( 'def Switch(a) :   ' )
84     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
85     PySwitch.append( '        sleep(1)    ' )
86     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
87     Switch,EndOfSwitch = GraphSwitch.SNode( 'Switch' , PySwitch )
88     EndOfSwitch.SetName( 'EndOfSwitch' )
89     EndOfSwitch.SetAuthor( '' )
90     EndOfSwitch.SetComment( 'Compute Node' )
91     EndOfSwitch.Coords( 582 , 170 )
92     PyEndOfSwitch = []
93     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
94     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
95     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
96     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
97     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
98     Switch.SetName( 'Switch' )
99     Switch.SetAuthor( '' )
100     Switch.SetComment( 'Compute Node' )
101     Switch.Coords( 194 , 129 )
102     ISwitcha = Switch.InPort( 'a' , 'long' )
103     ISwitchGate = Switch.GetInPort( 'Gate' )
104     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
105     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
106     OSwitcha = Switch.OutPort( 'a' , 'int' )
107     OSwitchDefault = Switch.GetOutPort( 'Default' )
108     
109     # Creation of Links
110     LIsOddaEndOfSwitcha = GraphSwitch.Link( OIsOdda , IEndOfSwitcha )
111     LIsOddaEndOfSwitcha.AddCoord( 1 , 564 , 201 )
112     LIsOddaEndOfSwitcha.AddCoord( 2 , 564 , 134 )
113     
114     LInitLoopSwitchIndexSwitcha = GraphSwitch.Link( OInitLoopSwitchIndex , ISwitcha )
115     
116     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitch.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
117     
118     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitch.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
119     
120     LSwitchOddIsOddGate = GraphSwitch.Link( OSwitchOdd , IIsOddGate )
121     
122     LSwitchaIsOdda = GraphSwitch.Link( OSwitcha , IIsOdda )
123     LSwitchaIsOdda.AddCoord( 1 , 371 , 136 )
124     LSwitchaIsOdda.AddCoord( 2 , 371 , 200 )
125     
126     LSwitchDefaultEndOfSwitchDefault = GraphSwitch.Link( OSwitchDefault , IEndOfSwitchDefault )
127     
128     # Input datas
129     IInitLoopSwitchIndex.Input( 0 )
130     IInitLoopSwitchMin.Input( 0 )
131     IInitLoopSwitchMax.Input( 35 )
132     
133     # Output Ports of the graph
134     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
135     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
136     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
137     #OSwitchEven = Switch.GetOutPort( 'Even' )
138     #OEndOfSwitcha = EndOfSwitch.GetOutPort( 'a' )
139     return GraphSwitch
140
141
142 GraphSwitch = DefGraphSwitch()