]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
Final version V2_0_1 which works with Med File V2.1 and the KERNEL
authornadir <nadir>
Thu, 14 Oct 2004 12:28:50 +0000 (12:28 +0000)
committernadir <nadir>
Thu, 14 Oct 2004 12:28:50 +0000 (12:28 +0000)
with AG addings.

src/MEDGUI/Makefile.in
src/MEDMEM/tests/readCoordinate.cxx
src/MEDMEM/tests/readEntete.cxx
src/MedClient/test/test2/Makefile.in
src/MedCorba_Swig/Makefile.in
src/MedCorba_Swig/libMedCorba_Swig.i

index e8b92245434e6a0983e82d50c00cc47e47775829..d465f0b8ada05fcac4c3609af3291303b9de61d7 100644 (file)
@@ -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
 
index 71f0d1008fcf17d7bd53dc68210ada3dfae49048..f0680544df5c1bf7bc8a829185f645c104ef5882 100755 (executable)
@@ -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)
index 01e83ce3a8d1f8e5a43cf39e91fb94f9093d3d54..5d21b118e57235cd5a03672e80760b4ad122f117 100755 (executable)
@@ -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;
 
index 30976ae438c1c61e4a0c35c22e02ae3e697bb795..43d046a9ab3b3794658ddc5389afa2e379aa4ee4 100644 (file)
@@ -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}
index 58439815f8148589841f4c799350a2e21746a5b3..3353a9e2a986aecf314e77a68325e5df2ec0b1b2 100644 (file)
@@ -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
 
index 15041dd22214963cce40c32250e3dc0311ae7ccf..db16e3283fa20189a019fea7cf1b96b0a826bbc9 100644 (file)
@@ -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"
   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 &
 {
 
 }
 
 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<FIELDDOUBLE_i> * fieldcorba1 = 
-       new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(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<FIELDINT_i> * fieldcorba1 = 
-       new POA_SALOME_MED::FIELDINT_tie<FIELDINT_i>(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;