Salome HOME
Addition of the 2 new unstructured mesh types.
authorageay <ageay>
Wed, 7 Aug 2013 12:32:13 +0000 (12:32 +0000)
committerageay <ageay>
Wed, 7 Aug 2013 12:32:13 +0000 (12:32 +0000)
src/MEDCouplingCorba_Swig/Client/MEDCouplingClient.i
src/MEDCouplingCorba_Swig/MEDCouplingCorba.i
src/MEDCouplingCorba_Swig/TestMEDCouplingCorbaClt.py

index 49dd4c8e478784feab1350ba743a31f51a98153b..842590f429cf0005bf4ff5eccd306b496cb6b30a 100644 (file)
@@ -26,6 +26,8 @@
 #include "MEDCouplingMultiFieldsClient.hxx"
 #include "MEDCouplingFieldOverTimeClient.hxx"
 #include "MEDCouplingUMeshClient.hxx"
+#include "MEDCoupling1SGTUMeshClient.hxx"
+#include "MEDCoupling1DGTUMeshClient.hxx"
 #include "MEDCouplingExtrudedMeshClient.hxx"
 #include "MEDCouplingCMeshClient.hxx"
 #include "MEDCouplingCurveLinearMeshClient.hxx"
@@ -42,6 +44,8 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDCouplingFieldDoubleClient::New;
 %newobject ParaMEDMEM::MEDCouplingFieldTemplateClient::New;
 %newobject ParaMEDMEM::MEDCouplingUMeshClient::New;
+%newobject ParaMEDMEM::MEDCoupling1SGTUMeshClient::New;
+%newobject ParaMEDMEM::MEDCoupling1DGTUMeshClient::New;
 %newobject ParaMEDMEM::MEDCouplingExtrudedMeshClient::New;
 %newobject ParaMEDMEM::MEDCouplingCMeshClient::New;
 %newobject ParaMEDMEM::MEDCouplingCurveLinearMeshClient::New;
@@ -216,6 +220,70 @@ namespace ParaMEDMEM
       }
   };
 
+  class MEDCoupling1SGTUMeshClient
+  {
+  public:
+    %extend
+      {
+        static MEDCoupling1SGTUMesh *New(PyObject *meshPtr) throw(INTERP_KERNEL::Exception)
+        {
+          PyObject* pdict=PyDict_New();
+          PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
+          PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
+          PyRun_String("import CORBA",Py_single_input,pdict, pdict);
+          PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
+          PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
+          // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
+          PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
+          if(!iorMesh)
+            throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCoupling1SGTUMeshClient.New appears to differ from CORBA reference ! Expecting a 1SGTUMeshCorbaInterface CORBA reference !");
+          char *ior=PyString_AsString(iorMesh);
+          int argc=0;
+          CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
+          CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
+          SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface_var meshPtrCppC=SALOME_MED::MEDCoupling1SGTUMeshCorbaInterface::_narrow(meshPtrCpp);
+          if(CORBA::is_nil(meshPtrCppC))
+            throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCoupling1SGTUMeshInterface_ptr !");
+          Py_DECREF(pdict);
+          Py_DECREF(iorMesh);
+          MEDCoupling1SGTUMesh *ret=MEDCoupling1SGTUMeshClient::New(meshPtrCppC);
+          return ret;
+        } 
+      }
+  };
+
+  class MEDCoupling1DGTUMeshClient
+  {
+  public:
+    %extend
+      {
+        static MEDCoupling1DGTUMesh *New(PyObject *meshPtr) throw(INTERP_KERNEL::Exception)
+        {
+          PyObject* pdict=PyDict_New();
+          PyDict_SetItemString(pdict,"__builtins__",PyEval_GetBuiltins());
+          PyRun_String("import MEDCouplingCorbaServant_idl",Py_single_input,pdict, pdict);
+          PyRun_String("import CORBA",Py_single_input,pdict, pdict);
+          PyRun_String("orbTmp15634=CORBA.ORB_init([''])", Py_single_input,pdict, pdict);
+          PyObject *orbPython=PyDict_GetItemString(pdict,"orbTmp15634");
+          // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
+          PyObject *iorMesh=PyObject_CallMethod(orbPython,(char*)"object_to_string",(char*)"O",meshPtr);
+          if(!iorMesh)
+            throw INTERP_KERNEL::Exception("Error : the input parameter of MEDCoupling1DGTUMeshClient.New appears to differ from CORBA reference ! Expecting a 1DGTUMeshCorbaInterface CORBA reference !");
+          char *ior=PyString_AsString(iorMesh);
+          int argc=0;
+          CORBA::ORB_var orb=CORBA::ORB_init(argc,0);
+          CORBA::Object_var meshPtrCpp=orb->string_to_object(ior);
+          SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface_var meshPtrCppC=SALOME_MED::MEDCoupling1DGTUMeshCorbaInterface::_narrow(meshPtrCpp);
+          if(CORBA::is_nil(meshPtrCppC))
+            throw INTERP_KERNEL::Exception("error corba pointer is not a SALOME_MED.MEDCoupling1DGTUMeshInterface_ptr !");
+          Py_DECREF(pdict);
+          Py_DECREF(iorMesh);
+          MEDCoupling1DGTUMesh *ret=MEDCoupling1DGTUMeshClient::New(meshPtrCppC);
+          return ret;
+        } 
+      }
+  };
+
   class MEDCouplingExtrudedMeshClient
   {
   public:
index 869bd06ff13b9ed09aca84bdaf1d0db3630615eb..9f164446b54a510fe0bc0e82dd0458e58dd869cb 100644 (file)
@@ -26,6 +26,8 @@
 #include "MEDCouplingMultiFieldsServant.hxx"
 #include "MEDCouplingFieldOverTimeServant.hxx"
 #include "MEDCouplingUMeshServant.hxx"
+#include "MEDCoupling1SGTUMeshServant.hxx"
+#include "MEDCoupling1DGTUMeshServant.hxx"
 #include "MEDCouplingExtrudedMeshServant.hxx"
 #include "MEDCouplingCMeshServant.hxx"
 #include "MEDCouplingCurveLinearMeshServant.hxx"
@@ -125,6 +127,40 @@ namespace ParaMEDMEM
        }
   };
 
+  class MEDCoupling1SGTUMeshServant
+  {
+  public:
+    %extend
+       {
+         static PyObject *_this(const MEDCoupling1SGTUMesh *cppPointerOfMesh)
+         {
+           return buildServantAndActivate<MEDCoupling1SGTUMeshServant>(cppPointerOfMesh);
+         }
+
+         static PyObject *_this2(const MEDCoupling1SGTUMesh *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCoupling1SGTUMeshServant>(cppPointerOfMesh);
+         }
+       }
+  };
+
+  class MEDCoupling1DGTUMeshServant
+  {
+  public:
+    %extend
+       {
+         static PyObject *_this(const MEDCoupling1DGTUMesh *cppPointerOfMesh)
+         {
+           return buildServantAndActivate<MEDCoupling1DGTUMeshServant>(cppPointerOfMesh);
+         }
+
+         static PyObject *_this2(const MEDCoupling1DGTUMesh *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCoupling1DGTUMeshServant>(cppPointerOfMesh);
+         }
+       }
+  };
+
   class MEDCouplingExtrudedMeshServant
   {
   public:
index 6b9fb99b39263cce7525030f71a00ecd9c9191ba..dcad42675037ee2089c135fd277a923a56c58c18 100644 (file)
@@ -143,6 +143,24 @@ class MEDCouplingCorbaServBasicsTestClt(unittest.TestCase):
         meshRef=test.buildCLMesh();
         self.assertTrue(_mesh_from_distant.isEqual(meshRef,1e-12))
         pass
+
+    def testCorbaFetching1SGTUMesh(self):
+        meshPtr=self._objC.get1SGTUMesh();
+        _mesh_from_distant=MEDCoupling1SGTUMeshClient.New(meshPtr);
+        meshPtr.UnRegister();
+        test=MEDCouplingCorbaSwigTest.MEDCouplingCorbaServBasicsTest()
+        meshRef=test.build1SGTUMesh();
+        self.assertTrue(_mesh_from_distant.isEqual(meshRef,1e-12))
+        pass
+
+    def testCorbaFetching1DGTUMesh(self):
+        meshPtr=self._objC.get1DGTUMesh();
+        _mesh_from_distant=MEDCoupling1DGTUMeshClient.New(meshPtr);
+        meshPtr.UnRegister();
+        test=MEDCouplingCorbaSwigTest.MEDCouplingCorbaServBasicsTest()
+        meshRef=test.build1DGTUMesh();
+        self.assertTrue(_mesh_from_distant.isEqual(meshRef,1e-12))
+        pass
     
     def testCorbaField2DNTFetching(self):
         fieldPtr=self._objC.getFieldScalarOn2DNT();