-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 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
#include "InterpKernelAutoPtr.hxx"
+/*!
+ * This method is an extention of PySlice_GetIndices but less
+ * open than PySlice_GetIndicesEx that accepts too many situations.
+ */
+void GetIndicesOfSlice(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure)
+{
+ int ret(PySlice_GetIndices(slice,length,start,stop,step));
+ if(ret==0)
+ return ;
+ if(*step>0 && *start==*stop && length==*start)
+ return ;
+ throw INTERP_KERNEL::Exception(msgInCaseOfFailure);
+}
+
+/*!
+ * This method allows to retrieve slice info from \a slice.
+ */
+void GetIndicesOfSliceExplicitely(PySliceObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure)
+{
+ int ret(PySlice_GetIndices(slice,std::numeric_limits<int>::max(),start,stop,step));
+ if(ret==0)
+ {
+ if(*start!=std::numeric_limits<int>::max() && *stop!=std::numeric_limits<int>::max())
+ return ;
+ std::ostringstream oss;
+ oss << msgInCaseOfFailure << " The input slice contains some unknowns that can't be determined in static method ! The input slice must be explicit here !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ throw INTERP_KERNEL::Exception(msgInCaseOfFailure);
+}
+
+int InterpreteNegativeInt(int val, int nbelem)
+{
+ if(val<0)
+ {
+ int newVal(nbelem+val);
+ if(newVal<0)
+ {
+ std::ostringstream oss; oss << "interpreteNegativeInt : request for negative int=" << val << " but number of elems is equal to " << nbelem << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return newVal;
+ }
+ else
+ return val;
+}
+
#ifdef WITH_NUMPY
#include <numpy/arrayobject.h>
+#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.
{
Py_XINCREF(obj);
PyArrayObject *objC=reinterpret_cast<PyArrayObject *>(obj);
- objC->flags|=NPY_OWNDATA;
+ objC->flags|=MED_NUMPY_OWNDATA;
Py_XDECREF(weakRefOnOwner);
Py_XDECREF(obj);
}
MCData *_pt_mc;
};
-typedef struct PyCallBackDataArraySt<ParaMEDMEM::DataArrayInt> PyCallBackDataArrayInt;
-typedef struct PyCallBackDataArraySt<ParaMEDMEM::DataArrayDouble> PyCallBackDataArrayDouble;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayInt> PyCallBackDataArrayInt;
+typedef struct PyCallBackDataArraySt<MEDCoupling::DataArrayDouble> PyCallBackDataArrayDouble;
extern "C"
{
{
if(self->_pt_mc)
{
- ParaMEDMEM::MemArray<int>& mma=self->_pt_mc->accessToMemArray();
+ MEDCoupling::MemArray<int>& mma=self->_pt_mc->accessToMemArray();
mma.destroy();
}
Py_XINCREF(Py_None);
{
if(self->_pt_mc)
{
- ParaMEDMEM::MemArray<double>& mma=self->_pt_mc->accessToMemArray();
+ MEDCoupling::MemArray<double>& mma=self->_pt_mc->accessToMemArray();
mma.destroy();
}
Py_XINCREF(Py_None);
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<MCData> ret=MCData::New();
+ typename MEDCoupling::MCAuto<MCData> ret=MCData::New();
if(PyArray_ISBEHAVED(elt0))//aligned and writeable and in machine byte-order
{
PyArrayObject *elt0C=reinterpret_cast<PyArrayObject *>(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<PyArrayObject *>(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<const T*>(data),reinterpret_cast<const T*>(data)+nbOfElems,dataCpy);
+ ret->useArray(dataCpy,true,MEDCoupling::C_DEALLOC,sz0,sz1);
+ return ret.retn();
}
- typename ParaMEDMEM::MemArray<T>& mma=ret->accessToMemArray();
+ typename MEDCoupling::MemArray<T>& mma=ret->accessToMemArray();
if(eltOwning==NULL)
{
PyCallBackDataArraySt<MCData> *cb=PyObject_GC_New(PyCallBackDataArraySt<MCData>,pytype);
cb->_pt_mc=ret;
- ret->useArray(reinterpret_cast<const T *>(data),true,ParaMEDMEM::C_DEALLOC,sz0,sz1);
+ ret->useArray(reinterpret_cast<const T *>(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);
}
else
{
- ret->useArray(reinterpret_cast<const T *>(data),true,ParaMEDMEM::C_DEALLOC,sz0,sz1);
+ ret->useArray(reinterpret_cast<const T *>(data),true,MEDCoupling::C_DEALLOC,sz0,sz1);
PyObject *ref=PyWeakref_NewRef(reinterpret_cast<PyObject *>(eltOwning),NULL);
- void **objs=new void *[2]; objs[0]=ref; objs[1]=(void*) ParaMEDMEM::MemArray<T>::CDeallocator;
+ typename MEDCoupling::MemArray<T>::Deallocator tmp(MEDCoupling::MemArray<T>::CDeallocator);
+ void **tmp2 = reinterpret_cast<void**>(&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<const T *>(data),false,ParaMEDMEM::CPP_DEALLOC,sz0,sz1);
+ ret->useArray(reinterpret_cast<const T *>(data),false,MEDCoupling::CPP_DEALLOC,sz0,sz1);
return ret.retn();
}
/* 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;
}
}
template<class MCData, class T>
-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<T>& mem=self->accessToMemArray();
- int nbComp=self->getNumberOfComponents();
+ MEDCoupling::MemArray<T>& mem=self->accessToMemArray();
if(nbComp==0)
{
std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !";
}
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<T *>(bg));
+ PyObject *ret(PyArray_SimpleNewFromData(nbDims,dim,npyObjectType,const_cast<T *>(bg)));
if(mem.isDeallocatorCalled())
{
if(mem.getDeallocator()!=numarrdeal)
{// case for the first call of toNumPyArray
- PyObject *ref=PyWeakref_NewRef(ret,NULL);
- void **objs=new void *[2]; objs[0]=ref; objs[1]=(void*) mem.getDeallocator();
+ PyObject *ref(PyWeakref_NewRef(ret,NULL));
+ typename MEDCoupling::MemArray<T>::Deallocator tmp(mem.getDeallocator());
+ void **tmp2 = reinterpret_cast<void**>(&tmp); // MSVC2010 does not support constructor()
+ void **objs=new void *[2]; objs[0]=reinterpret_cast<void*>(ref); objs[1]=*tmp2;
mem.setParameterForDeallocator(objs);
mem.setSpecificDeallocator(numarrdeal);
return ret;
return ret;
}
-SWIGINTERN PyObject *ParaMEDMEM_DataArrayInt_toNumPyArray(ParaMEDMEM::DataArrayInt *self);
-SWIGINTERN PyObject *ParaMEDMEM_DataArrayDouble_toNumPyArray(ParaMEDMEM::DataArrayDouble *self);
+template<class MCData, class T>
+PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr)
+{
+ return ToNumPyArrayUnderground<MCData,T>(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<std::map<int,double> >& m, int nbCols) throw(INTERP_KERNEL::Exception)
{
int nbRows((int)m.size());
- ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayInt> indPtr(ParaMEDMEM::DataArrayInt::New()),indices(ParaMEDMEM::DataArrayInt::New());
- ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::DataArrayDouble> data(ParaMEDMEM::DataArrayDouble::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> data(MEDCoupling::DataArrayDouble::New());
indPtr->alloc(nbRows+1,1);
int *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++;
int sz2(0);
*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);
PyObject* pdict=PyDict_New();
PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
PyObject *tmp(PyRun_String("from scipy.sparse import csr_matrix", Py_single_input, pdict, pdict));
+ if(!tmp)
+ throw INTERP_KERNEL::Exception("Problem during loading csr_matrix in scipy.sparse ! Is Scipy module available in present ?");
PyObject *csrMatrixCls=PyDict_GetItemString(pdict,"csr_matrix");
+ if(!csrMatrixCls)
+ throw INTERP_KERNEL::Exception("csr_matrix not found in scipy.sparse ! Is Scipy module available in present ?");
PyObject *ret(PyObject_Call(csrMatrixCls,args,kw));
Py_DECREF(pdict); Py_XDECREF(tmp); Py_DECREF(args); Py_DECREF(kw);
return ret;
#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)
Py_XINCREF(Py_None);
return Py_None;
}
- if(dynamic_cast<ParaMEDMEM::DataArrayByte *>(dac))
- ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayByte,owner);
- if(dynamic_cast<ParaMEDMEM::DataArrayAsciiChar *>(dac))
- ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayByte *>(dac))
+ ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayByte,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayAsciiChar *>(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)
Py_XINCREF(Py_None);
return Py_None;
}
- if(dynamic_cast<ParaMEDMEM::DataArrayDouble *>(dac))
- ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,owner);
- if(dynamic_cast<ParaMEDMEM::DataArrayInt *>(dac))
- ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,owner);
- if(dynamic_cast<ParaMEDMEM::DataArrayByte *>(dac))
- ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayByte,owner);
- if(dynamic_cast<ParaMEDMEM::DataArrayAsciiChar *>(dac))
- ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayDouble *>(dac))
+ ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayInt *>(dac))
+ ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayByte *>(dac))
+ ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayByte,owner);
+ if(dynamic_cast<MEDCoupling::DataArrayAsciiChar *>(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;
}
}
+static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
+{
+ PyObject *ret=PyList_New(arr.size());
+ for(std::size_t i=0;i<arr.size();i++)
+ {
+ PyObject *t=PyTuple_New(2);
+ PyTuple_SetItem(t,0,PyInt_FromLong(arr[i].first));
+ PyTuple_SetItem(t,1,PyInt_FromLong(arr[i].second));
+ PyList_SetItem(ret,i,t);
+ }
+ return ret;
+}
+
static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,int> >& 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 !";
throw INTERP_KERNEL::Exception(msg);
}
+static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pair<std::string,int> >& 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<size;i++)
+ {
+ PyObject *o=PyList_GetItem(pyLi,i);
+ if(PyTuple_Check(o))
+ {
+ int sz2=PyTuple_Size(o);
+ if(sz2!=2)
+ throw INTERP_KERNEL::Exception(msg);
+ PyObject *o_0=PyTuple_GetItem(o,0);
+ if(!PyString_Check(o_0))
+ throw INTERP_KERNEL::Exception(msg);
+ PyObject *o_1=PyTuple_GetItem(o,1);
+ if(!PyInt_Check(o_1))
+ throw INTERP_KERNEL::Exception(msg);
+ arr[i].first=PyString_AsString(o_0);
+ arr[i].second=(int)PyInt_AS_LONG(o_1);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ else if(PyTuple_Check(pyLi))
+ {
+ int size=PyTuple_Size(pyLi);
+ arr.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyTuple_GetItem(pyLi,i);
+ if(PyTuple_Check(o))
+ {
+ int sz2=PyTuple_Size(o);
+ if(sz2!=2)
+ throw INTERP_KERNEL::Exception(msg);
+ PyObject *o_0=PyTuple_GetItem(o,0);
+ if(!PyString_Check(o_0))
+ throw INTERP_KERNEL::Exception(msg);
+ PyObject *o_1=PyTuple_GetItem(o,1);
+ if(!PyInt_Check(o_1))
+ throw INTERP_KERNEL::Exception(msg);
+ arr[i].first=PyString_AsString(o_0);
+ arr[i].second=(int)PyInt_AS_LONG(o_1);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+}
+
static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr) throw(INTERP_KERNEL::Exception)
{
if(PyList_Check(pyLi))
else
return false;
}
+static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector<std::string> >& 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<sz;i++)
+ {
+ PyObject *o=PyList_GetItem(pyLi,i);
+ if(!fillStringVector(o,arr[i]))
+ 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<sz;i++)
+ {
+ PyObject *o=PyTuple_GetItem(pyLi,i);
+ if(!fillStringVector(o,arr[i]))
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+}
+
+static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec) throw(INTERP_KERNEL::Exception)
+{
+ if(PyList_Check(pyLi))
+ {
+ Py_ssize_t sz=PyList_Size(pyLi);
+ vec.resize(sz);
+ for(int i=0;i<sz;i++)
+ {
+ PyObject *o=PyList_GetItem(pyLi,i);
+ if(PyInt_Check(o))
+ vec[i]=PyInt_AS_LONG(o);
+ else
+ return false;
+ }
+ return true;
+ }
+ else if(PyTuple_Check(pyLi))
+ {
+ Py_ssize_t sz=PyTuple_Size(pyLi);
+ vec.resize(sz);
+ for(int i=0;i<sz;i++)
+ {
+ PyObject *o=PyTuple_GetItem(pyLi,i);
+ if(PyInt_Check(o))
+ vec[i]=PyInt_AS_LONG(o);
+ else
+ return false;
+ }
+ return true;
+ }
+ else
+ return false;
+}
+
+static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector<int> >& 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<sz;i++)
+ {
+ PyObject *o=PyList_GetItem(pyLi,i);
+ if(!fillIntVector(o,arr[i]))
+ 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<sz;i++)
+ {
+ PyObject *o=PyTuple_GetItem(pyLi,i);
+ if(!fillIntVector(o,arr[i]))
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+}
+
+static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< std::pair<std::string, std::vector<std::string> > >& 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<sz;i++)
+ {
+ PyObject *o=PyList_GetItem(pyLi,i);
+ if(PyTuple_Check(o))
+ {
+ int sz2=PyTuple_Size(o);
+ if(sz2!=2)
+ throw INTERP_KERNEL::Exception(msg);
+ std::pair<std::string, std::vector<std::string> > 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<sz;i++)
+ {
+ PyObject *o=PyTuple_GetItem(pyLi,i);
+ if(PyTuple_Check(o))
+ {
+ int sz2=PyTuple_Size(o);
+ if(sz2!=2)
+ throw INTERP_KERNEL::Exception(msg);
+ std::pair<std::string, std::vector<std::string> > 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)
{
return ret;
}
-//convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(pyLi,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh")
+//convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(pyLi,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh")
template<class T>
static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, const char *typeStr, typename std::vector<T>& ret)
{
*
* switch between (int,vector<int>,DataArrayInt)
*/
-static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, ParaMEDMEM::DataArrayInt *& daIntTyypp, ParaMEDMEM::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception)
{
sw=-1;
if(PyInt_Check(value))
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 ;
}
*
* switch between (int,vector<int>,DataArrayInt)
*/
-static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, ParaMEDMEM::DataArrayDouble *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDouble *& daIntTyypp) throw(INTERP_KERNEL::Exception)
{
sw=-1;
if(PyFloat_Check(value))
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;
}
*
* switch between (int,vector<int>,DataArrayInt)
*/
-static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, ParaMEDMEM::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
{
sw=-1;
if(PyFloat_Check(value))
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;
}
*
* switch between (int,vector<int>,DataArrayInt)
*/
-static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, ParaMEDMEM::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& 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;
{
Py_ssize_t strt=2,stp=2,step=2;
PySliceObject *oC=reinterpret_cast<PySliceObject *>(value);
- if(PySlice_GetIndices(oC,nbelem,&strt,&stp,&step)!=0)
- if(nbelem!=0 || strt!=0 || stp!=0)
- {
- std::ostringstream oss; oss << "Slice in subscriptable object DataArray invalid : number of elements is : " << nbelem;
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
+ GetIndicesOfSlice(oC,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
p.first=strt;
p.second.first=stp;
p.second.second=step;
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 !";
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 !";
throw INTERP_KERNEL::Exception(msg);
}
+/*!
+ * Idem than convertObjToPossibleCpp2
+ */
+static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+{
+ convertObjToPossibleCpp2(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp);
+ if(sw==1)
+ {
+ iTyypp=InterpreteNegativeInt(iTyypp,nbelem);
+ }
+}
+
/*!
* if python int -> cpp int sw=1
* if python tuple[int] -> cpp vector<int> sw=2
* 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<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, ParaMEDMEM::DataArrayIntTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
{
sw=-1;
if(PyInt_Check(value))
{
Py_ssize_t strt=2,stp=2,step=2;
PySliceObject *oC=reinterpret_cast<PySliceObject *>(value);
- if(PySlice_GetIndices(oC,nbelem,&strt,&stp,&step)!=0)
- if(nbelem!=0 || strt!=0 || stp!=0)
- {
- std::ostringstream oss; oss << "Slice in subscriptable object DataArray invalid : number of elements is : " << nbelem;
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
+ GetIndicesOfSlice(oC,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
p.first=strt;
p.second.first=stp;
p.second.second=step;
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;
}
* if python not null pointer of DataArrayChar -> cpp DataArrayChar sw=4
* switch between (int,string,vector<string>,DataArrayChar)
*/
-static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector<std::string>& vsType, ParaMEDMEM::DataArrayChar *& dacType) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector<std::string>& 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;
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 !";
*/
static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector<int>& vt, std::vector<int>& vc,
std::pair<int, std::pair<int,int> >& pt, std::pair<int, std::pair<int,int> >& 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))
{
- convertObjToPossibleCpp2(value,nbTuple,sw,it,vt,pt,dt);
+ convertObjToPossibleCpp2WithNegIntInterp(value,nbTuple,sw,it,vt,pt,dt);
return ;
}
else
throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !");
PyObject *ob0=PyTuple_GetItem(value,0);
int sw1,sw2;
- convertObjToPossibleCpp2(ob0,nbTuple,sw1,it,vt,pt,dt);
+ convertObjToPossibleCpp2WithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt);
PyObject *ob1=PyTuple_GetItem(value,1);
- convertObjToPossibleCpp2(ob1,nbCompo,sw2,ic,vc,pc,dc);
+ convertObjToPossibleCpp2WithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc);
sw=4*sw2+sw1;
}
}
* if value list[int,double] -> cpp std::vector<double> sw=4
* if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d, ParaMEDMEM::DataArrayDoubleTuple *&e, std::vector<double>& f)
+static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
{
sw=-1;
if(PyFloat_Check(value))
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 ;
}
* if value list[int,double] -> cpp std::vector<double> sw=4
* if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d, ParaMEDMEM::DataArrayDoubleTuple *&e, std::vector<double>& f,
+static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) throw(INTERP_KERNEL::Exception)
{
sw=-1;
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)
{
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)
{
* if value list[int,double] -> cpp std::vector<double> sw=4
* if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d, ParaMEDMEM::DataArrayDoubleTuple *&e, std::vector<double>& f,
+static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception)
{
sw=-1;
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)
{
{ 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)
{
static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector<double>& 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))
{
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)
{
{ 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)
{
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();
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);
}