1 # Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Generated python file of Graph TestSupervMedfieldLoopForiVisu
26 # Graph creation of TestSupervMedfieldLoopForiVisu
27 def DefTestSupervMedfieldLoopForiVisu() :
28 TestSupervMedfieldLoopForiVisu = Graph( 'TestSupervMedfieldLoopForiVisu' )
29 TestSupervMedfieldLoopForiVisu.SetName( 'TestSupervMedfieldLoopForiVisu' )
30 TestSupervMedfieldLoopForiVisu.SetAuthor( '' )
31 TestSupervMedfieldLoopForiVisu.SetComment( '' )
32 TestSupervMedfieldLoopForiVisu.Coords( 0 , 0 )
34 # Creation of Factory Nodes
36 Mul = TestSupervMedfieldLoopForiVisu.FNode( 'Calculator' , 'Calculator' , 'Mul' )
39 Mul.SetContainer( 'localhost/FactoryServer' )
40 Mul.SetComment( 'Multiply a field by a constant' )
41 Mul.Coords( 387 , 104 )
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' )
48 # Creation of InLine Nodes
50 PyInitDisplay.append( 'from LifeCycleCORBA import * ' )
51 PyInitDisplay.append( 'from VISU import * ' )
52 PyInitDisplay.append( 'def InitDisplay(): ' )
53 PyInitDisplay.append( ' # initialize the ORB ' )
54 PyInitDisplay.append( ' orb = CORBA.ORB_init([], CORBA.ORB_ID) ' )
55 PyInitDisplay.append( ' # create an LifeCycleCORBA instance ' )
56 PyInitDisplay.append( ' lcc = LifeCycleCORBA(orb) ' )
57 PyInitDisplay.append( ' # ----------------------------------------- ' )
58 PyInitDisplay.append( ' # loading visu component ' )
59 PyInitDisplay.append( ' aVisu = lcc.FindOrLoadComponent("FactoryServer","VISU") ' )
60 PyInitDisplay.append( ' print "InitDisplay --> aVisu = ",aVisu ' )
61 PyInitDisplay.append( ' aViewManager = aVisu.GetViewManager() ' )
62 PyInitDisplay.append( ' print "InitDisplay --> aViewManager = ",aViewManager ' )
63 PyInitDisplay.append( ' # aView = aViewManager.GetCurrentView() ' )
64 PyInitDisplay.append( ' aView = aViewManager.Create3DView() ' )
65 PyInitDisplay.append( ' print "InitDisplay --> aView = ",aView ' )
66 PyInitDisplay.append( ' return aVisu,aView ' )
67 InitDisplay = TestSupervMedfieldLoopForiVisu.INode( 'InitDisplay' , PyInitDisplay )
68 InitDisplay.SetName( 'InitDisplay' )
69 InitDisplay.SetAuthor( '' )
70 InitDisplay.SetComment( 'Compute Node' )
71 InitDisplay.Coords( 0 , 163 )
72 IInitDisplayGate = InitDisplay.GetInPort( 'Gate' )
73 OInitDisplayaVisu = InitDisplay.OutPort( 'aVisu' , 'objref' )
74 OInitDisplayaView = InitDisplay.OutPort( 'aView' , 'objref' )
75 OInitDisplayGate = InitDisplay.GetOutPort( 'Gate' )
78 PyDisplayMed.append( 'import os ' )
79 PyDisplayMed.append( 'import SALOME_MED ' )
80 PyDisplayMed.append( 'from VISU import * ' )
81 PyDisplayMed.append( 'from LifeCycleCORBA import * ' )
82 PyDisplayMed.append( 'def DisplayMed(medfield,index,aVisu,aView): ' )
83 PyDisplayMed.append( ' # initialize the ORB ' )
84 PyDisplayMed.append( ' orb = CORBA.ORB_init([''], CORBA.ORB_ID) ' )
85 PyDisplayMed.append( ' # create an LifeCycleCORBA instance ' )
86 PyDisplayMed.append( ' lcc = LifeCycleCORBA(orb) ' )
87 PyDisplayMed.append( ' print " " ' )
88 PyDisplayMed.append( ' print "***************************************************************" ' )
89 PyDisplayMed.append( ' calc = lcc.FindOrLoadComponent("FactoryServer", "Calculator") ' )
90 PyDisplayMed.append( ' print "-----> calc = ",calc ' )
91 PyDisplayMed.append( ' medfilename = "/tmp/LoopGraphFile" + str(index) + ".med" ' )
92 PyDisplayMed.append( ' print "-----> Writing Med field in temporary file : ",medfilename ' )
93 PyDisplayMed.append( ' calc.writeMEDfile(medfield,medfilename) ' )
94 PyDisplayMed.append( ' print "-----> calc = ",calc ' )
95 PyDisplayMed.append( ' print "***************************************************************" ' )
96 PyDisplayMed.append( ' myResult1 = aVisu.ImportFile(medfilename) ' )
97 PyDisplayMed.append( ' print "-----> myResult1 = ",myResult1 ' )
98 PyDisplayMed.append( ' field_name = medfield.getName() ' )
99 PyDisplayMed.append( ' print "-----> field_name = ",field_name ' )
100 PyDisplayMed.append( ' mesh_name = medfield.getSupport().getMesh().getName() ' )
101 PyDisplayMed.append( ' print "-----> mesh_name = ",mesh_name ' )
102 PyDisplayMed.append( ' aMesh1 = aVisu.MeshOnEntity(myResult1,mesh_name,CELL) ' )
103 PyDisplayMed.append( ' print "-----> aMesh1 = ",aMesh1 ' )
104 PyDisplayMed.append( ' aScalarMap1 = aVisu.ScalarMapOnField(myResult1,mesh_name,NODE,field_name,1) ' )
105 PyDisplayMed.append( ' print "-----> aScalarMap1 = ",aScalarMap1 ' )
106 PyDisplayMed.append( ' aView.DisplayOnly(aScalarMap1) ' )
107 PyDisplayMed.append( ' aView.FitAll() ' )
108 PyDisplayMed.append( ' command = "rm " + medfilename ' )
109 PyDisplayMed.append( ' os.system(command) ' )
110 PyDisplayMed.append( ' print "-----> Delete temporary Med file : ",medfilename ' )
111 PyDisplayMed.append( ' print "***************************************************************" ' )
112 PyDisplayMed.append( ' print " " ' )
113 PyDisplayMed.append( ' return medfield ' )
114 DisplayMed = TestSupervMedfieldLoopForiVisu.INode( 'DisplayMed' , PyDisplayMed )
115 DisplayMed.SetName( 'DisplayMed' )
116 DisplayMed.SetAuthor( '' )
117 DisplayMed.SetComment( 'Compute Node' )
118 DisplayMed.Coords( 594 , 105 )
119 IDisplayMedINmedfield = DisplayMed.InPort( 'INmedfield' , 'objref' )
120 IDisplayMedindex = DisplayMed.InPort( 'index' , 'long' )
121 IDisplayMedaVisu = DisplayMed.InPort( 'aVisu' , 'objref' )
122 IDisplayMedaView = DisplayMed.InPort( 'aView' , 'objref' )
123 IDisplayMedGate = DisplayMed.GetInPort( 'Gate' )
124 ODisplayMedOUTmedfield = DisplayMed.OutPort( 'OUTmedfield' , 'objref' )
125 ODisplayMedGate = DisplayMed.GetOutPort( 'Gate' )
127 # Creation of Loop Nodes
129 PyInit.append( 'def Init(index,min,max,medfield,x1,aVisu,aView): ' )
130 PyInit.append( ' if max >= min : ' )
131 PyInit.append( ' index = min ' )
132 PyInit.append( ' else : ' )
133 PyInit.append( ' index = max ' )
134 PyInit.append( ' print "Init --> index = ",index ' )
135 PyInit.append( ' print " min = ",min ' )
136 PyInit.append( ' print " max = ",max ' )
137 PyInit.append( ' print " medfield = ",medfield ' )
138 PyInit.append( ' return index,min,max,medfield,x1,aVisu,aView ' )
140 PyMoreInit.append( 'def More(index,min,max,medfield,x1,aVisu,aView): ' )
141 PyMoreInit.append( ' if max >= index : ' )
142 PyMoreInit.append( ' DoLoop = 1 ' )
143 PyMoreInit.append( ' else : ' )
144 PyMoreInit.append( ' DoLoop = 0 ' )
145 PyMoreInit.append( ' print "More --> DoLoop = ",DoLoop ' )
146 PyMoreInit.append( ' print " index = ",index ' )
147 PyMoreInit.append( ' print " min = ",min ' )
148 PyMoreInit.append( ' print " max = ",max ' )
149 PyMoreInit.append( ' print " medfield = ",medfield ' )
150 PyMoreInit.append( ' return DoLoop,index,min,max,medfield,x1,aVisu,aView ' )
152 PyNextInit.append( 'def Next(index,min,max,medfield,x1,aVisu,aView): ' )
153 PyNextInit.append( ' index = index + 1 ' )
154 PyNextInit.append( ' print "Next --> index = ",index ' )
155 PyNextInit.append( ' print " min = ",min ' )
156 PyNextInit.append( ' print " max = ",max ' )
157 PyNextInit.append( ' print " medfield = ",medfield ' )
158 PyNextInit.append( ' return index,min,max,medfield,x1,aVisu,aView ' )
159 Init,EndInit = TestSupervMedfieldLoopForiVisu.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
160 EndInit.SetName( 'EndInit' )
161 EndInit.SetAuthor( 'LD' )
162 EndInit.SetComment( 'no comment' )
163 EndInit.Coords( 776 , 64 )
165 EndInit.SetPyFunction( '' , PyEndInit )
166 IInitDoLoop = Init.GetInPort( 'DoLoop' )
167 IInitindex = Init.InPort( 'index' , 'long' )
168 IInitmin = Init.InPort( 'min' , 'long' )
169 IInitmax = Init.InPort( 'max' , 'long' )
170 IInitmedfield = Init.InPort( 'medfield' , 'objref' )
171 IInitx1 = Init.InPort( 'x1' , 'double' )
172 IInitaVisu = Init.InPort( 'aVisu' , 'objref' )
173 IInitaView = Init.InPort( 'aView' , 'objref' )
174 IInitGate = Init.GetInPort( 'Gate' )
175 OInitDoLoop = Init.GetOutPort( 'DoLoop' )
176 OInitindex = Init.GetOutPort( 'index' )
177 OInitmin = Init.GetOutPort( 'min' )
178 OInitmax = Init.GetOutPort( 'max' )
179 OInitmedfield = Init.GetOutPort( 'medfield' )
180 OInitx1 = Init.GetOutPort( 'x1' )
181 OInitaVisu = Init.GetOutPort( 'aVisu' )
182 OInitaView = Init.GetOutPort( 'aView' )
183 IEndInitDoLoop = EndInit.GetInPort( 'DoLoop' )
184 IEndInitindex = EndInit.GetInPort( 'index' )
185 IEndInitmin = EndInit.GetInPort( 'min' )
186 IEndInitmax = EndInit.GetInPort( 'max' )
187 IEndInitmedfield = EndInit.GetInPort( 'medfield' )
188 IEndInitx1 = EndInit.GetInPort( 'x1' )
189 IEndInitaVisu = EndInit.GetInPort( 'aVisu' )
190 IEndInitaView = EndInit.GetInPort( 'aView' )
191 IEndInitGate = EndInit.GetInPort( 'Gate' )
192 OEndInitDoLoop = EndInit.GetOutPort( 'DoLoop' )
193 OEndInitindex = EndInit.GetOutPort( 'index' )
194 OEndInitmin = EndInit.GetOutPort( 'min' )
195 OEndInitmax = EndInit.GetOutPort( 'max' )
196 OEndInitmedfield = EndInit.GetOutPort( 'medfield' )
197 OEndInitx1 = EndInit.GetOutPort( 'x1' )
198 OEndInitaVisu = EndInit.GetOutPort( 'aVisu' )
199 OEndInitaView = EndInit.GetOutPort( 'aView' )
200 OEndInitGate = EndInit.GetOutPort( 'Gate' )
201 Init.SetName( 'Init' )
202 Init.SetAuthor( 'LD' )
203 Init.SetComment( 'no comment' )
204 Init.Coords( 205 , 63 )
207 LInitDisplayaVisuInitaVisu = TestSupervMedfieldLoopForiVisu.Link( OInitDisplayaVisu , IInitaVisu )
209 LInitDisplayaViewInitaView = TestSupervMedfieldLoopForiVisu.Link( OInitDisplayaView , IInitaView )
211 LInitindexEndInitindex = TestSupervMedfieldLoopForiVisu.Link( OInitindex , IEndInitindex )
213 LInitindexDisplayMedindex = TestSupervMedfieldLoopForiVisu.Link( OInitindex , IDisplayMedindex )
214 LInitindexDisplayMedindex.AddCoord( 1 , 566 , 215 )
215 LInitindexDisplayMedindex.AddCoord( 2 , 566 , 96 )
217 LInitminEndInitmin = TestSupervMedfieldLoopForiVisu.Link( OInitmin , IEndInitmin )
219 LInitmaxEndInitmax = TestSupervMedfieldLoopForiVisu.Link( OInitmax , IEndInitmax )
221 LInitmedfieldMulfield1 = TestSupervMedfieldLoopForiVisu.Link( OInitmedfield , IMulfield1 )
223 LInitx1EndInitx1 = TestSupervMedfieldLoopForiVisu.Link( OInitx1 , IEndInitx1 )
225 LInitx1Mulx1 = TestSupervMedfieldLoopForiVisu.Link( OInitx1 , IMulx1 )
227 LInitaVisuEndInitaVisu = TestSupervMedfieldLoopForiVisu.Link( OInitaVisu , IEndInitaVisu )
229 LInitaVisuDisplayMedaVisu = TestSupervMedfieldLoopForiVisu.Link( OInitaVisu , IDisplayMedaVisu )
230 LInitaVisuDisplayMedaVisu.AddCoord( 1 , 570 , 242 )
231 LInitaVisuDisplayMedaVisu.AddCoord( 2 , 569 , 263 )
232 LInitaVisuDisplayMedaVisu.AddCoord( 3 , 377 , 264 )
233 LInitaVisuDisplayMedaVisu.AddCoord( 4 , 376 , 242 )
235 LInitaViewEndInitaView = TestSupervMedfieldLoopForiVisu.Link( OInitaView , IEndInitaView )
237 LInitaViewDisplayMedaView = TestSupervMedfieldLoopForiVisu.Link( OInitaView , IDisplayMedaView )
239 LMulreturnDisplayMedINmedfield = TestSupervMedfieldLoopForiVisu.Link( OMulreturn , IDisplayMedINmedfield )
241 LDisplayMedOUTmedfieldEndInitmedfield = TestSupervMedfieldLoopForiVisu.Link( ODisplayMedOUTmedfield , IEndInitmedfield )
244 IInitindex.Input( 0 )
249 # Input Ports of the graph
250 #IInitmedfield = Init.GetInPort( 'medfield' )
252 # Output Ports of the graph
253 #OEndInitindex = EndInit.GetOutPort( 'index' )
254 #OEndInitmin = EndInit.GetOutPort( 'min' )
255 #OEndInitmax = EndInit.GetOutPort( 'max' )
256 #OEndInitmedfield = EndInit.GetOutPort( 'medfield' )
257 #OEndInitx1 = EndInit.GetOutPort( 'x1' )
258 #OEndInitaVisu = EndInit.GetOutPort( 'aVisu' )
259 #OEndInitaView = EndInit.GetOutPort( 'aView' )
260 return TestSupervMedfieldLoopForiVisu
263 TestSupervMedfieldLoopForiVisu = DefTestSupervMedfieldLoopForiVisu()