2 # Generated python file of Graph LoopGraph
6 LoopGraph = Graph( 'LoopGraph' )
7 LoopGraph.SetName( 'LoopGraph' )
8 LoopGraph.SetAuthor( '' )
9 LoopGraph.SetComment( '' )
10 LoopGraph.Coords( 0 , 0 )
12 # Creation of Factory Nodes
14 Mul = LoopGraph.FNode( 'Calculator' , 'Calculator' , 'Mul' )
17 Mul.SetContainer( 'localhost/FactoryServer' )
18 Mul.SetComment( 'Multiply a field by a constant' )
19 Mul.Coords( 387 , 104 )
21 # Creation of InLine Nodes
23 PyInitDisplay.append( 'from LifeCycleCORBA import * ' )
24 PyInitDisplay.append( 'from VISU import * ' )
25 PyInitDisplay.append( 'def InitDisplay(): ' )
26 PyInitDisplay.append( ' # initialize the ORB ' )
27 PyInitDisplay.append( ' orb = CORBA.ORB_init([], CORBA.ORB_ID) ' )
28 PyInitDisplay.append( ' # create an LifeCycleCORBA instance ' )
29 PyInitDisplay.append( ' lcc = LifeCycleCORBA(orb) ' )
30 PyInitDisplay.append( ' # ----------------------------------------- ' )
31 PyInitDisplay.append( ' # loading visu component ' )
32 PyInitDisplay.append( ' aVisu = lcc.FindOrLoadComponent("FactoryServer","Visu") ' )
33 PyInitDisplay.append( ' print "InitDisplay --> aVisu = ",aVisu ' )
34 PyInitDisplay.append( ' aViewManager = aVisu.GetViewManager() ' )
35 PyInitDisplay.append( ' print "InitDisplay --> aViewManager = ",aViewManager ' )
36 PyInitDisplay.append( ' # aView = aViewManager.GetCurrentView() ' )
37 PyInitDisplay.append( ' aView = aViewManager.Create3DView() ' )
38 PyInitDisplay.append( ' print "InitDisplay --> aView = ",aView ' )
39 PyInitDisplay.append( ' return aVisu,aView ' )
40 InitDisplay = LoopGraph.INode( 'InitDisplay' , PyInitDisplay )
41 InitDisplay.OutPort( 'aVisu' , 'objref' )
42 InitDisplay.OutPort( 'aView' , 'objref' )
43 InitDisplay.SetName( 'InitDisplay' )
44 InitDisplay.SetAuthor( '' )
45 InitDisplay.SetComment( 'Compute Node' )
46 InitDisplay.Coords( 0 , 163 )
49 PyDisplayMed.append( 'import os ' )
50 PyDisplayMed.append( 'import SALOME_MED ' )
51 PyDisplayMed.append( 'from VISU import * ' )
52 PyDisplayMed.append( 'from LifeCycleCORBA import * ' )
53 PyDisplayMed.append( 'def DisplayMed(medfield,index,aVisu,aView): ' )
54 PyDisplayMed.append( ' # initialize the ORB ' )
55 PyDisplayMed.append( ' orb = CORBA.ORB_init([''], CORBA.ORB_ID) ' )
56 PyDisplayMed.append( ' # create an LifeCycleCORBA instance ' )
57 PyDisplayMed.append( ' lcc = LifeCycleCORBA(orb) ' )
58 PyDisplayMed.append( ' print " " ' )
59 PyDisplayMed.append( ' print "***************************************************************" ' )
60 PyDisplayMed.append( ' calc = lcc.FindOrLoadComponent("FactoryServer", "Calculator") ' )
61 PyDisplayMed.append( ' print "-----> calc = ",calc ' )
62 PyDisplayMed.append( ' medfilename = "/tmp/LoopGraphFile" + str(index) + ".med" ' )
63 PyDisplayMed.append( ' print "-----> Writing Med field in temporary file : ",medfilename ' )
64 PyDisplayMed.append( ' calc.writeMEDfile(medfield,medfilename) ' )
65 PyDisplayMed.append( ' print "-----> calc = ",calc ' )
66 PyDisplayMed.append( ' print "***************************************************************" ' )
67 PyDisplayMed.append( ' myResult1 = aVisu.ImportFile(medfilename) ' )
68 PyDisplayMed.append( ' print "-----> myResult1 = ",myResult1 ' )
69 PyDisplayMed.append( ' field_name = medfield.getName() ' )
70 PyDisplayMed.append( ' print "-----> field_name = ",field_name ' )
71 PyDisplayMed.append( ' mesh_name = medfield.getSupport().getMesh().getName() ' )
72 PyDisplayMed.append( ' print "-----> mesh_name = ",mesh_name ' )
73 PyDisplayMed.append( ' aMesh1 = aVisu.MeshOnEntity(myResult1,mesh_name,CELL) ' )
74 PyDisplayMed.append( ' print "-----> aMesh1 = ",aMesh1 ' )
75 PyDisplayMed.append( ' aScalarMap1 = aVisu.ScalarMapOnField(myResult1,mesh_name,NODE,field_name,1) ' )
76 PyDisplayMed.append( ' print "-----> aScalarMap1 = ",aScalarMap1 ' )
77 PyDisplayMed.append( ' aView.DisplayOnly(aScalarMap1) ' )
78 PyDisplayMed.append( ' aView.FitAll() ' )
79 PyDisplayMed.append( ' command = "rm " + medfilename ' )
80 PyDisplayMed.append( ' os.system(command) ' )
81 PyDisplayMed.append( ' print "-----> Delete temporary Med file : ",medfilename ' )
82 PyDisplayMed.append( ' print "***************************************************************" ' )
83 PyDisplayMed.append( ' print " " ' )
84 PyDisplayMed.append( ' return medfield ' )
85 DisplayMed = LoopGraph.INode( 'DisplayMed' , PyDisplayMed )
86 DisplayMed.InPort( 'INmedfield' , 'objref' )
87 DisplayMed.InPort( 'index' , 'long' )
88 DisplayMed.InPort( 'aVisu' , 'objref' )
89 DisplayMed.InPort( 'aView' , 'objref' )
90 DisplayMed.OutPort( 'OUTmedfield' , 'objref' )
91 DisplayMed.SetName( 'DisplayMed' )
92 DisplayMed.SetAuthor( '' )
93 DisplayMed.SetComment( 'Compute Node' )
94 DisplayMed.Coords( 594 , 105 )
96 # Creation of Loop Nodes
98 PyInit.append( 'def Init(index,min,max,medfield,x1,aVisu,aView): ' )
99 PyInit.append( ' if max >= min : ' )
100 PyInit.append( ' index = min ' )
101 PyInit.append( ' else : ' )
102 PyInit.append( ' index = max ' )
103 PyInit.append( ' print "Init --> index = ",index ' )
104 PyInit.append( ' print " min = ",min ' )
105 PyInit.append( ' print " max = ",max ' )
106 PyInit.append( ' print " medfield = ",medfield ' )
107 PyInit.append( ' return index,min,max,medfield,x1,aVisu,aView ' )
109 PyMoreInit.append( 'def More(index,min,max,medfield,x1,aVisu,aView): ' )
110 PyMoreInit.append( ' if max >= index : ' )
111 PyMoreInit.append( ' DoLoop = 1 ' )
112 PyMoreInit.append( ' else : ' )
113 PyMoreInit.append( ' DoLoop = 0 ' )
114 PyMoreInit.append( ' print "More --> DoLoop = ",DoLoop ' )
115 PyMoreInit.append( ' print " index = ",index ' )
116 PyMoreInit.append( ' print " min = ",min ' )
117 PyMoreInit.append( ' print " max = ",max ' )
118 PyMoreInit.append( ' print " medfield = ",medfield ' )
119 PyMoreInit.append( ' return DoLoop,index,min,max,medfield,x1,aVisu,aView ' )
121 PyNextInit.append( 'def Next(index,min,max,medfield,x1,aVisu,aView): ' )
122 PyNextInit.append( ' index = index + 1 ' )
123 PyNextInit.append( ' print "Next --> index = ",index ' )
124 PyNextInit.append( ' print " min = ",min ' )
125 PyNextInit.append( ' print " max = ",max ' )
126 PyNextInit.append( ' print " medfield = ",medfield ' )
127 PyNextInit.append( ' return index,min,max,medfield,x1,aVisu,aView ' )
128 Init,EndInit = LoopGraph.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
129 EndInit.SetName( 'EndInit' )
130 EndInit.SetAuthor( 'LD' )
131 EndInit.SetComment( 'no comment' )
132 EndInit.Coords( 776 , 64 )
133 Init.InPort( 'index' , 'long' )
134 Init.InPort( 'min' , 'long' )
135 Init.InPort( 'max' , 'long' )
136 Init.InPort( 'medfield' , 'objref' )
137 Init.InPort( 'x1' , 'double' )
138 Init.InPort( 'aVisu' , 'objref' )
139 Init.InPort( 'aView' , 'objref' )
140 Init.OutPort( 'index' , 'long' )
141 Init.OutPort( 'min' , 'long' )
142 Init.OutPort( 'max' , 'long' )
143 Init.OutPort( 'medfield' , 'objref' )
144 Init.OutPort( 'x1' , 'double' )
145 Init.OutPort( 'aVisu' , 'objref' )
146 Init.OutPort( 'aView' , 'objref' )
147 Init.SetName( 'Init' )
148 Init.SetAuthor( 'LD' )
149 Init.SetComment( 'no comment' )
150 Init.Coords( 205 , 63 )
153 InitDisplayaVisu = InitDisplay.Port( 'aVisu' )
154 InitaVisu = LoopGraph.Link( InitDisplayaVisu , Init.Port( 'aVisu' ) )
156 InitDisplayaView = InitDisplay.Port( 'aView' )
157 InitaView = LoopGraph.Link( InitDisplayaView , Init.Port( 'aView' ) )
159 Initindex = Init.Port( 'index' )
160 EndInitindex = LoopGraph.Link( Initindex , EndInit.Port( 'index' ) )
162 DisplayMedindex = LoopGraph.Link( Initindex , DisplayMed.Port( 'index' ) )
163 DisplayMedindex.AddCoord( 1 , 566 , 215 )
164 DisplayMedindex.AddCoord( 2 , 566 , 96 )
166 Initmin = Init.Port( 'min' )
167 EndInitmin = LoopGraph.Link( Initmin , EndInit.Port( 'min' ) )
169 Initmax = Init.Port( 'max' )
170 EndInitmax = LoopGraph.Link( Initmax , EndInit.Port( 'max' ) )
172 Initmedfield = Init.Port( 'medfield' )
173 Mulfield1 = LoopGraph.Link( Initmedfield , Mul.Port( 'field1' ) )
175 Initx1 = Init.Port( 'x1' )
176 EndInitx1 = LoopGraph.Link( Initx1 , EndInit.Port( 'x1' ) )
178 Mulx1 = LoopGraph.Link( Initx1 , Mul.Port( 'x1' ) )
180 InitaVisu = Init.Port( 'aVisu' )
181 EndInitaVisu = LoopGraph.Link( InitaVisu , EndInit.Port( 'aVisu' ) )
183 DisplayMedaVisu = LoopGraph.Link( InitaVisu , DisplayMed.Port( 'aVisu' ) )
184 DisplayMedaVisu.AddCoord( 1 , 570 , 242 )
185 DisplayMedaVisu.AddCoord( 2 , 569 , 263 )
186 DisplayMedaVisu.AddCoord( 3 , 377 , 264 )
187 DisplayMedaVisu.AddCoord( 4 , 376 , 242 )
189 InitaView = Init.Port( 'aView' )
190 EndInitaView = LoopGraph.Link( InitaView , EndInit.Port( 'aView' ) )
192 DisplayMedaView = LoopGraph.Link( InitaView , DisplayMed.Port( 'aView' ) )
194 Mulreturn = Mul.Port( 'return' )
195 DisplayMedINmedfield = LoopGraph.Link( Mulreturn , DisplayMed.Port( 'INmedfield' ) )
197 DisplayMedOUTmedfield = DisplayMed.Port( 'OUTmedfield' )
198 EndInitmedfield = LoopGraph.Link( DisplayMedOUTmedfield , EndInit.Port( 'medfield' ) )
200 # Creation of Input datas
201 Initindex = Init.Input( 'index' , 0)
202 Initmin = Init.Input( 'min' , 0)
203 Initmax = Init.Input( 'max' , 4)
204 Initx1 = Init.Input( 'x1' , 2)
206 # Missing Input datas
207 Initmedfield = Init.Port( 'medfield' )
209 # Creation of Output variables
210 EndInitindex = EndInit.Port( 'index' )
211 EndInitmin = EndInit.Port( 'min' )
212 EndInitmax = EndInit.Port( 'max' )
213 EndInitmedfield = EndInit.Port( 'medfield' )
214 EndInitx1 = EndInit.Port( 'x1' )
215 EndInitaVisu = EndInit.Port( 'aVisu' )
216 EndInitaView = EndInit.Port( 'aView' )