Salome HOME
4f80e257d039971551227d43df69e8c582ff0732
[samples/datafiles.git] / Superv / Python / GraphBadInputInLoop.py
1 #  Copyright (C) 2007-2011  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 GraphBadInputInLoop_1
23 #
24 from SuperV import *
25
26 # Graph creation of GraphBadInputInLoop_1
27 def DefGraphBadInputInLoop_1() :
28     GraphBadInputInLoop_1 = Graph( 'GraphBadInputInLoop_1' )
29     GraphBadInputInLoop_1.SetName( 'GraphBadInputInLoop_1' )
30     GraphBadInputInLoop_1.SetAuthor( '' )
31     GraphBadInputInLoop_1.SetComment( '' )
32     GraphBadInputInLoop_1.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 = GraphBadInputInLoop_1.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     PyBadInputOfLoop = []
54     PyBadInputOfLoop.append( 'def BadInputOfLoop() : ' )
55     PyBadInputOfLoop.append( '  return 1 ' )
56     PyBadInputOfLoop.append( '' )
57     BadInputOfLoop = GraphBadInputInLoop_1.INode( 'BadInputOfLoop' , PyBadInputOfLoop )
58     BadInputOfLoop.SetName( 'BadInputOfLoop' )
59     BadInputOfLoop.SetAuthor( '' )
60     BadInputOfLoop.SetComment( 'Compute Node' )
61     BadInputOfLoop.Coords( 15 , 307 )
62     IBadInputOfLoopGate = BadInputOfLoop.GetInPort( 'Gate' )
63     OBadInputOfLoopInputInLoop = BadInputOfLoop.OutPort( 'InputInLoop' , 'long' )
64     OBadInputOfLoopGate = BadInputOfLoop.GetOutPort( 'Gate' )
65     
66     # Creation of Loop Nodes
67     PyInitLoop = []
68     PyMoreInitLoop = []
69     PyMoreInitLoop.append( '' )
70     PyNextInitLoop = []
71     PyNextInitLoop.append( '' )
72     InitLoop,EndOfInitLoop = GraphBadInputInLoop_1.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 = GraphBadInputInLoop_1.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     ISwitchInputInLoop = Switch.InPort( 'InputInLoop' , 'long' )
138     ISwitchGate = Switch.GetInPort( 'Gate' )
139     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
140     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
141     OSwitcha = Switch.OutPort( 'a' , 'int' )
142     OSwitchDefault = Switch.GetOutPort( 'Default' )
143     
144     # Creation of Links
145     LIsOddaEndSwitcha = GraphBadInputInLoop_1.Link( OIsOdda , IEndSwitcha )
146     
147     LInitLoopIndexSwitcha = GraphBadInputInLoop_1.Link( OInitLoopIndex , ISwitcha )
148     
149     LInitLoopMinEndOfInitLoopMin = GraphBadInputInLoop_1.Link( OInitLoopMin , IEndOfInitLoopMin )
150     
151     LSwitchOddIsOddGate = GraphBadInputInLoop_1.Link( OSwitchOdd , IIsOddGate )
152     
153     LSwitchaIsOdda = GraphBadInputInLoop_1.Link( OSwitcha , IIsOdda )
154     
155     LEndSwitchaEndOfInitLoopIndex = GraphBadInputInLoop_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
156     
157     LBadInputOfLoopInputInLoopSwitchInputInLoop = GraphBadInputInLoop_1.Link( OBadInputOfLoopInputInLoop , ISwitchInputInLoop )
158     
159     # Input datas
160     IInitLoopIndex.Input( 0 )
161     IInitLoopMin.Input( 0 )
162     IInitLoopMax.Input( 100 )
163     
164     # Output Ports of the graph
165     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
166     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
167     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
168     #OSwitchEven = Switch.GetOutPort( 'Even' )
169     return GraphBadInputInLoop_1
170
171
172 GraphBadInputInLoop_1 = DefGraphBadInputInLoop_1()