X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingDataArrayTypemaps.i;h=cbd924d82eb38cdee3f473e5d1d29f77ab97bc18;hb=0b187729ac99d3e9e9bb9d2be8cb8600a783be6c;hp=76d2b4635648ea32b00f6716b37fba88adbe983a;hpb=79c404a024c4b00550400f158f89fcc64859e71d;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i index 76d2b4635..cbd924d82 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -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,17 +332,17 @@ 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); - void **tmp2(reinterpret_cast(&tmp)); + 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); mma.setSpecificDeallocator(numarrdeal); } } 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; } @@ -399,15 +416,14 @@ int NumpyArrSetBaseObjectExt(PyArrayObject *arr, PyObject *obj) } template -PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) +PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *MCDataStr, int nbTuples, int nbComp) { if(!self->isAllocated()) { std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : this is not allocated !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - ParaMEDMEM::MemArray& mem=self->accessToMemArray(); - int nbComp=self->getNumberOfComponents(); + MEDCoupling::MemArray& mem=self->accessToMemArray(); if(nbComp==0) { std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !"; @@ -415,7 +431,7 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) } int nbDims=nbComp==1?1:2; npy_intp dim[2]; - dim[0]=(npy_intp)self->getNumberOfTuples(); dim[1]=nbComp; + dim[0]=(npy_intp)nbTuples; dim[1]=nbComp; const T *bg=self->getConstPointer(); PyObject *ret(PyArray_SimpleNewFromData(nbDims,dim,npyObjectType,const_cast(bg))); if(mem.isDeallocatorCalled()) @@ -423,8 +439,8 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) if(mem.getDeallocator()!=numarrdeal) {// case for the first call of toNumPyArray PyObject *ref(PyWeakref_NewRef(ret,NULL)); - typename ParaMEDMEM::MemArray::Deallocator tmp(mem.getDeallocator()); - void **tmp2(reinterpret_cast(&tmp)); + 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); mem.setSpecificDeallocator(numarrdeal); @@ -451,14 +467,20 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) return ret; } -SWIGINTERN PyObject *ParaMEDMEM_DataArrayInt_toNumPyArray(ParaMEDMEM::DataArrayInt *self); -SWIGINTERN PyObject *ParaMEDMEM_DataArrayDouble_toNumPyArray(ParaMEDMEM::DataArrayDouble *self); +template +PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) +{ + return ToNumPyArrayUnderground(self,npyObjectType,MCDataStr,self->getNumberOfTuples(),self->getNumberOfComponents()); +} + +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); @@ -476,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); @@ -498,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) @@ -506,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) @@ -523,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; @@ -624,6 +646,19 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL } } +static PyObject *convertFromVectorPairInt(const std::vector< std::pair >& arr) throw(INTERP_KERNEL::Exception) +{ + PyObject *ret=PyList_New(arr.size()); + for(std::size_t i=0;i >& arr) throw(INTERP_KERNEL::Exception) { const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !"; @@ -681,6 +716,63 @@ static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair >& arr) throw(INTERP_KERNEL::Exception) +{ + const char msg[]="convertPyToVectorPairStringInt : list must contain tuples of 2 integers only or tuple must contain tuples of 1 string and 1 integer only !"; + if(PyList_Check(pyLi)) + { + int size=PyList_Size(pyLi); + arr.resize(size); + for(int i=0;i& arr) throw(INTERP_KERNEL::Exception) { if(PyList_Check(pyLi)) @@ -939,6 +1031,156 @@ static bool fillStringVector(PyObject *pyLi, std::vector& vec) thro else return false; } +static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector >& arr) throw(INTERP_KERNEL::Exception) +{ + const char msg[]="convertPyToVectorOfVectorOfString : expecting list of list of strings !"; + if(PyList_Check(pyLi)) + { + Py_ssize_t sz=PyList_Size(pyLi); + arr.resize(sz); + for(int i=0;i& vec) throw(INTERP_KERNEL::Exception) +{ + if(PyList_Check(pyLi)) + { + Py_ssize_t sz=PyList_Size(pyLi); + vec.resize(sz); + for(int i=0;i >& arr) throw(INTERP_KERNEL::Exception) +{ + const char msg[]="convertPyToVectorOfVectorOfInt : expecting list of list of strings !"; + if(PyList_Check(pyLi)) + { + Py_ssize_t sz=PyList_Size(pyLi); + arr.resize(sz); + for(int i=0;i > >& arr) throw(INTERP_KERNEL::Exception) +{ + const char msg[]="convertPyToVectorPairStringVecString : expecting list of tuples containing each exactly 2 items : one string and one vector of string !"; + if(PyList_Check(pyLi)) + { + Py_ssize_t sz=PyList_Size(pyLi); + arr.resize(sz); + for(int i=0;i > item; + PyObject *o_0=PyTuple_GetItem(o,0); + if(!PyString_Check(o_0)) + throw INTERP_KERNEL::Exception(msg); + item.first=PyString_AsString(o_0); + PyObject *o_1=PyTuple_GetItem(o,1); + if(!fillStringVector(o_1,item.second)) + throw INTERP_KERNEL::Exception(msg); + arr[i]=item; + } + else + throw INTERP_KERNEL::Exception(msg); + } + } + else if(PyTuple_Check(pyLi)) + { + Py_ssize_t sz=PyTuple_Size(pyLi); + arr.resize(sz); + for(int i=0;i > item; + PyObject *o_0=PyTuple_GetItem(o,0); + if(!PyString_Check(o_0)) + throw INTERP_KERNEL::Exception(msg); + item.first=PyString_AsString(o_0); + PyObject *o_1=PyTuple_GetItem(o,1); + if(!fillStringVector(o_1,item.second)) + throw INTERP_KERNEL::Exception(msg); + arr[i]=item; + } + else + throw INTERP_KERNEL::Exception(msg); + } + } + else + throw INTERP_KERNEL::Exception(msg); +} static PyObject *convertDblArrToPyList(const double *ptr, int size) throw(INTERP_KERNEL::Exception) { @@ -1139,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) { @@ -1197,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)) @@ -1243,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 ; } @@ -1271,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)) @@ -1327,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; } @@ -1345,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)) @@ -1401,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; } @@ -1417,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; @@ -1475,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 !"; @@ -1487,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 !"; @@ -1507,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) @@ -1523,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)) @@ -1580,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; } @@ -1594,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; @@ -1652,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 !"; @@ -1698,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)) { @@ -1727,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)) @@ -1783,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 ; } @@ -1808,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; @@ -1847,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) { @@ -1883,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) { @@ -1915,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; @@ -1996,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) { @@ -2025,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) { @@ -2068,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)) { @@ -2128,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) { @@ -2157,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) { @@ -2236,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(); @@ -2251,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); }