Salome HOME
Intersection: renaming some variables and refactor to make the algo easier to read.
[tools/medcoupling.git] / doc / tutorial / atestMEDCouplingCorba1.rst
1
2 .. _python_testMEDCouplingcorba1_solution:
3
4 Visualiser une instance de MEDCoupling dans ParaViS à travers CORBA
5 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6
7 ::
8         
9         import MEDCoupling as mc
10         from MEDCouplingCorba import MEDCouplingUMeshServant
11         
12         # Creating a mesh
13         arr = mc.DataArrayDouble(11)
14         arr.iota(0)
15         m = mc.MEDCouplingCMesh() 
16         m.setCoords(arr,arr) 
17         m = m.buildUnstructured()
18         
19         # Making it available on the CORBA bus
20         ref_m = MEDCouplingUMeshServant._this(m)
21         import CORBA
22         orb = CORBA.ORB_init()
23         ior = orb.object_to_string(ref_m)
24         print ior
25         
26         # Displaying it in ParaVis
27         import salome
28         salome.salome_init()
29         print "About to import module 'pvsimple' ..."
30         import pvsimple as pvs
31         print "Module 'pvsimple' was imported!"
32         
33         # From here, we use the standard ParaView API:
34         src1 = pvs.ParaMEDCorbaPluginSource()
35         src1.IORCorba = ior       # This is where we need the CORBA reference of the object created
36         dr = pvs.Show(src1)
37