Visualizing MEDCoupling field in VISU
Hello!
I have generated a MED field using MEDCoupling and would like to visualize it in VISU. I do it in this way:
First, Generate the field using ParaMEDMEM::MEDCouplingFieldDouble pointer;
Second, create an instance of ParaMEDMEM::MEDCouplingFieldDoubleServant using this field;
Third, pass out the field using SALOME_MED::MEDCouplingFieldDoubleCorbaInterface_ptr;
But for visualizing it in VISU, its method ImportMedField(SALOME_MED::Field) require a SALOME_MED::Field as a parameter.
Is there any possible way to make this conversion??
Any answer or even hints will be highly appreciated!
Best regards,
Yuefeng Qiu
Hello,
No it is not possible with visu but it is possible with PARAVIS. Using Para MEDCorbaPlugin in Sources Menu (below Mandelbrot) of PARAVIS.
Just copy paste the IOR ref given by.
from MEDCouplingCorba import *
fc=MEDCouplingFieldDoubleServant._this(myField)
import CORBA
orb=CORBA.ORB_init()
print orb.object_to_string(fc)
Best regards,
Anthony
Thanks, Anthony!
I would like to invoke PARAVIS from my C++ code, pass the IOR of the MEDCoupling field to it and then visualize. Now I understand how to obtain the IOR in MEDCoupling side.
Could you tell me how to write code to invoke PARAVIS, then how to call this plugin, then which method in this plugin to receive this IOR?
Best regards,
Yuefeng
Hello Yuefeng,
Before launching your application set the OMNIORB_CONFIG to those of your SALOME/PARAVIS session you want.
$OMNIORB_CONFIG should point to a file that describes the workstation and the port (typically 2810).
Then invoke paravis like the next python script using "ExecuteScript" of PARAVIS salome component.
#####
ref_f=MEDCouplingFieldDoubleServant._this(f)
import CORBA
orb=CORBA.ORB_init()
ior=orb.object_to_string(ref_f)
import PARAVIS_Gen_idl
import salome
salome.salome_init()
paravis=salome.lcc.FindOrLoadComponent("FactoryServer","PARAVIS")
script="""
src1 = ParaMEDCorbaPluginSource()
src1.IORCorba = '%s'
asc=GetAnimationScene()
rw=GetRenderView()
dr=Show()\ndr.Visibility = 1
Render()
"""
content=script%(ior)
paravis.ExecuteScript(content)
#############
The C++ code here : MED_SRC/src/MEDCalculator/MEDCalculatorDBField.cxx performs the job of python code above.
Best Regards,
Anthony
OA_var poa=PortableServer:
OA::_narrow(obj);
OAManager_var mgr=poa->the_POAManager();
stringstream path;
stringstream script;Check that "paravis" variable is not null with is_nil. There"s a great chance to be null ref !
You have to activate PARAVIS component before invoking your external process !
You have to set OMNIORB_CONFIG correctly to the salome session in which PARAVIS has been activated !
Best regards,
Anthony
You are right, Anthony. After loading the PARAVIS first and then call it, I can now visualize my MEDCouplingField in PARAVIS.
A further question: Can I use PARAVIS Engine to finish this job? I think it's convenient if I can use an uniform way to call another component in SALOME. The code above is not so straightforward for me.
Best regards,
Yuefeng
Hello Yuefeng,
Sorry I don't understand very well your question. What job do you mean ? data processing ?
It's clear that the standart way to communicate meshes and fields between components sequential engines (servers) it is by the use of CORBA interfaces MEDCoupling*CorbaInterfaces like you did successfully in your C++ code. Your code requires more CORBA knowledge because the invokation of remote service (ExecuteScript here) is done dynamically (it is needed for MED component), but you can perform the same thing using standart CORBA invcation because your are not expected to manage depedancies with PARAVIS as MED does.
Best regards
Hello Anthony,
Sorry for making the question unclear. I am a novice in CORBA programming so sometimes I feel a little bit lost.
I know in VISU we can visualized a SALOME_MED::Field in this way:
Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component("FactoryServer", "VISU" );
VISU::VISU_Gen_var aVISUGen = VISU::VISU_Gen::_narrow(comp);
ASSERT( !CORBA::is_nil( aVISUGen ) );
aVISUGen->ImportMedField(aMEDField);
My question is: can I also call the PARAVIS and the plugin in this way?
Hello Anthony,
Sorry for making the question unclear. I am a novice in CORBA programming so sometimes I feel a little bit lost.
I know in VISU we can visualized a SALOME_MED::Field in this way:
Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component("FactoryServer", "VISU" );
VISU::VISU_Gen_var aVISUGen = VISU::VISU_Gen::_narrow(comp);
ASSERT( !CORBA::is_nil( aVISUGen ) );
aVISUGen->ImportMedField(aMEDField);
My question is: can I also call the PARAVIS and the plugin in this way?
Best regards,
Yuefeng
Hello Yuefeng,
Yes absolutely ! Replace VISU by PARAVIS in you code. The code becomes :
Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component("FactoryServer", "PARAVIS" );
PARAVIS::PARAVIS_Gen_var aPVGen = PARAVIS::PARAVIS_Gen::_narrow(comp);
ASSERT( !CORBA::is_nil( aPVGen ) );
aPVGen->ExcecuteScript(...)
It is exactly equivalent to the code with "req->invoke()" you written. Except that here you have a static dependancy to PARAVIS_Gen.idl.
Anthony
