- std::string __str__() const
- {
- return self->repr();
- }
-
- double __float__() const throw(INTERP_KERNEL::Exception)
- {
- return self->doubleValue();
- }
-
- DataArrayDouble *buildDADouble()
- {
- return self->buildDADouble(1,self->getNumberOfCompo());
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- ParaMEDMEM::DataArrayInt *daIntTyypp=0;
- const double *pt=self->getConstPointer();
- int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp2(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 !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- 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,"");
- 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> !";
- int sw1,sw2;
- double singleValV;
- std::vector<double> multiValV;
- ParaMEDMEM::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;
- ParaMEDMEM::DataArrayInt *daIntTyypp=0;
- double *pt=self->getPointer();
- convertObjToPossibleCpp2(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,"");
- 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);
- }
- }
-}
-
-%extend ParaMEDMEM::DataArrayDouble
- {
- DataArrayDouble() throw(INTERP_KERNEL::Exception)
- {
- return DataArrayDouble::New();
- }
-
- static DataArrayDouble *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
- {
- const char *msg="ParaMEDMEM::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n--DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2) !";
- if(PyList_Check(elt0) || PyTuple_Check(elt0))
- {
- if(elt1)
- {
- if(PyInt_Check(elt1))
- {
- int nbOfTuples=PyInt_AS_LONG(elt1);
- if(nbOfTuples<0)
- throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
- if(elt2)
- {
- if(PyInt_Check(elt2))
- {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
- int nbOfCompo=PyInt_AS_LONG(elt2);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- double *tmp=new double[nbOfTuples*nbOfCompo];
- try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples*nbOfCompo,0.,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
- ret->incrRef();
- return ret;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {//DataArrayDouble.New([1.,3.,4.],3)
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- double *tmp=new double[nbOfTuples];
- try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples,0.,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
- ret->incrRef();
- return ret;
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {// DataArrayDouble.New([1.,3.,4.])
- int szz=-1;
- if(PyList_Check(elt0))
- szz=PyList_Size(elt0);
- else
- szz=PyTuple_Size(elt0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- double *tmp=new double[szz];
- try { fillArrayWithPyListDbl(elt0,tmp,szz,0.,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
- ret->incrRef();
- return ret;
- }
- }
- else if(PyInt_Check(elt0))
- {
- int nbOfTuples=PyInt_AS_LONG(elt0);
- if(nbOfTuples<0)
- throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
- if(elt1)
- {
- if(!elt2)
- {
- if(PyInt_Check(elt1))
- {//DataArrayDouble.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(elt1);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- ret->alloc(nbOfTuples,nbOfCompo);
- ret->incrRef();
- return ret;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {//DataArrayDouble.New(5)
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
- ret->alloc(nbOfTuples,1);
- ret->incrRef();
- return ret;
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
-
- DataArrayDouble(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
- {
- return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,elt1,elt2);
- }
-
- std::string __str__() const
- {
- return self->repr();
- }
-
- double __float__() const throw(INTERP_KERNEL::Exception)
- {
- return self->doubleValue();
- }
-
- int __len__() const throw(INTERP_KERNEL::Exception)
- {
- if(self->isAllocated())
- {
- return self->getNumberOfTuples();
- }
- else
- {
- throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
- }
- }
-
- DataArrayDoubleIterator *__iter__()
- {
- return self->iterator();
- }
-
- void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
- {
- double *tmp=new double[nbOfTuples*nbOfElsPerTuple];
- try
- {
- fillArrayWithPyListDbl(li,tmp,nbOfTuples*nbOfElsPerTuple,0.,false);
- }
- catch(INTERP_KERNEL::Exception& e)
- {
- delete [] tmp;
- throw e;
- }
- self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
- }
-
- PyObject *getValues() throw(INTERP_KERNEL::Exception)
- {
- const double *vals=self->getPointer();
- return convertDblArrToPyList(vals,self->getNbOfElems());
- }
-
- PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
- {
- std::string ret1;
- bool ret0=self->isEqualIfNotWhy(other,prec,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() throw(INTERP_KERNEL::Exception)
- {
- const double *vals=self->getPointer();
- int nbOfComp=self->getNumberOfComponents();
- int nbOfTuples=self->getNumberOfTuples();
- return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
- }
-
- DataArrayDouble *renumber(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 !");
- }
- 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());
- }
- }
-
- DataArrayDouble *renumberR(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 !");
- }
- 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());
- }
- }
-
- DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) 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 !");
- }
- 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);
- }
- }
-
- 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());
- }
- }
-
- 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());
- }
- }
-
- DataArrayDouble *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());
- }
- }
-
- DataArrayDouble *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());
- }
- }
-
- PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
- {
- int tmp;
- double r1=self->getMaxValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *tmp;
- double r1=self->getMaxValue2(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
- {
- int tmp;
- double r1=self->getMinValue(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
- return ret;
- }
-
- PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *tmp;
- double r1=self->getMinValue2(tmp);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
- {
- int nbOfCompo=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
- self->getMinMaxPerComponent(tmp);
- PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
- return ret;
- }
-
- PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->accumulate(tmp);
- return convertDblArrToPyList(tmp,sz);
- }
-
- DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- return self->keepSelectedComponents(tmp);
- }
-
- PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *comm, *commIndex;
- self->findCommonTuples(prec,limitNodeId,comm,commIndex);
- PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return res;
- }
-
- void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- self->setSelectedComponents(a,tmp);
- }
-
- PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
- {
- int sz=self->getNumberOfComponents();
- INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
- self->getTuple(tupleId,tmp);
- return convertDblArrToPyList(tmp,sz);
- }
-
- static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayDouble *> tmp;
- convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
- return DataArrayDouble::Aggregate(tmp);
- }
-
- static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayDouble *> tmp;
- convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
- return DataArrayDouble::Meld(tmp);
- }
-
- DataArrayDouble *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<std::pair<int,int> > ranges;
- convertPyToVectorPairInt(li,ranges);
- return self->selectByTupleRanges(ranges);
- }
-
- PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
- {
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- int nbComp=self->getNumberOfComponents(),nbTuples=-1;
- const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
- const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
- std::vector<int> c,cI;
- self->computeTupleIdsNearTuples(inpu,eps,c,cI);
- DataArrayInt *ret0=DataArrayInt::New(),*ret1=DataArrayInt::New();
- ret0->alloc((int)c.size(),1); std::copy(c.begin(),c.end(),ret0->getPointer());
- ret1->alloc((int)cI.size(),1); std::copy(cI.begin(),cI.end(),ret1->getPointer());
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
- 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);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
- switch(sw)
- {
- case 1:
- if(nbOfComponents==1)
- return PyFloat_FromDouble(self->getIJSafe(it1,0));
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- case 2:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- case 3:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- case 4:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- case 5:
- return PyFloat_FromDouble(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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 7:
- {
- ret=self->selectByTupleId2(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_ParaMEDMEM__DataArrayDouble, 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 9:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 11:
- {
- ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 13:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
- 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 14:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
- 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 15:
- {
- ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
- int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
- 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- case 16:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
- 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
- {
- self->checkAllocated();
- const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
- int nbOfTuples=self->getNumberOfTuples();
- int nbOfComponents=self->getNumberOfComponents();
- int sw1,sw2;
- double i1;
- std::vector<double> v1;
- DataArrayDouble *d1=0;
- convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
- 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);
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
- switch(sw2)
- {
- case 1:
- {
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
- 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;
- 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=DataArrayDouble::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;
- 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=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
- 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;
- 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=DataArrayDouble::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;
- 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=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
- 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;
- 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=DataArrayDouble::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;
- 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=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
- 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;
- 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=DataArrayDouble::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;
- 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=DataArrayDouble::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;
- 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=DataArrayDouble::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;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- case 11:
- {
- int bb=pt1.first;
- int ee=pt1.second.first;
- int ss=pt1.second.second;
- if(ee<bb || ss<=0)
- throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
- int nbOfE=(ee-bb)/ss;
- std::vector<int> nv(nbOfE);
- for(int jj=0;jj<nbOfE;jj++)
- nv[jj]=bb+jj*ss;
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 2:
- tmp=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
- self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&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=DataArrayDouble::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;
- 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=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
- 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;
- 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=DataArrayDouble::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;
- 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=DataArrayDouble::New();
- tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
- 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;
- 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=DataArrayDouble::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;
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- break;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- return self;
- }
-
- DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
- {
- return self->negate();
- }
-
- DataArrayDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __add__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
- ret->applyLin(1.,val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- return DataArrayDouble::Add(self,a);
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Add(self,aaa);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Add(self,aaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __radd__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
- ret->applyLin(1.,val);
- ret->incrRef();
- return ret;
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Add(self,aaa);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Add(self,aaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __iadd__ !";
- 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(1.,val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->addEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->addEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->addEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __sub__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
- ret->applyLin(1.,-val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- return DataArrayDouble::Substract(self,a);
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Substract(self,aaa);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Substract(self,aaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __rsub__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
- ret->applyLin(-1.,val);
- ret->incrRef();
- return ret;
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Substract(aaa,self);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Substract(aaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __isub__ !";
- 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(1,-val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 2:
- {
- self->substractEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->substractEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- self->substractEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayDouble *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __mul__ !";
- double val;
- DataArrayDouble *a;
- DataArrayDoubleTuple *aa;
- std::vector<double> bb;
- int sw;
- convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
- switch(sw)
- {
- case 1:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
- ret->applyLin(val,0.);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- return DataArrayDouble::Multiply(self,a);
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Multiply(self,aaa);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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);
- }
- }
-
- 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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
- ret->applyLin(val,0.);
- ret->incrRef();
- return ret;
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Multiply(self,aaa);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->multiplyEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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);
- }
- }
-
- DataArrayDouble *__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;
- 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 !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
- ret->applyLin(1/val,0.);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- return DataArrayDouble::Divide(self,a);
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Divide(self,aaa);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
- return DataArrayDouble::Divide(self,aaa);
- }
- 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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
- ret->applyInv(val);
- ret->incrRef();
- return ret;
- }
- case 3:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- return DataArrayDouble::Divide(aaa,self);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
- self->divideEqual(aaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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);
- }
- }
-
- PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
- {
- std::vector<int> c,cI;
- //
- self->computeTupleIdsNearTuples(other,eps,c,cI);
- PyObject *ret=PyTuple_New(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- d0->alloc(c.size(),1);
- d1->alloc(cI.size(),1);
- std::copy(c.begin(),c.end(),d0->getPointer());
- std::copy(cI.begin(),cI.end(),d1->getPointer());
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
- return ret;
- }
- };
-
-%extend ParaMEDMEM::DataArrayIntTuple
-{
- std::string __str__() const
- {
- return self->repr();
- }
-
- int __int__() const throw(INTERP_KERNEL::Exception)
- {
- return self->intValue();
- }
-
- DataArrayInt *buildDAInt()
- {
- return self->buildDAInt(1,self->getNumberOfCompo());
- }
-
- PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
- ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
-
- PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- ParaMEDMEM::DataArrayInt *daIntTyypp=0;
- const int *pt=self->getConstPointer();
- int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp2(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 !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- if(singleVal>=0)
- return PyInt_FromLong(pt[singleVal]);
- else
- {
- if(nbc+singleVal>0)
- return PyInt_FromLong(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,PyInt_FromLong(pt[cid]));
- }
- return t;
- }
- case 3:
- {
- int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,"");
- PyObject *t=PyTuple_New(sz);
- for(int j=0;j<sz;j++)
- PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
- return t;
- }
- default:
- throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
- }
- }
-
- DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
- int sw1,sw2;
- int singleValV;
- std::vector<int> multiValV;
- std::pair<int, std::pair<int,int> > slicV;
- ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
- int nbc=self->getNumberOfCompo();
- convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- ParaMEDMEM::DataArrayInt *daIntTyypp=0;
- int *pt=self->getPointer();
- convertObjToPossibleCpp2(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 4:
- {
- 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 4:
- {
- const int *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,"");
- 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 4:
- {
- const int *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);
- }
- }
-}
-
-%extend ParaMEDMEM::DataArrayIntIterator
-{
- PyObject *next()
- {
- DataArrayIntTuple *ret=self->nextt();
- if(ret)
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
- else
- {
- PyErr_SetString(PyExc_StopIteration,"No more data.");
- return 0;
- }
- }
-}
-
-%extend ParaMEDMEM::DataArrayInt
- {
- DataArrayInt() throw(INTERP_KERNEL::Exception)
- {
- return DataArrayInt::New();
- }
-
- static DataArrayInt *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
- {
- const char *msg="ParaMEDMEM::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(5)\n-DataArrayInt.New(5,2) !";
- if(PyList_Check(elt0) || PyTuple_Check(elt0))
- {
- if(elt1)
- {
- if(PyInt_Check(elt1))
- {
- int nbOfTuples=PyInt_AS_LONG(elt1);
- if(nbOfTuples<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
- if(elt2)
- {
- if(PyInt_Check(elt2))
- {//DataArrayInt.New([1,3,4,5],2,2)
- int nbOfCompo=PyInt_AS_LONG(elt2);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- int *tmp=new int[nbOfTuples*nbOfCompo];
- try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples*nbOfCompo,0,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
- ret->incrRef();
- return ret;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {//DataArrayInt.New([1,3,4],3)
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- int *tmp=new int[nbOfTuples];
- try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples,0,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
- ret->incrRef();
- return ret;
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {// DataArrayInt.New([1,3,4])
- int szz=-1;
- if(PyList_Check(elt0))
- szz=PyList_Size(elt0);
- else
- szz=PyTuple_Size(elt0);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- int *tmp=new int[szz];
- try { fillArrayWithPyListInt(elt0,tmp,szz,0,true); }
- catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
- ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
- ret->incrRef();
- return ret;
- }
- }
- else if(PyInt_Check(elt0))
- {
- int nbOfTuples=PyInt_AS_LONG(elt0);
- if(nbOfTuples<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
- if(elt1)
- {
- if(!elt2)
- {
- if(PyInt_Check(elt1))
- {//DataArrayInt.New(5,2)
- int nbOfCompo=PyInt_AS_LONG(elt1);
- if(nbOfCompo<0)
- throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples,nbOfCompo);
- ret->incrRef();
- return ret;
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
- else
- {//DataArrayInt.New(5)
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
- ret->alloc(nbOfTuples,1);
- ret->incrRef();
- return ret;
- }
- }
- else
- throw INTERP_KERNEL::Exception(msg);
- }
-
- DataArrayInt(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
- {
- return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,elt1,elt2);
- }
-
- std::string __str__() const
- {
- return self->repr();
- }
-
- 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__()
- {
- return self->iterator();
- }
-
- static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, const DataArrayInt *arr, const DataArrayInt *arrI) throw(INTERP_KERNEL::Exception)
- {
- int newNbOfTuples=-1;
- DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arr,arrI,newNbOfTuples);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
- PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
- return ret;
- }
-
- void setValues(PyObject *li, int nbOfTuples, int nbOfElsPerTuple) throw(INTERP_KERNEL::Exception)
- {
- int *tmp=new int[nbOfTuples*nbOfElsPerTuple];
- try
- {
- fillArrayWithPyListInt(li,tmp,nbOfTuples*nbOfElsPerTuple,0,false);
- }
- catch(INTERP_KERNEL::Exception& e)
- {
- delete [] tmp;
- throw e;
- }
- self->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfElsPerTuple);
- }
-
- PyObject *getValues() throw(INTERP_KERNEL::Exception)
- {
- const int *vals=self->getPointer();
- return convertIntArrToPyList(vals,self->getNbOfElems());
- }
-
- 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() throw(INTERP_KERNEL::Exception)
- {
- const int *vals=self->getPointer();
- 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 ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
- ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
- PyObject *ret = PyList_New(2);
- PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__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)
- {
- 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);
- self->transformWithIndArr(tmp,tmp+size);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
- }
- }
-
- DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- ParaMEDMEM::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- return self->getIdsEqualList(&singleVal,&singleVal+1);
- case 2:
- return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
- case 4:
- return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
- }
- }
-
- DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int singleVal;
- std::vector<int> multiVal;
- std::pair<int, std::pair<int,int> > slic;
- ParaMEDMEM::DataArrayInt *daIntTyypp=0;
- convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
- switch(sw)
- {
- case 1:
- return self->getIdsNotEqualList(&singleVal,&singleVal+1);
- case 2:
- return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
- case 4:
- return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
- default:
- throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : 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_ParaMEDMEM__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();
- int size=self->getNumberOfTuples();
- self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
- }
- PyObject *ret = PyList_New(3);
- PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
-
- DataArrayInt *transformWithIndArrR(PyObject *li) const
- {
- 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->transformWithIndArrR(tmp,tmp+size);
- }
- else
- {
- DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
- return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
- }
- }
-
- 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());
- }
- }
-
- 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());
- }
- }
-
- DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) 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 !");
- }
- 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_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 !");
- }
- 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_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 !");
- }
- 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());
- }
- }
-
- DataArrayInt *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());
- }
- }
-
- DataArrayInt *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());
- }
- }
-
- DataArrayInt *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- return self->keepSelectedComponents(tmp);
- }
-
- void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- self->setSelectedComponents(a,tmp);
- }
-
- 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_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
- PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
- return res;
- }
-
- DataArrayInt *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<std::pair<int,int> > ranges;
- convertPyToVectorPairInt(li,ranges);
- return self->selectByTupleRanges(ranges);
- }
-
- static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::Meld(tmp);
- }
-
- static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::Aggregate(tmp);
- }
-
- static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
- return DataArrayInt::BuildUnion(tmp);
- }
-
- static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<const DataArrayInt *> tmp;
- convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__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->locateValue(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->locateTuple(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__ !";
- 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);
- MEDCouplingAutoRefCountObjectPtr<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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 2:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- case 3:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- case 4:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 7:
- {
- ret=self->selectByTupleId2(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_ParaMEDMEM__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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 9:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 11:
- {
- ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 13:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
- 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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 14:
- {
- ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
- 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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 15:
- {
- ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
- int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
- 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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
- case 16:
- {
- ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- int nbOfComp=(pc1.second.first-1-pc1.first)/pc1.second.second+1;
- 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_ParaMEDMEM__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);
- MEDCouplingAutoRefCountObjectPtr<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,v1.size(),1);
- 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,v1.size(),1);
- 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,v1.size(),1);
- 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,v1.size(),1);
- 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:
- {
- int bb=pt1.first;
- int ee=pt1.second.first;
- int ss=pt1.second.second;
- if(ee<bb || ss<=0)
- throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
- int nbOfE=(ee-bb)/ss;
- std::vector<int> nv(nbOfE);
- for(int jj=0;jj<nbOfE;jj++)
- nv[jj]=bb+jj*ss;
- switch(sw1)
- {
- case 1:
- self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.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,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
- return self;
- case 3:
- self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
- return self;
- case 4:
- tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
- self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&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,v1.size(),1);
- 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,v1.size(),1);
- 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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyLin(1,val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Add(self,aaa);
- }
- case 3:
- {
- return DataArrayInt::Add(self,a);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyLin(1,val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Add(self,aaa);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyLin(1,-val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Substract(self,aaa);
- }
- case 3:
- {
- return DataArrayInt::Substract(self,a);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyLin(-1,val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Substract(aaa,self);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyLin(val,0);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Multiply(self,aaa);
- }
- case 3:
- {
- return DataArrayInt::Multiply(self,a);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyLin(val,0);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Multiply(self,aaa);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyDivideBy(val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Divide(self,aaa);
- }
- case 3:
- {
- return DataArrayInt::Divide(self,a);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyInv(val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Divide(aaa,self);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<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:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyModulus(val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Modulus(self,aaa);
- }
- case 3:
- {
- return DataArrayInt::Modulus(self,a);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Modulus(self,aaaa);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __rmod__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
- ret->applyRModulus(val);
- ret->incrRef();
- return ret;
- }
- case 2:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaa=DataArrayInt::New(); aaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
- return DataArrayInt::Modulus(aaa,self);
- }
- case 3:
- {
- return DataArrayInt::Modulus(a,self);
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- return DataArrayInt::Modulus(aaaa,self);
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
-
- PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
- {
- const char msg[]="Unexpected situation in __imod__ !";
- int val;
- DataArrayInt *a;
- std::vector<int> aa;
- DataArrayIntTuple *aaa;
- int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
- switch(sw)
- {
- case 1:
- {
- self->applyModulus(val);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 3:
- {
- self->modulusEqual(a);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- case 4:
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
- self->modulusEqual(aaaa);
- Py_XINCREF(trueSelf);
- return trueSelf;
- }
- default:
- throw INTERP_KERNEL::Exception(msg);
- }
- }
- };
-
-namespace ParaMEDMEM
-{
- class MEDCouplingField : public ParaMEDMEM::RefCountObject, public ParaMEDMEM::TimeLabel