Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/datafiles.git] / Superv / Python / GraphBadOutputOfLoop1.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 GraphBadOutputOfLoop1
23 #
24 from SuperV import *
25
26 # Graph creation of GraphBadOutputOfLoop1
27 def DefGraphBadOutputOfLoop1() :
28     GraphBadOutputOfLoop1 = Graph( 'GraphBadOutputOfLoop1' )
29     GraphBadOutputOfLoop1.SetName( 'GraphBadOutputOfLoop1' )
30     GraphBadOutputOfLoop1.SetAuthor( '' )
31     GraphBadOutputOfLoop1.SetComment( '' )
32     GraphBadOutputOfLoop1.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 (GraphLoopSwitch1)"          ' )
41     PyIsOdd.append( '    sleep( 1 )       ' )
42     PyIsOdd.append( '    return a         ' )
43     IsOdd = GraphBadOutputOfLoop1.INode( 'IsOdd' , PyIsOdd )
44     IsOdd.SetName( 'IsOdd' )
45     IsOdd.SetAuthor( '' )
46     IsOdd.SetComment( 'Python function' )
47     IsOdd.Coords( 397 , 1 )
48     IIsOdda = IsOdd.InPort( 'a' , 'long' )
49     IIsOddGate = IsOdd.GetInPort( 'Gate' )
50     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
51     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
52     
53     PyBadOutputOfLoop = []
54     PyBadOutputOfLoop.append( 'def BadOutputOfLoop() : ' )
55     PyBadOutputOfLoop.append( ' return 1 ' )
56     PyBadOutputOfLoop.append( '' )
57     BadOutputOfLoop = GraphBadOutputOfLoop1.INode( 'BadOutputOfLoop' , PyBadOutputOfLoop )
58     BadOutputOfLoop.SetName( 'BadOutputOfLoop' )
59     BadOutputOfLoop.SetAuthor( '' )
60     BadOutputOfLoop.SetComment( 'Compute Node' )
61     BadOutputOfLoop.Coords( 287 , 349 )
62     IBadOutputOfLoopOutputOfLoop = BadOutputOfLoop.InPort( 'OutputOfLoop' , 'long' )
63     IBadOutputOfLoopGate = BadOutputOfLoop.GetInPort( 'Gate' )
64     OBadOutputOfLoopGate = BadOutputOfLoop.GetOutPort( 'Gate' )
65     
66     # Creation of Loop Nodes
67     PyInitLoop = []
68     PyMoreInitLoop = []
69     PyMoreInitLoop.append( '' )
70     PyNextInitLoop = []
71     PyNextInitLoop.append( '' )
72     InitLoop,EndOfInitLoop = GraphBadOutputOfLoop1.LNode( '' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
73     EndOfInitLoop.SetName( 'EndOfInitLoop' )
74     EndOfInitLoop.SetAuthor( '' )
75     EndOfInitLoop.SetComment( 'Compute Node' )
76     EndOfInitLoop.Coords( 767 , 102 )
77     PyEndOfInitLoop = []
78     PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
79     PyEndOfInitLoop.append( '   Index = Index + 1     ' )
80     PyEndOfInitLoop.append( '   if Index <= Max :   ' )
81     PyEndOfInitLoop.append( '           DoLoop = 1     ' )
82     PyEndOfInitLoop.append( '   else :     ' )
83     PyEndOfInitLoop.append( '           DoLoop = 0     ' )
84     PyEndOfInitLoop.append( '   return DoLoop,Index,Min,Max     ' )
85     EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
86     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
87     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
88     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
89     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
90     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
91     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
92     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
93     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
94     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
95     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
96     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
97     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
98     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
99     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
100     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
101     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
102     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
103     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
104     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
105     InitLoop.SetName( 'InitLoop' )
106     InitLoop.SetAuthor( '' )
107     InitLoop.SetComment( 'Compute Node' )
108     InitLoop.Coords( 10 , 108 )
109     
110     # Creation of Switch Nodes
111     PySwitch = []
112     PySwitch.append( 'from time import *  ' )
113     PySwitch.append( 'def Switch(a) :    ' )
114     PySwitch.append( '    if ( a & 1 ) == 0 :  ' )
115     PySwitch.append( '        sleep(1)  ' )
116     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
117     Switch,EndSwitch = GraphBadOutputOfLoop1.SNode( 'Switch' , PySwitch )
118     EndSwitch.SetName( 'EndSwitch' )
119     EndSwitch.SetAuthor( '' )
120     EndSwitch.SetComment( 'Compute Node' )
121     EndSwitch.Coords( 587 , 103 )
122     PyEndSwitch = []
123     PyEndSwitch.append( 'def EndSwitch(a) :    ' )
124     PyEndSwitch.append( '    if ( a & 1 ) == 0 :  ' )
125     PyEndSwitch.append( '        sleep(1)  ' )
126     PyEndSwitch.append( '    return a    ' )
127     EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
128     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
129     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
130     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
131     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
132     Switch.SetName( 'Switch' )
133     Switch.SetAuthor( '' )
134     Switch.SetComment( 'Compute Node' )
135     Switch.Coords( 194 , 109 )
136     ISwitcha = Switch.InPort( 'a' , 'long' )
137     ISwitchGate = Switch.GetInPort( 'Gate' )
138     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
139     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
140     OSwitcha = Switch.OutPort( 'a' , 'int' )
141     OSwitchDefault = Switch.GetOutPort( 'Default' )
142     
143     # Creation of Links
144     LIsOddaEndSwitcha = GraphBadOutputOfLoop1.Link( OIsOdda , IEndSwitcha )
145     
146     LInitLoopIndexSwitcha = GraphBadOutputOfLoop1.Link( OInitLoopIndex , ISwitcha )
147     
148     LInitLoopMinEndOfInitLoopMin = GraphBadOutputOfLoop1.Link( OInitLoopMin , IEndOfInitLoopMin )
149     
150     LInitLoopMaxBadOutputOfLoopOutputOfLoop = GraphBadOutputOfLoop1.Link( OInitLoopMax , IBadOutputOfLoopOutputOfLoop )
151     
152     LSwitchOddIsOddGate = GraphBadOutputOfLoop1.Link( OSwitchOdd , IIsOddGate )
153     
154     LSwitchEvenEndSwitchDefault = GraphBadOutputOfLoop1.Link( OSwitchEven , IEndSwitchDefault )
155     
156     LSwitchaIsOdda = GraphBadOutputOfLoop1.Link( OSwitcha , IIsOdda )
157     
158     LEndSwitchaEndOfInitLoopIndex = GraphBadOutputOfLoop1.Link( OEndSwitcha , IEndOfInitLoopIndex )
159     
160     # Input datas
161     IInitLoopIndex.Input( 0 )
162     IInitLoopMin.Input( 0 )
163     IInitLoopMax.Input( 100 )
164     
165     # Output Ports of the graph
166     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
167     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
168     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
169     return GraphBadOutputOfLoop1
170
171
172 GraphBadOutputOfLoop1 = DefGraphBadOutputOfLoop1()