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