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