Salome HOME
8d83d6474310f4e373f652dda665a1529d94242c
[samples/datafiles.git] / Superv / Python / TestSupervMedfieldLoopFori.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 TestSupervMedfieldLoopFori
23 #
24 from SuperV import *
25
26 # Graph creation of TestSupervMedfieldLoopFori
27 def DefTestSupervMedfieldLoopFori() :
28     TestSupervMedfieldLoopFori = Graph( 'TestSupervMedfieldLoopFori' )
29     TestSupervMedfieldLoopFori.SetName( 'TestSupervMedfieldLoopFori' )
30     TestSupervMedfieldLoopFori.SetAuthor( '' )
31     TestSupervMedfieldLoopFori.SetComment( '' )
32     TestSupervMedfieldLoopFori.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     Mul = TestSupervMedfieldLoopFori.FNode( 'Calculator' , 'Calculator' , 'Mul' )
37     Mul.SetName( 'Mul' )
38     Mul.SetAuthor( 'LD' )
39     Mul.SetContainer( 'localhost/FactoryServer' )
40     Mul.SetComment( 'Multiply a field by a constant' )
41     Mul.Coords( 429 , 46 )
42     IMulfield1 = Mul.GetInPort( 'field1' )
43     IMulx1 = Mul.GetInPort( 'x1' )
44     IMulGate = Mul.GetInPort( 'Gate' )
45     OMulreturn = Mul.GetOutPort( 'return' )
46     OMulGate = Mul.GetOutPort( 'Gate' )
47     
48     # Creation of InLine Nodes
49     PyInitDisplay = []
50     PyInitDisplay.append( 'from VISU import *              ' )
51     PyInitDisplay.append( 'import SALOMEDS              ' )
52     PyInitDisplay.append( 'from LifeCycleCORBA import *       ' )
53     PyInitDisplay.append( 'from SALOME_NamingServicePy import *          ' )
54     PyInitDisplay.append( 'def InitDisplay():   ' )
55     PyInitDisplay.append( '    # initialize the ORB     ' )
56     PyInitDisplay.append( '    orb = CORBA.ORB_init([], CORBA.ORB_ID)   ' )
57     PyInitDisplay.append( '    # create an LifeCycleCORBA instance        ' )
58     PyInitDisplay.append( '    lcc = LifeCycleCORBA(orb)                  ' )
59     PyInitDisplay.append( '    # -----------------------------------------          ' )
60     PyInitDisplay.append( '    # Visualization parameters        ' )
61     PyInitDisplay.append( '    #create a naming service instance              ' )
62     PyInitDisplay.append( '    naming_service = SALOME_NamingServicePy_i(orb)              ' )
63     PyInitDisplay.append( '    # get Study Manager reference              ' )
64     PyInitDisplay.append( '    obj = naming_service.Resolve("myStudyManager")              ' )
65     PyInitDisplay.append( '    myStudyManager = obj._narrow(SALOMEDS.StudyManager)              ' )
66     PyInitDisplay.append( '    myStudy = myStudyManager.GetStudyByID(1)              ' )
67     PyInitDisplay.append( '    aVisu = lcc.FindOrLoadComponent("FactoryServer", "VISU")              ' )
68     PyInitDisplay.append( '    print "InitDisplay --> aVisu        = ",aVisu    ' )
69     PyInitDisplay.append( '    aVisu.SetCurrentStudy(myStudy);              ' )
70     PyInitDisplay.append( '    aViewManager = aVisu.GetViewManager()               ' )
71     PyInitDisplay.append( '    print "InitDisplay --> aViewManager = ",aViewManager    ' )
72     PyInitDisplay.append( '    aView = aViewManager.Create3DView()              ' )
73     PyInitDisplay.append( '    print "InitDisplay --> aView        = ",aView    ' )
74     PyInitDisplay.append( '    return aVisu,aView   ' )
75     InitDisplay = TestSupervMedfieldLoopFori.INode( 'InitDisplay' , PyInitDisplay )
76     InitDisplay.SetName( 'InitDisplay' )
77     InitDisplay.SetAuthor( '' )
78     InitDisplay.SetComment( 'Compute Node' )
79     InitDisplay.Coords( 1 , 105 )
80     IInitDisplayGate = InitDisplay.GetInPort( 'Gate' )
81     OInitDisplayaVisu = InitDisplay.OutPort( 'aVisu' , 'objref' )
82     OInitDisplayaView = InitDisplay.OutPort( 'aView' , 'objref' )
83     OInitDisplayGate = InitDisplay.GetOutPort( 'Gate' )
84     
85     # Creation of Loop Nodes
86     PyInit = []
87     PyInit.append( 'def Init(index,min,max,medfield,x1,aVisu,aView):  ' )
88     PyInit.append( '    if max >= min :  ' )
89     PyInit.append( '           index = min  ' )
90     PyInit.append( '    else : ' )
91     PyInit.append( '        index = max  ' )
92     PyInit.append( '    print "Init --> index      = ",index   ' )
93     PyInit.append( '    print "         min        = ",min   ' )
94     PyInit.append( '    print "         max        = ",max   ' )
95     PyInit.append( '    print "         medfield   = ",medfield   ' )
96     PyInit.append( '    return index,min,max,medfield,x1,aVisu,aView  ' )
97     PyMoreInit = []
98     PyMoreInit.append( 'def More(index,min,max,medfield,x1,aVisu,aView):  ' )
99     PyMoreInit.append( '    if max >= index :   ' )
100     PyMoreInit.append( '        DoLoop = 1   ' )
101     PyMoreInit.append( '    else :   ' )
102     PyMoreInit.append( '        DoLoop = 0   ' )
103     PyMoreInit.append( '    print "More --> DoLoop      = ",DoLoop   ' )
104     PyMoreInit.append( '    print "         index       = ",index   ' )
105     PyMoreInit.append( '    print "         min         = ",min   ' )
106     PyMoreInit.append( '    print "         max         = ",max   ' )
107     PyMoreInit.append( '    print "         medfield    = ",medfield   ' )
108     PyMoreInit.append( '    return DoLoop,index,min,max,medfield,x1,aVisu,aView  ' )
109     PyNextInit = []
110     PyNextInit.append( 'def Next(index,min,max,medfield,x1,aVisu,aView):  ' )
111     PyNextInit.append( '    index = index + 1  ' )
112     PyNextInit.append( '    print "Next --> index      = ",index   ' )
113     PyNextInit.append( '    print "         min        = ",min   ' )
114     PyNextInit.append( '    print "         max        = ",max   ' )
115     PyNextInit.append( '    print "         medfield   = ",medfield   ' )
116     PyNextInit.append( '    return index,min,max,medfield,x1,aVisu,aView  ' )
117     Init,EndInit = TestSupervMedfieldLoopFori.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
118     EndInit.SetName( 'EndInit' )
119     EndInit.SetAuthor( 'LD' )
120     EndInit.SetComment( 'no comment' )
121     EndInit.Coords( 631 , 5 )
122     PyEndInit = []
123     EndInit.SetPyFunction( '' , PyEndInit )
124     IInitDoLoop = Init.GetInPort( 'DoLoop' )
125     IInitindex = Init.InPort( 'index' , 'long' )
126     IInitmin = Init.InPort( 'min' , 'long' )
127     IInitmax = Init.InPort( 'max' , 'long' )
128     IInitmedfield = Init.InPort( 'medfield' , 'objref' )
129     IInitx1 = Init.InPort( 'x1' , 'double' )
130     IInitaVisu = Init.InPort( 'aVisu' , 'objref' )
131     IInitaView = Init.InPort( 'aView' , 'objref' )
132     IInitGate = Init.GetInPort( 'Gate' )
133     OInitDoLoop = Init.GetOutPort( 'DoLoop' )
134     OInitindex = Init.GetOutPort( 'index' )
135     OInitmin = Init.GetOutPort( 'min' )
136     OInitmax = Init.GetOutPort( 'max' )
137     OInitmedfield = Init.GetOutPort( 'medfield' )
138     OInitx1 = Init.GetOutPort( 'x1' )
139     OInitaVisu = Init.GetOutPort( 'aVisu' )
140     OInitaView = Init.GetOutPort( 'aView' )
141     IEndInitDoLoop = EndInit.GetInPort( 'DoLoop' )
142     IEndInitindex = EndInit.GetInPort( 'index' )
143     IEndInitmin = EndInit.GetInPort( 'min' )
144     IEndInitmax = EndInit.GetInPort( 'max' )
145     IEndInitmedfield = EndInit.GetInPort( 'medfield' )
146     IEndInitx1 = EndInit.GetInPort( 'x1' )
147     IEndInitaVisu = EndInit.GetInPort( 'aVisu' )
148     IEndInitaView = EndInit.GetInPort( 'aView' )
149     IEndInitGate = EndInit.GetInPort( 'Gate' )
150     OEndInitDoLoop = EndInit.GetOutPort( 'DoLoop' )
151     OEndInitindex = EndInit.GetOutPort( 'index' )
152     OEndInitmin = EndInit.GetOutPort( 'min' )
153     OEndInitmax = EndInit.GetOutPort( 'max' )
154     OEndInitmedfield = EndInit.GetOutPort( 'medfield' )
155     OEndInitx1 = EndInit.GetOutPort( 'x1' )
156     OEndInitaVisu = EndInit.GetOutPort( 'aVisu' )
157     OEndInitaView = EndInit.GetOutPort( 'aView' )
158     OEndInitGate = EndInit.GetOutPort( 'Gate' )
159     Init.SetName( 'Init' )
160     Init.SetAuthor( 'LD' )
161     Init.SetComment( 'no comment' )
162     Init.Coords( 216 , 5 )
163     
164     # Creation of Links
165     LInitDisplayaVisuInitaVisu = TestSupervMedfieldLoopFori.Link( OInitDisplayaVisu , IInitaVisu )
166     
167     LInitDisplayaViewInitaView = TestSupervMedfieldLoopFori.Link( OInitDisplayaView , IInitaView )
168     
169     LInitindexEndInitindex = TestSupervMedfieldLoopFori.Link( OInitindex , IEndInitindex )
170     
171     LInitminEndInitmin = TestSupervMedfieldLoopFori.Link( OInitmin , IEndInitmin )
172     
173     LInitmaxEndInitmax = TestSupervMedfieldLoopFori.Link( OInitmax , IEndInitmax )
174     
175     LInitmedfieldMulfield1 = TestSupervMedfieldLoopFori.Link( OInitmedfield , IMulfield1 )
176     
177     LInitx1EndInitx1 = TestSupervMedfieldLoopFori.Link( OInitx1 , IEndInitx1 )
178     
179     LInitx1Mulx1 = TestSupervMedfieldLoopFori.Link( OInitx1 , IMulx1 )
180     
181     LInitaVisuEndInitaVisu = TestSupervMedfieldLoopFori.Link( OInitaVisu , IEndInitaVisu )
182     
183     LInitaViewEndInitaView = TestSupervMedfieldLoopFori.Link( OInitaView , IEndInitaView )
184     
185     LMulreturnEndInitmedfield = TestSupervMedfieldLoopFori.Link( OMulreturn , IEndInitmedfield )
186     
187     # Input datas
188     IInitindex.Input( 0 )
189     IInitmin.Input( 0 )
190     IInitmax.Input( 55 )
191     IInitmedfield.Input( 'IOR:010000001f00000049444c3a53414c4f4d455f4d45442f4649454c44444f55424c453a312e300000010000000000000026000000010100000a0000003132372e302e302e3100ead00e000000fe1948673f000058e60000000021' )
192     IInitx1.Input( 2 )
193     
194     # Output Ports of the graph
195     #OEndInitindex = EndInit.GetOutPort( 'index' )
196     #OEndInitmin = EndInit.GetOutPort( 'min' )
197     #OEndInitmax = EndInit.GetOutPort( 'max' )
198     #OEndInitmedfield = EndInit.GetOutPort( 'medfield' )
199     #OEndInitx1 = EndInit.GetOutPort( 'x1' )
200     #OEndInitaVisu = EndInit.GetOutPort( 'aVisu' )
201     #OEndInitaView = EndInit.GetOutPort( 'aView' )
202     return TestSupervMedfieldLoopFori
203
204
205 TestSupervMedfieldLoopFori = DefTestSupervMedfieldLoopFori()