+
+ virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ self->renumberInPlace(tmp);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ self->renumberInPlace(da2->getConstPointer());
+ }
+ }
+
+ virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ self->renumberInPlaceR(tmp);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ self->renumberInPlaceR(da2->getConstPointer());
+ }
+ }
+
+ //tuplesSelec in PyObject * because DataArrayInt is not already existing !
+ virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
+ {
+ static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
+ DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
+ DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
+ DataArrayInt *tuplesSelecPtr2=0;
+ if(tuplesSelecPtr)
+ {
+ tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
+ if(!tuplesSelecPtr2)
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
+ }
+
+ virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
+ {
+ DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
+ self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
+ }
+
+ virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<std::pair<int,int> > ranges;
+ convertPyToVectorPairInt(li,ranges);
+ return self->selectByTupleRanges(ranges);
+ }
+
+ virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ return self->selectByTupleId(tmp,tmp+size);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
+ }
+ }
+
+ virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ return self->selectByTupleIdSafe(tmp,tmp+size);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
+ }
+ }
+
+ virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> tmp;
+ convertPyToNewIntArr3(li,tmp);
+ DataArray *ret=self->keepSelectedComponents(tmp);
+ return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
+ }
+
+ static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
+ {
+ if(!PySlice_Check(slic))
+ throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
+ GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
+ int a,b;
+ DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
+ return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
+ }
+
+ PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
+ {
+ if(!PySlice_Check(slic))
+ throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
+ GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
+ int a,b;
+ DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
+ return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
+ }
+
+ static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
+ {
+ if(!PySlice_Check(slic))
+ throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
+ GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
+ return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
+ }
+
+ static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
+ {
+ if(!PySlice_Check(slic))
+ throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
+ GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
+ return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
+ }
+
+ static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const DataArray *> tmp;
+ convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
+ return DataArray::Aggregate(tmp);
+ }
+
+ int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
+ {
+ if(!PySlice_Check(slic))
+ throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
+ GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
+ return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
+ }
+
+ int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
+ {
+ if(!PySlice_Check(slic))
+ throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
+ GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
+ return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
+ }
+
+ PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
+ {
+ PyObject *ret(PyTuple_New(2));
+ std::string a0(self->getName());
+ const std::vector<std::string> &a1(self->getInfoOnComponents());
+ PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
+ //
+ int sz(a1.size());
+ PyObject *ret1(PyList_New(sz));
+ for(int i=0;i<sz;i++)
+ PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
+ PyTuple_SetItem(ret,1,ret1);
+ //
+ return ret;
+ }
+
+ void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
+ {
+ static const char MSG[]="DataArrayDouble.__setstate__ : expected input is a tuple of size 2 with string as 1st arg and list of string as 2nd arg !";
+ if(!PyTuple_Check(inp))
+ throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
+ int sz(PyTuple_Size(inp));
+ if(sz!=2)
+ throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
+ PyObject *a0(PyTuple_GetItem(inp,0));
+ if(!PyString_Check(a0))
+ throw INTERP_KERNEL::Exception(MSG);
+ PyObject *a1(PyTuple_GetItem(inp,1));
+ std::vector<std::string> a1cpp;
+ if(!fillStringVector(a1,a1cpp))
+ throw INTERP_KERNEL::Exception(MSG);
+ self->setName(PyString_AsString(a0));
+ self->setInfoOnComponents(a1cpp);
+ }