From: nadir Date: Thu, 14 Oct 2004 12:28:50 +0000 (+0000) Subject: Final version V2_0_1 which works with Med File V2.1 and the KERNEL X-Git-Tag: V2_1_0b~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cdcf09d88b1907afcd4a5df17950e80a5145e0fb;p=modules%2Fmed.git Final version V2_0_1 which works with Med File V2.1 and the KERNEL with AG addings. --- diff --git a/src/MEDGUI/Makefile.in b/src/MEDGUI/Makefile.in index e8b922454..d465f0b8a 100644 --- a/src/MEDGUI/Makefile.in +++ b/src/MEDGUI/Makefile.in @@ -50,7 +50,7 @@ LIB_MOC = MedGUI.h LIB_CLIENT_IDL = SALOMEDS.idl SALOME_Exception.idl \ MED_Gen.idl MED.idl \ - SALOMEDS_Attributes.idl + SALOMEDS_Attributes.idl SALOME_Comm.idl # SMESH_Mesh.idl SMESH_Hypothesis.idl SMESH_BasicHypothesis.idl \ # GEOM_Shape.idl SALOMEDS_Attributes.idl diff --git a/src/MEDMEM/tests/readCoordinate.cxx b/src/MEDMEM/tests/readCoordinate.cxx index 71f0d1008..f0680544d 100755 --- a/src/MEDMEM/tests/readCoordinate.cxx +++ b/src/MEDMEM/tests/readCoordinate.cxx @@ -27,6 +27,7 @@ using namespace std; #include "MEDMEM_Exception.hxx" #include "MEDMEM_define.hxx" #include "MEDMEM_Mesh.hxx" +#include "MEDMEM_MedMeshDriver.hxx" using namespace MEDMEM; void usage(char * name) diff --git a/src/MEDMEM/tests/readEntete.cxx b/src/MEDMEM/tests/readEntete.cxx index 01e83ce3a..5d21b118e 100755 --- a/src/MEDMEM/tests/readEntete.cxx +++ b/src/MEDMEM/tests/readEntete.cxx @@ -27,6 +27,7 @@ using namespace std; #include "MEDMEM_Exception.hxx" #include "MEDMEM_define.hxx" #include "MEDMEM_Mesh.hxx" +#include "MEDMEM_MedMeshDriver.hxx" #include "MEDMEM_DriversDef.hxx" using namespace MEDMEM; diff --git a/src/MedClient/test/test2/Makefile.in b/src/MedClient/test/test2/Makefile.in index 30976ae43..43d046a9a 100644 --- a/src/MedClient/test/test2/Makefile.in +++ b/src/MedClient/test/test2/Makefile.in @@ -40,7 +40,7 @@ EXPORT_PYSCRIPTS = \ LIB = libCompo2cmodule.la LIB_SRC = Compo2.cxx -LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl MED.idl +LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_Comm.idl MED.idl CPPFLAGS += ${MED2_INCLUDES} ${HDF5_INCLUDES} ${PYTHON_INCLUDES} -I${KERNEL_ROOT_DIR}/include/salome LIBS = -L${KERNEL_ROOT_DIR}/lib/salome -lMEDClientcmodule -lMEDMEM_Swigcmodule -lmedmem -lMEDMEMImpl ${MED2_LIBS} ${HDF5_LIBS} diff --git a/src/MedCorba_Swig/Makefile.in b/src/MedCorba_Swig/Makefile.in index 58439815f..3353a9e2a 100644 --- a/src/MedCorba_Swig/Makefile.in +++ b/src/MedCorba_Swig/Makefile.in @@ -42,7 +42,7 @@ SWIG_DEF = libMedCorba_Swig.i LIB_SERVER_IDL = MED.idl -LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl +LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_Comm.idl EXPORT_PYSCRIPTS = libMedCorba_Swig.py medcorba_test.py batchmode_medcorba_test.py batchmode_medcorba_test1.py diff --git a/src/MedCorba_Swig/libMedCorba_Swig.i b/src/MedCorba_Swig/libMedCorba_Swig.i index 15041dd22..db16e3283 100644 --- a/src/MedCorba_Swig/libMedCorba_Swig.i +++ b/src/MedCorba_Swig/libMedCorba_Swig.i @@ -8,7 +8,6 @@ #include "MEDMEM_FieldDouble_i.hxx" #include "MEDMEM_Field_i.hxx" #include "MEDMEM_FieldInt_i.hxx" -#include "MEDMEM_FieldOf_i.hxx" #include "MEDMEM_Group_i.hxx" #include "MEDMEM_Med_i.hxx" #include "MEDMEM_Mesh_i.hxx" @@ -211,6 +210,82 @@ SCRUTE(*$1); } +%typemap(python,in) const SALOME_MED::FIELDDOUBLE_ptr, + SALOME_MED::FIELDDOUBLE_ptr +{ + + MESSAGE("typemap in sur Objet Corba FIELDDOUBLE sans reference"); + + PyObject* pdict = PyDict_New(); + PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins()); + PyRun_String("import CORBA", Py_single_input, pdict, pdict); + + PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input, + pdict, pdict); + + PyObject* orb = PyDict_GetItemString(pdict, "o"); + + // Ask omniORBpy to transform FIELDDOUBLE (python Corba) ptr to IOR string + + PyObject* iorFieldDouble + = PyObject_CallMethod(orb, "object_to_string", "O", $input); + + if (iorFieldDouble == Py_None) + return NULL; + char * s = PyString_AsString(PyObject_Str(iorFieldDouble)); + + // Ask omniORB to convert IOR string to FIELDDOUBLE (C++ Corba) ptr + + int argc = 0; + char *xargv = ""; + char **argv = &xargv; + CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv); + CORBA::Object_var O = ORB->string_to_object(s); + SCRUTE(O); + SALOME_MED::FIELDDOUBLE_ptr t = SALOME_MED::FIELDDOUBLE::_narrow(O); + + $1 = t; + SCRUTE($1); +} + +%typemap(python,in) const SALOME_MED::FIELDINT_ptr, + SALOME_MED::FIELDINT_ptr +{ + + MESSAGE("typemap in sur Objet Corba FIELDINT sans reference"); + + PyObject* pdict = PyDict_New(); + PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins()); + PyRun_String("import CORBA", Py_single_input, pdict, pdict); + + PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input, + pdict, pdict); + + PyObject* orb = PyDict_GetItemString(pdict, "o"); + + // Ask omniORBpy to transform FIELDINT (python Corba) ptr to IOR string + + PyObject* iorFieldInt + = PyObject_CallMethod(orb, "object_to_string", "O", $input); + + if (iorFieldInt == Py_None) + return NULL; + char * s = PyString_AsString(PyObject_Str(iorFieldInt)); + + // Ask omniORB to convert IOR string to FIELDINT (C++ Corba) ptr + + int argc = 0; + char *xargv = ""; + char **argv = &xargv; + CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv); + CORBA::Object_var O = ORB->string_to_object(s); + SCRUTE(O); + SALOME_MED::FIELDINT_ptr t = SALOME_MED::FIELDINT::_narrow(O); + + $1 = t; + SCRUTE($1); +} + %typemap(python,in) const SALOME_MED::SUPPORT_ptr &, SALOME_MED::SUPPORT_ptr & { @@ -407,10 +482,12 @@ } SALOME_MED::FIELDDOUBLE_ptr createCorbaFieldDouble(SALOME_MED::SUPPORT_ptr, - FIELDDOUBLE *); + FIELDDOUBLE *, + bool ownCppPtr=false); SALOME_MED::FIELDINT_ptr createCorbaFieldInt(SALOME_MED::SUPPORT_ptr, - FIELDINT *); + FIELDINT *, + bool ownCppPtr=false); SALOME_MED::SUPPORT_ptr createCorbaSupport(const SUPPORT *); @@ -421,12 +498,10 @@ FIELDINT * createLocalFieldInt(const int, const int); SALOME_MED::MESH_ptr createCorbaMesh(MESH * mesh); %{ - SALOME_MED::FIELDDOUBLE_ptr createCorbaFieldDouble(SALOME_MED::SUPPORT_ptr mySupportIOR,FIELDDOUBLE * field) + SALOME_MED::FIELDDOUBLE_ptr createCorbaFieldDouble(SALOME_MED::SUPPORT_ptr mySupportIOR,FIELDDOUBLE * field, bool ownCppPtr) { BEGIN_OF("SALOME_MED::FIELDDOUBLE_ptr createCorbaFieldDouble from libMedCorba_Swig"); - SCRUTE(mySupportIOR); - SCRUTE(field); // MT : Keep the local field name @@ -434,42 +509,31 @@ SALOME_MED::MESH_ptr createCorbaMesh(MESH * mesh); field->setDescription("Got From A Local One"); - FIELDDOUBLE_i * fieldimpl = new FIELDDOUBLE_i(mySupportIOR,field); - - POA_SALOME_MED::FIELDDOUBLE_tie * fieldcorba1 = - new POA_SALOME_MED::FIELDDOUBLE_tie(fieldimpl,true); - - SALOME_MED::FIELDDOUBLE_ptr fieldcorba2 = fieldcorba1->_this(); + FIELDDOUBLE_i * fieldimpl = new FIELDDOUBLE_i(field, ownCppPtr); - SALOME_MED::FIELDDOUBLE_ptr fieldcorba3 = SALOME_MED::FIELDDOUBLE::_duplicate(fieldcorba2); - - fieldcorba1->_remove_ref(); + SALOME_MED::FIELDDOUBLE_ptr fieldcorba2 = fieldimpl->_this(); SCRUTE(fieldimpl); - SCRUTE(fieldcorba1); - SCRUTE(fieldcorba2); - SCRUTE(fieldcorba3); - END_OF("SALOME_MED::FIELDDOUBLE_ptr createCorbaFieldDouble from libMedCorba_Swig"); MESSAGE("Test de tirarge sur le pointeur Corba Field dans le cxx"); - char * name = fieldcorba3->getName(); + char * name = fieldcorba2->getName(); SCRUTE(name); - return fieldcorba3; + delete [] name; + + return fieldcorba2; } - SALOME_MED::FIELDINT_ptr createCorbaFieldInt(SALOME_MED::SUPPORT_ptr mySupportIOR,FIELDINT * field) + SALOME_MED::FIELDINT_ptr createCorbaFieldInt(SALOME_MED::SUPPORT_ptr mySupportIOR,FIELDINT * field, bool ownCppPtr) { BEGIN_OF("SALOME_MED::FIELDINT_ptr createCorbaFieldInt from libMedCorba_Swig"); - SCRUTE(mySupportIOR); - SCRUTE(field); // MT : Keep the local field name @@ -477,33 +541,24 @@ SALOME_MED::MESH_ptr createCorbaMesh(MESH * mesh); field->setDescription("Got From A Local One"); - FIELDINT_i * fieldimpl = new FIELDINT_i(mySupportIOR,field); - - POA_SALOME_MED::FIELDINT_tie * fieldcorba1 = - new POA_SALOME_MED::FIELDINT_tie(fieldimpl,true); - - SALOME_MED::FIELDINT_ptr fieldcorba2 = fieldcorba1->_this(); - - SALOME_MED::FIELDINT_ptr fieldcorba3 = SALOME_MED::FIELDINT::_duplicate(fieldcorba2); + FIELDINT_i * fieldimpl = new FIELDINT_i(field, ownCppPtr); - fieldcorba1->_remove_ref(); + SALOME_MED::FIELDINT_ptr fieldcorba2 = fieldimpl->_this(); SCRUTE(fieldimpl); - SCRUTE(fieldcorba1); - SCRUTE(fieldcorba2); - SCRUTE(fieldcorba3); - END_OF("SALOME_MED::FIELDINT_ptr createCorbaFieldInt from libMedCorba_Swig"); MESSAGE("Test de tirarge sur le pointeur Corba Field dans le cxx"); - char * name = fieldcorba3->getName(); + char * name = fieldcorba2->getName(); SCRUTE(name); - return fieldcorba3; + delete [] name; + + return fieldcorba2; } SALOME_MED::SUPPORT_ptr createCorbaSupport(const SUPPORT * const support) @@ -521,8 +576,6 @@ SALOME_MED::MESH_ptr createCorbaMesh(MESH * mesh); SCRUTE(supportcorba); - supportimpl->_remove_ref(); - END_OF("SALOME_MED::SUPPORT_ptr createCorbaSupport from libMedCorba_Swig"); return supportcorba; @@ -543,8 +596,6 @@ SALOME_MED::MESH_ptr createCorbaMesh(MESH * mesh); SCRUTE(meshcorba); - meshimpl->_remove_ref(); - END_OF("SALOME_MED::MESH_ptr createCorbaMesh from libMedCorba_Swig"); return meshcorba;