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