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