2 # Generated python file of Graph aNewDataFlow
6 aNewDataFlow = Graph( 'aNewDataFlow' )
7 aNewDataFlow.SetName( 'aNewDataFlow' )
8 aNewDataFlow.SetAuthor( '' )
9 aNewDataFlow.SetComment( '' )
10 aNewDataFlow.Coords( 0 , 0 )
12 # Creation of Factory Nodes
14 # Creation of InLine Nodes
16 PyInitDisplay.append( 'import os ' )
17 PyInitDisplay.append( 'import time ' )
18 PyInitDisplay.append( 'from LifeCycleCORBA import * ' )
19 PyInitDisplay.append( 'from SALOME_NamingServicePy import * ' )
20 PyInitDisplay.append( 'import SALOMEDS ' )
21 PyInitDisplay.append( 'from VISU import * ' )
22 PyInitDisplay.append( 'def InitDisplay(): ' )
23 PyInitDisplay.append( ' # --- initialize the ORB ' )
24 PyInitDisplay.append( ' orb = CORBA.ORB_init([], CORBA.ORB_ID) ' )
25 PyInitDisplay.append( ' # --- create a LifeCycleCORBA instance ' )
26 PyInitDisplay.append( ' lcc = LifeCycleCORBA(orb) ' )
27 PyInitDisplay.append( ' # --- create a naming service instance ' )
28 PyInitDisplay.append( ' naming_service = SALOME_NamingServicePy_i(orb) ' )
29 PyInitDisplay.append( ' # --- get Study Manager reference ' )
30 PyInitDisplay.append( ' obj = naming_service.Resolve('myStudyManager') ' )
31 PyInitDisplay.append( ' StudyManager = obj._narrow(SALOMEDS.StudyManager) ' )
32 PyInitDisplay.append( ' # --- load visu component ' )
33 PyInitDisplay.append( ' aVisu = lcc.FindOrLoadComponent("FactoryServer","VISU") ' )
34 PyInitDisplay.append( ' aStudy = StudyManager.GetStudyByID(1) ' )
35 PyInitDisplay.append( ' aVisu.SetCurrentStudy(aStudy) ' )
36 PyInitDisplay.append( ' print "InitDisplay --> aVisu ", aVisu ' )
37 PyInitDisplay.append( ' time.sleep(2) ' )
38 PyInitDisplay.append( ' #aViewManager=aVisu.GetViewManager() ' )
39 PyInitDisplay.append( ' #print "InitDisplay --> aViewManager ", aViewManager ' )
40 PyInitDisplay.append( ' #time.sleep(2) ' )
41 PyInitDisplay.append( ' #aView=aViewManager.GetCurrentView() ' )
42 PyInitDisplay.append( ' #aView=aViewManager.Create3DView() ' )
43 PyInitDisplay.append( ' #print "InitDisplay --> aView ", aView ' )
44 PyInitDisplay.append( ' #time.sleep(2) ' )
45 PyInitDisplay.append( ' medFile = "TimeStamps.med" ' )
46 PyInitDisplay.append( ' medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile ' )
47 PyInitDisplay.append( ' myResult = aVisu.ImportFile(medFile) ' )
48 PyInitDisplay.append( ' print "InitDisplay --> myResult ", myResult ' )
49 PyInitDisplay.append( ' return aVisu,myResult ' )
50 PyInitDisplay.append( '' )
51 InitDisplay = aNewDataFlow.INode( 'InitDisplay' , PyInitDisplay )
52 InitDisplay.SetName( 'InitDisplay' )
53 InitDisplay.SetAuthor( '' )
54 InitDisplay.SetComment( 'Compute Node' )
55 InitDisplay.Coords( 13 , 173 )
56 InitDisplay.OutPort( 'aVisu' , 'objref' )
57 InitDisplay.OutPort( 'myResult' , 'objref' )
60 PyDisplayVitesse.append( 'import VISU ' )
61 PyDisplayVitesse.append( 'import os ' )
62 PyDisplayVitesse.append( 'import time ' )
63 PyDisplayVitesse.append( 'def DisplayVitesse(index,aVisu,aView,aResult,x1): ' )
64 PyDisplayVitesse.append( ' print "----- Display 1 index = ", index,aVisu,aView,aResult,x1 ' )
65 PyDisplayVitesse.append( ' aMeshName ="dom" ' )
66 PyDisplayVitesse.append( ' myFieldName = "vitesse" ' )
67 PyDisplayVitesse.append( ' anEntity = VISU.NODE ' )
68 PyDisplayVitesse.append( ' aMesh = aVisu.MeshOnEntity(aResult, aMeshName, anEntity) ' )
69 PyDisplayVitesse.append( ' print "----- Display 2 ", aMesh ' )
70 PyDisplayVitesse.append( ' aScalarMap=aVisu.ScalarMapOnField(aResult,aMeshName,anEntity,myFieldName,x1) ' )
71 PyDisplayVitesse.append( ' print "----- Display 4" ' )
72 PyDisplayVitesse.append( ' if aScalarMap is not None: ' )
73 PyDisplayVitesse.append( ' aScalarMap.SetScaling(VISU.LINEAR) ' )
74 PyDisplayVitesse.append( ' else: ' )
75 PyDisplayVitesse.append( ' print "Null scalar map is created" ' )
76 PyDisplayVitesse.append( ' print "----- Display 5" ' )
77 PyDisplayVitesse.append( ' aView.DisplayOnly(aScalarMap) ' )
78 PyDisplayVitesse.append( ' aView.FitAll() ' )
79 PyDisplayVitesse.append( ' aView.Update() ' )
80 PyDisplayVitesse.append( ' print "----- Display 6" ' )
81 PyDisplayVitesse.append( ' theResult=aResult ' )
82 PyDisplayVitesse.append( ' #time.sleep(2) ' )
83 PyDisplayVitesse.append( ' return theResult ' )
84 PyDisplayVitesse.append( '' )
85 DisplayVitesse = aNewDataFlow.INode( 'DisplayVitesse' , PyDisplayVitesse )
86 DisplayVitesse.SetName( 'DisplayVitesse' )
87 DisplayVitesse.SetAuthor( '' )
88 DisplayVitesse.SetComment( 'Compute Node' )
89 DisplayVitesse.Coords( 609 , 506 )
90 DisplayVitesse.InPort( 'index' , 'string' )
91 DisplayVitesse.InPort( 'aVisu' , 'objref' )
92 DisplayVitesse.InPort( 'aView' , 'objref' )
93 DisplayVitesse.InPort( 'aResult' , 'objref' )
94 DisplayVitesse.InPort( 'x1' , 'double' )
95 DisplayVitesse.OutPort( 'theResult' , 'objref' )
98 PyCreateView.append( 'def CreateView(aVisu,aResult) : ' )
99 PyCreateView.append( ' vm=aVisu.GetViewManager() ' )
100 PyCreateView.append( ' aView=vm.Create3DView() ' )
101 PyCreateView.append( ' theVisu=aVisu ' )
102 PyCreateView.append( ' theResult=aResult ' )
103 PyCreateView.append( ' return aView,theVisu,theResult ' )
104 CreateView = aNewDataFlow.INode( 'CreateView' , PyCreateView )
105 CreateView.SetName( 'CreateView' )
106 CreateView.SetAuthor( '' )
107 CreateView.SetComment( 'Compute Node' )
108 CreateView.Coords( 221 , 563 )
109 CreateView.InPort( 'aVisu' , 'objref' )
110 CreateView.InPort( 'aResult' , 'objref' )
111 CreateView.OutPort( 'aView' , 'objref' )
112 CreateView.OutPort( 'theVisu' , 'objref' )
113 CreateView.OutPort( 'theResult' , 'objref' )
115 # Creation of Loop Nodes
117 PyInit.append( 'def Init(index,min,max,aVisu,aView,myResult,x1): ' )
118 PyInit.append( ' if max >= min : ' )
119 PyInit.append( ' index = min ' )
120 PyInit.append( ' else : ' )
121 PyInit.append( ' index = max ' )
122 PyInit.append( ' print "---- Init ",index,min,max,aVisu,aView,myResult,x1 ' )
123 PyInit.append( ' return index,min,max,aVisu,aView,myResult,x1 ' )
125 PyMoreInit.append( 'def More(index,min,max,aVisu,aView,myResult,x1): ' )
126 PyMoreInit.append( ' if max >= index : ' )
127 PyMoreInit.append( ' DoLoop = 1 ' )
128 PyMoreInit.append( ' else : ' )
129 PyMoreInit.append( ' DoLoop = 0 ' )
130 PyMoreInit.append( ' print "---- More",index,min,max,aVisu,aView,myResult,x1 ' )
131 PyMoreInit.append( ' return DoLoop,index,min,max,aVisu,aView,myResult,x1 ' )
133 PyNextInit.append( 'def Next(index,min,max,aVisu,aView,myResult,x1): ' )
134 PyNextInit.append( ' index = index + 1 ' )
135 PyNextInit.append( ' x1=x1+1.0 ' )
136 PyNextInit.append( ' print "---- Next",index,min,max,aVisu,aView,myResult,x1 ' )
137 PyNextInit.append( ' return index,min,max,aVisu,aView,myResult,x1 ' )
138 Init,EndOfInit = aNewDataFlow.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
139 EndOfInit.SetName( 'EndOfInit' )
140 EndOfInit.SetAuthor( '' )
141 EndOfInit.SetComment( '' )
142 EndOfInit.Coords( 797 , 507 )
144 EndOfInit.SetPyFunction( 'EndInit' , PyEndOfInit )
145 Init.SetName( 'Init' )
147 Init.SetComment( '' )
148 Init.Coords( 428 , 493 )
149 Init.InPort( 'index' , 'long' )
150 Init.InPort( 'min' , 'long' )
151 Init.InPort( 'max' , 'long' )
152 Init.InPort( 'aVisu' , 'objref' )
153 Init.InPort( 'aView' , 'objref' )
154 Init.InPort( 'aResult' , 'objref' )
155 Init.InPort( 'x1' , 'double' )
156 Init.OutPort( 'index' , 'long' )
157 Init.OutPort( 'min' , 'long' )
158 Init.OutPort( 'max' , 'long' )
159 Init.OutPort( 'aVisu' , 'objref' )
160 Init.OutPort( 'aView' , 'objref' )
161 Init.OutPort( 'aResult' , 'objref' )
162 Init.OutPort( 'x1' , 'double' )
165 PyLoopOnViews.append( 'def InitViews( aVisu,aResult,ViewCount,MinCount,MaxCount ): ' )
166 PyLoopOnViews.append( ' ViewCount=MinCount ' )
167 PyLoopOnViews.append( ' return aVisu,aResult,ViewCount,MinCount,MaxCount ' )
168 PyMoreLoopOnViews = []
169 PyMoreLoopOnViews.append( 'def MoreViews( aVisu,aResult,ViewCount,MinCount,MaxCount ): ' )
170 PyMoreLoopOnViews.append( ' if ViewCount < MaxCount: ' )
171 PyMoreLoopOnViews.append( ' return 1,aVisu,aResult,ViewCount,MinCount,MaxCount ' )
172 PyMoreLoopOnViews.append( ' return 0,aVisu,aResult,ViewCount,MinCount,MaxCount ' )
173 PyNextLoopOnViews = []
174 PyNextLoopOnViews.append( 'def NextViews( aVisu,aResult,ViewCount,MinCount,MaxCount ): ' )
175 PyNextLoopOnViews.append( ' ViewCount = ViewCount + 1 ' )
176 PyNextLoopOnViews.append( ' return aVisu,aResult,ViewCount,MinCount,MaxCount ' )
177 LoopOnViews,EndOfLoopOnViews = aNewDataFlow.LNode( 'InitViews' , PyLoopOnViews , 'MoreViews' , PyMoreLoopOnViews , 'NextViews' , PyNextLoopOnViews )
178 EndOfLoopOnViews.SetName( 'EndOfLoopOnViews' )
179 EndOfLoopOnViews.SetAuthor( '' )
180 EndOfLoopOnViews.SetComment( '' )
181 EndOfLoopOnViews.Coords( 773 , 224 )
182 PyEndOfLoopOnViews = []
183 EndOfLoopOnViews.SetPyFunction( 'EndInitViews' , PyEndOfLoopOnViews )
184 LoopOnViews.SetName( 'LoopOnViews' )
185 LoopOnViews.SetAuthor( '' )
186 LoopOnViews.SetComment( '' )
187 LoopOnViews.Coords( 219 , 218 )
188 LoopOnViews.InPort( 'aVisu' , 'objref' )
189 LoopOnViews.InPort( 'aResult' , 'objref' )
190 LoopOnViews.InPort( 'ViewCount' , 'int' )
191 LoopOnViews.InPort( 'MinCount' , 'int' )
192 LoopOnViews.InPort( 'MaxCount' , 'int' )
193 LoopOnViews.OutPort( 'aVisu' , 'objref' )
194 LoopOnViews.OutPort( 'aResult' , 'objref' )
195 LoopOnViews.OutPort( 'ViewCount' , 'int' )
196 LoopOnViews.OutPort( 'MinCount' , 'int' )
197 LoopOnViews.OutPort( 'MaxCount' , 'int' )
200 InitDisplayaVisu = InitDisplay.Port( 'aVisu' )
201 LoopOnViewsInGate = aNewDataFlow.Link( InitDisplayaVisu , LoopOnViews.Port( 'InGate' ) )
203 LoopOnViewsaVisu = aNewDataFlow.Link( InitDisplayaVisu , LoopOnViews.Port( 'aVisu' ) )
205 InitDisplaymyResult = InitDisplay.Port( 'myResult' )
206 LoopOnViewsaResult = aNewDataFlow.Link( InitDisplaymyResult , LoopOnViews.Port( 'aResult' ) )
208 Initindex = Init.Port( 'index' )
209 EndOfInitindex = aNewDataFlow.Link( Initindex , EndOfInit.Port( 'index' ) )
211 DisplayVitesseindex = aNewDataFlow.Link( Initindex , DisplayVitesse.Port( 'index' ) )
212 DisplayVitesseindex.AddCoord( 1 , 590 , 587 )
213 DisplayVitesseindex.AddCoord( 2 , 591 , 527 )
215 Initmin = Init.Port( 'min' )
216 EndOfInitmin = aNewDataFlow.Link( Initmin , EndOfInit.Port( 'min' ) )
218 Initmax = Init.Port( 'max' )
219 EndOfInitmax = aNewDataFlow.Link( Initmax , EndOfInit.Port( 'max' ) )
221 InitaVisu = Init.Port( 'aVisu' )
222 EndOfInitaVisu = aNewDataFlow.Link( InitaVisu , EndOfInit.Port( 'aVisu' ) )
224 DisplayVitesseaVisu = aNewDataFlow.Link( InitaVisu , DisplayVitesse.Port( 'aVisu' ) )
226 InitaView = Init.Port( 'aView' )
227 EndOfInitaView = aNewDataFlow.Link( InitaView , EndOfInit.Port( 'aView' ) )
229 DisplayVitesseaView = aNewDataFlow.Link( InitaView , DisplayVitesse.Port( 'aView' ) )
231 InitaResult = Init.Port( 'aResult' )
232 DisplayVitesseaResult = aNewDataFlow.Link( InitaResult , DisplayVitesse.Port( 'aResult' ) )
234 Initx1 = Init.Port( 'x1' )
235 EndOfInitx1 = aNewDataFlow.Link( Initx1 , EndOfInit.Port( 'x1' ) )
237 DisplayVitessex1 = aNewDataFlow.Link( Initx1 , DisplayVitesse.Port( 'x1' ) )
239 EndOfInitaResult = EndOfInit.Port( 'aResult' )
240 EndOfLoopOnViewsaResult = aNewDataFlow.Link( EndOfInitaResult , EndOfLoopOnViews.Port( 'aResult' ) )
241 EndOfLoopOnViewsaResult.AddCoord( 1 , 762 , 288 )
242 EndOfLoopOnViewsaResult.AddCoord( 2 , 763 , 424 )
243 EndOfLoopOnViewsaResult.AddCoord( 3 , 972 , 425 )
244 EndOfLoopOnViewsaResult.AddCoord( 4 , 971 , 687 )
246 DisplayVitessetheResult = DisplayVitesse.Port( 'theResult' )
247 EndOfInitaResult = aNewDataFlow.Link( DisplayVitessetheResult , EndOfInit.Port( 'aResult' ) )
248 EndOfInitaResult.AddCoord( 1 , 787 , 687 )
249 EndOfInitaResult.AddCoord( 2 , 786 , 585 )
251 LoopOnViewsaVisu = LoopOnViews.Port( 'aVisu' )
252 EndOfLoopOnViewsaVisu = aNewDataFlow.Link( LoopOnViewsaVisu , EndOfLoopOnViews.Port( 'aVisu' ) )
254 CreateViewaVisu = aNewDataFlow.Link( LoopOnViewsaVisu , CreateView.Port( 'aVisu' ) )
255 CreateViewaVisu.AddCoord( 1 , 186 , 643 )
256 CreateViewaVisu.AddCoord( 2 , 186 , 442 )
257 CreateViewaVisu.AddCoord( 3 , 400 , 441 )
258 CreateViewaVisu.AddCoord( 4 , 401 , 251 )
260 LoopOnViewsaResult = LoopOnViews.Port( 'aResult' )
261 CreateViewaResult = aNewDataFlow.Link( LoopOnViewsaResult , CreateView.Port( 'aResult' ) )
262 CreateViewaResult.AddCoord( 1 , 169 , 671 )
263 CreateViewaResult.AddCoord( 2 , 170 , 412 )
264 CreateViewaResult.AddCoord( 3 , 386 , 413 )
265 CreateViewaResult.AddCoord( 4 , 387 , 280 )
267 LoopOnViewsViewCount = LoopOnViews.Port( 'ViewCount' )
268 EndOfLoopOnViewsViewCount = aNewDataFlow.Link( LoopOnViewsViewCount , EndOfLoopOnViews.Port( 'ViewCount' ) )
270 LoopOnViewsMinCount = LoopOnViews.Port( 'MinCount' )
271 EndOfLoopOnViewsMinCount = aNewDataFlow.Link( LoopOnViewsMinCount , EndOfLoopOnViews.Port( 'MinCount' ) )
273 LoopOnViewsMaxCount = LoopOnViews.Port( 'MaxCount' )
274 EndOfLoopOnViewsMaxCount = aNewDataFlow.Link( LoopOnViewsMaxCount , EndOfLoopOnViews.Port( 'MaxCount' ) )
276 CreateViewaView = CreateView.Port( 'aView' )
277 InitaView = aNewDataFlow.Link( CreateViewaView , Init.Port( 'aView' ) )
279 CreateViewtheVisu = CreateView.Port( 'theVisu' )
280 InitaVisu = aNewDataFlow.Link( CreateViewtheVisu , Init.Port( 'aVisu' ) )
282 CreateViewtheResult = CreateView.Port( 'theResult' )
283 InitaResult = aNewDataFlow.Link( CreateViewtheResult , Init.Port( 'aResult' ) )
285 # Creation of Input datas
286 Initindex = Init.Input( 'index' , 1)
287 Initmin = Init.Input( 'min' , 1)
288 Initmax = Init.Input( 'max' , 10)
289 Initx1 = Init.Input( 'x1' , 1)
290 LoopOnViewsViewCount = LoopOnViews.Input( 'ViewCount' , 0)
291 LoopOnViewsMinCount = LoopOnViews.Input( 'MinCount' , 0)
292 LoopOnViewsMaxCount = LoopOnViews.Input( 'MaxCount' , 10)
294 # Creation of Output variables
295 EndOfInitindex = EndOfInit.Port( 'index' )
296 EndOfInitmin = EndOfInit.Port( 'min' )
297 EndOfInitmax = EndOfInit.Port( 'max' )
298 EndOfInitaVisu = EndOfInit.Port( 'aVisu' )
299 EndOfInitaView = EndOfInit.Port( 'aView' )
300 EndOfInitx1 = EndOfInit.Port( 'x1' )
301 EndOfLoopOnViewsaVisu = EndOfLoopOnViews.Port( 'aVisu' )
302 EndOfLoopOnViewsaResult = EndOfLoopOnViews.Port( 'aResult' )
303 EndOfLoopOnViewsViewCount = EndOfLoopOnViews.Port( 'ViewCount' )
304 EndOfLoopOnViewsMinCount = EndOfLoopOnViews.Port( 'MinCount' )
305 EndOfLoopOnViewsMaxCount = EndOfLoopOnViews.Port( 'MaxCount' )