Salome HOME
24c691d7d59b24ce5bdead0a80ce99ea2d338174
[samples/datafiles.git] / Superv / Python / GraphLoopSwitchDefault.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 GraphLoopSwitchDefault
23 #
24 from SuperV import *
25
26 # Graph creation of GraphLoopSwitchDefault
27 def DefGraphLoopSwitchDefault() :
28     GraphLoopSwitchDefault = Graph( 'GraphLoopSwitchDefault' )
29     GraphLoopSwitchDefault.SetName( 'GraphLoopSwitchDefault' )
30     GraphLoopSwitchDefault.SetAuthor( 'JR' )
31     GraphLoopSwitchDefault.SetComment( '' )
32     GraphLoopSwitchDefault.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 (GraphLoopSwitch1)"        ' )
41     PyIsOdd.append( '    sleep( 1 )     ' )
42     PyIsOdd.append( '    return a       ' )
43     IsOdd = GraphLoopSwitchDefault.INode( 'IsOdd' , PyIsOdd )
44     IsOdd.SetName( 'IsOdd' )
45     IsOdd.SetAuthor( '' )
46     IsOdd.SetComment( 'Python function' )
47     IsOdd.Coords( 397 , 1 )
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     PyInitLoop = []
55     PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
56     PyInitLoop.append( '        Index = Min ' )
57     PyInitLoop.append( '        return Index,Min,Max ' )
58     PyInitLoop.append( '' )
59     PyMoreInitLoop = []
60     PyMoreInitLoop.append( '' )
61     PyNextInitLoop = []
62     PyNextInitLoop.append( '' )
63     InitLoop,EndOfInitLoop = GraphLoopSwitchDefault.LNode( 'InitLoop' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
64     EndOfInitLoop.SetName( 'EndOfInitLoop' )
65     EndOfInitLoop.SetAuthor( '' )
66     EndOfInitLoop.SetComment( 'Compute Node' )
67     EndOfInitLoop.Coords( 767 , 102 )
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 = GraphLoopSwitchDefault.SNode( 'Switch' , PySwitch )
109     EndSwitch.SetName( 'EndSwitch' )
110     EndSwitch.SetAuthor( '' )
111     EndSwitch.SetComment( 'Compute Node' )
112     EndSwitch.Coords( 587 , 103 )
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 = GraphLoopSwitchDefault.Link( OIsOdda , IEndSwitcha )
136     
137     LInitLoopIndexSwitcha = GraphLoopSwitchDefault.Link( OInitLoopIndex , ISwitcha )
138     
139     LInitLoopMinEndOfInitLoopMin = GraphLoopSwitchDefault.Link( OInitLoopMin , IEndOfInitLoopMin )
140     
141     LInitLoopMaxEndOfInitLoopMax = GraphLoopSwitchDefault.Link( OInitLoopMax , IEndOfInitLoopMax )
142     
143     LSwitchOddIsOddGate = GraphLoopSwitchDefault.Link( OSwitchOdd , IIsOddGate )
144     
145     LSwitchaIsOdda = GraphLoopSwitchDefault.Link( OSwitcha , IIsOdda )
146     
147     LSwitchDefaultEndSwitchDefault = GraphLoopSwitchDefault.Link( OSwitchDefault , IEndSwitchDefault )
148     
149     LEndSwitchaEndOfInitLoopIndex = GraphLoopSwitchDefault.Link( OEndSwitcha , IEndOfInitLoopIndex )
150     
151     # Input datas
152     IInitLoopIndex.Input( 0 )
153     IInitLoopMin.Input( 5 )
154     IInitLoopMax.Input( 23 )
155     
156     # Output Ports of the graph
157     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
158     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
159     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
160     #OSwitchEven = Switch.GetOutPort( 'Even' )
161     return GraphLoopSwitchDefault
162
163
164 GraphLoopSwitchDefault = DefGraphLoopSwitchDefault()