X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingMemArray.i;h=7e73d97ce9e1937868c099dfe04a5df8869d3138;hb=4169897bd0b8041daa825d33c693f2f1c3a0704f;hp=9b916b2986ee301ada6e0c34b883729a49d538a3;hpb=48e298dbf14059e3392eb522cfdb634bfefeaf1b;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index 9b916b298..7e73d97ce 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -32,6 +32,7 @@ namespace ParaMEDMEM std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception); std::string getName() const; void setInfoOnComponents(const std::vector& info) throw(INTERP_KERNEL::Exception); + void setInfoAndChangeNbOfCompo(const std::vector& info) throw(INTERP_KERNEL::Exception); std::vector getVarsOnComponent() const throw(INTERP_KERNEL::Exception); std::vector getUnitsOnComponent() const throw(INTERP_KERNEL::Exception); std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception); @@ -39,6 +40,11 @@ namespace ParaMEDMEM std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception); void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception); int getNumberOfComponents() const; + virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception); + virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception); + virtual bool isAllocated() const throw(INTERP_KERNEL::Exception); + virtual void checkAllocated() const throw(INTERP_KERNEL::Exception); + virtual void desallocate() throw(INTERP_KERNEL::Exception); virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception); virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception); virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception); @@ -77,6 +83,177 @@ namespace ParaMEDMEM convertPyToNewIntArr3(li,tmp); self->copyPartOfStringInfoFrom2(tmp,other); } + + virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + int size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + self->renumberInPlace(tmp); + } + else + { + DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + da2->checkAllocated(); + int size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + self->renumberInPlace(da2->getConstPointer()); + } + } + + virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + int size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + self->renumberInPlaceR(tmp); + } + else + { + DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + da2->checkAllocated(); + int size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + self->renumberInPlaceR(da2->getConstPointer()); + } + } + + //tuplesSelec in PyObject * because DataArrayInt is not already existing ! + virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception) + { + static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt"; + DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray"); + DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg); + DataArrayInt *tuplesSelecPtr2=0; + if(tuplesSelecPtr) + { + tuplesSelecPtr2=dynamic_cast(tuplesSelecPtr); + if(!tuplesSelecPtr2) + throw INTERP_KERNEL::Exception(msg); + } + self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2); + } + + virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception) + { + DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray"); + self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step); + } + + virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception) + { + std::vector > ranges; + convertPyToVectorPairInt(li,ranges); + return self->selectByTupleRanges(ranges); + } + + virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception) + { + std::vector tmp; + convertPyToNewIntArr3(li,tmp); + DataArray *ret=self->keepSelectedComponents(tmp); + return convertDataArray(ret,SWIG_POINTER_OWN | 0 ); + } + + static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception) + { + if(!PySlice_Check(slic)) + throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !"); + Py_ssize_t strt=2,stp=2,step=2; + PySliceObject *sly=reinterpret_cast(slic); + if(PySlice_GetIndices(sly,std::numeric_limits::max(),&strt,&stp,&step)!=0) + throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !"); + if(strt==std::numeric_limits::max() || stp==std::numeric_limits::max()) + throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !"); + int a,b; + DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b); + return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step)); + } + + PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception) + { + if(!PySlice_Check(slic)) + throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !"); + Py_ssize_t strt=2,stp=2,step=2; + PySliceObject *sly=reinterpret_cast(slic); + if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0) + throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !"); + int a,b; + DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b); + return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step)); + } + + static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception) + { + if(!PySlice_Check(slic)) + throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !"); + Py_ssize_t strt=2,stp=2,step=2; + PySliceObject *sly=reinterpret_cast(slic); + if(PySlice_GetIndices(sly,std::numeric_limits::max(),&strt,&stp,&step)!=0) + throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !"); + if(strt==std::numeric_limits::max() || stp==std::numeric_limits::max()) + throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !"); + return DataArray::GetNumberOfItemGivenBES(strt,stp,step,""); + } + + static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception) + { + if(!PySlice_Check(slic)) + throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !"); + Py_ssize_t strt=2,stp=2,step=2; + PySliceObject *sly=reinterpret_cast(slic); + if(PySlice_GetIndices(sly,std::numeric_limits::max(),&strt,&stp,&step)!=0) + throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !"); + if(strt==std::numeric_limits::max() || stp==std::numeric_limits::max()) + throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !"); + return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,""); + } + + int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception) + { + if(!PySlice_Check(slic)) + throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !"); + Py_ssize_t strt=2,stp=2,step=2; + PySliceObject *sly=reinterpret_cast(slic); + if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0) + throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !"); + return DataArray::GetNumberOfItemGivenBES(strt,stp,step,""); + } + + int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception) + { + if(!PySlice_Check(slic)) + throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !"); + Py_ssize_t strt=2,stp=2,step=2; + PySliceObject *sly=reinterpret_cast(slic); + if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0) + throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !"); + return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,""); + } } }; @@ -87,9 +264,6 @@ namespace ParaMEDMEM { public: static DataArrayDouble *New(); - bool isAllocated() const throw(INTERP_KERNEL::Exception); - void checkAllocated() const throw(INTERP_KERNEL::Exception); - void setInfoAndChangeNbOfCompo(const std::vector& info) throw(INTERP_KERNEL::Exception); double doubleValue() const throw(INTERP_KERNEL::Exception); bool empty() const throw(INTERP_KERNEL::Exception); DataArrayDouble *deepCpy() const throw(INTERP_KERNEL::Exception); @@ -100,7 +274,6 @@ namespace ParaMEDMEM void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception); double popBackSilent() throw(INTERP_KERNEL::Exception); void pack() const throw(INTERP_KERNEL::Exception); - void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception); void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception); void fillWithZero() throw(INTERP_KERNEL::Exception); void fillWithValue(double val) throw(INTERP_KERNEL::Exception); @@ -114,8 +287,7 @@ namespace ParaMEDMEM std::string reprZip() const throw(INTERP_KERNEL::Exception); bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception); bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception); - void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception); - DataArrayInt *convertToIntArr() const; + DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception); DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception); DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception); DataArrayDouble *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception); @@ -130,9 +302,8 @@ namespace ParaMEDMEM void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception); void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception); void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception); - void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception); - void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayDouble *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception); - double getIJ(int tupleId, int compoId) const; + double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception); + double front() const throw(INTERP_KERNEL::Exception); double back() const throw(INTERP_KERNEL::Exception); double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception); void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception); @@ -145,10 +316,10 @@ namespace ParaMEDMEM double getMaxValueInArray() const throw(INTERP_KERNEL::Exception); double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception); double getMinValueInArray() const throw(INTERP_KERNEL::Exception); + int count(double value, double eps) const throw(INTERP_KERNEL::Exception); double getAverageValue() const throw(INTERP_KERNEL::Exception); double norm2() const throw(INTERP_KERNEL::Exception); double normMax() const throw(INTERP_KERNEL::Exception); - void accumulate(double *res) const throw(INTERP_KERNEL::Exception); double accumulate(int compId) const throw(INTERP_KERNEL::Exception); DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception); DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception); @@ -181,9 +352,7 @@ namespace ParaMEDMEM void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception); static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); - static DataArrayDouble *Aggregate(const std::vector& arr) throw(INTERP_KERNEL::Exception); static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); - static DataArrayDouble *Meld(const std::vector& arr) throw(INTERP_KERNEL::Exception); static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception); @@ -207,7 +376,12 @@ namespace ParaMEDMEM static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=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([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2) !"; + const char *msgBase="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([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)"; + std::string msg(msgBase); +#ifdef WITH_NUMPY + msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)"; +#endif + msg+=" !"; if(PyList_Check(elt0) || PyTuple_Check(elt0)) { if(nbOfTuples) @@ -230,7 +404,7 @@ namespace ParaMEDMEM return ret.retn(); } else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } else {//DataArrayDouble.New([1.,3.,4.],3) @@ -242,7 +416,7 @@ namespace ParaMEDMEM } } else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } else {// DataArrayDouble.New([1.,3.,4.]) @@ -272,10 +446,10 @@ namespace ParaMEDMEM return ret.retn(); } else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } else {//DataArrayDouble.New(5) @@ -285,13 +459,13 @@ namespace ParaMEDMEM } } #ifdef WITH_NUMPY - else if(PyArray_Check(elt0)) + else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL) {//DataArrayDouble.New(numpyArray) return BuildNewInstance(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64"); } #endif else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception) @@ -338,7 +512,7 @@ namespace ParaMEDMEM } } - DataArrayDoubleIterator *__iter__() + DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception) { return self->iterator(); } @@ -509,64 +683,6 @@ namespace ParaMEDMEM } } - 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 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 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; @@ -674,12 +790,13 @@ namespace ParaMEDMEM self->accumulate(tmp); return convertDblArrToPyList(tmp,sz); } - - DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception) + + DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception) { - std::vector tmp; - convertPyToNewIntArr3(li,tmp); - return self->keepSelectedComponents(tmp); + int sw,sz,val; + std::vector val2; + const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2); + return self->accumulatePerChunck(bg,bg+sz); } PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception) @@ -738,13 +855,6 @@ namespace ParaMEDMEM return DataArrayDouble::Meld(tmp); } - DataArrayDouble *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception) - { - std::vector > ranges; - convertPyToVectorPairInt(li,ranges); - return self->selectByTupleRanges(ranges); - } - PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception) { double val; @@ -764,6 +874,18 @@ namespace ParaMEDMEM return ret; } + PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception) + { + DataArrayInt *ret1=0; + bool ret0=self->areIncludedInMe(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,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__ !"; @@ -1849,6 +1971,16 @@ namespace ParaMEDMEM PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); return ret; } + + PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception) + { + DataArrayInt *ret1=0; + DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + return ret; + } } }; @@ -1878,7 +2010,7 @@ namespace ParaMEDMEM class DataArrayDoubleTuple { public: - int getNumberOfCompo() const; + int getNumberOfCompo() const throw(INTERP_KERNEL::Exception); DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception); %extend { @@ -1892,7 +2024,7 @@ namespace ParaMEDMEM return self->doubleValue(); } - DataArrayDouble *buildDADouble() + DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception) { return self->buildDADouble(1,self->getNumberOfCompo()); } @@ -2154,9 +2286,6 @@ namespace ParaMEDMEM { public: static DataArrayInt *New(); - bool isAllocated() const throw(INTERP_KERNEL::Exception); - void checkAllocated() const throw(INTERP_KERNEL::Exception); - void setInfoAndChangeNbOfCompo(const std::vector& info) throw(INTERP_KERNEL::Exception); int intValue() const throw(INTERP_KERNEL::Exception); int getHashCode() const throw(INTERP_KERNEL::Exception); bool empty() const throw(INTERP_KERNEL::Exception); @@ -2167,7 +2296,6 @@ namespace ParaMEDMEM void pushBackSilent(int val) throw(INTERP_KERNEL::Exception); int popBackSilent() throw(INTERP_KERNEL::Exception); void pack() const throw(INTERP_KERNEL::Exception); - void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception); void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception); bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception); bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception); @@ -2184,11 +2312,10 @@ namespace ParaMEDMEM void iota(int init=0) throw(INTERP_KERNEL::Exception); std::string repr() const throw(INTERP_KERNEL::Exception); std::string reprZip() const throw(INTERP_KERNEL::Exception); - DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const; - DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const; + DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception); + DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception); DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception); - void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception); - DataArrayDouble *convertToDblArr() const; + DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception); DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception); DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception); DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception); @@ -2204,11 +2331,10 @@ namespace ParaMEDMEM void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception); void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception); void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception); - void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayInt*a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception); - void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayInt *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception); void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception); int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception); int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception); + int front() const throw(INTERP_KERNEL::Exception); int back() const throw(INTERP_KERNEL::Exception); void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception); void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception); @@ -2227,7 +2353,7 @@ namespace ParaMEDMEM bool presenceOfTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception); bool presenceOfValue(const std::vector& vals) const throw(INTERP_KERNEL::Exception); - void accumulate(int *res) const throw(INTERP_KERNEL::Exception); + int count(int value) const throw(INTERP_KERNEL::Exception); int accumulate(int compId) const throw(INTERP_KERNEL::Exception); int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception); int getMaxValueInArray() const throw(INTERP_KERNEL::Exception); @@ -2244,10 +2370,9 @@ namespace ParaMEDMEM void applyPow(int val) throw(INTERP_KERNEL::Exception); void applyRPow(int val) throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); - static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2); - static DataArrayInt *Aggregate(const std::vector& arr) throw(INTERP_KERNEL::Exception); + bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); + static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception); static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception); - static DataArrayInt *Meld(const std::vector& arr) throw(INTERP_KERNEL::Exception); static DataArrayInt *MakePartition(const std::vector& groups, int newNb, std::vector< std::vector >& fidsOfGroups) throw(INTERP_KERNEL::Exception); static DataArrayInt *BuildUnion(const std::vector& arr) throw(INTERP_KERNEL::Exception); static DataArrayInt *BuildIntersection(const std::vector& arr) throw(INTERP_KERNEL::Exception); @@ -2278,7 +2403,6 @@ namespace ParaMEDMEM static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception); void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception); public: - static int *CheckAndPreparePermutation(const int *start, const int *end); static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception); %extend { @@ -2289,7 +2413,12 @@ namespace ParaMEDMEM static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=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([1,3,4,5,7,8],3,2)\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2) !"; + const char *msgBase="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([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)"; + std::string msg(msgBase); +#ifdef WITH_NUMPY + msg+="\n-DataArrayInt.New(numpy array with dtype=int32)"; +#endif + msg+=" !"; if(PyList_Check(elt0) || PyTuple_Check(elt0)) { if(nbOfTuples) @@ -2312,7 +2441,7 @@ namespace ParaMEDMEM return ret.retn(); } else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } else {//DataArrayInt.New([1,3,4],3) @@ -2324,7 +2453,7 @@ namespace ParaMEDMEM } } else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } else {// DataArrayInt.New([1,3,4]) @@ -2354,10 +2483,10 @@ namespace ParaMEDMEM return ret.retn(); } else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } else {//DataArrayInt.New(5) @@ -2367,13 +2496,13 @@ namespace ParaMEDMEM } } #ifdef WITH_NUMPY - else if(PyArray_Check(elt0)) + else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL) {//DataArrayInt.New(numpyArray) - return BuildNewInstance(elt0,NPY_INT,&PyCallBackDataArrayInt_RefType,"INT32"); + return BuildNewInstance(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32"); } #endif else - throw INTERP_KERNEL::Exception(msg); + throw INTERP_KERNEL::Exception(msg.c_str()); } DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception) @@ -2403,7 +2532,7 @@ namespace ParaMEDMEM return self->intValue(); } - DataArrayIntIterator *__iter__() + DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception) { return self->iterator(); } @@ -2415,6 +2544,14 @@ namespace ParaMEDMEM self->accumulate(tmp); return convertIntArrToPyList(tmp,sz); } + + DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception) + { + int sw,sz,val; + std::vector val2; + const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2); + return self->accumulatePerChunck(bg,bg+sz); + } static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception) { @@ -2485,7 +2622,7 @@ namespace ParaMEDMEM #ifdef WITH_NUMPY PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug ! { - return ToNumPyArray(self,NPY_INT,"DataArrayInt"); + return ToNumPyArray(self,NPY_INT32,"DataArrayInt"); } #endif @@ -2611,7 +2748,7 @@ namespace ParaMEDMEM return ret; } - DataArrayInt *transformWithIndArrR(PyObject *li) const + DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception) { void *da=0; int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 ); @@ -2628,64 +2765,6 @@ namespace ParaMEDMEM } } - 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 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 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; @@ -2813,13 +2892,6 @@ namespace ParaMEDMEM } } - DataArrayInt *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception) - { - std::vector tmp; - convertPyToNewIntArr3(li,tmp); - return self->keepSelectedComponents(tmp); - } - void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception) { std::vector tmp; @@ -2846,13 +2918,6 @@ namespace ParaMEDMEM return res; } - DataArrayInt *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception) - { - std::vector > ranges; - convertPyToVectorPairInt(li,ranges); - return self->selectByTupleRanges(ranges); - } - static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception) { std::vector tmp; @@ -2867,6 +2932,13 @@ namespace ParaMEDMEM return DataArrayInt::Aggregate(tmp); } + static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp); + return DataArrayInt::AggregateIndexes(tmp); + } + static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception) { std::vector tmp; @@ -4200,7 +4272,7 @@ namespace ParaMEDMEM class DataArrayIntTuple { public: - int getNumberOfCompo() const; + int getNumberOfCompo() const throw(INTERP_KERNEL::Exception); DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception); %extend { @@ -4482,10 +4554,8 @@ namespace ParaMEDMEM class DataArrayChar : public DataArray { public: - virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception) = 0; - bool isAllocated() const throw(INTERP_KERNEL::Exception); - void checkAllocated() const throw(INTERP_KERNEL::Exception); - void setInfoAndChangeNbOfCompo(const std::vector& info) throw(INTERP_KERNEL::Exception); + virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception); + virtual DataArrayChar *deepCpy() const throw(INTERP_KERNEL::Exception); int getHashCode() const throw(INTERP_KERNEL::Exception); bool empty() const throw(INTERP_KERNEL::Exception); void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception); @@ -4494,7 +4564,6 @@ namespace ParaMEDMEM void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception); char popBackSilent() throw(INTERP_KERNEL::Exception); void pack() const throw(INTERP_KERNEL::Exception); - void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception); void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception); bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception); bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception); @@ -4503,10 +4572,7 @@ namespace ParaMEDMEM void fillWithValue(char val) throw(INTERP_KERNEL::Exception); std::string repr() const throw(INTERP_KERNEL::Exception); std::string reprZip() const throw(INTERP_KERNEL::Exception); - void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception); DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception); - void renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception); - void renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception); DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception); DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception); DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception); @@ -4518,10 +4584,11 @@ namespace ParaMEDMEM DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception); void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception); void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception); + char front() const throw(INTERP_KERNEL::Exception); char back() const throw(INTERP_KERNEL::Exception); - void setIJ(int tupleId, int compoId, char newVal); - void setIJSilent(int tupleId, int compoId, char newVal); - char *getPointer(); + void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception); + void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception); + char *getPointer() throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception); int locateTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); @@ -4531,10 +4598,8 @@ namespace ParaMEDMEM char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception); char getMinValueInArray() const throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception); - static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2); - static DataArrayChar *Aggregate(const std::vector& arr) throw(INTERP_KERNEL::Exception); + static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception); static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception); - static DataArrayChar *Meld(const std::vector& arr) throw(INTERP_KERNEL::Exception); %extend { int __len__() const throw(INTERP_KERNEL::Exception) @@ -4561,64 +4626,6 @@ namespace ParaMEDMEM return ret; } - 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 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 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()); - } - } - DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception) { void *da=0; @@ -4726,13 +4733,6 @@ namespace ParaMEDMEM } } - DataArrayChar *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception) - { - std::vector tmp; - convertPyToNewIntArr3(li,tmp); - return self->keepSelectedComponents(tmp); - } - static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception) { std::vector tmp; @@ -4755,10 +4755,8 @@ namespace ParaMEDMEM { public: static DataArrayByte *New(); - DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception); - DataArrayByteIterator *iterator(); - DataArrayByte *deepCpy() const; - DataArrayByte *performCpy(bool deepCpy) const; + DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception); + DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception); char byteValue() const throw(INTERP_KERNEL::Exception); %extend { @@ -4872,7 +4870,7 @@ namespace ParaMEDMEM return self->iterator(); } - int getIJ(int tupleId, int compoId) const + int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception) { return (int)self->getIJ(tupleId,compoId); } @@ -5035,7 +5033,7 @@ namespace ParaMEDMEM DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception); %extend { - std::string __str__() const + std::string __str__() const throw(INTERP_KERNEL::Exception) { return self->repr(); } @@ -5045,7 +5043,7 @@ namespace ParaMEDMEM return self->byteValue(); } - DataArrayByte *buildDAByte() + DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception) { return self->buildDAByte(1,self->getNumberOfCompo()); } @@ -5058,10 +5056,8 @@ namespace ParaMEDMEM { public: static DataArrayAsciiChar *New(); - DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception); - DataArrayAsciiCharIterator *iterator(); - DataArrayAsciiChar *deepCpy() const; - DataArrayAsciiChar *performCpy(bool deepCpy) const; + DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception); + DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception); char asciiCharValue() const throw(INTERP_KERNEL::Exception); %extend { @@ -5569,16 +5565,16 @@ namespace ParaMEDMEM class DataArrayAsciiCharTuple { public: - int getNumberOfCompo() const; + int getNumberOfCompo() const throw(INTERP_KERNEL::Exception); DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception); %extend { - std::string __str__() const + std::string __str__() const throw(INTERP_KERNEL::Exception) { return self->repr(); } - DataArrayAsciiChar *buildDAAsciiChar() + DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception) { return self->buildDAAsciiChar(1,self->getNumberOfCompo()); }