From: ageay Date: Wed, 7 Aug 2013 12:32:13 +0000 (+0000) Subject: Addition of the 2 new unstructured mesh types. X-Git-Tag: DBugPolyhIntersector~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c80dc66233279e9e2b8e413bcb2decebd2e6ad81;p=modules%2Fmed.git Addition of the 2 new unstructured mesh types. --- diff --git a/src/MEDCouplingCorba_Swig/Client/MEDCouplingClient.i b/src/MEDCouplingCorba_Swig/Client/MEDCouplingClient.i index 49dd4c8e4..842590f42 100644 --- a/src/MEDCouplingCorba_Swig/Client/MEDCouplingClient.i +++ b/src/MEDCouplingCorba_Swig/Client/MEDCouplingClient.i @@ -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: diff --git a/src/MEDCouplingCorba_Swig/MEDCouplingCorba.i b/src/MEDCouplingCorba_Swig/MEDCouplingCorba.i index 869bd06ff..9f164446b 100644 --- a/src/MEDCouplingCorba_Swig/MEDCouplingCorba.i +++ b/src/MEDCouplingCorba_Swig/MEDCouplingCorba.i @@ -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(cppPointerOfMesh); + } + + static PyObject *_this2(const MEDCoupling1SGTUMesh *cppPointerOfMesh) + { + return buildServantAndActivate2(cppPointerOfMesh); + } + } + }; + + class MEDCoupling1DGTUMeshServant + { + public: + %extend + { + static PyObject *_this(const MEDCoupling1DGTUMesh *cppPointerOfMesh) + { + return buildServantAndActivate(cppPointerOfMesh); + } + + static PyObject *_this2(const MEDCoupling1DGTUMesh *cppPointerOfMesh) + { + return buildServantAndActivate2(cppPointerOfMesh); + } + } + }; + class MEDCouplingExtrudedMeshServant { public: diff --git a/src/MEDCouplingCorba_Swig/TestMEDCouplingCorbaClt.py b/src/MEDCouplingCorba_Swig/TestMEDCouplingCorbaClt.py index 6b9fb99b3..dcad42675 100644 --- a/src/MEDCouplingCorba_Swig/TestMEDCouplingCorbaClt.py +++ b/src/MEDCouplingCorba_Swig/TestMEDCouplingCorbaClt.py @@ -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();