X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingTypemaps.i;h=b7a4ade9de7535214b00065a0439b35723c78e16;hb=5b299d506fcc63ff652df59a13f5b082fd45dabf;hp=72450ab355462796973a068120fdaf5502b60782;hpb=c5f9a2bb5f775564b5bd81de58dfa708bcef020d;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 72450ab35..b7a4ade9d 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -83,6 +83,25 @@ static PyObject *convertFieldDiscretization(MEDCoupling::MEDCouplingFieldDiscret return ret; } +static PyObject *convertField(MEDCoupling::MEDCouplingField *f, int owner) +{ + PyObject *ret(NULL); + if(!f) + { + Py_XINCREF(Py_None); + return Py_None; + } + if(dynamic_cast(f)) + ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,owner); + if(dynamic_cast(f)) + ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldInt,owner); + if(dynamic_cast(f)) + ret=SWIG_NewPointerObj(reinterpret_cast(f),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldFloat,owner); + if(!ret) + throw INTERP_KERNEL::Exception("Not recognized type of field on downcast !"); + return ret; +} + static PyObject* convertMultiFields(MEDCoupling::MEDCouplingMultiFields *mfs, int owner) { PyObject *ret=0;