Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/datafiles.git] / Superv / Python / GraphSwitchNOTExecutable1.py
1 #  Copyright (C) 2007-2008  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 GraphSwitchNOTExecutable1
23 #
24 from SuperV import *
25
26 # Graph creation of GraphSwitchNOTExecutable1
27 def DefGraphSwitchNOTExecutable1() :
28     GraphSwitchNOTExecutable1 = Graph( 'GraphSwitchNOTExecutable1' )
29     GraphSwitchNOTExecutable1.SetName( 'GraphSwitchNOTExecutable1' )
30     GraphSwitchNOTExecutable1.SetAuthor( '' )
31     GraphSwitchNOTExecutable1.SetComment( '' )
32     GraphSwitchNOTExecutable1.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) :       ' )
40     PyIsOdd.append( '    print a,"IsOdd (GraphSwitch)"      ' )
41     PyIsOdd.append( '    sleep( 1 )   ' )
42     PyIsOdd.append( '    return a     ' )
43     IsOdd = GraphSwitchNOTExecutable1.INode( 'IsOdd' , PyIsOdd )
44     IsOdd.SetName( 'IsOdd' )
45     IsOdd.SetAuthor( '' )
46     IsOdd.SetComment( 'Python function' )
47     IsOdd.Coords( 389 , 65 )
48     IIsOdda = IsOdd.InPort( 'a' , 'long' )
49     IIsOddGate = IsOdd.GetInPort( 'Gate' )
50     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
51     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
52     
53     # Creation of Loop Nodes
54     PyInitLoopSwitch = []
55     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :      ' )
56     PyInitLoopSwitch.append( '  return Index,Min,Max     ' )
57     PyMoreInitLoopSwitch = []
58     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :     ' )
59     PyMoreInitLoopSwitch.append( '      if Index <= Max :   ' )
60     PyMoreInitLoopSwitch.append( '              DoLoop = 1     ' )
61     PyMoreInitLoopSwitch.append( '      else :     ' )
62     PyMoreInitLoopSwitch.append( '              DoLoop = 0     ' )
63     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max     ' )
64     PyNextInitLoopSwitch = []
65     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :     ' )
66     PyNextInitLoopSwitch.append( '      Index = Index + 1     ' )
67     PyNextInitLoopSwitch.append( '      return Index,Min,Max     ' )
68     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchNOTExecutable1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
69     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
70     EndOfInitLoopSwitch.SetAuthor( '' )
71     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
72     EndOfInitLoopSwitch.Coords( 776 , 170 )
73     PyEndOfInitLoopSwitch = []
74     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
75     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
76     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
77     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
78     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
79     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
80     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
81     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
82     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
83     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
84     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
85     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
86     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
87     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
88     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
89     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
90     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
91     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
92     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
93     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
94     InitLoopSwitch.SetName( 'InitLoopSwitch' )
95     InitLoopSwitch.SetAuthor( '' )
96     InitLoopSwitch.SetComment( 'Compute Node' )
97     InitLoopSwitch.Coords( 10 , 129 )
98     
99     # Creation of Switch Nodes
100     PySwitch = []
101     PySwitch.append( 'from time import * ' )
102     PySwitch.append( 'def Switch(a) :   ' )
103     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
104     PySwitch.append( '        sleep(1)    ' )
105     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
106     Switch,EndOfSwitch = GraphSwitchNOTExecutable1.SNode( 'Switch' , PySwitch )
107     EndOfSwitch.SetName( 'EndOfSwitch' )
108     EndOfSwitch.SetAuthor( '' )
109     EndOfSwitch.SetComment( 'Compute Node' )
110     EndOfSwitch.Coords( 582 , 170 )
111     PyEndOfSwitch = []
112     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
113     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
114     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
115     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
116     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
117     Switch.SetName( 'Switch' )
118     Switch.SetAuthor( '' )
119     Switch.SetComment( 'Compute Node' )
120     Switch.Coords( 194 , 129 )
121     ISwitcha = Switch.InPort( 'a' , 'long' )
122     ISwitchGate = Switch.GetInPort( 'Gate' )
123     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
124     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
125     OSwitchn = Switch.OutPort( 'n' , 'int' )
126     OSwitchDefault = Switch.GetOutPort( 'Default' )
127     
128     # Creation of Links
129     LIsOddaEndOfSwitcha = GraphSwitchNOTExecutable1.Link( OIsOdda , IEndOfSwitcha )
130     LIsOddaEndOfSwitcha.AddCoord( 1 , 564 , 201 )
131     LIsOddaEndOfSwitcha.AddCoord( 2 , 564 , 137 )
132     
133     LInitLoopSwitchIndexSwitcha = GraphSwitchNOTExecutable1.Link( OInitLoopSwitchIndex , ISwitcha )
134     
135     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchNOTExecutable1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
136     
137     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchNOTExecutable1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
138     
139     LSwitchOddIsOddGate = GraphSwitchNOTExecutable1.Link( OSwitchOdd , IIsOddGate )
140     
141     LSwitchnIsOdda = GraphSwitchNOTExecutable1.Link( OSwitchn , IIsOdda )
142     LSwitchnIsOdda.AddCoord( 1 , 371 , 136 )
143     LSwitchnIsOdda.AddCoord( 2 , 371 , 200 )
144     
145     LSwitchnEndOfSwitcha = GraphSwitchNOTExecutable1.Link( OSwitchn , IEndOfSwitcha )
146     
147     LSwitchDefaultEndOfSwitchDefault = GraphSwitchNOTExecutable1.Link( OSwitchDefault , IEndOfSwitchDefault )
148     
149     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchNOTExecutable1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
150     
151     # Input datas
152     IInitLoopSwitchIndex.Input( 0 )
153     IInitLoopSwitchMin.Input( 0 )
154     IInitLoopSwitchMax.Input( 100 )
155     
156     # Output Ports of the graph
157     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
158     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
159     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
160     #OSwitchEven = Switch.GetOutPort( 'Even' )
161     return GraphSwitchNOTExecutable1
162
163
164 GraphSwitchNOTExecutable1 = DefGraphSwitchNOTExecutable1()