X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingTypemaps.i;h=dd61b8ee1ef0552ffe72a2409a08767f7ae7982b;hb=b79f750df5fc807078f4efbf89d88587a88f7548;hp=27a6de03ee46ace0d49c2b5e3307887ebd2154a1;hpb=006398744600d65aa2cf080b30f1cebfe851a701;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 27a6de03e..dd61b8ee1 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -210,17 +210,11 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype int ndim=PyArray_NDIM(elt0); if(ndim!=1 && ndim!=2) throw INTERP_KERNEL::Exception("Input numpy array should have dimension equal to 1 or 2 !"); - if(PyArray_ObjectType(elt0,0)!=npyObjectType) + if(PyArray_DESCR(elt0)->type_num != npyObjectType) { - std::ostringstream oss; oss << "Input numpy array has not of type " << msg << " at component #0 !"; + std::ostringstream oss; oss << "Input numpy array has not the type " << msg << "!"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - if(ndim==2) - if(PyArray_ObjectType(elt0,1)!=npyObjectType) - { - std::ostringstream oss; oss << "Input numpy array has not of type " << msg << " at component #1 !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } npy_intp sz0=PyArray_DIM(elt0,0); npy_intp sz1=ndim==2?PyArray_DIM(elt0,1):1; // @@ -419,6 +413,8 @@ static PyObject *convertMesh(ParaMEDMEM::MEDCouplingMesh *mesh, int owner) throw ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,owner); if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1SGTUMesh,owner); + if(dynamic_cast(mesh)) + ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCoupling1DGTUMesh,owner); if(dynamic_cast(mesh)) ret=SWIG_NewPointerObj((void*)mesh,SWIGTYPE_p_ParaMEDMEM__MEDCouplingExtrudedMesh,owner); if(dynamic_cast(mesh)) @@ -1123,7 +1119,10 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons PyObject *obj=PyList_GetItem(pyLi,i); int status=SWIG_ConvertPtr(obj,&argp,ty,0|0); if(!SWIG_IsOK(status)) - throw INTERP_KERNEL::Exception("list must contain only MEDCouplingUMesh"); + { + std::ostringstream oss; oss << "convertFromPyObjVectorOfObj : list is excepted to contain only " << typeStr << " instances !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } T arg=reinterpret_cast< T >(argp); ret[i]=arg; } @@ -1138,7 +1137,7 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons int status=SWIG_ConvertPtr(obj,&argp,ty,0|0); if(!SWIG_IsOK(status)) { - std::ostringstream oss; oss << "tuple must contain only " << typeStr; + std::ostringstream oss; oss << "convertFromPyObjVectorOfObj : tuple is excepted to contain only " << typeStr << " instances !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } T arg=reinterpret_cast< T >(argp);