Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphLoopSwitchDefault.py
1
2 # Generated python file of Graph GraphLoopSwitchDefault
3
4 from SuperV import *
5
6 # Graph creation of GraphLoopSwitchDefault
7 def DefGraphLoopSwitchDefault() :
8     GraphLoopSwitchDefault = Graph( 'GraphLoopSwitchDefault' )
9     GraphLoopSwitchDefault.SetName( 'GraphLoopSwitchDefault' )
10     GraphLoopSwitchDefault.SetAuthor( 'JR' )
11     GraphLoopSwitchDefault.SetComment( '' )
12     GraphLoopSwitchDefault.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 (GraphLoopSwitch1)"        ' )
21     PyIsOdd.append( '    sleep( 1 )     ' )
22     PyIsOdd.append( '    return a       ' )
23     IsOdd = GraphLoopSwitchDefault.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 397 , 1 )
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     PyInitLoop = []
35     PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
36     PyInitLoop.append( '        Index = Min ' )
37     PyInitLoop.append( '        return Index,Min,Max ' )
38     PyInitLoop.append( '' )
39     PyMoreInitLoop = []
40     PyMoreInitLoop.append( '' )
41     PyNextInitLoop = []
42     PyNextInitLoop.append( '' )
43     InitLoop,EndOfInitLoop = GraphLoopSwitchDefault.LNode( 'InitLoop' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
44     EndOfInitLoop.SetName( 'EndOfInitLoop' )
45     EndOfInitLoop.SetAuthor( '' )
46     EndOfInitLoop.SetComment( 'Compute Node' )
47     EndOfInitLoop.Coords( 767 , 102 )
48     PyEndOfInitLoop = []
49     PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
50     PyEndOfInitLoop.append( '   Index = Index + 1     ' )
51     PyEndOfInitLoop.append( '   if Index <= Max :   ' )
52     PyEndOfInitLoop.append( '           DoLoop = 1     ' )
53     PyEndOfInitLoop.append( '   else :     ' )
54     PyEndOfInitLoop.append( '           DoLoop = 0     ' )
55     PyEndOfInitLoop.append( '   return DoLoop,Index,Min,Max     ' )
56     EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
57     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
58     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
59     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
60     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
61     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
62     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
63     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
64     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
65     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
66     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
67     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
68     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
69     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
70     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
71     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
72     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
73     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
74     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
75     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
76     InitLoop.SetName( 'InitLoop' )
77     InitLoop.SetAuthor( '' )
78     InitLoop.SetComment( 'Compute Node' )
79     InitLoop.Coords( 10 , 108 )
80     
81     # Creation of Switch Nodes
82     PySwitch = []
83     PySwitch.append( 'from time import *  ' )
84     PySwitch.append( 'def Switch(a) :    ' )
85     PySwitch.append( '    if ( a & 1 ) == 0 :  ' )
86     PySwitch.append( '        sleep(1)  ' )
87     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
88     Switch,EndSwitch = GraphLoopSwitchDefault.SNode( 'Switch' , PySwitch )
89     EndSwitch.SetName( 'EndSwitch' )
90     EndSwitch.SetAuthor( '' )
91     EndSwitch.SetComment( 'Compute Node' )
92     EndSwitch.Coords( 587 , 103 )
93     PyEndSwitch = []
94     PyEndSwitch.append( 'def EndSwitch(a) :    ' )
95     PyEndSwitch.append( '    if ( a & 1 ) == 0 :  ' )
96     PyEndSwitch.append( '        sleep(1)  ' )
97     PyEndSwitch.append( '    return a    ' )
98     EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
99     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
100     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
101     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
102     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
103     Switch.SetName( 'Switch' )
104     Switch.SetAuthor( '' )
105     Switch.SetComment( 'Compute Node' )
106     Switch.Coords( 194 , 109 )
107     ISwitcha = Switch.InPort( 'a' , 'long' )
108     ISwitchGate = Switch.GetInPort( 'Gate' )
109     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
110     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
111     OSwitcha = Switch.OutPort( 'a' , 'int' )
112     OSwitchDefault = Switch.GetOutPort( 'Default' )
113     
114     # Creation of Links
115     LIsOddaEndSwitcha = GraphLoopSwitchDefault.Link( OIsOdda , IEndSwitcha )
116     
117     LInitLoopIndexSwitcha = GraphLoopSwitchDefault.Link( OInitLoopIndex , ISwitcha )
118     
119     LInitLoopMinEndOfInitLoopMin = GraphLoopSwitchDefault.Link( OInitLoopMin , IEndOfInitLoopMin )
120     
121     LInitLoopMaxEndOfInitLoopMax = GraphLoopSwitchDefault.Link( OInitLoopMax , IEndOfInitLoopMax )
122     
123     LSwitchOddIsOddGate = GraphLoopSwitchDefault.Link( OSwitchOdd , IIsOddGate )
124     
125     LSwitchaIsOdda = GraphLoopSwitchDefault.Link( OSwitcha , IIsOdda )
126     
127     LSwitchDefaultEndSwitchDefault = GraphLoopSwitchDefault.Link( OSwitchDefault , IEndSwitchDefault )
128     
129     LEndSwitchaEndOfInitLoopIndex = GraphLoopSwitchDefault.Link( OEndSwitcha , IEndOfInitLoopIndex )
130     
131     # Input datas
132     IInitLoopIndex.Input( 0 )
133     IInitLoopMin.Input( 5 )
134     IInitLoopMax.Input( 23 )
135     
136     # Output Ports of the graph
137     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
138     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
139     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
140     #OSwitchEven = Switch.GetOutPort( 'Even' )
141     return GraphLoopSwitchDefault
142
143
144 GraphLoopSwitchDefault = DefGraphLoopSwitchDefault()