X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingDataArrayTypemaps.i;h=cbd924d82eb38cdee3f473e5d1d29f77ab97bc18;hb=0b187729ac99d3e9e9bb9d2be8cb8600a783be6c;hp=05722176c5b5e84b42d4d73ab3e315643a754e84;hpb=3c911ce36f5caa779ea60042e738fa57671a44b1;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i index 05722176c..cbd924d82 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i @@ -69,6 +69,11 @@ int InterpreteNegativeInt(int val, int nbelem) #ifdef WITH_NUMPY #include +#if NPY_API_VERSION <= 0x00000006 +# define MED_NUMPY_OWNDATA NPY_OWNDATA +#else +# define MED_NUMPY_OWNDATA NPY_ARRAY_OWNDATA +#endif // specific DataArray deallocator callback. This deallocator is used both in the constructor of DataArray and in the toNumPyArr // method. This dellocator uses weakref to determine if the linked numArr is still alive or not. If alive the ownership is given to it. @@ -82,7 +87,7 @@ void numarrdeal(void *pt, void *wron) { Py_XINCREF(obj); PyArrayObject *objC=reinterpret_cast(obj); - objC->flags|=NPY_OWNDATA; + objC->flags|=MED_NUMPY_OWNDATA; Py_XDECREF(weakRefOnOwner); Py_XDECREF(obj); } @@ -102,8 +107,8 @@ struct PyCallBackDataArraySt { MCData *_pt_mc; }; -typedef struct PyCallBackDataArraySt PyCallBackDataArrayInt; -typedef struct PyCallBackDataArraySt PyCallBackDataArrayDouble; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayInt; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayDouble; extern "C" { @@ -132,7 +137,7 @@ extern "C" { if(self->_pt_mc) { - ParaMEDMEM::MemArray& mma=self->_pt_mc->accessToMemArray(); + MEDCoupling::MemArray& mma=self->_pt_mc->accessToMemArray(); mma.destroy(); } Py_XINCREF(Py_None); @@ -145,7 +150,7 @@ extern "C" { if(self->_pt_mc) { - ParaMEDMEM::MemArray& mma=self->_pt_mc->accessToMemArray(); + MEDCoupling::MemArray& mma=self->_pt_mc->accessToMemArray(); mma.destroy(); } Py_XINCREF(Py_None); @@ -278,35 +283,47 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype if(itemSize!=PyArray_STRIDE(elt0,1)) throw INTERP_KERNEL::Exception("Input numpy array has stride that mismatches the item size ! Data are not packed in the right way for DataArrays for component #1 !"); const char *data=PyArray_BYTES(elt0); - typename ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr ret=MCData::New(); + typename MEDCoupling::MEDCouplingAutoRefCountObjectPtr ret=MCData::New(); if(PyArray_ISBEHAVED(elt0))//aligned and writeable and in machine byte-order { PyArrayObject *elt0C=reinterpret_cast(elt0); - PyArrayObject *eltOwning=(PyArray_FLAGS(elt0C) & NPY_OWNDATA)?elt0C:NULL; - int mask=NPY_OWNDATA; mask=~mask; + PyArrayObject *eltOwning=(PyArray_FLAGS(elt0C) & MED_NUMPY_OWNDATA)?elt0C:NULL; + int mask=MED_NUMPY_OWNDATA; mask=~mask; elt0C->flags&=mask; PyObject *deepestObj=elt0; PyObject *base=elt0C->base; if(base) deepestObj=base; + bool isSpetialCase(false); while(base) { if(PyArray_Check(base)) { PyArrayObject *baseC=reinterpret_cast(base); - eltOwning=(PyArray_FLAGS(baseC) & NPY_OWNDATA)?baseC:eltOwning; + eltOwning=(PyArray_FLAGS(baseC) & MED_NUMPY_OWNDATA)?baseC:eltOwning; baseC->flags&=mask; base=baseC->base; if(base) deepestObj=base; } else - break; + { + isSpetialCase=true; + break; + } + } + if(isSpetialCase) + {// this case is present for numpy arrayint coming from load of pickelized string. The owner of elt0 is not an array -> A copy is requested. + std::size_t nbOfElems(sz0*sz1); + T *dataCpy=(T*)malloc(sizeof(T)*nbOfElems); + std::copy(reinterpret_cast(data),reinterpret_cast(data)+nbOfElems,dataCpy); + ret->useArray(dataCpy,true,MEDCoupling::C_DEALLOC,sz0,sz1); + return ret.retn(); } - typename ParaMEDMEM::MemArray& mma=ret->accessToMemArray(); + typename MEDCoupling::MemArray& mma=ret->accessToMemArray(); if(eltOwning==NULL) { PyCallBackDataArraySt *cb=PyObject_GC_New(PyCallBackDataArraySt,pytype); cb->_pt_mc=ret; - ret->useArray(reinterpret_cast(data),true,ParaMEDMEM::C_DEALLOC,sz0,sz1); + ret->useArray(reinterpret_cast(data),true,MEDCoupling::C_DEALLOC,sz0,sz1); PyObject *ref=PyWeakref_NewRef(deepestObj,(PyObject *)cb); void **objs=new void *[2]; objs[0]=cb; objs[1]=ref; mma.setParameterForDeallocator(objs); @@ -315,9 +332,9 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype } else { - ret->useArray(reinterpret_cast(data),true,ParaMEDMEM::C_DEALLOC,sz0,sz1); + ret->useArray(reinterpret_cast(data),true,MEDCoupling::C_DEALLOC,sz0,sz1); PyObject *ref=PyWeakref_NewRef(reinterpret_cast(eltOwning),NULL); - typename ParaMEDMEM::MemArray::Deallocator tmp(ParaMEDMEM::MemArray::CDeallocator); + typename MEDCoupling::MemArray::Deallocator tmp(MEDCoupling::MemArray::CDeallocator); void **tmp2 = reinterpret_cast(&tmp); // MSVC2010 does not support constructor() void **objs=new void *[2]; objs[0]=ref; objs[1]=*tmp2; mma.setParameterForDeallocator(objs); @@ -325,7 +342,7 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype } } else if(PyArray_ISBEHAVED_RO(elt0)) - ret->useArray(reinterpret_cast(data),false,ParaMEDMEM::CPP_DEALLOC,sz0,sz1); + ret->useArray(reinterpret_cast(data),false,MEDCoupling::CPP_DEALLOC,sz0,sz1); return ret.retn(); } @@ -363,7 +380,7 @@ int NumpyArrSetBaseObjectExt(PyArrayObject *arr, PyObject *obj) /* If this array owns its own data, stop collapsing */ - if (PyArray_CHKFLAGS(obj_arr, NPY_OWNDATA)) { + if (PyArray_CHKFLAGS(obj_arr, MED_NUMPY_OWNDATA )) { break; } @@ -406,7 +423,7 @@ PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *M std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : this is not allocated !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - ParaMEDMEM::MemArray& mem=self->accessToMemArray(); + MEDCoupling::MemArray& mem=self->accessToMemArray(); if(nbComp==0) { std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !"; @@ -422,7 +439,7 @@ PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *M if(mem.getDeallocator()!=numarrdeal) {// case for the first call of toNumPyArray PyObject *ref(PyWeakref_NewRef(ret,NULL)); - typename ParaMEDMEM::MemArray::Deallocator tmp(mem.getDeallocator()); + typename MEDCoupling::MemArray::Deallocator tmp(mem.getDeallocator()); void **tmp2 = reinterpret_cast(&tmp); // MSVC2010 does not support constructor() void **objs=new void *[2]; objs[0]=reinterpret_cast(ref); objs[1]=*tmp2; mem.setParameterForDeallocator(objs); @@ -456,14 +473,14 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) return ToNumPyArrayUnderground(self,npyObjectType,MCDataStr,self->getNumberOfTuples(),self->getNumberOfComponents()); } -SWIGINTERN PyObject *ParaMEDMEM_DataArrayInt_toNumPyArray(ParaMEDMEM::DataArrayInt *self); -SWIGINTERN PyObject *ParaMEDMEM_DataArrayDouble_toNumPyArray(ParaMEDMEM::DataArrayDouble *self); +SWIGINTERN PyObject *MEDCoupling_DataArrayInt_toNumPyArray(MEDCoupling::DataArrayInt *self); +SWIGINTERN PyObject *MEDCoupling_DataArrayDouble_toNumPyArray(MEDCoupling::DataArrayDouble *self); PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) throw(INTERP_KERNEL::Exception) { int nbRows((int)m.size()); - ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr indPtr(ParaMEDMEM::DataArrayInt::New()),indices(ParaMEDMEM::DataArrayInt::New()); - ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr data(ParaMEDMEM::DataArrayDouble::New()); + MEDCoupling::MEDCouplingAutoRefCountObjectPtr indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New()); + MEDCoupling::MEDCouplingAutoRefCountObjectPtr data(MEDCoupling::DataArrayDouble::New()); indPtr->alloc(nbRows+1,1); int *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++; int sz2(0); @@ -481,7 +498,7 @@ PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) t *indices_ptr=(*it1).first; *data_ptr=(*it1).second; } - PyObject *a(ParaMEDMEM_DataArrayDouble_toNumPyArray(data)),*b(ParaMEDMEM_DataArrayInt_toNumPyArray(indices)),*c(ParaMEDMEM_DataArrayInt_toNumPyArray(indPtr)); + PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt_toNumPyArray(indPtr)); // PyObject *args(PyTuple_New(1)),*args0(PyTuple_New(3)),*kw(PyDict_New()),*kw1(PyTuple_New(2)); PyTuple_SetItem(args0,0,a); PyTuple_SetItem(args0,1,b); PyTuple_SetItem(args0,2,c); PyTuple_SetItem(args,0,args0); @@ -503,7 +520,7 @@ PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) t #endif -static PyObject *convertDataArrayChar(ParaMEDMEM::DataArrayChar *dac, int owner) throw(INTERP_KERNEL::Exception) +static PyObject *convertDataArrayChar(MEDCoupling::DataArrayChar *dac, int owner) throw(INTERP_KERNEL::Exception) { PyObject *ret=0; if(!dac) @@ -511,16 +528,16 @@ static PyObject *convertDataArrayChar(ParaMEDMEM::DataArrayChar *dac, int owner) Py_XINCREF(Py_None); return Py_None; } - if(dynamic_cast(dac)) - ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayByte,owner); - if(dynamic_cast(dac)) - ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayByte,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,owner); if(!ret) throw INTERP_KERNEL::Exception("Not recognized type of DataArrayChar on downcast !"); return ret; } -static PyObject *convertDataArray(ParaMEDMEM::DataArray *dac, int owner) throw(INTERP_KERNEL::Exception) +static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) throw(INTERP_KERNEL::Exception) { PyObject *ret=0; if(!dac) @@ -528,14 +545,14 @@ static PyObject *convertDataArray(ParaMEDMEM::DataArray *dac, int owner) throw(I Py_XINCREF(Py_None); return Py_None; } - if(dynamic_cast(dac)) - ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,owner); - if(dynamic_cast(dac)) - ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,owner); - if(dynamic_cast(dac)) - ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayByte,owner); - if(dynamic_cast(dac)) - ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayByte,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,owner); if(!ret) throw INTERP_KERNEL::Exception("Not recognized type of DataArray on downcast !"); return ret; @@ -1364,7 +1381,7 @@ static std::vector fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTupl return ret; } -//convertFromPyObjVectorOfObj(pyLi,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh") +//convertFromPyObjVectorOfObj(pyLi,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh") template static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, const char *typeStr, typename std::vector& ret) { @@ -1422,7 +1439,7 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons * * switch between (int,vector,DataArrayInt) */ -static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector& stdvecTyypp, ParaMEDMEM::DataArrayInt *& daIntTyypp, ParaMEDMEM::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception) { sw=-1; if(PyInt_Check(value)) @@ -1468,17 +1485,17 @@ static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std: return; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); if(SWIG_IsOK(status)) { - daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp); + daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); sw=3; return; } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); if(SWIG_IsOK(status)) { - daIntTuple=reinterpret_cast< ParaMEDMEM::DataArrayIntTuple * >(argp); + daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); sw=4; return ; } @@ -1496,7 +1513,7 @@ static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std: * * switch between (int,vector,DataArrayInt) */ -static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, std::vector& stdvecTyypp, ParaMEDMEM::DataArrayDouble *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayDouble *& daIntTyypp) throw(INTERP_KERNEL::Exception) { sw=-1; if(PyFloat_Check(value)) @@ -1552,10 +1569,10 @@ static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, s return; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception("5 types accepted : double float, integer, tuple of double float or int, list of double float or int, DataArrayDouble"); - daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp); + daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp); sw=3; } @@ -1570,7 +1587,7 @@ static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, s * * switch between (int,vector,DataArrayInt) */ -static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, std::vector& stdvecTyypp, ParaMEDMEM::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception) { sw=-1; if(PyFloat_Check(value)) @@ -1626,10 +1643,10 @@ static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, return; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception("5 types accepted : double float, integer, tuple of double float or int, list of double float or int, DataArrayDoubleTuple"); - daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayDoubleTuple * >(argp); + daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp); sw=3; } @@ -1642,7 +1659,7 @@ static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, * * switch between (int,vector,DataArrayInt) */ -static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, ParaMEDMEM::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception) { const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple"; sw=-1; @@ -1700,10 +1717,10 @@ static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& return ; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); if(SWIG_IsOK(status)) { - daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp); + daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); if(!daIntTyypp) { std::ostringstream oss; oss << msg << " Instance in null !"; @@ -1712,10 +1729,10 @@ static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& sw=4; return ; } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); if(SWIG_IsOK(status)) { - ParaMEDMEM::DataArrayIntTuple *tmp=reinterpret_cast< ParaMEDMEM::DataArrayIntTuple * >(argp); + MEDCoupling::DataArrayIntTuple *tmp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); if(!tmp) { std::ostringstream oss; oss << msg << " Instance in null !"; @@ -1732,7 +1749,7 @@ static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& /*! * Idem than convertObjToPossibleCpp2 */ -static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, ParaMEDMEM::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception) { convertObjToPossibleCpp2(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp); if(sw==1) @@ -1748,7 +1765,7 @@ static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem * if python slice -> cpp pair sw=3 * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 . WARNING The returned pointer can be the null pointer ! */ -static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, ParaMEDMEM::DataArrayIntTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception) { sw=-1; if(PyInt_Check(value)) @@ -1805,10 +1822,10 @@ static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& return ; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIntTuple"); - daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayIntTuple * >(argp); + daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); sw=4; } @@ -1819,7 +1836,7 @@ static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& * if python not null pointer of DataArrayChar -> cpp DataArrayChar sw=4 * switch between (int,string,vector,DataArrayChar) */ -static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector& vsType, ParaMEDMEM::DataArrayChar *& dacType) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector& vsType, MEDCoupling::DataArrayChar *& dacType) throw(INTERP_KERNEL::Exception) { const char *msg="4 types accepted : string, list or tuple of strings having same size, not null DataArrayChar instance."; sw=-1; @@ -1877,10 +1894,10 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std:: return; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayChar,0|0); if(SWIG_IsOK(status)) { - dacType=reinterpret_cast< ParaMEDMEM::DataArrayChar * >(argp); + dacType=reinterpret_cast< MEDCoupling::DataArrayChar * >(argp); if(!dacType) { std::ostringstream oss; oss << msg << " Instance in null !"; @@ -1923,7 +1940,7 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std:: */ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector& vt, std::vector& vc, std::pair >& pt, std::pair >& pc, - ParaMEDMEM::DataArrayInt *&dt, ParaMEDMEM::DataArrayInt *&dc) throw(INTERP_KERNEL::Exception) + MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc) throw(INTERP_KERNEL::Exception) { if(!PyTuple_Check(value)) { @@ -1952,7 +1969,7 @@ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d, ParaMEDMEM::DataArrayDoubleTuple *&e, std::vector& f) +static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f) { sw=-1; if(PyFloat_Check(value)) @@ -2008,17 +2025,17 @@ static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, Para return; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(SWIG_IsOK(status)) { - d=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp); + d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp); sw=2; return ; } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0); if(SWIG_IsOK(status)) { - e=reinterpret_cast< ParaMEDMEM::DataArrayDoubleTuple * >(argp); + e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp); sw=3; return ; } @@ -2033,7 +2050,7 @@ static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, Para * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d, ParaMEDMEM::DataArrayDoubleTuple *&e, std::vector& f, +static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) throw(INTERP_KERNEL::Exception) { sw=-1; @@ -2072,10 +2089,10 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou catch(INTERP_KERNEL::Exception& exc) { throw exc; } } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(SWIG_IsOK(status)) { - d=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp); + d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp); sw=2; if(d) { @@ -2108,10 +2125,10 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou return 0; } } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0); if(SWIG_IsOK(status)) { - e=reinterpret_cast< ParaMEDMEM::DataArrayDoubleTuple * >(argp); + e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp); sw=3; if(e->getNumberOfCompo()==nbCompExpected) { @@ -2140,7 +2157,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d, ParaMEDMEM::DataArrayDoubleTuple *&e, std::vector& f, +static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception) { sw=-1; @@ -2221,10 +2238,10 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do return &f[0]; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(SWIG_IsOK(status)) { - d=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp); + d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp); sw=2; if(d) { @@ -2250,10 +2267,10 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do { nbTuples=0; return 0; } } } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0); if(SWIG_IsOK(status)) { - e=reinterpret_cast< ParaMEDMEM::DataArrayDoubleTuple * >(argp); + e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp); sw=3; if(e) { @@ -2293,8 +2310,8 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector& f, const char *msg, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception) { - ParaMEDMEM::DataArrayDouble *d=0; - ParaMEDMEM::DataArrayDoubleTuple *e=0; + MEDCoupling::DataArrayDouble *d=0; + MEDCoupling::DataArrayDoubleTuple *e=0; sw=-1; if(PyFloat_Check(value)) { @@ -2353,10 +2370,10 @@ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& return &f[0]; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(SWIG_IsOK(status)) { - d=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp); + d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp); sw=2; if(d) { @@ -2382,10 +2399,10 @@ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& { nbTuples=0; return 0; } } } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0); if(SWIG_IsOK(status)) { - e=reinterpret_cast< ParaMEDMEM::DataArrayDoubleTuple * >(argp); + e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp); sw=3; if(e) { @@ -2461,10 +2478,10 @@ static const int *convertObjToPossibleCpp1_Safe(PyObject *value, int& sw, int& s return &stdvecTyypp[0]; } void *argp; - int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0); + int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); if(SWIG_IsOK(status)) { - ParaMEDMEM::DataArrayInt *daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp); + MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); if(daIntTyypp) { sw=3; sz=daIntTyypp->getNbOfElems(); @@ -2476,37 +2493,37 @@ static const int *convertObjToPossibleCpp1_Safe(PyObject *value, int& sw, int& s return 0; } } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); if(SWIG_IsOK(status)) { - ParaMEDMEM::DataArrayIntTuple *daIntTuple=reinterpret_cast< ParaMEDMEM::DataArrayIntTuple * >(argp); + MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); sw=4; sz=daIntTuple->getNumberOfCompo(); return daIntTuple->getConstPointer(); } throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple"); } -static ParaMEDMEM::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, const char *msg) +static MEDCoupling::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, const char *msg) { void *aBasePtrVS=0; - int status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArray,0|0); + int status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArray,0|0); if(!SWIG_IsOK(status)) { - status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0); + status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(!SWIG_IsOK(status)) { - status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0); + status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); if(!SWIG_IsOK(status)) { - status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar,0|0); + status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,0|0); if(!SWIG_IsOK(status)) { - status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_ParaMEDMEM__DataArrayByte,0|0); + status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayByte,0|0); std::ostringstream oss; oss << msg << " ! Accepted instances are DataArrayDouble, DataArrayInt, DataArrayAsciiChar, DataArrayByte !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } } } - return reinterpret_cast< ParaMEDMEM::DataArray * >(aBasePtrVS); + return reinterpret_cast< MEDCoupling::DataArray * >(aBasePtrVS); }