Salome HOME
Update copyrights 2014.
[samples/datafiles.git] / Superv / Python / GraphBadOutputOfLoop1.py
1 # Copyright (C) 2007-2014  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, or (at your option) any later version.
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
23 # Generated python file of Graph GraphBadOutputOfLoop1
24 #
25 from SuperV import *
26
27 # Graph creation of GraphBadOutputOfLoop1
28 def DefGraphBadOutputOfLoop1() :
29     GraphBadOutputOfLoop1 = Graph( 'GraphBadOutputOfLoop1' )
30     GraphBadOutputOfLoop1.SetName( 'GraphBadOutputOfLoop1' )
31     GraphBadOutputOfLoop1.SetAuthor( '' )
32     GraphBadOutputOfLoop1.SetComment( '' )
33     GraphBadOutputOfLoop1.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     # Creation of InLine Nodes
38     PyIsOdd = []
39     PyIsOdd.append( 'from time import *       ' )
40     PyIsOdd.append( 'def IsOdd(a) :           ' )
41     PyIsOdd.append( '    print a,"IsOdd (GraphLoopSwitch1)"          ' )
42     PyIsOdd.append( '    sleep( 1 )       ' )
43     PyIsOdd.append( '    return a         ' )
44     IsOdd = GraphBadOutputOfLoop1.INode( 'IsOdd' , PyIsOdd )
45     IsOdd.SetName( 'IsOdd' )
46     IsOdd.SetAuthor( '' )
47     IsOdd.SetComment( 'Python function' )
48     IsOdd.Coords( 397 , 1 )
49     IIsOdda = IsOdd.InPort( 'a' , 'long' )
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 = GraphBadOutputOfLoop1.INode( 'BadOutputOfLoop' , PyBadOutputOfLoop )
59     BadOutputOfLoop.SetName( 'BadOutputOfLoop' )
60     BadOutputOfLoop.SetAuthor( '' )
61     BadOutputOfLoop.SetComment( 'Compute Node' )
62     BadOutputOfLoop.Coords( 287 , 349 )
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 = GraphBadOutputOfLoop1.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 = GraphBadOutputOfLoop1.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 = GraphBadOutputOfLoop1.Link( OIsOdda , IEndSwitcha )
146     
147     LInitLoopIndexSwitcha = GraphBadOutputOfLoop1.Link( OInitLoopIndex , ISwitcha )
148     
149     LInitLoopMinEndOfInitLoopMin = GraphBadOutputOfLoop1.Link( OInitLoopMin , IEndOfInitLoopMin )
150     
151     LInitLoopMaxBadOutputOfLoopOutputOfLoop = GraphBadOutputOfLoop1.Link( OInitLoopMax , IBadOutputOfLoopOutputOfLoop )
152     
153     LSwitchOddIsOddGate = GraphBadOutputOfLoop1.Link( OSwitchOdd , IIsOddGate )
154     
155     LSwitchEvenEndSwitchDefault = GraphBadOutputOfLoop1.Link( OSwitchEven , IEndSwitchDefault )
156     
157     LSwitchaIsOdda = GraphBadOutputOfLoop1.Link( OSwitcha , IIsOdda )
158     
159     LEndSwitchaEndOfInitLoopIndex = GraphBadOutputOfLoop1.Link( OEndSwitcha , IEndOfInitLoopIndex )
160     
161     # Input datas
162     IInitLoopIndex.Input( 0 )
163     IInitLoopMin.Input( 0 )
164     IInitLoopMax.Input( 100 )
165     
166     # Output Ports of the graph
167     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
168     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
169     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
170     return GraphBadOutputOfLoop1
171
172
173 GraphBadOutputOfLoop1 = DefGraphBadOutputOfLoop1()