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