- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __rmul__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayDouble> ret=self->deepCopy();
- ret->applyLin(val,0.);
- return ret.retn();
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Multiply(self,aaa);
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Multiply(self,aaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __imul__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(val,0.);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->multiplyEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->multiplyEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->multiplyEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __div__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- //
-#ifndef WITHOUT_AUTOFIELD
- void *argp;
- if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
- {
- MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
- if(other)
- {
- PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
- MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
- Py_XDECREF(tmp);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
-#endif
- //
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(val==0.)
- throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
- MCAuto<DataArrayDouble> ret=self->deepCopy();
- ret->applyLin(1/val,0.);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 2:
- {
- return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __rdiv__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayDouble> ret=self->deepCopy();
- ret->applyInv(val);
- return ret.retn();
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Divide(aaa,self);
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Divide(aaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __idiv__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- if(val==0.)
- throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
- self->applyLin(1./val,0.);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->divideEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->divideEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->divideEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __pow__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayDouble> ret=self->deepCopy();
- ret->applyPow(val);
- return ret.retn();
- }
- case 2:
- {
- return DataArrayDouble::Pow(self,a);
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Pow(self,aaa);
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Pow(self,aaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __rpow__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayDouble> ret=self->deepCopy();
- ret->applyRPow(val);
- return ret.retn();
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Pow(aaa,self);
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Pow(aaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __ipow__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- self->applyPow(val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->powEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->powEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->powEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
- {
- DataArrayInt *c=0,*cI=0;
- //
- self->computeTupleIdsNearTuples(other,eps,c,cI);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *ret1=0;
- DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- // serialization
- static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
- {
- return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
- }
-
- PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
- {
-#ifdef WITH_NUMPY
- if(!self->isAllocated())
- throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
- PyObject *ret(PyTuple_New(1));
- PyObject *ret0(PyDict_New());
- PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
- {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
- PyObject *tmp1(PyInt_FromLong(0));
- PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
- PyTuple_SetItem(ret,0,ret0);
- }
- return ret;
-#else
- throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
-#endif
- }
- }
- };
-
- class DataArrayDoubleTuple;
-
- class DataArrayDoubleIterator
- {
- public:
- DataArrayDoubleIterator(DataArrayDouble *da);
- ~DataArrayDoubleIterator();
- %extend
- {
- PyObject *next()
- {
- DataArrayDoubleTuple *ret=self->nextt();
- if(ret)
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
- else
- {
- PyErr_SetString(PyExc_StopIteration,"No more data.");
- return 0;
- }
- }
- }
- };
-
- class DataArrayDoubleTuple
- {
- public:
- int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
- DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
- %extend
- {
- std::string __str__() const throw(INTERP_KERNEL::Exception)
- {
- return self->repr();
- }
-
- double __float__() const throw(INTERP_KERNEL::Exception)
- {
- return self->doubleValue();
- }
-
- DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
- {
- return self->buildDADouble(1,self->getNumberOfCompo());
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
- MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *__len__() throw(INTERP_KERNEL::Exception)
- {
- return PyInt_FromLong(self->getNumberOfCompo());
- }
-
- PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- const double *pt=self->getConstPointer();
- int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- {
- if(singleVal>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
- PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
- return 0;
- }
- if(singleVal>=0)
- return PyFloat_FromDouble(pt[singleVal]);
- else
- {
- if(nbc+singleVal>0)
- return PyFloat_FromDouble(pt[nbc+singleVal]);
- else
- {
- std::ostringstream oss;
- oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- }
- }
- case 2:
- {
- PyObject *t=PyTuple_New(multiVal.size());
- for(int j=0;j<(int)multiVal.size();j++)
- {
- int cid=multiVal[j];
- if(cid>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
- }
- return t;
- }
- case 3:
- {
- int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
- PyObject *t=PyTuple_New(sz);
- for(int j=0;j<sz;j++)
- PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
- return t;
- }
- default:
- throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
- }
- }
-
- DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
- const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
- int sw1,sw2;
- double singleValV;
- std::vector<double> multiValV;
- MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
- int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- double *pt=self->getPointer();
- convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
- switch(sw2)
- {
- case 1:
- {
- if(singleVal>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- switch(sw1)
- {
- case 1:
- {
- pt[singleVal]=singleValV;
- return self;
- }
- case 2:
- {
- if(multiValV.size()!=1)
- {
- std::ostringstream oss;
- oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- pt[singleVal]=multiValV[0];
- return self;
- }
- case 3:
- {
- pt[singleVal]=daIntTyyppV->getConstPointer()[0];
- return self;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- case 2:
- {
- switch(sw1)
- {
- case 1:
- {
- for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
- {
- if(*it>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- pt[*it]=singleValV;
- }
- return self;
- }
- case 2:
- {
- if(multiVal.size()!=multiValV.size())
- {
- std::ostringstream oss;
- oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- for(int i=0;i<(int)multiVal.size();i++)
- {
- int pos=multiVal[i];
- if(pos>=nbc)
- {
- std::ostringstream oss;
- oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- pt[multiVal[i]]=multiValV[i];
- }
- return self;
- }
- case 3:
- {
- const double *ptV=daIntTyyppV->getConstPointer();
- if(nbc>daIntTyyppV->getNumberOfCompo())
- {
- std::ostringstream oss;
- oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- std::copy(ptV,ptV+nbc,pt);
- return self;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- case 3:
- {
- int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
- switch(sw1)
- {
- case 1:
- {
- for(int j=0;j<sz;j++)
- pt[slic.first+j*slic.second.second]=singleValV;
- return self;
- }
- case 2:
- {
- if(sz!=(int)multiValV.size())
- {
- std::ostringstream oss;
- oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- for(int j=0;j<sz;j++)
- pt[slic.first+j*slic.second.second]=multiValV[j];
- return self;
- }
- case 3:
- {
- const double *ptV=daIntTyyppV->getConstPointer();
- if(sz>daIntTyyppV->getNumberOfCompo())
- {
- std::ostringstream oss;
- oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- for(int j=0;j<sz;j++)
- pt[slic.first+j*slic.second.second]=ptV[j];
- return self;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- }
- };
-
- class DataArrayIntIterator;
-
- class DataArrayInt : public DataArray
- {
- public:
- static DataArrayInt *New();
- int intValue() const throw(INTERP_KERNEL::Exception);
- int getHashCode() const throw(INTERP_KERNEL::Exception);
- bool empty() const throw(INTERP_KERNEL::Exception);
- void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
- DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
- void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
- void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
- void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
- int popBackSilent() throw(INTERP_KERNEL::Exception);
- void pack() const throw(INTERP_KERNEL::Exception);
- void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
- bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
- bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
- bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
- void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
- void reverse() throw(INTERP_KERNEL::Exception);
- void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
- bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
- void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
- bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
- void fillWithZero() throw(INTERP_KERNEL::Exception);
- void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
- void iota(int init=0) throw(INTERP_KERNEL::Exception);
- std::string repr() const throw(INTERP_KERNEL::Exception);
- std::string reprZip() const throw(INTERP_KERNEL::Exception);
- std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
- bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
- bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
- bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
- void transpose() throw(INTERP_KERNEL::Exception);
- DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
- void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
- void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
- void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
- void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
- void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
- int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
- int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
- int front() const throw(INTERP_KERNEL::Exception);
- int back() const throw(INTERP_KERNEL::Exception);
- void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
- void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
- int *getPointer() throw(INTERP_KERNEL::Exception);
- const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
- DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
- const int *begin() const throw(INTERP_KERNEL::Exception);
- const int *end() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
- int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
- int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
- int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
- int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
- int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
- bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
- bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
- bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
- int count(int value) const throw(INTERP_KERNEL::Exception);
- int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
- int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
- int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
- int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
- int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
- void abs() throw(INTERP_KERNEL::Exception);
- DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
- void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
- void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
- void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
- DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
- void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
- void applyModulus(int val) throw(INTERP_KERNEL::Exception);
- void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
- void applyPow(int val) throw(INTERP_KERNEL::Exception);
- void applyRPow(int val) throw(INTERP_KERNEL::Exception);
- DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
- bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
- static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
- DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
- void computeOffsets() throw(INTERP_KERNEL::Exception);
- void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
- DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
- void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
- DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
- DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
- static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
- void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
- void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
- void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
- void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
- void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
- static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
- void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
- public:
- static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
- %extend
- {
- DataArrayInt() throw(INTERP_KERNEL::Exception)
- {
- return DataArrayInt::New();
- }
-
- static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
- {
- const char *msgBase="MEDCoupling::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)";
- std::string msg(msgBase);
-#ifdef WITH_NUMPY
- msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
-#endif
- msg+=" !";
- if(PyList_Check(elt0) || PyTuple_Check(elt0))
- {
- if(nbOfTuples)
- {
- if(PyInt_Check(nbOfTuples))
- {
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
- if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
- if(nbOfComp)
- {
- if(PyInt_Check(nbOfComp))
- {//DataArrayInt.New([1,3,4,5],2,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfComp);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
- ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- }
- else
- {//DataArrayInt.New([1,3,4],3)
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int tmpp1=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
- ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- }
- else
- {// DataArrayInt.New([1,3,4])
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- int tmpp1=-1,tmpp2=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
- ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
- return ret.retn();
- }
- }
- else if(PyInt_Check(elt0))
- {
- int nbOfTuples1=PyInt_AS_LONG(elt0);
- if(nbOfTuples1<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
- if(nbOfTuples)
- {
- if(!nbOfComp)
- {
- if(PyInt_Check(nbOfTuples))
- {//DataArrayInt.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples1,nbOfCompo);
- return ret.retn();
- }
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- }
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- }
- else
- {//DataArrayInt.New(5)
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples1,1);
- return ret.retn();
- }
- }
-#ifdef WITH_NUMPY
- else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
- {//DataArrayInt.New(numpyArray)
- return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
- }
-#endif
- else
- throw INTERP_KERNEL::Exception(msg.c_str());
- throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
- }
-
- DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
- {
- return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
- }
-
- DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayDouble> ret(self->convertToDblArr());
- return ret.retn();
- }
-
- DataArrayFloat *convertToFloatArr() const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayFloat> ret(self->convertToFloatArr());
- return ret.retn();
- }
-
- std::string __str__() const throw(INTERP_KERNEL::Exception)
- {
- return self->reprNotTooLong();
- }
-
- int __len__() const throw(INTERP_KERNEL::Exception)
- {
- if(self->isAllocated())
- {
- return self->getNumberOfTuples();
- }
- else
- {
- throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
- }
- }
-
- int __int__() const throw(INTERP_KERNEL::Exception)
- {
- return self->intValue();
- }
-
- DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
- {
- return self->iterator();
- }
-
- DataArrayInt *fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayInt> ret(self->fromLinkedListOfPairToList());
- return ret.retn();
- }
-
- DataArrayInt *findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayInt> ret(self->findIdsGreaterOrEqualTo(val));
- return ret.retn();
- }
-
- DataArrayInt *findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayInt> ret(self->findIdsGreaterThan(val));
- return ret.retn();
- }
-
- DataArrayInt *findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayInt> ret(self->findIdsLowerOrEqualTo(val));
- return ret.retn();
- }
-
- DataArrayInt *findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayInt> ret(self->findIdsLowerThan(val));
- return ret.retn();
- }
-
- DataArrayInt *selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayInt> ret(self->selectPartDef(pd));
- return ret.retn();
- }
-
- PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
- self->accumulate(tmp);
- return convertIntArrToPyList(tmp,sz);
- }
-
- DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
- {
- int sw,sz,val;
- std::vector<int> val2;
- const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
- return self->accumulatePerChunck(bg,bg+sz);
- }
-
- DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
- {
- int sw,sz,val;
- std::vector<int> val2;
- const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
- return self->findIdsEqualTuple(bg,bg+sz);
- }
-
- PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
- {
- std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
- PyObject *ret=PyList_New(slcs.size());
- for(std::size_t i=0;i<slcs.size();i++)
- PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
- return ret;
- }
-
- DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
- {
- if(!PySlice_Check(slic))
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (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,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
- if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
- throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
- return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
- }
-
- PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
- {
- int a,b;
- self->getMinMaxValues(a,b);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyInt_FromLong(a));
- PyTuple_SetItem(ret,1,PyInt_FromLong(b));
- return ret;
- }
-
- static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
- {
- int newNbOfTuples=-1;
- int szArr,szArrI,sw,iTypppArr,iTypppArrI;
- std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
- const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
- const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
- DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
- PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
- return ret;
- }
-
- static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
- {
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
- int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
- ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
- return ret.retn();
- }
-
- void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
- {
- const char *msg="MEDCoupling::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !";
- if(PyList_Check(li) || PyTuple_Check(li))
- {
- if(nbOfTuples && nbOfTuples != Py_None)
- {
- if(PyInt_Check(nbOfTuples))
- {
- int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
- if(nbOfTuples<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
- if(nbOfComp && nbOfComp != Py_None)
- {
- if(PyInt_Check(nbOfComp))
- {//DataArrayInt.setValues([1,3,4,5],2,2)
- int nbOfCompo=PyInt_AS_LONG(nbOfComp);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
- std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
- self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {//DataArrayInt.setValues([1,3,4],3)
- int tmpp1=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
- self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {// DataArrayInt.setValues([1,3,4])
- int tmpp1=-1,tmpp2=-1;
- std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
- self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
-
- PyObject *getValues() const throw(INTERP_KERNEL::Exception)
- {
- const int *vals=self->getConstPointer();
- return convertIntArrToPyList(vals,self->getNbOfElems());
- }
-
-#ifdef WITH_NUMPY
- PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
- {
- return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
- }
-#endif
-
- PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
- {
- std::string ret1;
- bool ret0=self->isEqualIfNotWhy(other,ret1);
- PyObject *ret=PyTuple_New(2);
- PyObject *ret0Py=ret0?Py_True:Py_False;
- Py_XINCREF(ret0Py);
- PyTuple_SetItem(ret,0,ret0Py);
- PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
- return ret;
- }
-
- PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
- {
- const int *vals=self->getConstPointer();
- int nbOfComp=self->getNumberOfComponents();
- int nbOfTuples=self->getNumberOfTuples();
- return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
- }
-
- static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> groups;
- std::vector< std::vector<int> > fidsOfGroups;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
- MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
- PyObject *ret = PyList_New(2);
- PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- int sz=fidsOfGroups.size();
- PyObject *ret1 = PyList_New(sz);
- for(int i=0;i<sz;i++)
- PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
- PyList_SetItem(ret,1,ret1);
- return ret;
- }
-
- void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->transformWithIndArr(tmp,tmp+size);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
- }
- }
-
- DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- return self->findIdsEqualList(&singleVal,&singleVal+1);
- case 2:
- return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
- case 4:
- return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- }
-
- DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- MEDCoupling::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- return self->findIdsNotEqualList(&singleVal,&singleVal+1);
- case 2:
- return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
- case 4:
- return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- }
-
- PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *ret0=0,*ret1=0,*ret2=0;
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- if(!da2)
- throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
- da2->checkAllocated();
- self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
- }
- PyObject *ret = PyList_New(3);
- PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
- if (!SWIG_IsOK(res1))
- {
- int size;
- INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
- return self->transformWithIndArrR(tmp,tmp+size);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
- }
- }
-
- DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !");
- }
- return self->renumberAndReduce(tmp,newNbOfTuple);
- }
- 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 !");
- }
- return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
- }
- }
-
- DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !");
- }
- return self->renumber(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 !");
- }
- return self->renumber(da2->getConstPointer());
- }
- }
-
- DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !");
- }
- return self->renumberR(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 !");
- }
- return self->renumberR(da2->getConstPointer());
- }
- }
-
- void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- self->setSelectedComponents(a,tmp);
- }
-
- PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
- {
- std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
- std::size_t sz(retCpp.size());
- PyObject *res(PyList_New(sz));
- for(std::size_t i=0;i<sz;i++)
- PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return res;
- }
-
- PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
- self->getTuple(tupleId,tmp);
- return convertIntArrToPyList(tmp,sz);
- }
-
- PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *arr=0;
- DataArrayInt *arrI=0;
- self->changeSurjectiveFormat(targetNb,arr,arrI);
- PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
- PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
- return res;
- }
-
- static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::Meld(tmp);
- }
-
- static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::Aggregate(tmp);
- }
-
- static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::AggregateIndexes(tmp);
- }
-
- static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::BuildUnion(tmp);
- }
-
- static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::BuildIntersection(tmp);
- }
-
- PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
- {
- int tmp;
- int r1=self->getMaxValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
- {
- int tmp;
- int r1=self->getMinValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
- {
- int nbOfCompo=self->getNumberOfComponents();
- switch(nbOfCompo)
- {
- case 1:
- {
- if(PyInt_Check(obj))
- {
- int val=(int)PyInt_AS_LONG(obj);
- return self->findIdFirstEqual(val);
- }
- else
- throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
- }
- default:
- {
- std::vector<int> arr;
- convertPyToNewIntArr3(obj,arr);
- return self->findIdFirstEqualTuple(arr);
- }
- }
- }
-
- bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
- {
- int nbOfCompo=self->getNumberOfComponents();
- switch(nbOfCompo)
- {
- case 0:
- return false;
- case 1:
- {
- if(PyInt_Check(obj))
- {
- int val=(int)PyInt_AS_LONG(obj);
- return self->presenceOfValue(val);
- }
- else
- throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
- }
- default:
- {
- std::vector<int> arr;
- convertPyToNewIntArr3(obj,arr);
- return self->presenceOfTuple(arr);
- }
- }
- }
-
- PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
- const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
- self->checkAllocated();
- int nbOfTuples=self->getNumberOfTuples();
- int nbOfComponents=self->getNumberOfComponents();
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- DataArrayInt *dt1=0,*dc1=0;
- int sw;
- convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MCAuto<DataArrayInt> ret;
- switch(sw)
- {
- case 1:
- {
- if(nbOfComponents==1)
- return PyInt_FromLong(self->getIJSafe(it1,0));
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 2:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- case 3:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- case 4:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- case 5:
- return PyInt_FromLong(self->getIJSafe(it1,ic1));
- case 6:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 7:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 8:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- std::vector<int> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 9:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 10:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 11:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 12:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 13:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 14:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 15:
- {
- ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 16:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
- std::vector<int> v2(nbOfComp);
- for(int i=0;i<nbOfComp;i++)
- v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
- {
- self->checkAllocated();
- const char msg[]="Unexpected situation in __setitem__ !";
- int nbOfTuples=self->getNumberOfTuples();
- int nbOfComponents=self->getNumberOfComponents();
- int sw1,sw2;
- int i1;
- std::vector<int> v1;
- DataArrayInt *d1=0;
- DataArrayIntTuple *dd1=0;
- convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
- int it1,ic1;
- std::vector<int> vt1,vc1;
- std::pair<int, std::pair<int,int> > pt1,pc1;
- DataArrayInt *dt1=0,*dc1=0;
- convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
- MCAuto<DataArrayInt> tmp;
- switch(sw2)
- {
- case 1:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 2:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 3:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 4:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 5:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 6:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 7:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 8:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 9:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 10:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 11:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 12:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 13:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 14:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 15:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 16:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 2:
- tmp=DataArrayInt::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
- return self;
- case 3:
- self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
- return self;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- return self;
- }
-
- DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
- {
- return self->negate();
- }
-
- DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __add__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(1,val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Add(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Add(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Add(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __radd__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(1,val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Add(self,aaaa);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Add(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __iadd__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(1,val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- self->addEqual(bb);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->addEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->addEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __sub__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(1,-val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Substract(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Substract(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Substract(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __rsub__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(-1,val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Substract(aaaa,self);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Substract(aaaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __isub__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(1,-val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- self->substractEqual(bb);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->substractEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->substractEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __mul__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(val,0);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Multiply(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Multiply(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Multiply(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __rmul__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyLin(val,0);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Multiply(self,aaaa);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Multiply(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __imul__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyLin(val,0);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- self->multiplyEqual(bb);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->multiplyEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->multiplyEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __div__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyDivideBy(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Divide(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Divide(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Divide(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __rdiv__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyInv(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Divide(aaaa,self);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Divide(aaaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __idiv__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyDivideBy(val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- self->divideEqual(bb);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->divideEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->divideEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __mod__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MCAuto<DataArrayInt> ret=self->deepCopy();
- ret->applyModulus(val);
- return ret.retn();
- }
- case 2:
- {
- MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Modulus(self,aaaa);
- }
- case 3:
- {
- return DataArrayInt::Modulus(self,a);
- }
- case 4:
- {
- MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Modulus(self,aaaa);