Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/datafiles.git] / Superv / Python / GraphSwitchBugDefault.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # Generated python file of Graph GraphSwitchBugDefault
23 #
24 from SuperV import *
25
26 # Graph creation of GraphSwitchBugDefault
27 def DefGraphSwitchBugDefault() :
28     GraphSwitchBugDefault = Graph( 'GraphSwitchBugDefault' )
29     GraphSwitchBugDefault.SetName( 'GraphSwitchBugDefault' )
30     GraphSwitchBugDefault.SetAuthor( 'JR' )
31     GraphSwitchBugDefault.SetComment( '' )
32     GraphSwitchBugDefault.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     # Creation of InLine Nodes
37     PyIsOdd = []
38     PyIsOdd.append( 'from time import *   ' )
39     PyIsOdd.append( 'def IsOdd(a) :       ' )
40     PyIsOdd.append( '    print a,"IsOdd (GraphSwitch)"      ' )
41     PyIsOdd.append( '    sleep( 1 )   ' )
42     PyIsOdd.append( '    return a     ' )
43     IsOdd = GraphSwitchBugDefault.INode( 'IsOdd' , PyIsOdd )
44     IsOdd.SetName( 'IsOdd' )
45     IsOdd.SetAuthor( '' )
46     IsOdd.SetComment( 'Python function' )
47     IsOdd.Coords( 389 , 65 )
48     IIsOdda = IsOdd.InPort( 'a' , 'long' )
49     IIsOddGate = IsOdd.GetInPort( 'Gate' )
50     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
51     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
52     
53     # Creation of Loop Nodes
54     PyInitLoopSwitch = []
55     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
56     PyInitLoopSwitch.append( '    Index = Min ' )
57     PyInitLoopSwitch.append( '    return Index,Min,Max      ' )
58     PyMoreInitLoopSwitch = []
59     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :      ' )
60     PyMoreInitLoopSwitch.append( '      if Index <= Max :    ' )
61     PyMoreInitLoopSwitch.append( '              DoLoop = 1      ' )
62     PyMoreInitLoopSwitch.append( '      else :      ' )
63     PyMoreInitLoopSwitch.append( '              DoLoop = 0      ' )
64     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max      ' )
65     PyNextInitLoopSwitch = []
66     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :      ' )
67     PyNextInitLoopSwitch.append( '      Index = Index + 1      ' )
68     PyNextInitLoopSwitch.append( '      return Index,Min,Max      ' )
69     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchBugDefault.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
70     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
71     EndOfInitLoopSwitch.SetAuthor( '' )
72     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
73     EndOfInitLoopSwitch.Coords( 772 , 132 )
74     PyEndOfInitLoopSwitch = []
75     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
76     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
77     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
78     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
79     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
80     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
81     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
82     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
83     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
84     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
85     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
86     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
87     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
88     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
89     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
90     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
91     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
92     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
93     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
94     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
95     InitLoopSwitch.SetName( 'InitLoopSwitch' )
96     InitLoopSwitch.SetAuthor( '' )
97     InitLoopSwitch.SetComment( 'Compute Node' )
98     InitLoopSwitch.Coords( 10 , 129 )
99     
100     # Creation of Switch Nodes
101     PySwitch = []
102     PySwitch.append( 'from time import *  ' )
103     PySwitch.append( 'def Switch(a) :    ' )
104     PySwitch.append( '    if ( a & 1 ) == 0 :  ' )
105     PySwitch.append( '        sleep(1)     ' )
106     PySwitch.append( '    return a & 1,1-(a&1),a,a ' )
107     Switch,EndOfSwitch = GraphSwitchBugDefault.SNode( 'Switch' , PySwitch )
108     EndOfSwitch.SetName( 'EndOfSwitch' )
109     EndOfSwitch.SetAuthor( '' )
110     EndOfSwitch.SetComment( 'Compute Node' )
111     EndOfSwitch.Coords( 581 , 132 )
112     PyEndOfSwitch = []
113     PyEndOfSwitch.append( 'def EndOfSwitch(a,Even,k) : ' )
114     PyEndOfSwitch.append( '    return a ' )
115     EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
116     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
117     IEndOfSwitchEven = EndOfSwitch.InPort( 'Even' , 'long' )
118     IEndOfSwitchk = EndOfSwitch.InPort( 'k' , 'long' )
119     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
120     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
121     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
122     Switch.SetName( 'Switch' )
123     Switch.SetAuthor( '' )
124     Switch.SetComment( 'Compute Node' )
125     Switch.Coords( 194 , 129 )
126     ISwitcha = Switch.InPort( 'a' , 'long' )
127     ISwitchGate = Switch.GetInPort( 'Gate' )
128     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
129     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
130     OSwitcha = Switch.OutPort( 'a' , 'int' )
131     OSwitchn = Switch.OutPort( 'n' , 'int' )
132     OSwitchDefault = Switch.GetOutPort( 'Default' )
133     
134     # Creation of Links
135     LIsOddaEndOfSwitcha = GraphSwitchBugDefault.Link( OIsOdda , IEndOfSwitcha )
136     
137     LInitLoopSwitchIndexSwitcha = GraphSwitchBugDefault.Link( OInitLoopSwitchIndex , ISwitcha )
138     
139     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchBugDefault.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
140     
141     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchBugDefault.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
142     
143     LSwitchOddIsOddGate = GraphSwitchBugDefault.Link( OSwitchOdd , IIsOddGate )
144     
145     LSwitchaIsOdda = GraphSwitchBugDefault.Link( OSwitcha , IIsOdda )
146     
147     LSwitchnEndOfSwitchk = GraphSwitchBugDefault.Link( OSwitchn , IEndOfSwitchk )
148     
149     LSwitchDefaultEndOfSwitchDefault = GraphSwitchBugDefault.Link( OSwitchDefault , IEndOfSwitchDefault )
150     
151     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchBugDefault.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
152     
153     # Input datas
154     IInitLoopSwitchIndex.Input( 0 )
155     IInitLoopSwitchMin.Input( 1 )
156     IInitLoopSwitchMax.Input( 20 )
157     
158     # Input Ports of the graph
159     #IEndOfSwitchEven = EndOfSwitch.GetInPort( 'Even' )
160     
161     # Output Ports of the graph
162     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
163     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
164     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
165     #OSwitchEven = Switch.GetOutPort( 'Even' )
166     return GraphSwitchBugDefault
167
168
169 GraphSwitchBugDefault = DefGraphSwitchBugDefault()