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