From: eap Date: Fri, 29 Nov 2019 17:08:32 +0000 (+0300) Subject: Lot2: update MEDCoupling_Swig according to int->mcIdType in MEDCoupling X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dcaa0739a9418322eb30cd251d84e68b74a73144;p=tools%2Fmedcoupling.git Lot2: update MEDCoupling_Swig according to int->mcIdType in MEDCoupling --- diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index 8dd9feb7f..81ca4a501 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -30,10 +30,14 @@ ELSE() SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow") ENDIF() SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDCoupling_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) SET (MEDCoupling_SWIG_DPYS_FILES MEDCouplingCommon.i MEDCouplingMemArray.i + DataArrayInt.i MEDCouplingFieldDiscretization.i MEDCouplingFinalize.i MEDCouplingTypemaps.i) @@ -49,6 +53,7 @@ SET (MC_Swig_interf MEDCouplingRemapperCommon.i MEDCouplingRefCountObject.i MEDCouplingMemArray.i + DataArrayInt.i MEDCouplingFieldDiscretization.i MEDCouplingTimeDiscretization.i MEDCouplingFinalize.i @@ -118,6 +123,9 @@ ELSE() SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow") ENDIF() SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) # _ABR_ Ensure dependency mechanism on all SWIG files and headers SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES} diff --git a/src/MEDCoupling_Swig/DataArrayInt.i b/src/MEDCoupling_Swig/DataArrayInt.i new file mode 100644 index 000000000..15497e69e --- /dev/null +++ b/src/MEDCoupling_Swig/DataArrayInt.i @@ -0,0 +1,2987 @@ +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +%include "MEDCouplingMemArray.i" + +namespace MEDCoupling +{ + class DataArrayInt32Iterator; + + class DataArrayInt32 : public DataArray + { + public: + static DataArrayInt32 *New(); + int intValue() const; + int getHashCode() const; + bool empty() const; + void aggregate(const DataArrayInt32 *other); + DataArrayInt32 *performCopyOrIncrRef(bool deepCopy) const; + void deepCopyFrom(const DataArrayInt32& other); + void reserve(std::size_t nbOfElems); + void pushBackSilent(int val); + int popBackSilent(); + void pack() const; + void allocIfNecessary(int nbOfTuple, int nbOfCompo); + bool isEqual(const DataArrayInt32& other) const; + bool isEqualWithoutConsideringStr(const DataArrayInt32& other) const; + bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt32& other) const; + DataArrayInt32 *buildPermutationArr(const DataArrayInt32& other) const; + DataArrayInt32 *sumPerTuple() const; + void sort(bool asc=true); + void reverse(); + void checkMonotonic(bool increasing) const; + bool isMonotonic(bool increasing) const; + void checkStrictlyMonotonic(bool increasing) const; + bool isStrictlyMonotonic(bool increasing) const; + void fillWithZero(); + void fillWithValue(int val); + void iota(int init=0); + std::string repr() const; + std::string reprZip() const; + std::string reprNotTooLong() const; + DataArrayInt32 *invertArrayO2N2N2O(int newNbOfElem) const; + DataArrayInt32 *invertArrayN2O2O2N(int oldNbOfElem) const; + DataArrayInt32 *invertArrayO2N2N2OBis(int newNbOfElem) const; +#ifndef MEDCOUPLING_USE_64BIT_IDS + MCAuto< MapII > invertArrayN2O2O2NOptimized() const; + MCAuto< MapII > giveN2OOptimized() const; +#endif + DataArrayInt32 *indicesOfSubPart(const DataArrayInt32& partOfThis) const; + DataArrayInt32 *fromNoInterlace() const; + DataArrayInt32 *toNoInterlace() const; + DataArrayInt32 *selectByTupleIdSafeSlice(int bg, int end, int step) const; + DataArrayInt32 *checkAndPreparePermutation() const; + DataArrayInt32 *buildPermArrPerLevel() const; + bool isIota(int sizeExpected) const; + bool isUniform(int val) const; + int checkUniformAndGuess() const; + bool hasUniqueValues() const; + DataArrayInt32 *subArray(int tupleIdBg, int tupleIdEnd=-1) const; + void transpose(); + DataArrayInt32 *changeNbOfComponents(int newNbOfComp, int dftValue) const; + void meldWith(const DataArrayInt32 *other); + void setPartOfValues1(const DataArrayInt32 *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); + void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp); + void setPartOfValuesAdv(const DataArrayInt32 *a, const DataArrayIdType *tuplesSelec); + void getTuple(int tupleId, int *res) const; + int getIJ(int tupleId, int compoId) const; + int getIJSafe(int tupleId, int compoId) const; + int front() const; + int back() const; + void setIJ(int tupleId, int compoId, int newVal); + void setIJSilent(int tupleId, int compoId, int newVal); + int *getPointer(); + const int *getConstPointer() const; + DataArrayInt32Iterator *iterator(); + const int *begin() const; + const int *end() const; + DataArrayInt32 *findIdsEqual(int val) const; + DataArrayInt32 *findIdsNotEqual(int val) const; + int changeValue(int oldValue, int newValue); + int findIdFirstEqualTuple(const std::vector& tupl) const; + int findIdFirstEqual(int value) const; + int findIdFirstEqual(const std::vector& vals) const; + int findIdSequence(const std::vector& vals) const; + bool presenceOfTuple(const std::vector& tupl) const; + bool presenceOfValue(int value) const; + bool presenceOfValue(const std::vector& vals) const; + int count(int value) const; + int accumulate(int compId) const; + int getMaxValueInArray() const; + int getMaxAbsValueInArray() const; + int getMinValueInArray() const; + void abs(); + DataArrayInt32 *computeAbs() const; + void applyLin(int a, int b, int compoId); + void applyLin(int a, int b); + void applyInv(int numerator); + DataArrayInt32 *negate() const; + void applyDivideBy(int val); + void applyModulus(int val); + void applyRModulus(int val); + void applyPow(int val); + void applyRPow(int val); + DataArrayInt32 *findIdsInRange(int vmin, int vmax) const; + DataArrayInt32 *findIdsNotInRange(int vmin, int vmax) const; + DataArrayInt32 *findIdsStrictlyNegative() const; + bool checkAllIdsInRange(int vmin, int vmax) const; + static DataArrayInt32 *Aggregate(const DataArrayInt32 *a1, const DataArrayInt32 *a2, int offsetA2); + static DataArrayInt32 *Meld(const DataArrayInt32 *a1, const DataArrayInt32 *a2); + static DataArrayIdType *MakePartition(const std::vector& groups, mcIdType newNb, std::vector< std::vector >& fidsOfGroups); + static DataArrayInt32 *BuildUnion(const std::vector& arr); + static DataArrayInt32 *BuildIntersection(const std::vector& arr); + static DataArrayInt32 *FindPermutationFromFirstToSecond(const DataArrayInt32 *ids1, const DataArrayInt32 *ids2); + DataArrayInt32 *buildComplement(int nbOfElement) const; + DataArrayInt32 *buildSubstraction(const DataArrayInt32 *other) const; + DataArrayInt32 *buildSubstractionOptimized(const DataArrayInt32 *other) const; + DataArrayInt32 *buildUnion(const DataArrayInt32 *other) const; + DataArrayInt32 *buildIntersection(const DataArrayInt32 *other) const; + DataArrayInt32 *buildUnique() const; + DataArrayInt32 *buildUniqueNotSorted() const; + DataArrayInt32 *deltaShiftIndex() const; + void computeOffsets(); + void computeOffsetsFull(); + DataArrayInt32 *buildExplicitArrByRanges(const DataArrayInt32 *offsets) const; + DataArrayInt32 *findRangeIdForEachTuple(const DataArrayInt32 *ranges) const; + DataArrayInt32 *findIdInRangeForEachTuple(const DataArrayInt32 *ranges) const; + void sortEachPairToMakeALinkedList(); + DataArrayInt32 *duplicateEachTupleNTimes(int nbTimes) const; + DataArrayInt32 *getDifferentValues() const; + static DataArrayInt32 *Add(const DataArrayInt32 *a1, const DataArrayInt32 *a2); + void addEqual(const DataArrayInt32 *other); + static DataArrayInt32 *Substract(const DataArrayInt32 *a1, const DataArrayInt32 *a2); + void substractEqual(const DataArrayInt32 *other); + static DataArrayInt32 *Multiply(const DataArrayInt32 *a1, const DataArrayInt32 *a2); + void multiplyEqual(const DataArrayInt32 *other); + static DataArrayInt32 *Divide(const DataArrayInt32 *a1, const DataArrayInt32 *a2); + void divideEqual(const DataArrayInt32 *other); + static DataArrayInt32 *Modulus(const DataArrayInt32 *a1, const DataArrayInt32 *a2); + void modulusEqual(const DataArrayInt32 *other); + static DataArrayInt32 *Pow(const DataArrayInt32 *a1, const DataArrayInt32 *a2); + void powEqual(const DataArrayInt32 *other); + MCAuto fromLinkedListOfPairToList() const; + MCAuto findIdsGreaterOrEqualTo(int val) const; + MCAuto findIdsGreaterThan(int val) const; + MCAuto findIdsLowerOrEqualTo(int val) const; + MCAuto findIdsLowerThan(int val) const; + MCAuto selectPartDef(const PartDefinition* pd) const; + MCAuto convertToDblArr() const; + MCAuto convertToFloatArr() const; + public: + static DataArrayInt32 *Range(int begin, int end, int step); + %extend + { + DataArrayInt32() + { + return DataArrayInt32::New(); + } + + static DataArrayInt32 *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + { + const char *msgBase="MEDCoupling::DataArrayInt32::New : Available API are : \n-DataArrayInt32.New()\n-DataArrayInt32.New([1,3,4])\n-DataArrayInt32.New([1,3,4],3)\n-DataArrayInt32.New([1,3,4,5],2,2)\n-DataArrayInt32.New([1,3,4,5,7,8],3,2)\n-DataArrayInt32.New([(1,3),(4,5),(7,8)])\n-DataArrayInt32.New(5)\n-DataArrayInt32.New(5,2)"; + std::string msg(msgBase); +#ifdef WITH_NUMPY + msg+="\n-DataArrayInt32.New(numpy array with dtype=int32)"; +#endif + msg+=" !"; + if(PyList_Check(elt0) || PyTuple_Check(elt0)) + { + if(nbOfTuples) + { + if(PyInt_Check(nbOfTuples)) + { + mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + if(nbOfTuples1<0) + throw INTERP_KERNEL::Exception("DataArrayInt32::New : should be a positive set of allocated memory !"); + if(nbOfComp) + { + if(PyInt_Check(nbOfComp)) + {//DataArrayInt32.New([1,3,4,5],2,2) + mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp); + if(nbOfCompo<0) + throw INTERP_KERNEL::Exception("DataArrayInt32::New : should be a positive number of components !"); + MCAuto ret=DataArrayInt32::New(); + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); + ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {//DataArrayInt32.New([1,3,4],3) + MCAuto ret=DataArrayInt32::New(); + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); + ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {// DataArrayInt32.New([1,3,4]) + MCAuto ret=DataArrayInt32::New(); + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); + ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + } + else if(PyInt_Check(elt0)) + { + int nbOfTuples1=PyInt_AS_LONG(elt0); + if(nbOfTuples1<0) + throw INTERP_KERNEL::Exception("DataArrayInt32::New : should be a positive set of allocated memory !"); + if(nbOfTuples) + { + if(!nbOfComp) + { + if(PyInt_Check(nbOfTuples)) + {//DataArrayInt32.New(5,2) + int nbOfCompo=PyInt_AS_LONG(nbOfTuples); + if(nbOfCompo<0) + throw INTERP_KERNEL::Exception("DataArrayInt32::New : should be a positive number of components !"); + MCAuto ret=DataArrayInt32::New(); + ret->alloc(nbOfTuples1,nbOfCompo); + return ret.retn(); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {//DataArrayInt32.New(5) + MCAuto ret=DataArrayInt32::New(); + ret->alloc(nbOfTuples1,1); + return ret.retn(); + } + } +#ifdef WITH_NUMPY + else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL) + {//DataArrayInt32.New(numpyArray) + return BuildNewInstance(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32"); + } +#endif + else + throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy + } + + DataArrayInt32(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + { + return MEDCoupling_DataArrayInt32_New__SWIG_1(elt0,nbOfTuples,nbOfComp); + } + + std::string __str__() const + { + return self->reprNotTooLong(); + } + + int __len__() const + { + if(self->isAllocated()) + { + return self->getNumberOfTuples(); + } + else + { + throw INTERP_KERNEL::Exception("DataArrayInt32::__len__ : Instance is NOT allocated !"); + } + } + + int __int__() const + { + return self->intValue(); + } + + DataArrayInt32Iterator *__iter__() + { + return self->iterator(); + } + + PyObject *accumulate() const + { + mcIdType sz=self->getNumberOfComponents(); + INTERP_KERNEL::AutoPtr tmp=new int[sz]; + self->accumulate((int *)tmp); + return convertIntArrToPyList((const int *)tmp,sz); + } + + DataArrayInt32 *accumulatePerChunck(PyObject *indexArr) const + { + mcIdType sw,sz,val; + std::vector val2; + const mcIdType *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2); + return self->accumulatePerChunck(bg,bg+sz); + } + + DataArrayIdType *findIdsEqualTuple(PyObject *inputTuple) const + { + mcIdType sw,sz; + int val; + std::vector val2; + const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2)); + return self->findIdsEqualTuple(bg,bg+sz); + } + + DataArrayIdType *findIdForEach(PyObject *vals) const + { + mcIdType sw,sz; + int val; + std::vector val2; + const int *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2)); + MCAuto ret(self->findIdForEach(bg,bg+sz)); + return ret.retn(); + } + + PyObject *splitInBalancedSlices(mcIdType nbOfSlices) const + { + std::vector< std::pair > slcs(self->splitInBalancedSlices(nbOfSlices)); + PyObject *ret=PyList_New(slcs.size()); + for(std::size_t i=0;i::max() || stp==std::numeric_limits::max()) + throw INTERP_KERNEL::Exception("DataArrayInt32::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !"); + return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step); + } + + PyObject *getMinMaxValues() const + { + int a,b; + self->getMinMaxValues(a,b); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,PyInt_FromLong(a)); + PyTuple_SetItem(ret,1,PyInt_FromLong(b)); + return ret; + } + + static PyObject *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, PyObject *arr, PyObject *arrI) + { + mcIdType newNbOfTuples=-1; + mcIdType szArr,szArrI,sw,iTypppArrI; + int iTypppArr; + std::vector stdvecTyyppArr; + std::vector stdvecTyyppArrI; + const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr); + const mcIdType *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI); + DataArrayIdType *ret0=MEDCoupling::DataArrayInt32::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); + PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples)); + return ret; + } + + static DataArrayIdType *CheckAndPreparePermutation(PyObject *arr) + { + MCAuto ret(DataArrayIdType::New()); + mcIdType szArr,sw; + int iTypppArr; + std::vector stdvecTyyppArr; + const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr)); + mcIdType *pt(MEDCoupling::DataArrayInt32::CheckAndPreparePermutation(arrPtr,arrPtr+szArr)); + ret->useArray(pt,true,MEDCoupling::DeallocType::C_DEALLOC,szArr,1); + return ret.retn(); + } + + void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + { + const char *msg="MEDCoupling::DataArrayInt32::setValues : Available API are : \n-DataArrayInt32.setValues([1,3,4])\n-DataArrayInt32.setValues([1,3,4],3)\n-DataArrayInt32.setValues([1,3,4,5],2,2)\n-DataArrayInt32.New(5)\n !"; + if(PyList_Check(li) || PyTuple_Check(li)) + { + if(nbOfTuples && nbOfTuples != Py_None) + { + if(PyInt_Check(nbOfTuples)) + { + mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + if(nbOfTuples1<0) + throw INTERP_KERNEL::Exception("DataArrayInt32::setValue : should be a positive set of allocated memory !"); + if(nbOfComp && nbOfComp != Py_None) + { + if(PyInt_Check(nbOfComp)) + {//DataArrayInt32.setValues([1,3,4,5],2,2) + mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp); + if(nbOfCompo<0) + throw INTERP_KERNEL::Exception("DataArrayInt32::setValue : should be a positive number of components !"); + std::vector tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo); + self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer()); + } + else + throw INTERP_KERNEL::Exception(msg); + } + else + {//DataArrayInt32.setValues([1,3,4],3) + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1); + self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer()); + } + } + else + throw INTERP_KERNEL::Exception(msg); + } + else + {// DataArrayInt32.setValues([1,3,4]) + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2); + self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer()); + } + } + else + throw INTERP_KERNEL::Exception(msg); + } + + PyObject *getValues() const + { + const int *vals=self->getConstPointer(); + return convertIntArrToPyList(vals,self->getNbOfElems()); + } + +#ifdef WITH_NUMPY + PyObject *toNumPyArray() // not const. It is not a bug ! + { + return ToNumPyArray(self,NPY_INT32,"DataArrayInt32"); + } +#endif + + PyObject *isEqualIfNotWhy(const DataArrayInt32& other) const + { + std::string ret1; + bool ret0=self->isEqualIfNotWhy(other,ret1); + PyObject *ret=PyTuple_New(2); + PyObject *ret0Py=ret0?Py_True:Py_False; + Py_XINCREF(ret0Py); + PyTuple_SetItem(ret,0,ret0Py); + PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); + return ret; + } + + PyObject *getValuesAsTuple() const + { + const int *vals=self->getConstPointer(); + mcIdType nbOfComp=self->getNumberOfComponents(); + mcIdType nbOfTuples=self->getNumberOfTuples(); + return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); + } + + static PyObject *MakePartition(PyObject *gps, mcIdType newNb) + { + std::vector groups; + std::vector< std::vector > fidsOfGroups; + convertFromPyObjVectorOfObj(gps,SWIGTITraits::TI,"DataArrayInt32",groups); + DataArrayIdType *ret0=MEDCoupling::DataArrayInt32::MakePartition(groups,newNb,fidsOfGroups); + PyObject *ret = PyList_New(2); + PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + mcIdType sz=fidsOfGroups.size(); + PyObject *ret1 = PyList_New(sz); + for(mcIdType i=0;i::TI, 0 | 0 )); + if (!SWIG_IsOK(res1)) + { + int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 )); + if(SWIG_IsOK(res2)) + { + MapII *m=reinterpret_cast(da); + self->transformWithIndArr(*m); + } + else + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + self->transformWithIndArr(tmp,tmp+size); + } + } + else + { + DataArrayInt32 *da2=reinterpret_cast< DataArrayInt32 * >(da); + self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); + } + } +#endif + DataArrayIdType *findIdsEqualList(PyObject *obj) + { + mcIdType sw; + int singleVal; + std::vector multiVal; + std::pair > slic; + DataArrayInt32 *daIntTyypp=0; + convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + return self->findIdsEqualList(&singleVal,&singleVal+1); + case 2: + return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); + case 4: + return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end()); + default: + throw INTERP_KERNEL::Exception("DataArrayInt32::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt32 !"); + } + } + + DataArrayIdType *findIdsNotEqualList(PyObject *obj) + { + mcIdType sw; + int singleVal; + std::vector multiVal; + std::pair > slic; + DataArrayInt32 *daIntTyypp=0; + convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + return self->findIdsNotEqualList(&singleVal,&singleVal+1); + case 2: + return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); + case 4: + return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end()); + default: + throw INTERP_KERNEL::Exception("DataArrayInt32::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt32 !"); + } + } + + PyObject *splitByValueRange(PyObject *li) const + { + DataArrayInt32 *ret0=0,*ret1=0,*ret2=0; + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2); + } + else + { + DataArrayInt32 *da2=reinterpret_cast< DataArrayInt32 * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt32 instance expected !"); + da2->checkAllocated(); + self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2); + } + PyObject *ret = PyList_New(3); + PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + DataArrayIdType *transformWithIndArrR(PyObject *li) const + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + return self->transformWithIndArrR(tmp,tmp+size); + } + else + { + DataArrayInt32 *da2=reinterpret_cast< DataArrayInt32 * >(da); + return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); + } + } + + DataArrayInt32 *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType 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 !"); + } + return self->renumberAndReduce(tmp,newNbOfTuple); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + da2->checkAllocated(); + mcIdType 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); + } + } + + DataArrayInt32 *renumber(PyObject *li) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType 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 !"); + } + return self->renumber(tmp); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + da2->checkAllocated(); + mcIdType 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()); + } + } + + DataArrayInt32 *renumberR(PyObject *li) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType 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 !"); + } + return self->renumberR(tmp); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + da2->checkAllocated(); + mcIdType size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberR(da2->getConstPointer()); + } + } + + void setSelectedComponents(const DataArrayInt32 *a, PyObject *li) + { + std::vector tmp; + convertPyToNewIntArr3(li,tmp); + self->setSelectedComponents(a,tmp); + } + + PyObject *explodeComponents() const + { + std::vector< MCAuto > retCpp(self->explodeComponents()); + std::size_t sz(retCpp.size()); + PyObject *res(PyList_New(sz)); + for(std::size_t i=0;i::TI, SWIG_POINTER_OWN | 0 )); + return res; + } + + PyObject *getTuple(mcIdType tupleId) + { + mcIdType sz=self->getNumberOfComponents(); + INTERP_KERNEL::AutoPtr tmp=new int[sz]; + self->getTuple(tupleId,tmp); + return convertIntArrToPyList((const int*)tmp,sz); + } + + PyObject *changeSurjectiveFormat(int targetNb) const + { + DataArrayIdType *arr=0; + DataArrayIdType *arrI=0; + self->changeSurjectiveFormat(targetNb,arr,arrI); + PyObject *res = PyList_New(2); + PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); + PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); + return res; + } + + static DataArrayInt32 *Meld(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayInt32",tmp); + return DataArrayInt32::Meld(tmp); + } + + static DataArrayInt32 *Aggregate(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayInt32",tmp); + return DataArrayInt32::Aggregate(tmp); + } + + static DataArrayInt32 *AggregateIndexes(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayInt32",tmp); + return DataArrayInt32::AggregateIndexes(tmp); + } + + static DataArrayInt32 *BuildUnion(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayInt32",tmp); + return DataArrayInt32::BuildUnion(tmp); + } + + static DataArrayInt32 *BuildIntersection(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayInt32",tmp); + return DataArrayInt32::BuildIntersection(tmp); + } + + PyObject *getMaxValue() const + { + mcIdType 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 *getMaxAbsValue(std::size_t& tupleId) const + { + std::size_t tmp; + int r1=self->getMaxAbsValue(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 + { + mcIdType 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; + } + + mcIdType index(PyObject *obj) const + { + mcIdType nbOfCompo=self->getNumberOfComponents(); + switch(nbOfCompo) + { + case 1: + { + if(PyInt_Check(obj)) + { + int val=(int)PyInt_AS_LONG(obj); + return self->findIdFirstEqual(val); + } + else + throw INTERP_KERNEL::Exception("DataArrayInt32::index : 'this' contains one component and trying to find an element which is not an integer !"); + } + default: + { + std::vector arr; + convertPyToNewIntArr3(obj,arr); + return self->findIdFirstEqualTuple(arr); + } + } + } + + bool __contains__(PyObject *obj) const + { + mcIdType 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("DataArrayInt32::__contains__ : 'this' contains one component and trying to find an element which is not an integer !"); + } + default: + { + std::vector arr; + convertPyToNewIntArr3(obj,arr); + return self->presenceOfTuple(arr); + } + } + } + + PyObject *__getitem__(PyObject *obj) + { + const char msg[]="Unexpected situation in DataArrayInt32::__getitem__ !"; + const char msg2[]="DataArrayInt32::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; + self->checkAllocated(); + mcIdType nbOfTuples=self->getNumberOfTuples(); + mcIdType nbOfComponents=self->getNumberOfComponents(); + mcIdType it1; + std::size_t ic1; + std::vector vt1; + std::vector vc1; + std::pair > pt1,pc1; + DataArrayIdType *dt1=0,*dc1=0; + mcIdType sw; + convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); + MCAuto 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)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 2: + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + case 3: + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + case 4: + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTITraits::TI, 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 v2(1,ic1); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 7: + { + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); + std::vector v2(1,ic1); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 8: + { + ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); + std::vector v2(1,ic1); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 9: + { + ret=self->selectByTupleIdSafe(&it1,&it1+1); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 10: + { + ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 11: + { + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 12: + { + ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 13: + { + ret=self->selectByTupleIdSafe(&it1,&it1+1); + mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); + std::vector v2(nbOfComp); + for(int i=0;ikeepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 14: + { + ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); + mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); + std::vector v2(nbOfComp); + for(int i=0;ikeepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 15: + { + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); + mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); + std::vector v2(nbOfComp); + for(mcIdType i=0;ikeepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 16: + { + ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); + mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); + std::vector v2(nbOfComp); + for(int i=0;ikeepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__setitem__(PyObject *obj, PyObject *value) + { + self->checkAllocated(); + const char msg[]="Unexpected situation in __setitem__ !"; + mcIdType nbOfTuples=self->getNumberOfTuples(); + mcIdType nbOfComponents=self->getNumberOfComponents(); + mcIdType sw1,sw2; + int i1; + std::vector v1; + DataArrayInt32 *d1=0; + DataArrayInt32Tuple *dd1=0; + convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1); + mcIdType it1,ic1; + std::vector vt1,vc1; + std::pair > pt1,pc1; + DataArrayIdType *dt1=0,*dc1=0; + convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); + MCAuto tmp; + switch(sw2) + { + case 1: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false); + return self; + case 3: + self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 2: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::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=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false); + return self; + case 3: + self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 4: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::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=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false); + return self; + case 3: + self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 6: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::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=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false); + return self; + case 3: + self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 8: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::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=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::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=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false); + return self; + case 3: + self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 11: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false); + return self; + case 3: + self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 12: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size()); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::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=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false); + return self; + case 3: + self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 14: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::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=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false); + return self; + case 3: + self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 16: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second); + return self; + case 2: + tmp=DataArrayInt32::New(); + tmp->useArray(&v1[0],false,DeallocType::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; + } + + DataArrayInt32 *__neg__() const + { + return self->negate(); + } + + DataArrayInt32 *__add__(PyObject *obj) + { + const char msg[]="Unexpected situation in __add__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayIntTuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(1,val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Add(self,aaaa); + } + case 3: + { + return DataArrayInt32::Add(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Add(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__radd__(PyObject *obj) + { + const char msg[]="Unexpected situation in __radd__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayIntTuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(1,val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Add(self,aaaa); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Add(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __iadd__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyLin(1,val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + MCAuto bb=DataArrayInt32::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + self->addEqual(bb); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->addEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->addEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__sub__(PyObject *obj) + { + const char msg[]="Unexpected situation in __sub__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(1,-val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Substract(self,aaaa); + } + case 3: + { + return DataArrayInt32::Substract(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Substract(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__rsub__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rsub__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(-1,val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Substract(aaaa,self); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Substract(aaaa,self); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___isub___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __isub__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyLin(1,-val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + MCAuto bb=DataArrayInt32::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + self->substractEqual(bb); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->substractEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->substractEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__mul__(PyObject *obj) + { + const char msg[]="Unexpected situation in __mul__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(val,0); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Multiply(self,aaaa); + } + case 3: + { + return DataArrayInt32::Multiply(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Multiply(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__rmul__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rmul__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(val,0); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Multiply(self,aaaa); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Multiply(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___imul___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __imul__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyLin(val,0); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + MCAuto bb=DataArrayInt32::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + self->multiplyEqual(bb); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->multiplyEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->multiplyEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__div__(PyObject *obj) + { + const char msg[]="Unexpected situation in __div__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyDivideBy(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Divide(self,aaaa); + } + case 3: + { + return DataArrayInt32::Divide(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Divide(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__rdiv__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rdiv__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyInv(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Divide(aaaa,self); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Divide(aaaa,self); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __idiv__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyDivideBy(val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + MCAuto bb=DataArrayInt32::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + self->divideEqual(bb); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->divideEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->divideEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__mod__(PyObject *obj) + { + const char msg[]="Unexpected situation in __mod__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyModulus(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Modulus(self,aaaa); + } + case 3: + { + return DataArrayInt32::Modulus(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Modulus(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__rmod__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rmod__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyRModulus(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Modulus(aaaa,self); + } + case 3: + { + return DataArrayInt32::Modulus(a,self); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Modulus(aaaa,self); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___imod___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __imod__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(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: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->modulusEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__pow__(PyObject *obj) + { + const char msg[]="Unexpected situation in __pow__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyPow(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Pow(self,aaaa); + } + case 3: + { + return DataArrayInt32::Pow(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Pow(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + DataArrayInt32 *__rpow__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rpow__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyRPow(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=DataArrayInt32::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return DataArrayInt32::Pow(aaaa,self); + } + case 3: + { + return DataArrayInt32::Pow(a,self); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return DataArrayInt32::Pow(aaaa,self); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __ipow__ !"; + int val; + DataArrayInt32 *a; + std::vector aa; + DataArrayInt32Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyPow(val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->powEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->powEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + std::string __repr__() const + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } + + void pushBackValsSilent(PyObject *li) + { + mcIdType szArr,sw; + int iTypppArr; + std::vector stdvecTyyppArr; + const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + self->pushBackValsSilent(tmp,tmp+szArr); + } + + PyObject *partitionByDifferentValues() const + { + std::vector ret1; + std::vector ret0=self->partitionByDifferentValues(ret1); + std::size_t sz=ret0.size(); + PyObject *pyRet=PyTuple_New(2); + PyObject *pyRet0=PyList_New((int)sz); + PyObject *pyRet1=PyList_New((int)sz); + for(std::size_t i=0;i::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i])); + } + PyTuple_SetItem(pyRet,0,pyRet0); + PyTuple_SetItem(pyRet,1,pyRet1); + return pyRet; + } + + PyObject *findIdsRangesInListOfIds(const DataArrayInt32 *listOfIds) const + { + DataArrayIdType *ret0=0; + DataArrayInt32 *ret1=0; + self->findIdsRangesInListOfIds(listOfIds,ret0,ret1); + PyObject *pyRet=PyTuple_New(2); + PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return pyRet; + } + + PyObject *isRange() const + { + int a(0),b(0),c(0); + bool ret(self->isRange(a,b,c)); + PyObject *pyRet=PyTuple_New(2); + PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0); + Py_XINCREF(ret0Py); + PyTuple_SetItem(pyRet,0,ret0Py); + if(ret) + ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c)); + else + { + ret1Py=Py_None; + Py_XINCREF(ret1Py); + } + PyTuple_SetItem(pyRet,1,ret1Py); + return pyRet; + } + + static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt32 *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0) throw(INTERP_KERNEL::Exception) + { + mcIdType sw; + int singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayInt32 *daIntTyypp=0; + if(!arrIndx) + throw INTERP_KERNEL::Exception("DataArrayInt32::RemoveIdsFromIndexedArrays : null pointer as arrIndex !"); + convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + return DataArrayInt32::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval); + case 2: + return DataArrayInt32::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval); + case 4: + return DataArrayInt32::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval); + default: + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt32 !"); + } + } + + static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt32 *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception) + { + DataArrayInt32 *arrOut=0; + DataArrayIdType *arrIndexOut=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + if(!arrIndxIn) + throw INTERP_KERNEL::Exception("DataArrayInt32::ExtractFromIndexedArrays : null pointer as arrIndxIn !"); + convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + { + DataArrayInt32::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut); + break; + } + case 2: + { + DataArrayInt32::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut); + break; + } + case 4: + { + DataArrayInt32::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut); + break; + } + default: + throw INTERP_KERNEL::Exception("DataArrayInt32::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt32 !"); + } + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + static PyObject *ExtractFromIndexedArraysSlice(mcIdType strt, mcIdType stp, mcIdType step, const DataArrayInt32 *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception) + { + DataArrayInt32 *arrOut=0; + DataArrayIdType *arrIndexOut=0; + DataArrayInt32::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const DataArrayInt32 *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception) + { + if(!PySlice_Check(slic)) + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !"); + Py_ssize_t strt=2,stp=2,step=2; + if(!arrIndxIn) + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !"); + arrIndxIn->checkAllocated(); + if(arrIndxIn->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !"); + GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !"); + DataArrayInt32 *arrOut=0; + DataArrayIdType *arrIndexOut=0; + DataArrayInt32::ExtractFromIndexedArraysSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),arrIn,arrIndxIn,arrOut,arrIndexOut); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + static PyObject *SetPartOfIndexedArrays(PyObject *li, + const DataArrayInt32 *arrIn, const DataArrayIdType *arrIndxIn, + const DataArrayInt32 *srcArr, const DataArrayIdType *srcArrIndex) throw(INTERP_KERNEL::Exception) + { + DataArrayInt32 *arrOut=0; + DataArrayIdType *arrIndexOut=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + if(!arrIndxIn) + throw INTERP_KERNEL::Exception("DataArrayInt32::SetPartOfIndexedArrays : null pointer as arrIndex !"); + convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + { + DataArrayInt32::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); + break; + } + case 2: + { + DataArrayInt32::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); + break; + } + case 4: + { + DataArrayInt32::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); + break; + } + default: + throw INTERP_KERNEL::Exception("DataArrayInt32::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt32 !"); + } + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt32 *arrIn, const DataArrayIdType *arrIndxIn, + const DataArrayInt32 *srcArr, const DataArrayIdType *srcArrIndex) throw(INTERP_KERNEL::Exception) + { + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + if(!arrIndxIn) + throw INTERP_KERNEL::Exception("DataArrayInt32::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !"); + convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + { + DataArrayInt32::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex); + break; + } + case 2: + { + DataArrayInt32::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex); + break; + } + case 4: + { + DataArrayInt32::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex); + break; + } + default: + throw INTERP_KERNEL::Exception("DataArrayInt32::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt32 !"); + } + } + + } // end extent + }; + + class DataArrayInt32Tuple; + + class DataArrayInt32Iterator + { + public: + DataArrayInt32Iterator(DataArrayInt32 *da); + ~DataArrayInt32Iterator(); + %extend + { + PyObject *next() + { + DataArrayInt32Tuple *ret=self->nextt(); + if(ret) + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple,SWIG_POINTER_OWN | 0); + else + { + PyErr_SetString(PyExc_StopIteration,"No more data."); + return 0; + } + } + } + }; + + class DataArrayInt32Tuple + { + public: + std::size_t getNumberOfCompo() const; + DataArrayInt32 *buildDAInt(int nbOfTuples, int nbOfCompo) const; + %extend + { + std::string __str__() const + { + return self->repr(); + } + + int __int__() const + { + return self->intValue(); + } + + DataArrayInt32 *buildDAInt() + { + return self->buildDAInt(1,self->getNumberOfCompo()); + } + + PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_DataArrayInt32____iadd___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + + PyObject *___isub___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_DataArrayInt32____isub___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + + PyObject *___imul___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_DataArrayInt32____imul___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_DataArrayInt32____idiv___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + + PyObject *___imod___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_DataArrayInt32____imod___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + + PyObject *__len__() + { + return PyInt_FromLong(self->getNumberOfCompo()); + } + + PyObject *__getitem__(PyObject *obj) + { + const char msg2[]="DataArrayInt32Tuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + const int *pt=self->getConstPointer(); + int nbc=self->getNumberOfCompo(); + convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + { + if(singleVal>=nbc) + { + std::ostringstream oss; + oss << "Requesting for id " << singleVal << " having only " << nbc << " components !"; + PyErr_SetString(PyExc_StopIteration,oss.str().c_str()); + return 0; + } + if(singleVal>=0) + return 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,msg2); + PyObject *t=PyTuple_New(sz); + for(int j=0;j multiValV; + std::pair > slicV; + MEDCoupling::DataArrayInt32Tuple *daIntTyyppV=0; + int nbc=self->getNumberOfCompo(); + convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV); + int singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayInt32 *daIntTyypp=0; + int *pt=self->getPointer(); + convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(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::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>(int)daIntTyyppV->getNumberOfCompo()) + { + std::ostringstream oss; + oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + std::copy(ptV,ptV+nbc,pt); + return self; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + case 3: + { + int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); + switch(sw1) + { + case 1: + { + for(int j=0;jgetConstPointer(); + if(sz>(int)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 ret=DataArrayInt64::New(); + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); + ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {//DataArrayInt64.New([1,3,4],3) + MCAuto ret=DataArrayInt64::New(); + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); + ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {// DataArrayInt64.New([1,3,4]) + MCAuto ret=DataArrayInt64::New(); + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); + ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + } + else if(PyInt_Check(elt0)) + { + int nbOfTuples1=PyInt_AS_LONG(elt0); + if(nbOfTuples1<0) + throw INTERP_KERNEL::Exception("DataArrayInt64::New : should be a positive set of allocated memory !"); + if(nbOfTuples) + { + if(!nbOfComp) + { + if(PyInt_Check(nbOfTuples)) + {//DataArrayInt64.New(5,2) + int nbOfCompo=PyInt_AS_LONG(nbOfTuples); + if(nbOfCompo<0) + throw INTERP_KERNEL::Exception("DataArrayInt64::New : should be a positive number of components !"); + MCAuto ret=DataArrayInt64::New(); + ret->alloc(nbOfTuples1,nbOfCompo); + return ret.retn(); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {//DataArrayInt64.New(5) + MCAuto ret=DataArrayInt64::New(); + ret->alloc(nbOfTuples1,1); + return ret.retn(); + } + } +#ifdef WITH_NUMPY + else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL) + {//DataArrayInt64.New(numpyArray) + return BuildNewInstance(elt0,NPY_INT64,&PyCallBackDataArrayInt_RefType,"INT64"); + } +#endif + else + throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy + } + +#ifdef WITH_NUMPY + PyObject *toNumPyArray() // not const. It is not a bug ! + { + return ToNumPyArray(self,NPY_INT64,"DataArrayInt64"); + } +#endif + } + }; + + class DataArrayInt64Tuple; + + class DataArrayInt64Iterator + { + public: + DataArrayInt64Iterator(DataArrayInt64 *da); + ~DataArrayInt64Iterator(); + %extend + { + PyObject *next() + { + DataArrayInt64Tuple *ret=self->nextt(); + if(ret) + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple,SWIG_POINTER_OWN | 0); + else + { + PyErr_SetString(PyExc_StopIteration,"No more data."); + return 0; + } + } + } + }; + + class DataArrayInt64Tuple + { + public: + std::size_t getNumberOfCompo() const; + DataArrayInt64 *buildDAInt(int nbOfTuples, int nbOfCompo) const; + // %extend + // { + // std::string __str__() const + // { + // return self->repr(); + // } + + // int __int__() const + // { + // return self->intValue(); + // } + + // DataArrayInt64 *buildDAInt() + // { + // return self->buildDAInt(1,self->getNumberOfCompo()); + // } + + // PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) + // { + // MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + // MEDCoupling_DataArrayInt64____iadd___(ret,0,obj); + // Py_XINCREF(trueSelf); + // return trueSelf; + // } + + // PyObject *___isub___(PyObject *trueSelf, PyObject *obj) + // { + // MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + // MEDCoupling_DataArrayInt64____isub___(ret,0,obj); + // Py_XINCREF(trueSelf); + // return trueSelf; + // } + + // PyObject *___imul___(PyObject *trueSelf, PyObject *obj) + // { + // MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + // MEDCoupling_DataArrayInt64____imul___(ret,0,obj); + // Py_XINCREF(trueSelf); + // return trueSelf; + // } + // PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) + // { + // MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + // MEDCoupling_DataArrayInt64____idiv___(ret,0,obj); + // Py_XINCREF(trueSelf); + // return trueSelf; + // } + + // PyObject *___imod___(PyObject *trueSelf, PyObject *obj) + // { + // MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + // MEDCoupling_DataArrayInt64____imod___(ret,0,obj); + // Py_XINCREF(trueSelf); + // return trueSelf; + // } + + // PyObject *__len__() + // { + // return PyInt_FromLong(self->getNumberOfCompo()); + // } + + // PyObject *__getitem__(PyObject *obj) + // { + // const char msg2[]="DataArrayInt64Tuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; + // mcIdType sw; + // int singleVal; + // std::vector multiVal; + // std::pair > slic; + // MEDCoupling::DataArrayInt64 *daIntTyypp=0; + // const int *pt=self->getConstPointer(); + // int nbc=self->getNumberOfCompo(); + // convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp); + // switch(sw) + // { + // case 1: + // { + // if(singleVal>=nbc) + // { + // std::ostringstream oss; + // oss << "Requesting for id " << singleVal << " having only " << nbc << " components !"; + // PyErr_SetString(PyExc_StopIteration,oss.str().c_str()); + // return 0; + // } + // if(singleVal>=0) + // return 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,msg2); + // PyObject *t=PyTuple_New(sz); + // for(int j=0;j multiValV; + // std::pair > slicV; + // MEDCoupling::DataArrayInt64Tuple *daIntTyyppV=0; + // int nbc=self->getNumberOfCompo(); + // convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV); + // int singleVal; + // std::vector multiVal; + // std::pair > slic; + // MEDCoupling::DataArrayInt64 *daIntTyypp=0; + // int *pt=self->getPointer(); + // convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(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::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>(int)daIntTyyppV->getNumberOfCompo()) + // { + // std::ostringstream oss; + // oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; + // throw INTERP_KERNEL::Exception(oss.str().c_str()); + // } + // std::copy(ptV,ptV+nbc,pt); + // return self; + // } + // default: + // throw INTERP_KERNEL::Exception(msg); + // } + // } + // case 3: + // { + // int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); + // switch(sw1) + // { + // case 1: + // { + // for(int j=0;jgetConstPointer(); + // if(sz>(int)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::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble; SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat; - SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt; + SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32; + SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64; SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple; SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple; - SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayIntTuple; + SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple; + SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple; } %} @@ -526,7 +528,7 @@ using namespace INTERP_KERNEL; auto szOut(maxElt+1); std::vector< int > retCpp(szOut,-1); mcIdType id(0); - for(const int *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++) + for(const mcIdType *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++) { if(*it!=-1) retCpp[*it]=id; @@ -603,7 +605,8 @@ namespace MEDCoupling IMAGE_GRID = 12 } MEDCouplingMeshType; - class DataArrayInt; + class DataArrayInt32; + class DataArrayInt64; class DataArrayDouble; class MEDCouplingUMesh; class MEDCouplingCMesh; @@ -663,10 +666,10 @@ namespace MEDCoupling virtual DataArrayDouble *getCoordinatesAndOwner() const; virtual DataArrayDouble *computeCellCenterOfMass() const; virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; - virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - virtual DataArrayInt *computeNbOfNodesPerCell() const; - virtual DataArrayInt *computeNbOfFacesPerCell() const; - virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const; + virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + virtual DataArrayIdType *computeNbOfNodesPerCell() const; + virtual DataArrayIdType *computeNbOfFacesPerCell() const; + virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const; virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const; virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; @@ -685,8 +688,8 @@ namespace MEDCoupling virtual MEDCouplingUMesh *buildUnstructured() const; virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const; - virtual DataArrayInt *simplexize(int policy); - virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + virtual DataArrayIdType *simplexize(int policy); + virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings); static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2); static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type); static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type); @@ -727,7 +730,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -740,15 +743,15 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true); - MCAuto elts,eltsIndex; + MCAuto elts,eltsIndex; self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -758,27 +761,27 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true); - MCAuto elts,eltsIndex; + MCAuto elts,eltsIndex; self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getCellsContainingPoints(PyObject *p, double eps) const { - auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto& d, MCAuto& e) { self->getCellsContainingPoints(a,b,c,d,e); }; + auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto& d, MCAuto& e) { self->getCellsContainingPoints(a,b,c,d,e); }; return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc); } PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const { - auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto& d, MCAuto& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); }; + auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto& d, MCAuto& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); }; return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc); } @@ -788,91 +791,91 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true); - std::vector elts; + std::vector elts; self->getCellsContainingPoint(pos,eps,elts); - DataArrayInt *ret=DataArrayInt::New(); + DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc((int)elts.size(),1); std::copy(elts.begin(),elts.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } virtual PyObject *getReverseNodalConnectivity() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); self->getReverseNodalConnectivity(d0,d1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } void renumberCells(PyObject *li, bool check=true) { - int sw,sz(-1); - int v0; std::vector v1; - const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1)); self->renumberCells(ids,check); } PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const { - DataArrayInt *cellCor, *nodeCor; + DataArrayIdType *cellCor, *nodeCor; self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits::TI, cellCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits::TI, nodeCor?SWIG_POINTER_OWN | 0:0 )); return res; } PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const { - DataArrayInt *cellCor=0,*nodeCor=0; + DataArrayIdType *cellCor=0,*nodeCor=0; self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits::TI, cellCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits::TI, nodeCor?SWIG_POINTER_OWN | 0:0 )); return res; } - DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const + DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const { - DataArrayInt *cellCor=0; + DataArrayIdType *cellCor=0; self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor); return cellCor; } - DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const + DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); } } PyObject *getNodeIdsOfCell(int cellId) const { - std::vector conn; + std::vector conn; self->getNodeIdsOfCell(cellId,conn); return convertIntArrToPyList2(conn); } - PyObject *getCoordinatesOfNode(int nodeId) const + PyObject *getCoordinatesOfNode(mcIdType nodeId) const { std::vector coo; self->getCoordinatesOfNode(nodeId,coo); @@ -885,7 +888,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::scale : "; const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -915,14 +918,14 @@ namespace MEDCoupling PyObject *buildPart(PyObject *li) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -932,15 +935,15 @@ namespace MEDCoupling PyObject *buildPartAndReduceNodes(PyObject *li) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - DataArrayInt *arr=0; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + DataArrayIdType *arr=0; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -948,22 +951,22 @@ namespace MEDCoupling // PyObject *res = PyList_New(2); PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 ); - PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); PyList_SetItem(res,0,obj0); PyList_SetItem(res,1,obj1); return res; } - PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const + PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const { - int a,b,c; - DataArrayInt *arr=0; + mcIdType a,b,c; + DataArrayIdType *arr=0; MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr); PyObject *res = PyTuple_New(2); PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 ); PyObject *obj1=0; if(arr) - obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); else obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b)); PyTuple_SetItem(res,0,obj0); @@ -973,11 +976,11 @@ namespace MEDCoupling PyObject *getDistributionOfTypes() const { - std::vector vals=self->getDistributionOfTypes(); + std::vector vals=self->getDistributionOfTypes(); if(vals.size()%3!=0) throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !"); - PyObject *ret=PyList_New((int)vals.size()/3); - for(int j=0;j<(int)vals.size()/3;j++) + PyObject *ret=PyList_New((mcIdType)vals.size()/3); + for(std::size_t j=0;j code; - std::vector idsPerType; - convertFromPyObjVectorOfObj(li2,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",idsPerType); + std::vector code; + std::vector idsPerType; + convertFromPyObjVectorOfObj(li2,SWIGTITraits::TI,"DataArrayIdType",idsPerType); convertPyToNewIntArr4(li,1,3,code); return self->checkTypeConsistencyAndContig(code,idsPerType); } - PyObject *splitProfilePerType(const DataArrayInt *profile, bool smartPflKiller=true) const + PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const { - std::vector code; - std::vector idsInPflPerType; - std::vector idsPerType; + std::vector code; + std::vector idsInPflPerType; + std::vector idsPerType; self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller); PyObject *ret=PyTuple_New(3); // if(code.size()%3!=0) throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !"); - PyObject *ret0=PyList_New((int)code.size()/3); - for(int j=0;j<(int)code.size()/3;j++) + PyObject *ret0=PyList_New((mcIdType)code.size()/3); + for(std::size_t j=0;j::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1); - int n=idsPerType.size(); + std::size_t n=idsPerType.size(); PyObject *ret2=PyList_New(n); - for(int i=0;i::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,2,ret2); return ret; } @@ -1036,7 +1039,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::translate : "; const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -1050,7 +1053,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true); self->rotate(centerPtr,0,alpha); @@ -1063,7 +1066,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2 @@ -1083,16 +1086,16 @@ namespace MEDCoupling virtual PyObject *getTinySerializationInformation() const { std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; self->getTinySerializationInformation(a0,a1,a2); PyObject *ret(PyTuple_New(3)); PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0)); PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1)); - int sz(a2.size()); + mcIdType sz(a2.size()); PyObject *ret2(PyList_New(sz)); { - for(int i=0;iserialize(a0Tmp,a1Tmp); PyObject *ret(PyTuple_New(2)); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); return ret; } - void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2) const + void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const { std::vector littleStrings; self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings); @@ -1131,21 +1134,21 @@ namespace MEDCoupling static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !"; if(!PyTuple_Check(inp)) throw INTERP_KERNEL::Exception(MSG); - int sz(PyTuple_Size(inp)); + mcIdType sz(PyTuple_Size(inp)); if(sz!=2) throw INTERP_KERNEL::Exception(MSG); PyObject *elt0(PyTuple_GetItem(inp,0)); PyObject *elt1(PyTuple_GetItem(inp,1)); std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; - DataArrayInt *b0(0); + DataArrayIdType *b0(0); DataArrayDouble *b1(0); { if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3) throw INTERP_KERNEL::Exception(MSG); PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2)); - int tmp(-1); + mcIdType tmp(-1); fillArrayWithPyListDbl3(a0py,tmp,a0); convertPyToNewIntArr3(a1py,a1); fillStringVector(a2py,a2); @@ -1155,10 +1158,10 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception(MSG); PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1)); void *argp(0); - int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0)); + int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits::TI,0|0)); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception(MSG); - b0=reinterpret_cast(argp); + b0=reinterpret_cast(argp); status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception(MSG); @@ -1248,10 +1251,10 @@ namespace MEDCoupling class MEDCouplingSkyLineArray { public: - static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI ); + static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI ); - void set( DataArrayInt* index, DataArrayInt* value ); - void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value ); + void set( DataArrayIdType* index, DataArrayIdType* value ); + void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value ); int getSuperNumberOf() const; int getNumberOf() const; @@ -1260,7 +1263,7 @@ namespace MEDCoupling void deletePack(const int i, const int j); void deleteSimplePack(const int i); - void deleteSimplePacks(const DataArrayInt* idx); + void deleteSimplePacks(const DataArrayIdType* idx); %extend { @@ -1269,12 +1272,12 @@ namespace MEDCoupling return MEDCouplingSkyLineArray::New(); } - MEDCouplingSkyLineArray( const std::vector& index, const std::vector& value) + MEDCouplingSkyLineArray( const std::vector& index, const std::vector& value) { return MEDCouplingSkyLineArray::New(index, value); } - MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value ) + MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value ) { return MEDCouplingSkyLineArray::New(index, value); } @@ -1289,40 +1292,40 @@ namespace MEDCoupling return self->simpleRepr(); } - DataArrayInt *getSuperIndexArray() const + DataArrayIdType *getSuperIndexArray() const { - DataArrayInt *ret(self->getSuperIndexArray()); + DataArrayIdType *ret(self->getSuperIndexArray()); if(ret) ret->incrRef(); return ret; } - DataArrayInt *getIndexArray() const + DataArrayIdType *getIndexArray() const { - DataArrayInt *ret(self->getIndexArray()); + DataArrayIdType *ret(self->getIndexArray()); if(ret) ret->incrRef(); return ret; } - DataArrayInt *getValuesArray() const + DataArrayIdType *getValuesArray() const { - DataArrayInt *ret(self->getValuesArray()); + DataArrayIdType *ret(self->getValuesArray()); if(ret) ret->incrRef(); return ret; } - PyObject *getSimplePackSafe(int absolutePackId) const + PyObject *getSimplePackSafe(mcIdType absolutePackId) const { - std::vector ret; + std::vector ret; self->getSimplePackSafe(absolutePackId,ret); return convertIntArrToPyList2(ret); } PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const { - std::vector vpack, vspIdx, out; + std::vector vpack, vspIdx, out; convertPyToNewIntArr3(superPackIndices,vspIdx); convertPyToNewIntArr3(pack,vpack); @@ -1331,42 +1334,42 @@ namespace MEDCoupling return convertIntArrToPyList2(out); } - void pushBackPack(const int i, PyObject *pack) + void pushBackPack(const mcIdType i, PyObject *pack) { - std::vector vpack; + std::vector vpack; convertPyToNewIntArr3(pack,vpack); self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size()); } - void replaceSimplePack(const int idx, PyObject *pack) + void replaceSimplePack(const mcIdType idx, PyObject *pack) { - std::vector vpack; + std::vector vpack; convertPyToNewIntArr3(pack,vpack); self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size()); } - void replaceSimplePacks(const DataArrayInt* idx, PyObject *listePacks) + void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks) { - std::vector packs; - convertFromPyObjVectorOfObj(listePacks,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",packs); + std::vector packs; + convertFromPyObjVectorOfObj(listePacks,SWIGTITraits::TI,"DataArrayIdType",packs); self->replaceSimplePacks(idx, packs); } - void replacePack(const int superIdx, const int idx, PyObject *pack) + void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack) { - std::vector vpack; + std::vector vpack; convertPyToNewIntArr3(pack,vpack); self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size()); } PyObject *convertToPolyhedronConn() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); self->convertToPolyhedronConn(d0,d1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } } @@ -1395,17 +1398,17 @@ namespace MEDCoupling virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon); static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2); static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type); - static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps); - virtual DataArrayInt *computeFetchedNodeIds() const; + static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps); + virtual DataArrayIdType *computeFetchedNodeIds() const; virtual int getNumberOfNodesInCell(int cellId) const; virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const; - virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps); - virtual DataArrayInt *zipCoordsTraducer(); - virtual DataArrayInt *findBoundaryNodes() const; - virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0); + virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps); + virtual DataArrayIdType *zipCoordsTraducer(); + virtual DataArrayIdType *findBoundaryNodes() const; + virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0); virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; virtual void checkFullyDefined() const; - virtual bool isEmptyMesh(const std::vector& tinyInfo) const; + virtual bool isEmptyMesh(const std::vector& tinyInfo) const; virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const; virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const; virtual void renumberNodesWithOffsetInConn(int offset); @@ -1419,23 +1422,23 @@ namespace MEDCoupling return self->simpleRepr(); } - PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const + PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const { - int newNbOfNodes; - DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes); + mcIdType newNbOfNodes; + DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes)); return res; } - PyObject *findCommonNodes(double prec, int limitTupleId=-1) const + PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const { - DataArrayInt *comm, *commIndex; + DataArrayIdType *comm, *commIndex; self->findCommonNodes(prec,limitTupleId,comm,commIndex); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return res; } @@ -1449,14 +1452,14 @@ namespace MEDCoupling PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -1466,14 +1469,14 @@ namespace MEDCoupling PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -1483,14 +1486,14 @@ namespace MEDCoupling virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -1498,7 +1501,7 @@ namespace MEDCoupling return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } - virtual PyObject *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const + virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const { MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step); return convertMesh(ret, SWIG_POINTER_OWN | 0 ); @@ -1506,14 +1509,14 @@ namespace MEDCoupling PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -1521,19 +1524,19 @@ namespace MEDCoupling return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } - void renumberNodes(PyObject *li, int newNbOfNodes) + void renumberNodes(PyObject *li, mcIdType newNbOfNodes) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberNodes(tmp,newNbOfNodes); } - void renumberNodesCenter(PyObject *li, int newNbOfNodes) + void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberNodesCenter(tmp,newNbOfNodes); } @@ -1544,17 +1547,17 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point."; const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector."; const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true); - std::vector nodes; + std::vector nodes; self->findNodesOnLine(p,v,eps,nodes); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)nodes.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(nodes.size(),1); std::copy(nodes.begin(),nodes.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const { @@ -1563,17 +1566,17 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point."; const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector."; const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true); - std::vector nodes; + std::vector nodes; self->findNodesOnPlane(p,v,eps,nodes); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)nodes.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(nodes.size(),1); std::copy(nodes.begin(),nodes.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const @@ -1582,49 +1585,49 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true); - DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } - PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const + PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const { - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; // double val; DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : "; const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true); self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const { - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; int spaceDim=self->getSpaceDimension(); double val; DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; - int nbOfTuples=-1; + mcIdType sw; + mcIdType nbOfTuples=-1; const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples); self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI); // PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -1634,22 +1637,22 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : "; const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true); // - DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps); - return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps); + return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } void duplicateNodesInCoords(PyObject *li) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -1660,17 +1663,17 @@ namespace MEDCoupling case 4: return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end()); default: - throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !"); } } - virtual PyObject *findCommonCells(int compType, int startCellId=0) const + virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const { - DataArrayInt *v0(nullptr),*v1(nullptr); + DataArrayIdType *v0(nullptr),*v1(nullptr); self->findCommonCells(compType,startCellId,v0,v1); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return res; } @@ -1687,18 +1690,18 @@ namespace MEDCoupling return ; } } - int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 )); + int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 )); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); self->renumberNodesInConn(tmp); } else { - DataArrayInt *da2(reinterpret_cast< DataArrayInt * >(da)); + DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da)); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); self->renumberNodesInConn(da2->getConstPointer()); } @@ -1706,21 +1709,21 @@ namespace MEDCoupling virtual PyObject *getNodeIdsInUse() const { - int ret1=-1; - DataArrayInt *ret0=self->getNodeIdsInUse(ret1); + mcIdType ret1=-1; + DataArrayIdType *ret0=self->getNodeIdsInUse(ret1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,PyInt_FromLong(ret1)); return ret; } - virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const + virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const { - DataArrayInt *ret(nullptr); + DataArrayIdType *ret(nullptr); // - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret); return ret; } @@ -1728,10 +1731,10 @@ namespace MEDCoupling virtual PyObject *mergeNodes(double precision) { bool ret1; - int ret2; - DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2); + mcIdType ret2; + DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2); PyObject *res = PyList_New(3); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyList_SetItem(res,1,SWIG_From_bool(ret1)); PyList_SetItem(res,2,SWIG_From_int(ret2)); return res; @@ -1740,30 +1743,30 @@ namespace MEDCoupling virtual PyObject *mergeNodesCenter(double precision) { bool ret1; - int ret2; - DataArrayInt *ret0=self->mergeNodesCenter(precision,ret1,ret2); + mcIdType ret2; + DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2); PyObject *res = PyList_New(3); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyList_SetItem(res,1,SWIG_From_bool(ret1)); PyList_SetItem(res,2,SWIG_From_int(ret2)); return res; } - DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const + DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn); } @@ -1771,12 +1774,12 @@ namespace MEDCoupling MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int nbc=self->getNumberOfCells(); + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + mcIdType nbc=self->getNumberOfCells(); convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -1794,7 +1797,7 @@ namespace MEDCoupling { if(nbc+singleVal>0) { - int tmp=nbc+singleVal; + mcIdType tmp=nbc+singleVal; return self->buildPartOfMySelf(&tmp,&tmp+1,true); } else @@ -1821,25 +1824,25 @@ namespace MEDCoupling return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true); } default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !"); } } - static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) + static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords) { - int sz; + mcIdType sz; INTERP_KERNEL::AutoCPtr c=convertPyToNewDblArr2(center,&sz); INTERP_KERNEL::AutoCPtr coo=convertPyToNewDblArr2(coords,&sz); MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo); - for(int i=0;i c=convertPyToNewDblArr2(center,&sz); - int sw,nbNodes=0; + mcIdType sw,nbNodes=0; double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0; std::vector val3; const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3, @@ -1849,22 +1852,22 @@ namespace MEDCoupling MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast(coo)); } - static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) + static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords) { - int sz,sz2; + mcIdType sz,sz2; INTERP_KERNEL::AutoCPtr c=convertPyToNewDblArr2(center,&sz); INTERP_KERNEL::AutoCPtr coo=convertPyToNewDblArr2(coords,&sz); INTERP_KERNEL::AutoCPtr v=convertPyToNewDblArr2(vect,&sz2); MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo); - for(int i=0;i c=convertPyToNewDblArr2(center,&sz); - int sw,nbNodes=0; + mcIdType sw,nbNodes=0; double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0; std::vector val3; const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3, @@ -1892,10 +1895,10 @@ namespace MEDCoupling PyObject *getAllConn() const { - int ret2; - const int *r=self->getAllConn(ret2); + mcIdType ret2; + const mcIdType *r=self->getAllConn(ret2); PyObject *ret=PyTuple_New(ret2); - for(int i=0;i getQuadraticStatus() const; - DataArrayInt *findCellIdsOnBoundary() const; + DataArrayIdType *findCellIdsOnBoundary() const; MEDCouplingUMesh *computeSkin() const; bool checkConsecutiveCellTypes() const; bool checkConsecutiveCellTypesForMEDFileFrmt() const; - DataArrayInt *rearrange2ConsecutiveCellTypes(); - DataArrayInt *sortCellsInMEDFileFrmt(); - DataArrayInt *getRenumArrForMEDFileFrmt() const; - DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const; - MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; + DataArrayIdType *rearrange2ConsecutiveCellTypes(); + DataArrayIdType *sortCellsInMEDFileFrmt(); + DataArrayIdType *getRenumArrForMEDFileFrmt() const; + DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const; + MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; void orientCorrectlyPolyhedrons(); bool isPresenceOfQuadratic() const; bool isFullyQuadratic() const; @@ -2013,9 +2016,9 @@ namespace MEDCoupling bool isContiguous1D() const; void tessellate2D(double eps); void convertQuadraticCellsToLinear(); - DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0); + DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0); void convertDegeneratedCells(); - DataArrayInt *convertDegeneratedCellsAndRemoveFlatOnes(); + DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes(); bool removeDegenerated1DCells(); bool areOnlySimplexCells() const; MEDCouplingFieldDouble *getEdgeRatioField() const; @@ -2023,27 +2026,27 @@ namespace MEDCoupling MEDCouplingFieldDouble *getWarpField() const; MEDCouplingFieldDouble *getSkewField() const; DataArrayDouble *computePlaneEquationOf3DFaces() const; - DataArrayInt *convexEnvelop2D(); + DataArrayIdType *convexEnvelop2D(); std::string cppRepr() const; - DataArrayInt *findAndCorrectBadOriented3DExtrudedCells(); - DataArrayInt *findAndCorrectBadOriented3DCells(); + DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells(); + DataArrayIdType *findAndCorrectBadOriented3DCells(); MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const; MEDCouplingSkyLineArray *generateGraph() const; - DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const; - DataArrayInt *buildUnionOf2DMesh() const; - DataArrayInt *buildUnionOf3DMesh() const; - DataArrayInt *orderConsecutiveCells1D() const; + DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const; + DataArrayIdType *buildUnionOf2DMesh() const; + DataArrayIdType *buildUnionOf3DMesh() const; + DataArrayIdType *orderConsecutiveCells1D() const; DataArrayDouble *getBoundingBoxForBBTreeFast() const; DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const; DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const; void changeOrientationOfCells(); DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps); - int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0); + int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0); static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da); static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2); static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2); - static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn); - static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector& code); + static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn); + static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector& code); %extend { MEDCouplingUMesh() { @@ -2090,12 +2093,12 @@ namespace MEDCoupling void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int nbc=self->getNumberOfCells(); + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + mcIdType nbc=self->getNumberOfCells(); convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2116,7 +2119,7 @@ namespace MEDCoupling { if(nbc+singleVal>0) { - int tmp=nbc+singleVal; + mcIdType tmp=nbc+singleVal; self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis); break; } @@ -2142,18 +2145,18 @@ namespace MEDCoupling break; } default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !"); } } void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int nbc=self->getNumberOfCells(); + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + mcIdType nbc=self->getNumberOfCells(); convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2174,7 +2177,7 @@ namespace MEDCoupling { if(nbc+singleVal>0) { - int tmp=nbc+singleVal; + mcIdType tmp=nbc+singleVal; self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis); break; } @@ -2205,15 +2208,15 @@ namespace MEDCoupling break; } default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !"); } } - void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) + void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); if(size>szArr) { std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !"; @@ -2224,47 +2227,47 @@ namespace MEDCoupling void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->insertNextCell(type,szArr,tmp); } - DataArrayInt *getNodalConnectivity() + DataArrayIdType *getNodalConnectivity() { - DataArrayInt *ret=self->getNodalConnectivity(); + DataArrayIdType *ret=self->getNodalConnectivity(); if(ret) ret->incrRef(); return ret; } - DataArrayInt *getNodalConnectivityIndex() + DataArrayIdType *getNodalConnectivityIndex() { - DataArrayInt *ret=self->getNodalConnectivityIndex(); + DataArrayIdType *ret=self->getNodalConnectivityIndex(); if(ret) ret->incrRef(); return ret; } - static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) + static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr); - int nbOfDepthPeelingPerformed=0; - DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType nbOfDepthPeelingPerformed=0; + DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed); PyObject *res=PyTuple_New(2); - PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed)); return res; } - static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) + static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI) { - DataArrayInt *v0=0,*v1=0; + DataArrayIdType *v0=0,*v1=0; MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return res; } @@ -2274,11 +2277,11 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int nbOfCompo=self->getSpaceDimension(); const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true); // - int cellId=-1; + mcIdType cellId=-1; double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0)); @@ -2288,118 +2291,118 @@ namespace MEDCoupling PyObject *distanceToPoints(const DataArrayDouble *pts) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; DataArrayDouble *ret0=self->distanceToPoints(pts,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *tetrahedrize(int policy) { - int ret2(-1); - DataArrayInt *ret1(0); + mcIdType ret2(-1); + DataArrayIdType *ret1(0); MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2)); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,2,PyInt_FromLong(ret2)); return ret; } PyObject *checkButterflyCells(double eps=1e-12) { - std::vector cells; + std::vector cells; self->checkButterflyCells(cells,eps); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)cells.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(cells.size(),1); std::copy(cells.begin(),cells.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *splitByType() const { std::vector ms=self->splitByType(); - int sz=ms.size(); + std::size_t sz=ms.size(); PyObject *ret = PyList_New(sz); - for(int i=0;i retCpp=self->partitionBySpreadZone(); - int sz=retCpp.size(); + std::vector retCpp=self->partitionBySpreadZone(); + std::size_t sz=retCpp.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i::TI, SWIG_POINTER_OWN | 0 )); return ret; } - static PyObject *PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) + static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn) { - std::vector retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn)); - int sz=retCpp.size(); + std::vector retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn)); + std::size_t sz=retCpp.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(ids,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(ids,&size); MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size); return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ); } bool checkConsecutiveCellTypesAndOrder(PyObject *li) const { - int sz; + mcIdType sz; INTERP_KERNEL::AutoPtr order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz); bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz); return ret; } - DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const + DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const { - int sz; + mcIdType sz; INTERP_KERNEL::AutoPtr order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz); - DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz); + DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz); return ret; } PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const { - DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0; + DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0; self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2); PyObject *ret=PyTuple_New(3); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const { - DataArrayInt *tmp0=0,*tmp1=0; + DataArrayIdType *tmp0=0,*tmp1=0; self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } void duplicateNodes(PyObject *li) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2410,17 +2413,17 @@ namespace MEDCoupling case 4: return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end()); default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !"); } } - void duplicateNodesInConn(PyObject *li, int offset) + void duplicateNodesInConn(PyObject *li, mcIdType offset) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2431,37 +2434,37 @@ namespace MEDCoupling case 4: return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset); default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !"); } } void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr)); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr)); self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr); } PyObject *getLevArrPerCellTypes(PyObject *li) const { - int sz; + mcIdType sz; INTERP_KERNEL::AutoPtr order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz); - DataArrayInt *tmp0,*tmp1=0; + DataArrayIdType *tmp0,*tmp1=0; tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const { - DataArrayInt *ret0=0,*ret1=0; + DataArrayIdType *ret0=0,*ret1=0; self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2469,12 +2472,12 @@ namespace MEDCoupling { std::vector meshes; convertFromPyObjVectorOfObj(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes); - DataArrayInt *ret1=0,*ret2=0; + DataArrayIdType *ret1=0,*ret2=0; MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2488,15 +2491,15 @@ namespace MEDCoupling static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) { - int sz; + mcIdType sz; std::vector meshes; convertFromPyObjVectorOfObj(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes); - std::vector corr; + std::vector corr; MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr); sz=corr.size(); PyObject *ret1=PyList_New(sz); for(int i=0;i::TI, SWIG_POINTER_OWN | 0 )); PyObject *ret=PyList_New(2); PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); PyList_SetItem(ret,1,ret1); @@ -2523,17 +2526,17 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : "; const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true); // - std::vector cells; + std::vector cells; self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)cells.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(cells.size(),1); std::copy(cells.begin(),cells.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } void orientCorrectly2DCells(PyObject *vec, bool polyOnly) @@ -2542,7 +2545,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : "; const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -2551,12 +2554,12 @@ namespace MEDCoupling PyObject *arePolyhedronsNotCorrectlyOriented() const { - std::vector cells; + std::vector cells; self->arePolyhedronsNotCorrectlyOriented(cells); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)cells.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(cells.size(),1); std::copy(cells.begin(),cells.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getFastAveragePlaneOfThis() const @@ -2579,200 +2582,200 @@ namespace MEDCoupling PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const { - DataArrayInt *ret1; + DataArrayIdType *ret1; bool ret0=self->areCellsIncludedIn(other,compType,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_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const { - DataArrayInt *ret1; + DataArrayIdType *ret1; bool ret0=self->areCellsIncludedInPolicy7(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,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *explode3DMeshTo1D() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - MCAuto d2=DataArrayInt::New(); - MCAuto d3=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + MCAuto d2=DataArrayIdType::New(); + MCAuto d3=DataArrayIdType::New(); MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *explodeIntoEdges() const { - MCAuto desc,descIndex,revDesc,revDescIndx; + MCAuto desc,descIndex,revDesc,revDescIndx; MCAuto m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx)); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *explodeMeshIntoMicroEdges() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - MCAuto d2=DataArrayInt::New(); - MCAuto d3=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + MCAuto d2=DataArrayIdType::New(); + MCAuto d3=DataArrayIdType::New(); MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *buildDescendingConnectivity() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - MCAuto d2=DataArrayInt::New(); - MCAuto d3=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + MCAuto d2=DataArrayIdType::New(); + MCAuto d3=DataArrayIdType::New(); MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *buildDescendingConnectivity2() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - MCAuto d2=DataArrayInt::New(); - MCAuto d3=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + MCAuto d2=DataArrayIdType::New(); + MCAuto d3=DataArrayIdType::New(); MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *computeNeighborsOfCells() const { - DataArrayInt *neighbors=0,*neighborsIdx=0; + DataArrayIdType *neighbors=0,*neighborsIdx=0; self->computeNeighborsOfCells(neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *computeNeighborsOfNodes() const { - DataArrayInt *neighbors=0,*neighborsIdx=0; + DataArrayIdType *neighbors=0,*neighborsIdx=0; self->computeNeighborsOfNodes(neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *computeEnlargedNeighborsOfNodes() const { - MCAuto neighbors,neighborsIdx; + MCAuto neighbors,neighborsIdx; self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI) const + PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const { - MCAuto cellNeigh,cellNeighIndex; + MCAuto cellNeigh,cellNeighIndex; self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) + static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI) { - DataArrayInt *neighbors=0,*neighborsIdx=0; + DataArrayIdType *neighbors=0,*neighborsIdx=0; MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh) { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - DataArrayInt *d2,*d3,*d4,*dd5; + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + DataArrayIdType *d2,*d3,*d4,*dd5; MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5); PyObject *ret=PyTuple_New(7); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const + DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); } - DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const + DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); } - MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const + MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); } - PyObject *getTypesOfPart(DataArrayInt *da) const + PyObject *getTypesOfPart(DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); std::set result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); std::set::const_iterator iL=result.begin(); @@ -2782,37 +2785,37 @@ namespace MEDCoupling return res; } - DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const + DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); - DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); + DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); ret->setName(da->getName().c_str()); return ret; } static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) { - DataArrayInt *cellNb1=0,*cellNb2=0; + DataArrayIdType *cellNb1=0,*cellNb2=0; MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps) { MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0); - DataArrayInt *cellIdInMesh2D(0),*cellIdInMesh1D(0); + DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0); MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D); PyObject *ret(PyTuple_New(4)); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2825,17 +2828,17 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true); // - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2848,17 +2851,17 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true); // - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2868,7 +2871,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true); @@ -2877,7 +2880,7 @@ namespace MEDCoupling return ret.retn(); } - DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const + DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const { int spaceDim=self->getSpaceDimension(); if(spaceDim!=3) @@ -2886,7 +2889,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -2896,11 +2899,11 @@ namespace MEDCoupling void convertToPolyTypes(PyObject *li) { - int sw; - int pos1; - std::vector pos2; - DataArrayInt *pos3=0; - DataArrayIntTuple *pos4=0; + mcIdType sw; + mcIdType pos1; + std::vector pos2; + DataArrayIdType *pos3=0; + DataArrayIdTypeTuple *pos4=0; convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4); switch(sw) { @@ -2946,7 +2949,7 @@ namespace MEDCoupling MEDCouplingUMesh *build3DUnstructuredMesh() const; int get2DCellIdForExtrusion() const; %extend { - MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) + MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId) { return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId); } @@ -2989,10 +2992,10 @@ namespace MEDCoupling } PyObject *getMesh3DIds() const { - DataArrayInt *ret=self->getMesh3DIds(); + DataArrayIdType *ret=self->getMesh3DIds(); if(ret) ret->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } } }; @@ -3012,15 +3015,15 @@ namespace MEDCoupling { virtual void insertNextCell(PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->insertNextCell(tmp,tmp+szArr); } - virtual DataArrayInt *getNodalConnectivity() const + virtual DataArrayIdType *getNodalConnectivity() const { - DataArrayInt *ret=self->getNodalConnectivity(); + DataArrayIdType *ret=self->getNodalConnectivity(); if(ret) ret->incrRef(); return ret; } @@ -3041,13 +3044,13 @@ namespace MEDCoupling public: static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type); static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m); - void setNodalConnectivity(DataArrayInt *nodalConn); + void setNodalConnectivity(DataArrayIdType *nodalConn); int getNumberOfNodesPerCell() const; static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2); MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const; MEDCoupling1GTUMesh *computeDualMesh() const; MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const; - DataArrayInt *sortHexa8EachOther(); + DataArrayIdType *sortHexa8EachOther(); %extend { MEDCoupling1SGTUMesh() @@ -3079,12 +3082,12 @@ namespace MEDCoupling PyObject *structurizeMe(double eps=1e-12) const { - DataArrayInt *cellPerm(0),*nodePerm(0); + DataArrayIdType *cellPerm(0),*nodePerm(0); MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps)); PyObject *ret(PyTuple_New(3)); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -3113,7 +3116,7 @@ namespace MEDCoupling public: static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type); static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m); - void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex); + void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex); MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const; bool isPacked() const; %extend @@ -3144,23 +3147,23 @@ namespace MEDCoupling return oss.str(); } - DataArrayInt *getNodalConnectivityIndex() const + DataArrayIdType *getNodalConnectivityIndex() const { - DataArrayInt *ret=self->getNodalConnectivityIndex(); + DataArrayIdType *ret=self->getNodalConnectivityIndex(); if(ret) ret->incrRef(); return ret; } PyObject *retrievePackedNodalConnectivity() const { - DataArrayInt *ret1=0,*ret2=0; + DataArrayIdType *ret1=0,*ret2=0; bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -3189,10 +3192,10 @@ namespace MEDCoupling return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp); } - static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector& offsetInNodeIdsPerElt) + static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector& offsetInNodeIdsPerElt) { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayIdType",tmp); return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt); } } @@ -3203,32 +3206,32 @@ namespace MEDCoupling class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh { public: - int getCellIdFromPos(int i, int j, int k) const; - int getNodeIdFromPos(int i, int j, int k) const; - int getNumberOfCellsOfSubLevelMesh() const; + mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const; + mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const; + mcIdType getNumberOfCellsOfSubLevelMesh() const; int getSpaceDimensionOnNodeStruct() const; double computeSquareness() const; - virtual std::vector getNodeGridStructure() const; - std::vector getCellGridStructure() const; + virtual std::vector getNodeGridStructure() const; + std::vector getCellGridStructure() const; MEDCoupling1SGTUMesh *build1SGTUnstructured() const; - std::vector getLocationFromCellId(int cellId) const; - std::vector getLocationFromNodeId(int cellId) const; + std::vector getLocationFromCellId(mcIdType cellId) const; + std::vector getLocationFromNodeId(mcIdType cellId) const; static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim); MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const; - static int DeduceNumberOfGivenStructure(const std::vector& st); - static DataArrayInt *ComputeCornersGhost(const std::vector& st, int ghostLev); - static std::vector GetSplitVectFromStruct(const std::vector& strct); + static mcIdType DeduceNumberOfGivenStructure(const std::vector& st); + static DataArrayIdType *ComputeCornersGhost(const std::vector& st, mcIdType ghostLev); + static std::vector GetSplitVectFromStruct(const std::vector& strct); %extend { virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const { - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2); - std::vector< std::pair > inp; + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2); + std::vector< std::pair > inp; if(tmpp2==2) { inp.resize(tmpp1); - for(int i=0;ibuildStructuredSubPart(inp); } - static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) + static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); // - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr); - std::vector tmp5(tmp4,tmp4+szArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr); + std::vector tmp5(tmp4,tmp4+szArr); // return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp); } - static void MultiplyPartOf(const std::vector& st, PyObject *part, double factor, DataArrayDouble *da) + static void MultiplyPartOf(const std::vector& st, PyObject *part, double factor, DataArrayDouble *da) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da); } - static void MultiplyPartOfByGhost(const std::vector& st, PyObject *part, int ghostSize, double factor, DataArrayDouble *da) + static void MultiplyPartOfByGhost(const std::vector& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da); } - static PyObject *PutInGhostFormat(int ghostSize, const std::vector& st, PyObject *part) + static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector& st, PyObject *part) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); - std::vector stWithGhost; - std::vector< std::pair > partWithGhost; + std::vector stWithGhost; + std::vector< std::pair > partWithGhost; MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost); PyObject *ret(PyTuple_New(2)); PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost)); @@ -3284,53 +3287,53 @@ namespace MEDCoupling return ret; } - static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) + static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(partCompactFormat,inp); return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp); } - static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other) + static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(partCompactFormat,inp); MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other); } - static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) + static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp); } - static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) + static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr); } - static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) + static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr)); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr)); return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr); } - static std::vector GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) + static std::vector GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(partCompactFormat,inp); return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp); } - static PyObject *GetCompactFrmtFromDimensions(const std::vector& dims) + static PyObject *GetCompactFrmtFromDimensions(const std::vector& dims) { - std::vector< std::pair > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims)); + std::vector< std::pair > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims)); PyObject *retPy=PyList_New(ret.size()); for(std::size_t i=0;i > r1Cpp,r2Cpp; + std::vector< std::pair > r1Cpp,r2Cpp; convertPyToVectorPairInt(r1,r1Cpp); convertPyToVectorPairInt(r2,r2Cpp); - std::vector< std::pair > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp)); + std::vector< std::pair > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp)); PyObject *retPy=PyList_New(ret.size()); for(std::size_t i=0;i > r1Cpp,r2Cpp; + std::vector< std::pair > r1Cpp,r2Cpp; convertPyToVectorPairInt(r1,r1Cpp); convertPyToVectorPairInt(r2,r2Cpp); return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp); @@ -3369,14 +3372,14 @@ namespace MEDCoupling static PyObject *IsPartStructured(PyObject *li, PyObject *st) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); - int szArr2,sw2,iTypppArr2; - std::vector stdvecTyyppArr2; - const int *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2); - std::vector tmp3(tmp2,tmp2+szArr2); - std::vector< std::pair > partCompactFormat; + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr2,sw2,iTypppArr2; + std::vector stdvecTyyppArr2; + const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2); + std::vector tmp3(tmp2,tmp2+szArr2); + std::vector< std::pair > partCompactFormat; bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat); PyObject *ret=PyTuple_New(2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); @@ -3395,7 +3398,7 @@ namespace MEDCoupling static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true) { - std::vector< std::pair > param0,param1,ret; + std::vector< std::pair > param0,param1,ret; convertPyToVectorPairInt(bigInAbs,param0); convertPyToVectorPairInt(partOfBigInAbs,param1); MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check); @@ -3410,11 +3413,11 @@ namespace MEDCoupling return retPy; } - static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector& translation) + static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector& translation) { - std::vector< std::pair > param0; + std::vector< std::pair > param0; convertPyToVectorPairInt(part,param0); - std::vector< std::pair > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation)); + std::vector< std::pair > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation)); PyObject *retPy(PyList_New(ret.size())); for(std::size_t i=0;i FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo) + static std::vector FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo) { - std::vector< std::pair > param0,param1; + std::vector< std::pair > param0,param1; convertPyToVectorPairInt(startingFrom,param0); convertPyToVectorPairInt(goingTo,param1); return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1); @@ -3436,7 +3439,7 @@ namespace MEDCoupling static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true) { - std::vector< std::pair > param0,param1,ret; + std::vector< std::pair > param0,param1,ret; convertPyToVectorPairInt(bigInAbs,param0); convertPyToVectorPairInt(partOfBigRelativeToBig,param1); MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check); @@ -3534,9 +3537,9 @@ namespace MEDCoupling } void setNodeGridStructure(PyObject *gridStruct) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr); self->setNodeGridStructure(tmp,tmp+szArr); } } @@ -3552,51 +3555,51 @@ namespace MEDCoupling static MEDCouplingIMesh *New(); // void setSpaceDimension(int spaceDim); - std::vector getNodeStruct() const; + std::vector getNodeStruct() const; std::vector getOrigin() const; std::vector getDXYZ() const; void setAxisUnit(const std::string& unitName); std::string getAxisUnit() const; double getMeasureOfAnyCell() const; MEDCouplingCMesh *convertToCartesian() const; - void refineWithFactor(const std::vector& factors); + void refineWithFactor(const std::vector& factors); MEDCouplingIMesh *asSingleCell() const; - MEDCouplingIMesh *buildWithGhost(int ghostLev) const; + MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const; %extend { MEDCouplingIMesh() { return MEDCouplingIMesh::New(); } - static MEDCouplingIMesh *New(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) + static MEDCouplingIMesh *New(const std::string& meshName, mcIdType spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) { static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !"; static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !"; - const int *nodeStrctPtr(0); + const mcIdType *nodeStrctPtr(0); const double *originPtr(0),*dxyzPtr(0); - int sw,sz,val0; - std::vector bb0; + mcIdType sw,sz,val0; + std::vector bb0; nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0); // double val,val2; std::vector bb,bb2; - int sz1,sz2; + mcIdType sz1,sz2; originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1); dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2); // return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2); } - MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) + MEDCouplingIMesh(const std::string& meshName, mcIdType spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz) { return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz); } void setNodeStruct(PyObject *nodeStrct) { - int sw,sz,val0; - std::vector bb0; - const int *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0)); + mcIdType sw,sz,val0; + std::vector bb0; + const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0)); self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz); } @@ -3604,10 +3607,8 @@ namespace MEDCoupling { static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !"; double val; - DataArrayDouble *a; - DataArrayDoubleTuple *aa; std::vector bb; - int sw,nbTuples; + mcIdType sw,nbTuples; const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples)); self->setOrigin(originPtr,originPtr+nbTuples); } @@ -3616,45 +3617,43 @@ namespace MEDCoupling { static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !"; double val; - DataArrayDouble *a; - DataArrayDoubleTuple *aa; std::vector bb; - int sw,nbTuples; + mcIdType sw,nbTuples; const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples)); self->setDXYZ(originPtr,originPtr+nbTuples); } - static void CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA) + static void CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA); } - static void CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, int ghostSize) + static void CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, mcIdType ghostSize) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize); } - static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts) + static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts); } - static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, int ghostSize) + static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize); } - static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, int ghostSize) + static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize); } @@ -3694,16 +3693,16 @@ namespace MEDCoupling virtual void setNature(NatureOfField nat); DataArrayDouble *getLocalizationOfDiscr() const; MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const; - int getNumberOfTuplesExpected() const; - int getNumberOfMeshPlacesExpected() const; + mcIdType getNumberOfTuplesExpected() const; + mcIdType getNumberOfMeshPlacesExpected() const; void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); void clearGaussLocalizations(); - MEDCouplingGaussLocalization& getGaussLocalization(int locId); - int getNbOfGaussLocalization() const; - int getGaussLocalizationIdOfOneCell(int cellId) const; - const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const; - int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId); + mcIdType getNbOfGaussLocalization() const; + mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const; + const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const; + mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; void setDiscretization(MEDCouplingFieldDiscretization *newDisc); %extend { PyObject *getMesh() const @@ -3724,45 +3723,45 @@ namespace MEDCoupling PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { - std::set ret=self->getGaussLocalizationIdsOfOneType(type); + std::set ret=self->getGaussLocalizationIdsOfOneType(type); return convertIntArrToPyList3(ret); } PyObject *buildSubMeshData(PyObject *li) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; MEDCouplingMesh *ret0=0; void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); ret0=self->buildSubMeshData(tmp,tmp+size,ret1); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1); } PyObject *res = PyList_New(2); PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); + PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); return res; } - PyObject *buildSubMeshDataRange(int begin, int end, int step) const + PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const { - DataArrayInt *ret1=0; - int bb,ee,ss; + DataArrayIdType *ret1=0; + mcIdType bb,ee,ss; MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1); PyObject *res=PyTuple_New(2); PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 )); if(ret1) - PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); + PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); else { PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss)); @@ -3771,11 +3770,11 @@ namespace MEDCoupling return res; } - DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const + DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1)); return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz); } @@ -3783,39 +3782,39 @@ namespace MEDCoupling const std::vector& gsCoo, const std::vector& wg) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg); } } - PyObject *getCellIdsHavingGaussLocalization(int locId) const + PyObject *getCellIdsHavingGaussLocalization(mcIdType locId) const { - std::vector tmp; + std::vector tmp; self->getCellIdsHavingGaussLocalization(locId,tmp); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)tmp.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc((mcIdType)tmp.size(),1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } - int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const + mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const { - std::vector inp0; + std::vector inp0; convertPyToNewIntArr4(code,1,3,inp0); - std::vector inp1; - convertFromPyObjVectorOfObj(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1); + std::vector inp1; + convertFromPyObjVectorOfObj(idsPerType,SWIGTITraits::TI,"DataArrayIdType",inp1); return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1); } } @@ -3981,7 +3980,7 @@ namespace MEDCoupling double normL1(int compId) const; double normL2(int compId) const; double normMax(int compId) const; - DataArrayInt *findIdsInRange(double vmin, double vmax) const; + DataArrayIdType *findIdsInRange(double vmin, double vmax) const; MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const; static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); @@ -4052,7 +4051,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true); const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true); return self->computeVectorFieldCyl(centerPtr,vectorPtr); @@ -4088,9 +4087,9 @@ namespace MEDCoupling { std::vector tmp; convertFromPyObjVectorOfObj(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp); - int sz=tmp.size(); + std::size_t sz=tmp.size(); std::vector arrs(sz); - for(int i=0;i(tmp[i]); self->setArrays(arrs); } @@ -4109,7 +4108,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; const MEDCouplingMesh *mesh=self->getMesh(); if(!mesh) throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !"); @@ -4123,7 +4122,7 @@ namespace MEDCoupling return convertDblArrToPyList(res,sz); } - PyObject *getValueOnPos(int i, int j, int k) const + PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const { int sz=self->getNumberOfComponents(); INTERP_KERNEL::AutoPtr res=new double[sz]; @@ -4137,7 +4136,7 @@ namespace MEDCoupling if(!mesh) throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !"); // - int sw,nbPts; + mcIdType sw,nbPts; double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector v3; const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti", mesh->getSpaceDimension(),true,nbPts); @@ -4150,7 +4149,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; const MEDCouplingMesh *mesh=self->getMesh(); if(!mesh) throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !"); @@ -4253,33 +4252,33 @@ namespace MEDCoupling } void renumberCells(PyObject *li, bool check=true) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberCells(tmp,check); } void renumberCellsWithoutMesh(PyObject *li, bool check=true) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberCellsWithoutMesh(tmp,check); } void renumberNodes(PyObject *li, double eps=1e-15) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberNodes(tmp,eps); } - void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) + void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps); } @@ -4295,34 +4294,34 @@ namespace MEDCoupling PyObject *getMaxValue2() const { - DataArrayInt *tmp; + DataArrayIdType *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_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getMinValue2() const { - DataArrayInt *tmp; + DataArrayIdType *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_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); return self->keepSelectedComponents(tmp); } void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); self->setSelectedComponents(f,tmp); } @@ -4333,8 +4332,8 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; - int spaceDim=3; + mcIdType sw; + mcIdType spaceDim=3; const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -4372,7 +4371,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4409,7 +4408,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); MCAuto ret=DataArrayDouble::Substract(self->getArray(),aaa); MCAuto ret2=self->clone(false); ret2->setArray(ret); @@ -4454,7 +4453,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4493,7 +4492,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); MCAuto ret=DataArrayDouble::Divide(self->getArray(),aaa); MCAuto ret2=self->clone(false); ret2->setArray(ret); @@ -4528,7 +4527,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4565,7 +4564,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); MCAuto ret=DataArrayDouble::Pow(self->getArray(),aaa); MCAuto ret2=self->clone(false); ret2->setArray(ret); @@ -4604,7 +4603,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4637,7 +4636,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->getArray()->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4670,7 +4669,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4703,7 +4702,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->getArray()->substractEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4736,7 +4735,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4802,7 +4801,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4837,7 +4836,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->getArray()->divideEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4870,7 +4869,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4903,7 +4902,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->getArray()->powEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -5116,7 +5115,7 @@ namespace MEDCoupling void setTimeUnit(const std::string& unit); std::string getTimeUnit() const; void setTime(double val, int iteration, int order); - void setArray(DataArrayInt *array); + void setArray(DataArrayInt32 *array); MEDCouplingFieldInt *deepCopy() const; MEDCouplingFieldInt *clone(bool recDeepCpy) const; MEDCouplingFieldInt *cloneWithMesh(bool recDeepCpy) const; @@ -5167,9 +5166,9 @@ namespace MEDCoupling return fieldT__getitem__(self,li); } - DataArrayInt *getArray() + DataArrayInt32 *getArray() { - DataArrayInt *ret=self->getArray(); + DataArrayInt32 *ret=self->getArray(); if(ret) ret->incrRef(); return ret; @@ -5413,29 +5412,29 @@ namespace MEDCoupling public: int getNumberOfOverlapedCellsForFather() const; bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const; - std::vector computeCellGridSt() const; + std::vector computeCellGridSt() const; %extend { PyObject *getBLTRRange() const { - const std::vector< std::pair >& ret(self->getBLTRRange()); + const std::vector< std::pair >& ret(self->getBLTRRange()); return convertFromVectorPairInt(ret); } PyObject *getBLTRRangeRelativeToGF() const { - std::vector< std::pair > ret(self->getBLTRRangeRelativeToGF()); + std::vector< std::pair > ret(self->getBLTRRangeRelativeToGF()); return convertFromVectorPairInt(ret); } - void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) + void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(bottomLeftTopRight,inp); self->addPatch(inp,factors); } - MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const + MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const { const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh()); if(!mesh) @@ -5453,7 +5452,7 @@ namespace MEDCoupling return ret; } - void __delitem__(int patchId) + void __delitem__(mcIdType patchId) { MEDCouplingCartesianAMRMeshGen *mesh(const_cast(self->getMesh())); if(!mesh) @@ -5461,7 +5460,7 @@ namespace MEDCoupling mesh->removePatch(patchId); } - int __len__() const + mcIdType __len__() const { const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh()); if(!mesh) @@ -5478,45 +5477,45 @@ namespace MEDCoupling class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel { public: - int getAbsoluteLevel() const; - int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; - std::vector getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + mcIdType getAbsoluteLevel() const; + mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + std::vector getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; int getSpaceDimension() const; - const std::vector& getFactors() const; - void setFactors(const std::vector& newFactors); - int getMaxNumberOfLevelsRelativeToThis() const; - int getNumberOfCellsAtCurrentLevel() const; - int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const; - int getNumberOfCellsRecursiveWithOverlap() const; - int getNumberOfCellsRecursiveWithoutOverlap() const; - bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const; + const std::vector& getFactors() const; + void setFactors(const std::vector& newFactors); + mcIdType getMaxNumberOfLevelsRelativeToThis() const; + mcIdType getNumberOfCellsAtCurrentLevel() const; + mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const; + mcIdType getNumberOfCellsRecursiveWithOverlap() const; + mcIdType getNumberOfCellsRecursiveWithoutOverlap() const; + bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const; virtual void detachFromFather(); // - int getNumberOfPatches() const; - int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const; + mcIdType getNumberOfPatches() const; + mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const; MEDCouplingUMesh *buildUnstructured() const; - DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const; - std::vector getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const; + DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const; + std::vector getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const; MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const; MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const; void removeAllPatches(); - void removePatch(int patchId); - void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors); - void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps); - DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const; - void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const; - void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const; - void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const; - void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const; - void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const; - void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const; - DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const; + void removePatch(mcIdType patchId); + void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors); + void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps); + DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const; + void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const; + void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const; + void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const; + void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const; + void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const; + void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const; + DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const; std::string buildPythonDumpOfThis() const; %extend { - void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) + void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(bottomLeftTopRight,inp); self->addPatch(inp,factors); } @@ -5524,9 +5523,9 @@ namespace MEDCoupling PyObject *getPatches() const { std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches()); - int sz(ps.size()); + mcIdType sz(ps.size()); PyObject *ret = PyList_New(sz); - for(int i=0;i(ps[i])); if(elt) @@ -5542,7 +5541,7 @@ namespace MEDCoupling return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 ); } - MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const + MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const { const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos)); MEDCouplingCartesianAMRPatch *ret2(const_cast(ret)); @@ -5551,7 +5550,7 @@ namespace MEDCoupling return ret2; } - MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector& pos) const + MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector& pos) const { const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos)); MEDCouplingCartesianAMRMeshGen *ret2(const_cast(ret)); @@ -5562,25 +5561,25 @@ namespace MEDCoupling virtual PyObject *positionRelativeToGodFather() const { - std::vector out1; - std::vector< std::pair > out0(self->positionRelativeToGodFather(out1)); + std::vector out1; + std::vector< std::pair > out0(self->positionRelativeToGodFather(out1)); PyObject *ret(PyTuple_New(2)); PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0)); PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1)); return ret; } - virtual PyObject *retrieveGridsAt(int absoluteLev) const + virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const { std::vector ps(self->retrieveGridsAt(absoluteLev)); - int sz(ps.size()); + mcIdType sz(ps.size()); PyObject *ret = PyList_New(sz); - for(int i=0;i inp; convertFromPyObjVectorOfObj(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp); @@ -5603,7 +5602,7 @@ namespace MEDCoupling return ret; } - MEDCouplingCartesianAMRPatch *getPatch(int patchId) const + MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const { MEDCouplingCartesianAMRPatch *ret(const_cast(self->getPatch(patchId))); if(ret) @@ -5619,7 +5618,7 @@ namespace MEDCoupling return const_cast(ret); } - MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const + MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const { if(patchId==self->getNumberOfPatches()) { @@ -5634,26 +5633,26 @@ namespace MEDCoupling return ret; } - void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const + void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const { std::vector arrsOnPatches2; convertFromPyObjVectorOfObj(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2); self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative); } - void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const + void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const { std::vector arrsOnPatches2; convertFromPyObjVectorOfObj(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2); self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2); } - void __delitem__(int patchId) + void __delitem__(mcIdType patchId) { self->removePatch(patchId); } - int __len__() const + mcIdType __len__() const { return self->getNumberOfPatches(); } @@ -5674,15 +5673,15 @@ namespace MEDCoupling { static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !"; static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !"; - const int *nodeStrctPtr(0); + const mcIdType *nodeStrctPtr(0); const double *originPtr(0),*dxyzPtr(0); - int sw,sz,val0; - std::vector bb0; + mcIdType sw,sz,val0; + std::vector bb0; nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0); // double val,val2; std::vector bb,bb2; - int sz1,sz2; + mcIdType sz1,sz2; originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1); dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2); // @@ -5693,7 +5692,7 @@ namespace MEDCoupling { std::vector inp0; convertFromPyObjVectorOfObj(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0); - std::vector< std::vector > inp2; + std::vector< std::vector > inp2; convertPyToVectorOfVectorOfInt(factors,inp2); self->createPatchesFromCriterionML(inp0,criterion,inp2,eps); } @@ -5714,13 +5713,13 @@ namespace MEDCoupling { public: virtual void synchronizeFineToCoarse(); - virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev); + virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev); virtual void synchronizeCoarseToFine(); - virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev); + virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev); virtual void synchronizeAllGhostZones(); virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh); - virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level); - virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level); + virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level); + virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level); virtual void alloc(); virtual void dealloc(); %extend @@ -5738,7 +5737,7 @@ namespace MEDCoupling class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel { public: - int getNumberOfLevels() const; + mcIdType getNumberOfLevels() const; MEDCouplingAMRAttribute *deepCopy() const; MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const; MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const; @@ -5749,7 +5748,7 @@ namespace MEDCoupling std::string writeVTHB(const std::string& fileName) const; %extend { - static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) + static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev) { std::vector< std::pair > fieldNamesCpp0; std::vector< std::pair > > fieldNamesCpp1; @@ -5767,7 +5766,7 @@ namespace MEDCoupling return ret; } - MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) + MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev) { return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev); } @@ -5790,7 +5789,7 @@ namespace MEDCoupling void spillNatures(PyObject *nfs) { - std::vector inp0; + std::vector inp0; if(!fillIntVector(nfs,inp0)) throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !"); std::size_t sz(inp0.size()); @@ -5803,9 +5802,9 @@ namespace MEDCoupling PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const { std::vector ret(self->retrieveFieldsOn(mesh)); - int sz((int)ret.size()); + std::size_t sz(ret.size()); PyObject *retPy(PyList_New(sz)); - for(int i=0;i +using namespace MEDCoupling; + +template +struct SWIGTITraits +{ }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt32 is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt64 is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt32 is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt64 is null when called here ! Postpone initialization at inlined initializeMe() + static PyObject *convertArray(MEDCoupling::DataArray *array, int owner) { PyObject *ret(NULL); @@ -40,8 +72,10 @@ static PyObject *convertArray(MEDCoupling::DataArray *array, int owner) } if(dynamic_cast(array)) ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner); - if(dynamic_cast(array)) - ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner); + if(dynamic_cast(array)) + ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt32,owner); + if(dynamic_cast(array)) + ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt64,owner); if(dynamic_cast(array)) ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner); if(!ret) @@ -195,7 +229,7 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype void **objs=new void *[2]; objs[0]=cb; objs[1]=ref; mma.setParameterForDeallocator(objs); mma.setSpecificDeallocator(numarrdeal2); - //"Impossible to share this numpy array chunk of data, because already shared by an another non numpy array object (maybe an another DataArrayInt instance) ! Release it, or perform a copy on the input array !"); + //"Impossible to share this numpy array chunk of data, because already shared by an another non numpy array object (maybe an another DataArrayIdType instance) ! Release it, or perform a copy on the input array !"); } else { @@ -346,35 +380,40 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) return ToNumPyArrayUnderground(self,npyObjectType,MCDataStr,self->getNumberOfTuples(),self->getNumberOfComponents()); } -SWIGINTERN PyObject *MEDCoupling_DataArrayInt_toNumPyArray(MEDCoupling::DataArrayInt *self); +SWIGINTERN PyObject *MEDCoupling_DataArrayInt32_toNumPyArray(MEDCoupling::DataArrayInt32 *self); +SWIGINTERN PyObject *MEDCoupling_DataArrayInt64_toNumPyArray(MEDCoupling::DataArrayInt64 *self); SWIGINTERN PyObject *MEDCoupling_DataArrayDouble_toNumPyArray(MEDCoupling::DataArrayDouble *self); #endif #ifdef WITH_SCIPY -PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) +PyObject *ToCSRMatrix(const std::vector >& m, mcIdType nbCols) { - int nbRows((int)m.size()); - MEDCoupling::MCAuto indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New()); + mcIdType nbRows((mcIdType)m.size()); + MEDCoupling::MCAuto indPtr(MEDCoupling::DataArrayIdType::New()),indices(MEDCoupling::DataArrayIdType::New()); MEDCoupling::MCAuto data(MEDCoupling::DataArrayDouble::New()); indPtr->alloc(nbRows+1,1); - int *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++; - int sz2(0); - for(std::vector >::const_iterator it0=m.begin();it0!=m.end();it0++,intPtr_ptr++) + mcIdType *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++; + mcIdType sz2(0); + for(std::vector >::const_iterator it0=m.begin();it0!=m.end();it0++,intPtr_ptr++) { - sz2+=(int)(*it0).size(); + sz2+=(mcIdType)(*it0).size(); *intPtr_ptr=sz2; } indices->alloc(sz2,1); data->alloc(sz2,1); - int *indices_ptr(indices->getPointer()); + mcIdType *indices_ptr(indices->getPointer()); double *data_ptr(data->getPointer()); - for(std::vector >::const_iterator it0=m.begin();it0!=m.end();it0++) - for(std::map::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++,indices_ptr++,data_ptr++) + for(std::vector >::const_iterator it0=m.begin();it0!=m.end();it0++) + for(std::map::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++,indices_ptr++,data_ptr++) { *indices_ptr=(*it1).first; *data_ptr=(*it1).second; } - PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt_toNumPyArray(indPtr)); +#ifndef MEDCOUPLING_USE_64BIT_IDS + PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt32_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt32_toNumPyArray(indPtr)); +#else + PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt64_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt64_toNumPyArray(indPtr)); +#endif // PyObject *args(PyTuple_New(1)),*args0(PyTuple_New(3)),*kw(PyDict_New()),*kw1(PyTuple_New(2)); PyTuple_SetItem(args0,0,a); PyTuple_SetItem(args0,1,b); PyTuple_SetItem(args0,2,c); PyTuple_SetItem(args,0,args0); @@ -423,8 +462,10 @@ static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) } if(dynamic_cast(dac)) ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner); - if(dynamic_cast(dac)) - ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt32,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt64,owner); if(dynamic_cast(dac)) ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner); if(dynamic_cast(dac)) @@ -436,29 +477,32 @@ static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) return ret; } -static PyObject *convertIntArrToPyList(const int *ptr, int size) +template +static PyObject *convertIntArrToPyList(const T *ptr, mcIdType size) { PyObject *ret=PyList_New(size); - for(int i=0;i& v) +template +static PyObject *convertIntArrToPyList2(const std::vector& v) { - int size=v.size(); + T size=v.size(); PyObject *ret=PyList_New(size); - for(int i=0;i& v) +template +static PyObject *convertIntArrToPyList3(const std::set& v) { - int size=v.size(); + T size=v.size(); PyObject *ret=PyList_New(size); - std::set::const_iterator it=v.begin(); - for(int i=0;i::const_iterator it=v.begin(); + for(T i=0;i +static PyObject *convertIntArrToPyListOfTuple(const T *vals, mcIdType nbOfComp, mcIdType nbOfTuples) { PyObject *ret=PyList_New(nbOfTuples); - for(int i=0;i +static T *convertPyToNewIntArr2(PyObject *pyLi, mcIdType *size) { if(PyList_Check(pyLi)) { *size=PyList_Size(pyLi); - int *tmp=new int[*size]; - for(int i=0;i<*size;i++) + T *tmp=new T[*size]; + for(mcIdType i=0;i<*size;i++) { PyObject *o=PyList_GetItem(pyLi,i); if(PyInt_Check(o)) { - int val=(int)PyInt_AS_LONG(o); + T val=(T)PyInt_AS_LONG(o); tmp[i]=val; } else @@ -539,13 +585,13 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) else if(PyTuple_Check(pyLi)) { *size=PyTuple_Size(pyLi); - int *tmp=new int[*size]; - for(int i=0;i<*size;i++) + T *tmp=new T[*size]; + for(mcIdType i=0;i<*size;i++) { PyObject *o=PyTuple_GetItem(pyLi,i); if(PyInt_Check(o)) { - int val=(int)PyInt_AS_LONG(o); + mcIdType val=(int)PyInt_AS_LONG(o); tmp[i]=val; } else @@ -562,7 +608,7 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) } } -static PyObject *convertFromVectorPairInt(const std::vector< std::pair >& arr) +static PyObject *convertFromVectorPairInt(const std::vector< std::pair >& arr) { PyObject *ret=PyList_New(arr.size()); for(std::size_t i=0;i return ret; } -static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair >& arr) +static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair >& arr) { const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !"; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + mcIdType size=PyList_Size(pyLi); arr.resize(size); - for(int i=0;i& arr) +template +static void convertPyToNewIntArr3(PyObject *pyLi, std::vector& arr) { if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); arr.resize(size); - for(int i=0;i& arr) } else if(PyTuple_Check(pyLi)) { - int size=PyTuple_Size(pyLi); + std::size_t size=PyTuple_Size(pyLi); arr.resize(size); - for(int i=0;i& arr) } } -static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector& arr) +static void convertPyToNewIntArr4(PyObject *pyLi, mcIdType recurseLev, mcIdType nbOfSubPart, std::vector& arr) { if(recurseLev<0) throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : invalid list of integers level of recursion !"); arr.clear(); if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); - for(int i=0;i arr2; + std::vector arr2; convertPyToNewIntArr4(o,recurseLev-1,nbOfSubPart,arr2); - if(nbOfSubPart>=1 && nbOfSubPart!=(int)arr2.size()) + if(nbOfSubPart>=1 && nbOfSubPart!=(mcIdType)arr2.size()) { std::ostringstream oss; oss << "convertPyToNewIntArr4 : input list at lev " << recurseLev << " invalid nb of subpart elts expected " << nbOfSubPart << " having " << arr2.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -756,20 +803,20 @@ static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPar } else if(PyTuple_Check(pyLi)) { - int size=PyTuple_Size(pyLi); - for(int i=0;i arr2; + std::vector arr2; convertPyToNewIntArr4(o,recurseLev-1,nbOfSubPart,arr2); - if(nbOfSubPart>=1 && nbOfSubPart!=(int)arr2.size()) + if(nbOfSubPart>=1 && nbOfSubPart!=(mcIdType)arr2.size()) { std::ostringstream oss; oss << "convertPyToNewIntArr4 : input list at lev " << recurseLev << " invalid nb of subpart elts expected " << nbOfSubPart << " having " << arr2.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -782,7 +829,7 @@ static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPar throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : not a list nor a tuple recursively !"); } -static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& nbOfComp) +static void checkFillArrayWithPyList(mcIdType size1, mcIdType size2, mcIdType& nbOfTuples, mcIdType& nbOfComp) { if(nbOfTuples==-1) { @@ -822,12 +869,13 @@ static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& } } -static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector& ret) +template< class T > +static void fillArrayWithPyListInt3(PyObject *pyLi, mcIdType& nbOfElt, std::vector& ret) { static const char MSG[]="fillArrayWithPyListInt3 : It appears that the input list or tuple is composed by elts having different sizes !"; if(PyInt_Check(pyLi)) { - long val=PyInt_AS_LONG(pyLi); + T val=PyInt_AS_LONG(pyLi); if(nbOfElt==-1) nbOfElt=1; else @@ -837,12 +885,12 @@ static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) +template< class T = mcIdType > +static std::vector fillArrayWithPyListInt2(PyObject *pyLi, mcIdType& nbOfTuples, mcIdType& nbOfComp) { - std::vector ret; - int size1=-1,size2=-1; + std::vector ret; + mcIdType size1=-1,size2=-1; if(PyList_Check(pyLi)) { size1=PyList_Size(pyLi); - for(int i=0;i fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, else if(PyTuple_Check(pyLi)) { size1=PyTuple_Size(pyLi); - for(int i=0;i& vec) { Py_ssize_t sz=PyList_Size(pyLi); vec.resize(sz); - for(int i=0;i& vec) { Py_ssize_t sz=PyTuple_Size(pyLi); vec.resize(sz); - for(int i=0;i& vec) +static bool fillIntVector(PyObject *pyLi, std::vector& vec) { if(PyList_Check(pyLi)) { Py_ssize_t sz=PyList_Size(pyLi); vec.resize(sz); - for(int i=0;i& vec) { Py_ssize_t sz=PyTuple_Size(pyLi); vec.resize(sz); - for(int i=0;i& vec) return false; } -static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector >& arr) +static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector >& arr) { const char msg[]="convertPyToVectorOfVectorOfInt : expecting list of list of strings !"; if(PyList_Check(pyLi)) { Py_ssize_t sz=PyList_Size(pyLi); arr.resize(sz); - for(int i=0;i > item; @@ -1062,12 +1111,12 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st { Py_ssize_t sz=PyTuple_Size(pyLi); arr.resize(sz); - for(int i=0;i > item; @@ -1087,42 +1136,42 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st } template -PyObject *convertDblArrToPyList(const T *ptr, int size) +PyObject *convertDblArrToPyList(const T *ptr, mcIdType size) { PyObject *ret(PyList_New(size)); - for(int i=0;i& v) { - int size(v.size()); + mcIdType size(v.size()); PyObject *ret(PyList_New(size)); - for(int i=0;i -PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, int nbOfTuples) +PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, mcIdType nbOfTuples) { PyObject *ret(PyList_New(nbOfTuples)); - for(int i=0;i tmp=new char[nbOfComp+1]; tmp[nbOfComp]='\0'; - for(int i=0;i& ret) +static void fillArrayWithPyListDbl3(PyObject *pyLi, mcIdType& nbOfElt, std::vector& ret) { static const char MSG[]="fillArrayWithPyListDbl3 : It appears that the input list or tuple is composed by elts having different sizes !"; if(PyFloat_Check(pyLi)) @@ -1203,7 +1252,7 @@ static void fillArrayWithPyListDbl3(PyObject *pyLi, int& nbOfElt, std::vector fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) +static std::vector fillArrayWithPyListDbl2(PyObject *pyLi, mcIdType& nbOfTuples, mcIdType& nbOfComp) { std::vector ret; - int size1=-1,size2=-1; + mcIdType size1=-1,size2=-1; if(PyList_Check(pyLi)) { size1=PyList_Size(pyLi); - for(int i=0;i fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTupl else if(PyTuple_Check(pyLi)) { size1=PyTuple_Size(pyLi); - for(int i=0;i cpp int sw=1 * if python list[int] -> cpp vector sw=2 * if python tuple[int] -> cpp vector sw=2 - * if python DataArrayInt -> cpp DataArrayInt sw=3 - * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 + * if python DataArrayIdType -> cpp DataArrayIdType sw=3 + * if python DataArrayIntTuple -> cpp DataArrayIdTypeTuple sw=4 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static void convertIntStarLikePyObjToCpp(PyObject *value, int& sw, int& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) +template< class T, class ARRAY > +static void convertIntStarLikePyObjToCpp(PyObject *value, mcIdType& sw, T& iTyypp, std::vector& stdvecTyypp, ARRAY *& daIntTyypp, typename MEDCoupling::Traits< T >::ArrayTuple *&daIntTuple) { sw=-1; if(PyInt_Check(value)) { - iTyypp=(int)PyInt_AS_LONG(value); + iTyypp=(T)PyInt_AS_LONG(value); sw=1; return; } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i::TI,0|0); if(SWIG_IsOK(status)) { - daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + daIntTyypp=reinterpret_cast< ARRAY * >(argp); sw=3; return; } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTITraits::TI_TUPLE,0|0); if(SWIG_IsOK(status)) { - daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); + daIntTuple=reinterpret_cast< typename MEDCoupling::Traits< T >::ArrayTuple * >(argp); sw=4; return ; } - throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple"); + throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayIdType, DataArrayIdTypeTuple"); } /*! * if python int -> cpp int sw=1 * if python list[int] -> cpp vector sw=2 * if python tuple[int] -> cpp vector sw=2 - * if python DataArrayInt -> cpp DataArrayInt sw=3 - * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 + * if python DataArrayIdType -> cpp DataArrayIdType sw=3 + * if python DataArrayIdTypeTuple -> cpp DataArrayIdTypeTuple sw=4 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector& stdvecTyypp) +template< class T > +static const T *convertIntStarLikePyObjToCppIntStar(PyObject *value, mcIdType& sw, mcIdType& sz, T& iTyypp, std::vector& stdvecTyypp) { sw=-1; if(PyInt_Check(value)) { - iTyypp=(int)PyInt_AS_LONG(value); + iTyypp=(T)PyInt_AS_LONG(value); sw=1; sz=1; return &iTyypp; } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i::TI,0|0); if(SWIG_IsOK(status)) { - MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + typedef typename MEDCoupling::Traits< T >::ArrayType ARRAY; + ARRAY *daIntTyypp=reinterpret_cast< ARRAY * >(argp); if(daIntTyypp) { sw=3; sz=daIntTyypp->getNbOfElems(); @@ -1478,14 +1530,15 @@ static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, return 0; } } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTITraits::TI_TUPLE,0|0); if(SWIG_IsOK(status)) { - MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); + typedef typename MEDCoupling::Traits< T >::ArrayTuple ARRAYTUPLE; + ARRAYTUPLE *daIntTuple=reinterpret_cast< ARRAYTUPLE * >(argp); sw=4; sz=daIntTuple->getNumberOfCompo(); return daIntTuple->getConstPointer(); } - throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple"); + throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayIdType, DataArrayIdTypeTuple"); } /*! @@ -1497,10 +1550,10 @@ static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, * if python tuple[int] -> cpp vector sw=2 * if python DataArrayDouble -> cpp DataArrayDouble sw=3 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ template -void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::vector& stdvecTyypp, typename MEDCoupling::Traits::ArrayType *& daIntTyypp, swig_type_info *ti) +void considerPyObjAsATStarLikeObject(PyObject *value, mcIdType& sw, T& iTyypp, std::vector& stdvecTyypp, typename MEDCoupling::Traits::ArrayType *& daIntTyypp, swig_type_info *ti) { sw=-1; if(PyFloat_Check(value)) @@ -1517,9 +1570,9 @@ void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::v } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i cpp vector sw=2 * if python DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) +static void convertDoubleStarLikePyObjToCpp(PyObject *value, mcIdType& sw, double& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) { sw=-1; if(PyFloat_Check(value)) @@ -1591,9 +1644,9 @@ static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iT } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i -void convertFPStarLikePyObjToCpp_2(PyObject *value, int& sw, T& val, typename MEDCoupling::Traits::ArrayType *&d, typename MEDCoupling::Traits::ArrayTuple *&e, std::vector& f, swig_type_info *ti_da, swig_type_info *ti_tuple) +void convertFPStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, T& val, typename MEDCoupling::Traits::ArrayType *&d, typename MEDCoupling::Traits::ArrayTuple *&e, std::vector& f, swig_type_info *ti_da, swig_type_info *ti_tuple) { sw=-1; if(PyFloat_Check(value)) @@ -1655,9 +1708,9 @@ void convertFPStarLikePyObjToCpp_2(PyObject *value, int& sw, T& val, typename ME } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); f.resize(size); - for(int i=0;i cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f) +static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f) { convertFPStarLikePyObjToCpp_2(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple); } @@ -1732,7 +1785,7 @@ static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static void convertFloatStarLikePyObjToCpp_2(PyObject *value, int& sw, float& val, MEDCoupling::DataArrayFloat *&d, MEDCoupling::DataArrayFloatTuple *&e, std::vector& f) +static void convertFloatStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, float& val, MEDCoupling::DataArrayFloat *&d, MEDCoupling::DataArrayFloatTuple *&e, std::vector& f) { convertFPStarLikePyObjToCpp_2(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple); } @@ -1742,29 +1795,30 @@ static void convertFloatStarLikePyObjToCpp_2(PyObject *value, int& sw, float& va * if python list[int] -> cpp vector sw=2 * if python tuple[int] -> cpp vector sw=2 * if python slicp -> cpp pair sw=3 (begin,end,step) - * if python DataArrayInt -> cpp DataArrayInt sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown. + * if python DataArrayIdType -> cpp DataArrayIdType sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown. * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) +template +static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, mcIdType nbelem, mcIdType& sw, T& iTyypp, std::vector& stdvecTyypp, std::pair >& p, ARRAY *& daIntTyypp) { - const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple"; + const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIdType, DataArrayIdTypeTuple"; sw=-1; if(PyInt_Check(value)) { - iTyypp=(int)PyInt_AS_LONG(value); + iTyypp=(mcIdType)PyInt_AS_LONG(value); sw=1; return; } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i::TI,0|0); if(SWIG_IsOK(status)) { - daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + daIntTyypp=reinterpret_cast< ARRAY * >(argp); if(!daIntTyypp) { std::ostringstream oss; oss << msg << " Instance in null !"; @@ -1815,10 +1869,11 @@ static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int sw=4; return ; } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTITraits< typename ARRAY::Type >::TI_TUPLE,0|0); if(SWIG_IsOK(status)) { - MEDCoupling::DataArrayIntTuple *tmp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); + typedef typename MEDCoupling::Traits< typename ARRAY::Type >::ArrayTuple ARRAYTUPLE; + ARRAYTUPLE *tmp=reinterpret_cast< ARRAYTUPLE * >(argp); if(!tmp) { std::ostringstream oss; oss << msg << " Instance in null !"; @@ -1835,7 +1890,8 @@ static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int /*! * Idem than convertIntStarOrSliceLikePyObjToCpp */ -static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) +template +static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, mcIdType nbelem, mcIdType& sw, T& iTyypp, std::vector& stdvecTyypp, std::pair >& p, ARRAY *& daIntTyypp) { convertIntStarOrSliceLikePyObjToCpp(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp); if(sw==1) @@ -1849,26 +1905,27 @@ static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, * if python tuple[int] -> cpp vector sw=2 * if python list[int] -> cpp vector sw=2 * if python slice -> cpp pair sw=3 - * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 . WARNING The returned pointer can be the null pointer ! + * if python DataArrayIdTypeTuple -> cpp DataArrayIdTypeTuple sw=4 . WARNING The returned pointer can be the null pointer ! */ -static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp) +template< class TUPLE_T > +static void convertObjToPossibleCpp22(PyObject *value, mcIdType nbelem, mcIdType& sw, mcIdType& iTyypp, std::vector& stdvecTyypp, std::pair >& p, typename MEDCoupling::Traits< TUPLE_T >::ArrayTuple *& daIntTyypp) { sw=-1; if(PyInt_Check(value)) { - iTyypp=(int)PyInt_AS_LONG(value); + iTyypp=(mcIdType)PyInt_AS_LONG(value); sw=1; return; } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i::TI_TUPLE,0|0); if(!SWIG_IsOK(status)) - throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIntTuple"); - daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); + throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIdTypeTuple"); + daIntTyypp=reinterpret_cast< typename MEDCoupling::Traits< TUPLE_T >::ArrayTuple * >(argp); sw=4; } @@ -1921,7 +1978,7 @@ static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& * if python not null pointer of DataArrayChar -> cpp DataArrayChar sw=4 * switch between (int,string,vector,DataArrayChar) */ -static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector& vsType, MEDCoupling::DataArrayChar *& dacType) +static void convertObjToPossibleCpp6(PyObject *value, mcIdType& sw, char& cTyp, std::string& sType, std::vector& vsType, MEDCoupling::DataArrayChar *& dacType) { const char *msg="4 types accepted : string, list or tuple of strings having same size, not null DataArrayChar instance."; sw=-1; @@ -1963,9 +2020,9 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std:: #endif if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); vsType.resize(size); - for(int i=0;i vt sw=2 * if value tuple[int] -> vt sw=2 * if value slice -> pt sw=3 - * if value DataArrayInt -> dt sw=4 + * if value DataArrayIdType -> dt sw=4 * if value tuple [int,int] -> cpp it,ip sw=5 * if value tuple [list[int],int] -> cpp vt,ip sw=6 * if value tuple [tuple[int],int] -> cpp vt,ip sw=6 @@ -2044,11 +2101,12 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std:: * if value tuple [slice,slice] -> cpp pt,pc sw=15 * if value tuple [DaI,slice] -> cpp dt,pc sw=16 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector& vt, std::vector& vc, - std::pair >& pt, std::pair >& pc, - MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc) +template +static void convertObjToPossibleCpp3(PyObject *value, mcIdType nbTuple, int nbCompo, mcIdType& sw, mcIdType& it, TC& ic, std::vector& vt, std::vector& vc, + std::pair >& pt, std::pair >& pc, + MEDCoupling::DataArrayIdType *&dt, MEDCoupling::DataArrayIdType *&dc) { if(!PyTuple_Check(value)) { @@ -2057,11 +2115,11 @@ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, } else { - int sz=PyTuple_Size(value); + mcIdType sz=PyTuple_Size(value); if(sz!=2) throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !"); PyObject *ob0=PyTuple_GetItem(value,0); - int sw1,sw2; + mcIdType sw1,sw2; convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt); PyObject *ob1=PyTuple_GetItem(value,1); convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc); @@ -2077,8 +2135,8 @@ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, - const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) +static const double *convertObjToPossibleCpp5_Safe(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, + const char *msg, mcIdType nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) { sw=-1; if(PyFloat_Check(value)) @@ -2107,7 +2165,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou { try { - int tmp1=nbTuplesExpected,tmp2=nbCompExpected; + mcIdType tmp1=nbTuplesExpected,tmp2=nbCompExpected; std::vector ret=fillArrayWithPyListDbl2(value,tmp1,tmp2); sw=4; f=ret; @@ -2125,7 +2183,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou { if(d->getNumberOfTuples()==nbTuplesExpected) { - if(d->getNumberOfComponents()==nbCompExpected) + if(ToIdType(d->getNumberOfComponents())==nbCompExpected) { return d->getConstPointer(); } @@ -2157,7 +2215,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou { e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp); sw=3; - if(e->getNumberOfCompo()==nbCompExpected) + if(ToIdType(e->getNumberOfCompo())==nbCompExpected) { if(nbTuplesExpected==1) return e->getConstPointer(); @@ -2184,8 +2242,8 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, - const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples) +static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, + const char *msg, int nbCompExpected, bool throwIfNullPt, mcIdType& nbTuples) { sw=-1; if(PyFloat_Check(value)) @@ -2214,9 +2272,9 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); f.resize(size); - for(int i=0;igetNumberOfComponents()==nbCompExpected) + if(ToIdType(d->getNumberOfComponents())==nbCompExpected) { nbTuples=d->getNumberOfTuples(); return d->getConstPointer(); @@ -2301,7 +2359,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do sw=3; if(e) { - if(e->getNumberOfCompo()==nbCompExpected) + if(ToIdType(e->getNumberOfCompo())==nbCompExpected) { nbTuples=1; return e->getConstPointer(); @@ -2334,8 +2392,8 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector& f, - const char *msg, bool throwIfNullPt, int& nbTuples) +static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, mcIdType& sw, double& val, std::vector& f, + const char *msg, bool throwIfNullPt, mcIdType& nbTuples) { MEDCoupling::DataArrayDouble *d=0; MEDCoupling::DataArrayDoubleTuple *e=0; @@ -2356,9 +2414,9 @@ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + mcIdType size=PyTuple_Size(value); f.resize(size); - for(int i=0;i::ArrayType *DataArrayT_New(PyObject *elt0 { if(PyInt_Check(nbOfTuples)) { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples); if(nbOfTuples1<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); + mcIdType nbOfCompo=PyInt_AS_LONG(elt2); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !"); MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > ret(MEDCoupling::Traits::ArrayType::New()); @@ -2526,7 +2588,7 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 else {//DataArrayDouble.New([1.,3.,4.],3) MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > ret(MEDCoupling::Traits::ArrayType::New()); - int tmpp1(-1); + mcIdType tmpp1(-1); std::vector tmp(fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1)); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); @@ -2538,7 +2600,7 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 else {// DataArrayDouble.New([1.,3.,4.]) MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > ret(MEDCoupling::Traits::ArrayType::New()); - int tmpp1(-1),tmpp2(-1); + mcIdType tmpp1(-1),tmpp2(-1); std::vector tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); @@ -2546,7 +2608,7 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 } else if(PyInt_Check(elt0)) { - int nbOfTuples1(PyInt_AS_LONG(elt0)); + mcIdType nbOfTuples1(PyInt_AS_LONG(elt0)); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !"); if(nbOfTuples) @@ -2555,7 +2617,7 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 { if(PyInt_Check(nbOfTuples)) {//DataArrayDouble.New(5,2) - int nbOfCompo=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfCompo=PyInt_AS_LONG(nbOfTuples); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !"); MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > ret(MEDCoupling::Traits::ArrayType::New()); @@ -2591,16 +2653,17 @@ typename MEDCoupling::Traits::ArrayType *DataArrayT__setitem__internal(typena { self->checkAllocated(); const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !"; - int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); - int sw1,sw2; + mcIdType nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); + mcIdType sw1,sw2; T i1; std::vector v1; typename MEDCoupling::Traits::ArrayType *d1=0; considerPyObjAsATStarLikeObject(value,sw1,i1,v1,d1,ti); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - MEDCoupling::DataArrayInt *dt1=0,*dc1=0; + mcIdType it1,ic1; + std::vector vt1; + std::vector vc1; + std::pair > pt1,pc1; + MEDCoupling::DataArrayIdType *dt1=0,*dc1=0; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > tmp; switch(sw2) @@ -2937,12 +3000,14 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !"; const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; self->checkAllocated(); - int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - MEDCoupling::DataArrayInt *dt1=0,*dc1=0; - int sw; + mcIdType nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); + mcIdType it1; + std::size_t ic1; + std::vector vt1; + std::vector vc1; + std::pair > pt1,pc1; + MEDCoupling::DataArrayIdType *dt1=0,*dc1=0; + mcIdType sw; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); MEDCoupling::MCAuto::ArrayType > ret; switch(sw) @@ -2962,19 +3027,19 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A case 6: { ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - std::vector v2(1,ic1); + std::vector v2(1,ic1); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); } case 7: { ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - std::vector v2(1,ic1); + std::vector v2(1,ic1); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); } case 8: { ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - std::vector v2(1,ic1); + std::vector v2(1,ic1); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); } case 9: @@ -3001,8 +3066,8 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A { ret=self->selectByTupleIdSafe(&it1,&it1+1); int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); - std::vector v2(nbOfComp); - for(int i=0;i v2(nbOfComp); + for(mcIdType i=0;ikeepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); } @@ -3010,7 +3075,7 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A { ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); - std::vector v2(nbOfComp); + std::vector v2(nbOfComp); for(int i=0;ikeepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); @@ -3019,7 +3084,7 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A { ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); - std::vector v2(nbOfComp); + std::vector v2(nbOfComp); for(int i=0;ikeepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); @@ -3028,7 +3093,7 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A { ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); - std::vector v2(nbOfComp); + std::vector v2(nbOfComp); for(int i=0;ikeepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); @@ -3057,7 +3122,7 @@ bool isCSRMatrix(PyObject *m) #endif } -void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayInt *indptrPtr, const MEDCoupling::DataArrayInt *indicesPtr, const MEDCoupling::DataArrayDouble *dataPtr, std::vector >& mCpp) +void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayIdType *indptrPtr, const MEDCoupling::DataArrayIdType *indicesPtr, const MEDCoupling::DataArrayDouble *dataPtr, std::vector >& mCpp) { auto nbOfRows(indptrPtr->getNumberOfTuples()-1); if(nbOfRows<0) @@ -3076,7 +3141,7 @@ void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayInt *indptr } } -void convertToVectMapIntDouble(PyObject *pyobj, std::vector >& mCpp) +void convertToVectMapIntDouble(PyObject *pyobj, std::vector >& mCpp) { if(!PyList_Check(pyobj)) throw INTERP_KERNEL::Exception("convertToVectMapIntDouble : input is not a python list !"); @@ -3093,7 +3158,7 @@ void convertToVectMapIntDouble(PyObject *pyobj, std::vector } PyObject *key, *value; Py_ssize_t pos(0); - std::map& mapCpp(mCpp[i]); + std::map& mapCpp(mCpp[i]); while(PyDict_Next(elt,&pos,&key,&value)) { if(!PyInt_Check(key)) @@ -3106,7 +3171,7 @@ void convertToVectMapIntDouble(PyObject *pyobj, std::vector std::ostringstream oss; oss << "convertToVectMapIntDouble : at pos # " << i << " of pylist the dict contains at pos " << pos << " the value not mappable to pyfloat !"; throw INTERP_KERNEL::Exception(oss.str()); } - mapCpp[(int)PyInt_AS_LONG(key)]=PyFloat_AS_DOUBLE(value); + mapCpp[(mcIdType)PyInt_AS_LONG(key)]=PyFloat_AS_DOUBLE(value); } } } @@ -3119,7 +3184,7 @@ PyObject *DataArrayT_imul__internal(PyObject *trueSelf, PyObject *obj, typename typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); switch(sw) { @@ -3144,7 +3209,7 @@ PyObject *DataArrayT_imul__internal(PyObject *trueSelf, PyObject *obj, typename } case 4: { - MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); self->multiplyEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3162,7 +3227,7 @@ PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); switch(sw) { @@ -3189,7 +3254,7 @@ PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename } case 4: { - MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); self->divideEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3207,7 +3272,7 @@ PyObject *DataArrayT_iadd__internal(PyObject *trueSelf, PyObject *obj, typename typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); switch(sw) { @@ -3232,7 +3297,7 @@ PyObject *DataArrayT_iadd__internal(PyObject *trueSelf, PyObject *obj, typename } case 4: { - MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); self->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3250,7 +3315,7 @@ PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); switch(sw) { @@ -3275,7 +3340,7 @@ PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename } case 4: { - MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); self->substractEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3285,29 +3350,6 @@ PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename } } -template -struct SWIGTITraits -{ }; - -template<> -struct SWIGTITraits -{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; - -template<> -struct SWIGTITraits -{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; - -template<> -struct SWIGTITraits -{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; - -swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() - #ifdef WITH_NUMPY PyTypeObject *NPYTraits::NPYFunc=&PyCallBackDataArrayDouble_RefType; @@ -3358,7 +3400,7 @@ typename MEDCoupling::Traits::ArrayType *DataArrayFPT_rmul(typename MEDCoupli typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,SWIGTITraits::TI,SWIGTITraits::TI_TUPLE); switch(sw) { @@ -3375,7 +3417,7 @@ typename MEDCoupling::Traits::ArrayType *DataArrayFPT_rmul(typename MEDCoupli } case 4: { - typename MEDCoupling::MCAuto::ArrayType> aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + typename MEDCoupling::MCAuto::ArrayType> aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); return MEDCoupling::Traits::ArrayType::Multiply(self,aaa); } default: diff --git a/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i b/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i index 4b973f257..124206120 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i +++ b/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i @@ -50,7 +50,7 @@ namespace MEDCoupling virtual const char *getRepr() const; virtual int getNumberOfTuples(const MEDCouplingMesh *mesh) const; virtual int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; - virtual DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const; + virtual DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const; virtual DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; virtual void checkCompatibilityWithNature(NatureOfField nat) const; virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const; @@ -67,21 +67,21 @@ namespace MEDCoupling { virtual MEDCouplingFieldDiscretization *clonePart(PyObject *li) { - int sz=0,sw=-1,val1=-1; - std::vector val2; - const int *inp=convertIntStarLikePyObjToCppIntStar(li,sw,sz,val1,val2); + mcIdType sz=0,sw=-1,val1=-1; + std::vector val2; + const mcIdType *inp=convertIntStarLikePyObjToCppIntStar(li,sw,sz,val1,val2); return self->clonePart(inp,inp+sz); } - virtual PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const + virtual PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const { - DataArrayInt *ret1=0; - int bb,ee,ss; + DataArrayIdType *ret1=0; + mcIdType bb,ee,ss; MEDCouplingMesh *ret0=self->buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,bb,ee,ss,ret1); PyObject *res=PyTuple_New(2); PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 )); if(ret1) - PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); + PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); else { PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss)); @@ -90,27 +90,27 @@ namespace MEDCoupling return res; } - virtual int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const + virtual mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const { - std::vector inp0; + std::vector inp0; convertPyToNewIntArr4(code,1,3,inp0); - std::vector inp1; - convertFromPyObjVectorOfObj(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1); + std::vector inp1; + convertFromPyObjVectorOfObj(idsPerType,SWIGTITraits::TI,"DataArrayIdType",inp1); return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1); } virtual PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const { - std::vector vVal; int iVal=-1; - int sz=-1,sw=0; - const int *tupleIdsBg=convertIntStarLikePyObjToCppIntStar(tupleIds,sw,sz,iVal,vVal); + std::vector vVal; mcIdType iVal=-1; + mcIdType sz=-1,sw=0; + const mcIdType *tupleIdsBg=convertIntStarLikePyObjToCppIntStar(tupleIds,sw,sz,iVal,vVal); if(sw==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !"); - DataArrayInt *ret0=0,*ret1=0; + DataArrayIdType *ret0=0,*ret1=0; self->computeMeshRestrictionFromTupleIds(mesh,tupleIdsBg,tupleIdsBg+sz,ret0,ret1); PyObject *pyRet=PyTuple_New(2); - PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return pyRet; } @@ -144,32 +144,32 @@ namespace MEDCoupling return convertDblArrToPyList(tmp,sz); } - virtual PyObject *getCellIdsHavingGaussLocalization(int locId) const + virtual PyObject *getCellIdsHavingGaussLocalization(mcIdType locId) const { - std::vector tmp; + std::vector tmp; self->getCellIdsHavingGaussLocalization(locId,tmp); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)tmp.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(tmp.size(),1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, PyObject *li, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - self->setGaussLocalizationOnCells(m,tmp,((int *)tmp)+size,refCoo,gsCoo,wg); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + self->setGaussLocalizationOnCells(m,tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); self->setGaussLocalizationOnCells(m,da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg); } @@ -177,7 +177,7 @@ namespace MEDCoupling virtual PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { - std::set ret=self->getGaussLocalizationIdsOfOneType(type); + std::set ret=self->getGaussLocalizationIdsOfOneType(type); return convertIntArrToPyList3(ret); } @@ -187,7 +187,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; if(!mesh) throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDiscretization::getValueOn : no underlying mesh !"); int spaceDim=mesh->getSpaceDimension(); @@ -199,22 +199,22 @@ namespace MEDCoupling return convertDblArrToPyList(res,spaceDim); } - virtual PyObject *getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k) const + virtual PyObject *getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k) const { if(!arr) throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::getValueOnPos : input array is null !"); int sz(arr->getNumberOfComponents()); - INTERP_KERNEL::AutoPtr res=new double[sz]; - self->getValueOnPos(arr,mesh,i,j,k,res); - return convertDblArrToPyList(res,sz); - } + INTERP_KERNEL::AutoPtr res=new double[sz]; + self->getValueOnPos(arr,mesh,i,j,k,res); + return convertDblArrToPyList(res,sz); + } virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, PyObject *loc) const { if(!mesh) throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDiscretization::getValueOnMulti : null input mesh !"); // - int sw,nbPts; + mcIdType sw,nbPts; double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector v3; const double *inp=convertObjToPossibleCpp5_Safe2(loc,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti", mesh->getSpaceDimension(),true,nbPts); @@ -223,9 +223,9 @@ namespace MEDCoupling virtual void renumberCells(PyObject *li, bool check=true) { - int sw,sz(-1); - int v0; std::vector v1; - const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1)); self->renumberCells(ids,check); } @@ -235,55 +235,55 @@ namespace MEDCoupling std::vector input1; convertFromPyObjVectorOfObj(arrays,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",input1); // - int sw,sz(-1); - int v0; std::vector v1; - const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); // self->renumberArraysForCell(mesh,input1,old2NewBg,check); } - virtual DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, PyObject *cellIds) const + virtual DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, PyObject *cellIds) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1)); return self->computeTupleIdsToSelectFromCellIds(mesh,cellIdsBg,cellIdsBg+sz); } virtual PyObject *buildSubMeshData(const MEDCouplingMesh *mesh, PyObject *ids) { - int sw,sz(-1); - int v0; std::vector v1; - const int *idsBg(convertIntStarLikePyObjToCppIntStar(ids,sw,sz,v0,v1)); - DataArrayInt *di(0); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *idsBg(convertIntStarLikePyObjToCppIntStar(ids,sw,sz,v0,v1)); + DataArrayIdType *di(0); MEDCouplingMesh *ret0=self->buildSubMeshData(mesh,idsBg,idsBg+sz,di); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(di),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(di),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - virtual void renumberValuesOnNodes(double epsOnVals, PyObject *old2New, int newNbOfNodes, DataArrayDouble *arr) const + virtual void renumberValuesOnNodes(double epsOnVals, PyObject *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); self->renumberValuesOnNodes(epsOnVals,old2NewBg,newNbOfNodes,arr); } - virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, PyObject *old2New, int newSz, DataArrayDouble *arr) const + virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, PyObject *old2New, mcIdType newSz, DataArrayDouble *arr) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); self->renumberValuesOnCells(epsOnVals,mesh,old2NewBg,newSz,arr); } - virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, PyObject *new2old, int newSz, DataArrayDouble *arr) const + virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, PyObject *new2old, mcIdType newSz, DataArrayDouble *arr) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *new2oldBg(convertIntStarLikePyObjToCppIntStar(new2old,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *new2oldBg(convertIntStarLikePyObjToCppIntStar(new2old,sw,sz,v0,v1)); self->renumberValuesOnCellsR(mesh,new2oldBg,newSz,arr); } } @@ -304,29 +304,29 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationPerCell : public MEDCouplingFieldDiscretization { public: - void setArrayOfDiscIds(const DataArrayInt *adids); + void setArrayOfDiscIds(const DataArrayIdType *adids); void checkNoOrphanCells() const; %extend { PyObject *getArrayOfDiscIds() const { - DataArrayInt *ret=const_cast(self->getArrayOfDiscIds()); + DataArrayIdType *ret=const_cast(self->getArrayOfDiscIds()); if(ret) ret->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *splitIntoSingleGaussDicrPerCellType() const { - std::vector ret1; - std::vector ret0=self->splitIntoSingleGaussDicrPerCellType(ret1); + std::vector ret1; + std::vector ret0=self->splitIntoSingleGaussDicrPerCellType(ret1); std::size_t sz=ret0.size(); PyObject *pyRet=PyTuple_New(2); - PyObject *pyRet0=PyList_New((int)sz); - PyObject *pyRet1=PyList_New((int)sz); + PyObject *pyRet0=PyList_New((mcIdType)sz); + PyObject *pyRet1=PyList_New((mcIdType)sz); for(std::size_t i=0;i::TI, SWIG_POINTER_OWN | 0 )); PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i])); } PyTuple_SetItem(pyRet,0,pyRet0); @@ -375,12 +375,12 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes { public: - static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, int isDrift); + static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, mcIdType isDrift); %extend { PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const { - int ret1; + mcIdType ret1; DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); @@ -390,7 +390,7 @@ namespace MEDCoupling PyObject *computeInverseMatrix(const MEDCouplingMesh *mesh) const { - int ret1(-1),ret2(-1); + mcIdType ret1(-1),ret2(-1); DataArrayDouble *ret0=self->computeInverseMatrix(mesh,ret1,ret2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); @@ -401,7 +401,7 @@ namespace MEDCoupling PyObject *computeMatrix(const MEDCouplingMesh *mesh) const { - int ret1(-1),ret2(-1); + mcIdType ret1(-1),ret2(-1); DataArrayDouble *ret0=self->computeMatrix(mesh,ret1,ret2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); @@ -414,12 +414,12 @@ namespace MEDCoupling { if(!mesh) throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts : input mesh is empty !"); - int sw,nbPts; + mcIdType sw,nbPts; double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector v3; const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts", mesh->getSpaceDimension(),true,nbPts); // - int ret1(-1); + mcIdType ret1(-1); DataArrayDouble *ret0=self->computeEvaluationMatrixOnGivenPts(mesh,inp,nbPts,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); @@ -436,7 +436,7 @@ namespace MEDCoupling PyObject *performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr) const { - int ret1(-1); + mcIdType ret1(-1); DataArrayDouble *ret0(self->performDrift(matr,arr,ret1)); PyObject *res(PyTuple_New(2)); PyTuple_SetItem(res,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0)); @@ -446,7 +446,7 @@ namespace MEDCoupling static PyObject *PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr) { - int ret1(-1); + mcIdType ret1(-1); DataArrayDouble *ret0(MEDCouplingFieldDiscretizationKriging::PerformDriftRect(matr,arr,ret1)); PyObject *res(PyTuple_New(2)); PyTuple_SetItem(res,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0)); diff --git a/src/MEDCoupling_Swig/MEDCouplingFinalize.i b/src/MEDCoupling_Swig/MEDCouplingFinalize.i index 1cc2bfab0..f2801968e 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFinalize.i +++ b/src/MEDCoupling_Swig/MEDCouplingFinalize.i @@ -33,19 +33,33 @@ DataArrayDouble.__floordiv__=DataArrayDouble.__div__ DataArrayDouble.__ifloordiv__=MEDCouplingDataArrayDoubleIdiv DataArrayDouble.__rfloordiv__=DataArrayDouble.__rdiv__ -DataArrayInt.__reduce__=MEDCouplingDataArrayIntReduce -DataArrayInt.__iadd__=MEDCouplingDataArrayIntIadd -DataArrayInt.__isub__=MEDCouplingDataArrayIntIsub -DataArrayInt.__imul__=MEDCouplingDataArrayIntImul -DataArrayInt.__idiv__=MEDCouplingDataArrayIntIdiv -DataArrayInt.__imod__=MEDCouplingDataArrayIntImod -DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow -DataArrayInt.__truediv__=DataArrayInt.__div__ -DataArrayInt.__itruediv__=MEDCouplingDataArrayIntIdiv -DataArrayInt.__rtruediv__=DataArrayInt.__rdiv__ -DataArrayInt.__floordiv__=DataArrayInt.__div__ -DataArrayInt.__ifloordiv__=MEDCouplingDataArrayIntIdiv -DataArrayInt.__rfloordiv__=DataArrayInt.__rdiv__ +DataArrayInt32.__reduce__=MEDCouplingDataArrayIntReduce +DataArrayInt32.__iadd__=MEDCouplingDataArrayIntIadd +DataArrayInt32.__isub__=MEDCouplingDataArrayIntIsub +DataArrayInt32.__imul__=MEDCouplingDataArrayIntImul +DataArrayInt32.__idiv__=MEDCouplingDataArrayIntIdiv +DataArrayInt32.__imod__=MEDCouplingDataArrayIntImod +DataArrayInt32.__ipow__=MEDCouplingDataArrayIntIpow +DataArrayInt32.__truediv__=DataArrayInt.__div__ +DataArrayInt32.__itruediv__=MEDCouplingDataArrayIntIdiv +DataArrayInt32.__rtruediv__=DataArrayInt.__rdiv__ +DataArrayInt32.__floordiv__=DataArrayInt.__div__ +DataArrayInt32.__ifloordiv__=MEDCouplingDataArrayIntIdiv +DataArrayInt32.__rfloordiv__=DataArrayInt.__rdiv__ + +DataArrayInt64.__reduce__=MEDCouplingDataArrayIntReduce +DataArrayInt64.__iadd__=MEDCouplingDataArrayIntIadd +DataArrayInt64.__isub__=MEDCouplingDataArrayIntIsub +DataArrayInt64.__imul__=MEDCouplingDataArrayIntImul +DataArrayInt64.__idiv__=MEDCouplingDataArrayIntIdiv +DataArrayInt64.__imod__=MEDCouplingDataArrayIntImod +DataArrayInt64.__ipow__=MEDCouplingDataArrayIntIpow +DataArrayInt64.__truediv__=DataArrayInt.__div__ +DataArrayInt64.__itruediv__=MEDCouplingDataArrayIntIdiv +DataArrayInt64.__rtruediv__=DataArrayInt.__rdiv__ +DataArrayInt64.__floordiv__=DataArrayInt.__div__ +DataArrayInt64.__ifloordiv__=MEDCouplingDataArrayIntIdiv +DataArrayInt64.__rfloordiv__=DataArrayInt.__rdiv__ DataArrayByte.__reduce__=MEDCouplingDataArrayByteReduce @@ -72,7 +86,8 @@ MEDCouplingFieldDouble.__ifloordiv__=MEDCouplingFieldDoubleIdiv MEDCouplingFieldTemplate.__reduce__=MEDCouplingFieldTemplateReduce -MEDCouplingFieldInt.__reduce__=MEDCouplingFieldIntReduce +MEDCouplingFieldInt32.__reduce__=MEDCouplingFieldIntReduce +MEDCouplingFieldInt64.__reduce__=MEDCouplingFieldIntReduce MEDCouplingFieldFloat.__reduce__=MEDCouplingFieldFloatReduce @@ -83,13 +98,21 @@ DataArrayDoubleTuple.__idiv__=MEDCouplingDataArrayDoubleTupleIdiv DataArrayDoubleTuple.__itruediv__=MEDCouplingDataArrayDoubleTupleIdiv DataArrayDoubleTuple.__ifloordiv__=MEDCouplingDataArrayDoubleTupleIdiv -DataArrayIntTuple.__iadd__=MEDCouplingDataArrayIntTupleIadd -DataArrayIntTuple.__isub__=MEDCouplingDataArrayIntTupleIsub -DataArrayIntTuple.__imul__=MEDCouplingDataArrayIntTupleImul -DataArrayIntTuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv -DataArrayIntTuple.__itruediv__=MEDCouplingDataArrayIntTupleIdiv -DataArrayIntTuple.__ifloordiv__=MEDCouplingDataArrayIntTupleIdiv -DataArrayIntTuple.__imod__=MEDCouplingDataArrayIntTupleImod +DataArrayInt32Tuple.__iadd__=MEDCouplingDataArrayIntTupleIadd +DataArrayInt32Tuple.__isub__=MEDCouplingDataArrayIntTupleIsub +DataArrayInt32Tuple.__imul__=MEDCouplingDataArrayIntTupleImul +DataArrayInt32Tuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv +DataArrayInt32Tuple.__itruediv__=MEDCouplingDataArrayIntTupleIdiv +DataArrayInt32Tuple.__ifloordiv__=MEDCouplingDataArrayIntTupleIdiv +DataArrayInt32Tuple.__imod__=MEDCouplingDataArrayIntTupleImod + +DataArrayInt64Tuple.__iadd__=MEDCouplingDataArrayIntTupleIadd +DataArrayInt64Tuple.__isub__=MEDCouplingDataArrayIntTupleIsub +DataArrayInt64Tuple.__imul__=MEDCouplingDataArrayIntTupleImul +DataArrayInt64Tuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv +DataArrayInt64Tuple.__itruediv__=MEDCouplingDataArrayIntTupleIdiv +DataArrayInt64Tuple.__ifloordiv__=MEDCouplingDataArrayIntTupleIdiv +DataArrayInt64Tuple.__imod__=MEDCouplingDataArrayIntTupleImod DenseMatrix.__iadd__=MEDCouplingDenseMatrixIadd DenseMatrix.__isub__=MEDCouplingDenseMatrixIsub @@ -103,54 +126,54 @@ MEDCouplingIMesh.__reduce__=MEDCouplingIMeshReduce MEDCouplingMappedExtrudedMesh.__reduce__=MEDCouplingMappedExtrudedMeshReduce DataArrayAsciiCharIterator.__next__ = DataArrayAsciiCharIterator.next -DataArrayIntIterator.__next__ = DataArrayIntIterator.next +DataArrayInt32Iterator.__next__ = DataArrayInt32Iterator.next +DataArrayInt64Iterator.__next__ = DataArrayInt64Iterator.next DataArrayDoubleIterator.__next__ = DataArrayDoubleIterator.next MEDCouplingUMeshCellIterator.__next__ = MEDCouplingUMeshCellIterator.next MEDCouplingUMeshCellByTypeIterator.__next__ = MEDCouplingUMeshCellByTypeIterator.next + del INTERPKERNELExceptionReduce -del MEDCouplingDataArrayDoubleReduce -del MEDCouplingDataArrayFloatReduce -del MEDCouplingDataArrayIntReduce -del MEDCouplingDataArrayByteReduce -del MEDCouplingUMeshReduce +del MEDCoupling1DGTUMeshReduce +del MEDCoupling1SGTUMeshReduce del MEDCouplingCMeshReduce -del MEDCouplingIMeshReduce -del MEDCouplingMappedExtrudedMeshReduce del MEDCouplingCurveLinearMeshReduce -del MEDCoupling1SGTUMeshReduce -del MEDCoupling1DGTUMeshReduce -del MEDCouplingFieldDoubleReduce -del MEDCouplingFieldFloatReduce -del MEDCouplingFieldIntReduce -del MEDCouplingFieldTemplateReduce +del MEDCouplingDataArrayByteReduce del MEDCouplingDataArrayDoubleIadd -del MEDCouplingDataArrayDoubleIsub del MEDCouplingDataArrayDoubleImul -del MEDCouplingDataArrayDoubleIdiv -del MEDCouplingFieldDoubleIadd -del MEDCouplingFieldDoubleIsub -del MEDCouplingFieldDoubleImul -del MEDCouplingFieldDoubleIdiv -del MEDCouplingFieldDoubleIpow -del MEDCouplingDataArrayIntIadd -del MEDCouplingDataArrayIntIsub -del MEDCouplingDataArrayIntImul -del MEDCouplingDataArrayIntIdiv -del MEDCouplingDataArrayIntImod -del MEDCouplingDataArrayFloatIadd -del MEDCouplingDataArrayFloatIsub -del MEDCouplingDataArrayFloatImul -del MEDCouplingDataArrayFloatIdiv +del MEDCouplingDataArrayDoubleIpow +del MEDCouplingDataArrayDoubleIsub +del MEDCouplingDataArrayDoubleReduce del MEDCouplingDataArrayDoubleTupleIadd -del MEDCouplingDataArrayDoubleTupleIsub del MEDCouplingDataArrayDoubleTupleImul -del MEDCouplingDataArrayDoubleTupleIdiv +del MEDCouplingDataArrayDoubleTupleIsub +del MEDCouplingDataArrayFloatIadd +del MEDCouplingDataArrayFloatImul +del MEDCouplingDataArrayFloatIsub +del MEDCouplingDataArrayFloatReduce +del MEDCouplingDataArrayIntIadd +del MEDCouplingDataArrayIntIadd +del MEDCouplingDataArrayIntImod +del MEDCouplingDataArrayIntImul +del MEDCouplingDataArrayIntIpow +del MEDCouplingDataArrayIntIsub +del MEDCouplingDataArrayIntReduce del MEDCouplingDataArrayIntTupleIadd -del MEDCouplingDataArrayIntTupleIsub -del MEDCouplingDataArrayIntTupleImul del MEDCouplingDataArrayIntTupleIdiv del MEDCouplingDataArrayIntTupleImod +del MEDCouplingDataArrayIntTupleImul +del MEDCouplingDataArrayIntTupleIsub del MEDCouplingDenseMatrixIadd del MEDCouplingDenseMatrixIsub +del MEDCouplingFieldDoubleIadd +del MEDCouplingFieldDoubleImul +del MEDCouplingFieldDoubleIpow +del MEDCouplingFieldDoubleIsub +del MEDCouplingFieldDoubleReduce +del MEDCouplingFieldFloatReduce +del MEDCouplingFieldIntReduce +del MEDCouplingFieldTemplateReduce +del MEDCouplingIMeshReduce +del MEDCouplingMappedExtrudedMeshReduce +del MEDCouplingUMeshReduce %} diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index f096deb75..99a0dc6e8 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -41,9 +41,14 @@ $result=convertDataArrayChar($1,$owner); } -%typemap(out) MCAuto +%typemap(out) MCAuto { - $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0); + $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt32,SWIG_POINTER_OWN|0); +} + +%typemap(out) MCAuto +{ + $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt64,SWIG_POINTER_OWN|0); } %typemap(out) MCAuto @@ -74,78 +79,150 @@ %newobject MEDCoupling::DataArrayFloat::__iter__; %newobject MEDCoupling::DataArrayFloat::Meld; %newobject MEDCoupling::DataArrayFloat::__rmul__; -%newobject MEDCoupling::DataArrayInt::New; -%newobject MEDCoupling::DataArrayInt::__iter__; -%newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef; -%newobject MEDCoupling::DataArrayInt::subArray; -%newobject MEDCoupling::DataArrayInt::changeNbOfComponents; -%newobject MEDCoupling::DataArrayInt::accumulatePerChunck; -%newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation; -%newobject MEDCoupling::DataArrayInt::transformWithIndArrR; -%newobject MEDCoupling::DataArrayInt::renumber; -%newobject MEDCoupling::DataArrayInt::renumberR; -%newobject MEDCoupling::DataArrayInt::renumberAndReduce; -%newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O; -%newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N; -%newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis; -%newobject MEDCoupling::DataArrayInt::findIdsEqual; -%newobject MEDCoupling::DataArrayInt::findIdsNotEqual; -%newobject MEDCoupling::DataArrayInt::findIdsEqualList; -%newobject MEDCoupling::DataArrayInt::findIdsNotEqualList; -%newobject MEDCoupling::DataArrayInt::findIdsEqualTuple; -%newobject MEDCoupling::DataArrayInt::findIdForEach; -%newobject MEDCoupling::DataArrayInt::sumPerTuple; -%newobject MEDCoupling::DataArrayInt::negate; -%newobject MEDCoupling::DataArrayInt::computeAbs; -%newobject MEDCoupling::DataArrayInt::findIdsInRange; -%newobject MEDCoupling::DataArrayInt::findIdsNotInRange; -%newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative; -%newobject MEDCoupling::DataArrayInt::Aggregate; -%newobject MEDCoupling::DataArrayInt::AggregateIndexes; -%newobject MEDCoupling::DataArrayInt::Meld; -%newobject MEDCoupling::DataArrayInt::Add; -%newobject MEDCoupling::DataArrayInt::Substract; -%newobject MEDCoupling::DataArrayInt::Multiply; -%newobject MEDCoupling::DataArrayInt::Divide; -%newobject MEDCoupling::DataArrayInt::Pow; -%newobject MEDCoupling::DataArrayInt::BuildUnion; -%newobject MEDCoupling::DataArrayInt::BuildIntersection; -%newobject MEDCoupling::DataArrayInt::Range; -%newobject MEDCoupling::DataArrayInt::indicesOfSubPart; -%newobject MEDCoupling::DataArrayInt::fromNoInterlace; -%newobject MEDCoupling::DataArrayInt::toNoInterlace; -%newobject MEDCoupling::DataArrayInt::buildComplement; -%newobject MEDCoupling::DataArrayInt::buildUnion; -%newobject MEDCoupling::DataArrayInt::buildSubstraction; -%newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized; -%newobject MEDCoupling::DataArrayInt::buildIntersection; -%newobject MEDCoupling::DataArrayInt::buildUnique; -%newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted; -%newobject MEDCoupling::DataArrayInt::deltaShiftIndex; -%newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges; -%newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr; -%newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple; -%newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple; -%newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes; -%newobject MEDCoupling::DataArrayInt::buildPermutationArr; -%newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel; -%newobject MEDCoupling::DataArrayInt::getDifferentValues; -%newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond; -%newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation; -%newobject MEDCoupling::DataArrayInt::__neg__; -%newobject MEDCoupling::DataArrayInt::__add__; -%newobject MEDCoupling::DataArrayInt::__radd__; -%newobject MEDCoupling::DataArrayInt::__sub__; -%newobject MEDCoupling::DataArrayInt::__rsub__; -%newobject MEDCoupling::DataArrayInt::__mul__; -%newobject MEDCoupling::DataArrayInt::__rmul__; -%newobject MEDCoupling::DataArrayInt::__div__; -%newobject MEDCoupling::DataArrayInt::__rdiv__; -%newobject MEDCoupling::DataArrayInt::__mod__; -%newobject MEDCoupling::DataArrayInt::__rmod__; -%newobject MEDCoupling::DataArrayInt::__pow__; -%newobject MEDCoupling::DataArrayInt::__rpow__; -%newobject MEDCoupling::DataArrayIntTuple::buildDAInt; +%newobject MEDCoupling::DataArrayInt32::New; +%newobject MEDCoupling::DataArrayInt32::__iter__; +%newobject MEDCoupling::DataArrayInt32::performCopyOrIncrRef; +%newobject MEDCoupling::DataArrayInt32::subArray; +%newobject MEDCoupling::DataArrayInt32::changeNbOfComponents; +%newobject MEDCoupling::DataArrayInt32::accumulatePerChunck; +%newobject MEDCoupling::DataArrayInt32::checkAndPreparePermutation; +%newobject MEDCoupling::DataArrayInt32::transformWithIndArrR; +%newobject MEDCoupling::DataArrayInt32::renumber; +%newobject MEDCoupling::DataArrayInt32::renumberR; +%newobject MEDCoupling::DataArrayInt32::renumberAndReduce; +%newobject MEDCoupling::DataArrayInt32::invertArrayO2N2N2O; +%newobject MEDCoupling::DataArrayInt32::invertArrayN2O2O2N; +%newobject MEDCoupling::DataArrayInt32::invertArrayO2N2N2OBis; +%newobject MEDCoupling::DataArrayInt32::findIdsEqual; +%newobject MEDCoupling::DataArrayInt32::findIdsNotEqual; +%newobject MEDCoupling::DataArrayInt32::findIdsEqualList; +%newobject MEDCoupling::DataArrayInt32::findIdsNotEqualList; +%newobject MEDCoupling::DataArrayInt32::findIdsEqualTuple; +%newobject MEDCoupling::DataArrayInt32::findIdForEach; +%newobject MEDCoupling::DataArrayInt32::sumPerTuple; +%newobject MEDCoupling::DataArrayInt32::negate; +%newobject MEDCoupling::DataArrayInt32::computeAbs; +%newobject MEDCoupling::DataArrayInt32::findIdsInRange; +%newobject MEDCoupling::DataArrayInt32::findIdsNotInRange; +%newobject MEDCoupling::DataArrayInt32::findIdsStrictlyNegative; +%newobject MEDCoupling::DataArrayInt32::Aggregate; +%newobject MEDCoupling::DataArrayInt32::AggregateIndexes; +%newobject MEDCoupling::DataArrayInt32::Meld; +%newobject MEDCoupling::DataArrayInt32::Add; +%newobject MEDCoupling::DataArrayInt32::Substract; +%newobject MEDCoupling::DataArrayInt32::Multiply; +%newobject MEDCoupling::DataArrayInt32::Divide; +%newobject MEDCoupling::DataArrayInt32::Pow; +%newobject MEDCoupling::DataArrayInt32::BuildUnion; +%newobject MEDCoupling::DataArrayInt32::BuildIntersection; +%newobject MEDCoupling::DataArrayInt32::Range; +%newobject MEDCoupling::DataArrayInt32::indicesOfSubPart; +%newobject MEDCoupling::DataArrayInt32::fromNoInterlace; +%newobject MEDCoupling::DataArrayInt32::toNoInterlace; +%newobject MEDCoupling::DataArrayInt32::buildComplement; +%newobject MEDCoupling::DataArrayInt32::buildUnion; +%newobject MEDCoupling::DataArrayInt32::buildSubstraction; +%newobject MEDCoupling::DataArrayInt32::buildSubstractionOptimized; +%newobject MEDCoupling::DataArrayInt32::buildIntersection; +%newobject MEDCoupling::DataArrayInt32::buildUnique; +%newobject MEDCoupling::DataArrayInt32::buildUniqueNotSorted; +%newobject MEDCoupling::DataArrayInt32::deltaShiftIndex; +%newobject MEDCoupling::DataArrayInt32::buildExplicitArrByRanges; +%newobject MEDCoupling::DataArrayInt32::buildExplicitArrOfSliceOnScaledArr; +%newobject MEDCoupling::DataArrayInt32::findRangeIdForEachTuple; +%newobject MEDCoupling::DataArrayInt32::findIdInRangeForEachTuple; +%newobject MEDCoupling::DataArrayInt32::duplicateEachTupleNTimes; +%newobject MEDCoupling::DataArrayInt32::buildPermutationArr; +%newobject MEDCoupling::DataArrayInt32::buildPermArrPerLevel; +%newobject MEDCoupling::DataArrayInt32::getDifferentValues; +%newobject MEDCoupling::DataArrayInt32::FindPermutationFromFirstToSecond; +%newobject MEDCoupling::DataArrayInt32::CheckAndPreparePermutation; +%newobject MEDCoupling::DataArrayInt32::__neg__; +%newobject MEDCoupling::DataArrayInt32::__add__; +%newobject MEDCoupling::DataArrayInt32::__radd__; +%newobject MEDCoupling::DataArrayInt32::__sub__; +%newobject MEDCoupling::DataArrayInt32::__rsub__; +%newobject MEDCoupling::DataArrayInt32::__mul__; +%newobject MEDCoupling::DataArrayInt32::__rmul__; +%newobject MEDCoupling::DataArrayInt32::__div__; +%newobject MEDCoupling::DataArrayInt32::__rdiv__; +%newobject MEDCoupling::DataArrayInt32::__mod__; +%newobject MEDCoupling::DataArrayInt32::__rmod__; +%newobject MEDCoupling::DataArrayInt32::__pow__; +%newobject MEDCoupling::DataArrayInt32::__rpow__; +%newobject MEDCoupling::DataArrayInt32Tuple::buildDAInt; +%newobject MEDCoupling::DataArrayInt64::New; +%newobject MEDCoupling::DataArrayInt64::__iter__; +%newobject MEDCoupling::DataArrayInt64::performCopyOrIncrRef; +%newobject MEDCoupling::DataArrayInt64::subArray; +%newobject MEDCoupling::DataArrayInt64::changeNbOfComponents; +%newobject MEDCoupling::DataArrayInt64::accumulatePerChunck; +%newobject MEDCoupling::DataArrayInt64::checkAndPreparePermutation; +%newobject MEDCoupling::DataArrayInt64::transformWithIndArrR; +%newobject MEDCoupling::DataArrayInt64::renumber; +%newobject MEDCoupling::DataArrayInt64::renumberR; +%newobject MEDCoupling::DataArrayInt64::renumberAndReduce; +%newobject MEDCoupling::DataArrayInt64::invertArrayO2N2N2O; +%newobject MEDCoupling::DataArrayInt64::invertArrayN2O2O2N; +%newobject MEDCoupling::DataArrayInt64::invertArrayO2N2N2OBis; +%newobject MEDCoupling::DataArrayInt64::findIdsEqual; +%newobject MEDCoupling::DataArrayInt64::findIdsNotEqual; +%newobject MEDCoupling::DataArrayInt64::findIdsEqualList; +%newobject MEDCoupling::DataArrayInt64::findIdsNotEqualList; +%newobject MEDCoupling::DataArrayInt64::findIdsEqualTuple; +%newobject MEDCoupling::DataArrayInt64::findIdForEach; +%newobject MEDCoupling::DataArrayInt64::sumPerTuple; +%newobject MEDCoupling::DataArrayInt64::negate; +%newobject MEDCoupling::DataArrayInt64::computeAbs; +%newobject MEDCoupling::DataArrayInt64::findIdsInRange; +%newobject MEDCoupling::DataArrayInt64::findIdsNotInRange; +%newobject MEDCoupling::DataArrayInt64::findIdsStrictlyNegative; +%newobject MEDCoupling::DataArrayInt64::Aggregate; +%newobject MEDCoupling::DataArrayInt64::AggregateIndexes; +%newobject MEDCoupling::DataArrayInt64::Meld; +%newobject MEDCoupling::DataArrayInt64::Add; +%newobject MEDCoupling::DataArrayInt64::Substract; +%newobject MEDCoupling::DataArrayInt64::Multiply; +%newobject MEDCoupling::DataArrayInt64::Divide; +%newobject MEDCoupling::DataArrayInt64::Pow; +%newobject MEDCoupling::DataArrayInt64::BuildUnion; +%newobject MEDCoupling::DataArrayInt64::BuildIntersection; +%newobject MEDCoupling::DataArrayInt64::Range; +%newobject MEDCoupling::DataArrayInt64::indicesOfSubPart; +%newobject MEDCoupling::DataArrayInt64::fromNoInterlace; +%newobject MEDCoupling::DataArrayInt64::toNoInterlace; +%newobject MEDCoupling::DataArrayInt64::buildComplement; +%newobject MEDCoupling::DataArrayInt64::buildUnion; +%newobject MEDCoupling::DataArrayInt64::buildSubstraction; +%newobject MEDCoupling::DataArrayInt64::buildSubstractionOptimized; +%newobject MEDCoupling::DataArrayInt64::buildIntersection; +%newobject MEDCoupling::DataArrayInt64::buildUnique; +%newobject MEDCoupling::DataArrayInt64::buildUniqueNotSorted; +%newobject MEDCoupling::DataArrayInt64::deltaShiftIndex; +%newobject MEDCoupling::DataArrayInt64::buildExplicitArrByRanges; +%newobject MEDCoupling::DataArrayInt64::buildExplicitArrOfSliceOnScaledArr; +%newobject MEDCoupling::DataArrayInt64::findRangeIdForEachTuple; +%newobject MEDCoupling::DataArrayInt64::findIdInRangeForEachTuple; +%newobject MEDCoupling::DataArrayInt64::duplicateEachTupleNTimes; +%newobject MEDCoupling::DataArrayInt64::buildPermutationArr; +%newobject MEDCoupling::DataArrayInt64::buildPermArrPerLevel; +%newobject MEDCoupling::DataArrayInt64::getDifferentValues; +%newobject MEDCoupling::DataArrayInt64::FindPermutationFromFirstToSecond; +%newobject MEDCoupling::DataArrayInt64::CheckAndPreparePermutation; +%newobject MEDCoupling::DataArrayInt64::__neg__; +%newobject MEDCoupling::DataArrayInt64::__add__; +%newobject MEDCoupling::DataArrayInt64::__radd__; +%newobject MEDCoupling::DataArrayInt64::__sub__; +%newobject MEDCoupling::DataArrayInt64::__rsub__; +%newobject MEDCoupling::DataArrayInt64::__mul__; +%newobject MEDCoupling::DataArrayInt64::__rmul__; +%newobject MEDCoupling::DataArrayInt64::__div__; +%newobject MEDCoupling::DataArrayInt64::__rdiv__; +%newobject MEDCoupling::DataArrayInt64::__mod__; +%newobject MEDCoupling::DataArrayInt64::__rmod__; +%newobject MEDCoupling::DataArrayInt64::__pow__; +%newobject MEDCoupling::DataArrayInt64::__rpow__; +%newobject MEDCoupling::DataArrayInt64Tuple::buildDAInt; %newobject MEDCoupling::DataArrayChar::convertToIntArr; %newobject MEDCoupling::DataArrayChar::renumber; %newobject MEDCoupling::DataArrayChar::renumberR; @@ -238,7 +315,8 @@ %feature("unref") DataArray "$this->decrRef();" %feature("unref") DataArrayDouble "$this->decrRef();" -%feature("unref") DataArrayInt "$this->decrRef();" +%feature("unref") DataArrayInt32 "$this->decrRef();" +%feature("unref") DataArrayInt64 "$this->decrRef();" %feature("unref") DataArrayChar "$this->decrRef();" %feature("unref") DataArrayAsciiChar "$this->decrRef();" %feature("unref") DataArrayByte "$this->decrRef();" @@ -257,7 +335,8 @@ namespace MEDCoupling AX_SPHER = 5 } MEDCouplingAxisType; - class DataArrayInt; + class DataArrayInt32; + class DataArrayInt64; class MapII : public RefCountObject, public TimeLabel { @@ -269,8 +348,8 @@ namespace MEDCoupling { public: static PartDefinition *New(int start, int stop, int step); - static PartDefinition *New(DataArrayInt *listOfIds); - virtual DataArrayInt *toDAI() const; + static PartDefinition *New(DataArrayIdType *listOfIds); + virtual DataArrayIdType *toDAI() const; virtual int getNumberOfElems() const; virtual std::string getRepr() const; virtual PartDefinition *composeWith(const PartDefinition *other) const; @@ -307,10 +386,10 @@ namespace MEDCoupling class DataArrayPartDefinition : public PartDefinition { public: - static DataArrayPartDefinition *New(DataArrayInt *listOfIds); + static DataArrayPartDefinition *New(DataArrayIdType *listOfIds); %extend { - DataArrayPartDefinition(DataArrayInt *listOfIds) + DataArrayPartDefinition(DataArrayIdType *listOfIds) { return DataArrayPartDefinition::New(listOfIds); } @@ -338,14 +417,14 @@ namespace MEDCoupling int getEffectiveStop() const; %extend { - SlicePartDefinition(int start, int stop, int step) + SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step) { return SlicePartDefinition::New(start,stop,step); } PyObject *getSlice() const { - int a,b,c; + mcIdType a,b,c; self->getSlice(a,b,c); return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c)); } @@ -371,8 +450,8 @@ namespace MEDCoupling public: void setName(const std::string& name); void copyStringInfoFrom(const DataArray& other); - void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); - void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other); + void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); + void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other); bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const; bool areInfoEquals(const DataArray& other) const; std::string cppRepr(const std::string& varName) const; @@ -419,22 +498,22 @@ namespace MEDCoupling PyObject *getInfoOnComponents() const { const std::vector& comps=self->getInfoOnComponents(); - PyObject *ret=PyList_New((int)comps.size()); - for(int i=0;i<(int)comps.size();i++) + PyObject *ret=PyList_New((mcIdType)comps.size()); + for(std::size_t i=0;i tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); self->copyPartOfStringInfoFrom(other,tmp); } void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); self->copyPartOfStringInfoFrom2(tmp,other); } @@ -442,11 +521,11 @@ namespace MEDCoupling virtual void renumberInPlace(PyObject *li) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType 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 !"); @@ -455,11 +534,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -471,11 +550,11 @@ namespace MEDCoupling virtual void renumberInPlaceR(PyObject *li) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType 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 !"); @@ -484,11 +563,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -498,22 +577,22 @@ namespace MEDCoupling } //tuplesSelec in PyObject * because DataArrayInt is not already existing ! - virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) + virtual void setContigPartOfSelectedValues(mcIdType tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) { static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt"; DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray"); DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg); - DataArrayInt *tuplesSelecPtr2=0; + DataArrayIdType *tuplesSelecPtr2=0; if(tuplesSelecPtr) { - tuplesSelecPtr2=dynamic_cast(tuplesSelecPtr); + tuplesSelecPtr2=dynamic_cast(tuplesSelecPtr); if(!tuplesSelecPtr2) throw INTERP_KERNEL::Exception(msg); } self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2); } - virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) + virtual void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, PyObject *aBase, mcIdType bg, mcIdType end2, mcIdType step) { DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray"); self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step); @@ -521,7 +600,7 @@ namespace MEDCoupling virtual DataArray *selectByTupleRanges(PyObject *li) const { - std::vector > ranges; + std::vector > ranges; convertPyToVectorPairInt(li,ranges); return self->selectByTupleRanges(ranges); } @@ -529,16 +608,16 @@ namespace MEDCoupling virtual DataArray *selectByTupleId(PyObject *li) const { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); return self->selectByTupleId(tmp,tmp+size); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); @@ -549,16 +628,16 @@ namespace MEDCoupling virtual DataArray *selectByTupleIdSafe(PyObject *li) const { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); return self->selectByTupleIdSafe(tmp,tmp+size); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); @@ -568,35 +647,35 @@ namespace MEDCoupling virtual PyObject *keepSelectedComponents(PyObject *li) const { - std::vector tmp; + 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) + static PyObject *GetSlice(PyObject *slic, mcIdType sliceId, mcIdType nbOfSlices) { 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; GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !"); - int a,b; + mcIdType 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 + PyObject *getSlice(PyObject *slic, mcIdType sliceId, mcIdType nbOfSlices) const { 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; GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !"); - int a,b; + mcIdType 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) + static mcIdType GetNumberOfItemGivenBES(PyObject *slic) { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !"); @@ -605,7 +684,7 @@ namespace MEDCoupling return DataArray::GetNumberOfItemGivenBES(strt,stp,step,""); } - static int GetNumberOfItemGivenBESRelative(PyObject *slic) + static mcIdType GetNumberOfItemGivenBESRelative(PyObject *slic) { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !"); @@ -621,7 +700,7 @@ namespace MEDCoupling return DataArray::Aggregate(tmp); } - int getNumberOfItemGivenBES(PyObject *slic) const + mcIdType getNumberOfItemGivenBES(PyObject *slic) const { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !"); @@ -630,7 +709,7 @@ namespace MEDCoupling return DataArray::GetNumberOfItemGivenBES(strt,stp,step,""); } - int getNumberOfItemGivenBESRelative(PyObject *slic) + mcIdType getNumberOfItemGivenBESRelative(PyObject *slic) { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !"); @@ -646,9 +725,9 @@ namespace MEDCoupling const std::vector &a1(self->getInfoOnComponents()); PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str())); // - int sz(a1.size()); + mcIdType sz(a1.size()); PyObject *ret1(PyList_New(sz)); - for(int i=0;ireprNotTooLong(); } - int __len__() const + mcIdType __len__() const { if(self->isAllocated()) { @@ -744,7 +823,7 @@ namespace MEDCoupling PyObject *getValuesAsTuple() const { const float *vals(self->begin()); - int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples()); + mcIdType nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples()); return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); } @@ -830,8 +909,8 @@ namespace MEDCoupling class DataArrayFloatTuple { public: - int getNumberOfCompo() const; - DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const; + std::size_t getNumberOfCompo() const; + DataArrayFloat *buildDAFloat(mcIdType nbOfTuples, mcIdType nbOfCompo) const; %extend { std::string __str__() const @@ -864,7 +943,6 @@ namespace MEDCoupling } }; - class DataArrayInt; class DataArrayDoubleIterator; class DataArrayDouble : public DataArray @@ -902,11 +980,11 @@ namespace MEDCoupling void meldWith(const DataArrayDouble *other); DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const; DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const; - DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const; - DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const; + DataArrayIdType *findClosestTupleId(const DataArrayDouble *other) const; + DataArrayIdType *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const; void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp); - void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec); + void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayIdType *tuplesSelec); double getIJ(int tupleId, int compoId) const; double front() const; double back() const; @@ -962,9 +1040,9 @@ namespace MEDCoupling DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe=true) const; void applyFuncFast32(const std::string& func); void applyFuncFast64(const std::string& func); - DataArrayInt *findIdsInRange(double vmin, double vmax) const; - DataArrayInt *findIdsNotInRange(double vmin, double vmax) const; - DataArrayInt *findIdsStrictlyNegative() const; + DataArrayIdType *findIdsInRange(double vmin, double vmax) const; + DataArrayIdType *findIdsNotInRange(double vmin, double vmax) const; + DataArrayIdType *findIdsStrictlyNegative() const; static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2); static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2); static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2); @@ -981,11 +1059,11 @@ namespace MEDCoupling void divideEqual(const DataArrayDouble *other); static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2); void powEqual(const DataArrayDouble *other); - MCAuto findIdsGreaterOrEqualTo(double val) const; - MCAuto findIdsGreaterThan(double val) const; - MCAuto findIdsLowerOrEqualTo(double val) const; - MCAuto findIdsLowerThan(double val) const; - MCAuto convertToIntArr() const; + MCAuto findIdsGreaterOrEqualTo(double val) const; + MCAuto findIdsGreaterThan(double val) const; + MCAuto findIdsLowerOrEqualTo(double val) const; + MCAuto findIdsLowerThan(double val) const; + MCAuto convertToIntArr() const; MCAuto selectPartDef(const PartDefinition* pd) const; MCAuto cumSum() const; MCAuto convertToFloatArr() const; @@ -1010,7 +1088,7 @@ namespace MEDCoupling { double val; std::vector bb; - int sw,nbTuples=-1; + mcIdType sw; mcIdType nbTuples=-1; const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : "; const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples); self->pushBackValsSilent(tmp,tmp+nbTuples); @@ -1075,14 +1153,14 @@ namespace MEDCoupling { if(PyInt_Check(nbOfTuples)) { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !"); if(nbOfComp && nbOfComp != Py_None) { if(PyInt_Check(nbOfComp)) {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); + mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !"); std::vector tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo); @@ -1093,7 +1171,7 @@ namespace MEDCoupling } else {//DataArrayDouble.setValues([1.,3.,4.],3) - int tmpp1=-1; + mcIdType tmpp1=-1; std::vector tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1); self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer()); } @@ -1103,7 +1181,7 @@ namespace MEDCoupling } else {// DataArrayDouble.setValues([1.,3.,4.]) - int tmpp1=-1,tmpp2=-1; + mcIdType tmpp1=-1,tmpp2=-1; std::vector tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2); self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer()); } @@ -1140,7 +1218,7 @@ namespace MEDCoupling PyObject *getValuesAsTuple() const { const double *vals(self->begin()); - int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples()); + mcIdType nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples()); return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); } @@ -1151,7 +1229,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const double *seg2Ptr(convertObjToPossibleCpp5_Safe(seg2,sw,val,a,aa,bb,msg,2,2,true)); const double *tri3Ptr(convertObjToPossibleCpp5_Safe(tri3,sw,val2,a2,aa2,bb2,msg,3,2,true)); // @@ -1173,7 +1251,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true)); const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true)); MCAuto ret(self->symmetry3DPlane(centerPtr,vectorPtr)); @@ -1183,11 +1261,11 @@ namespace MEDCoupling static PyObject *GiveBaseForPlane(PyObject *normalVector) { const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : "; - double val,val2; - DataArrayDouble *a,*a2; - DataArrayDoubleTuple *aa,*aa2; + double val; + DataArrayDouble *a; + DataArrayDoubleTuple *aa; std::vector bb,bb2; - int sw; + mcIdType sw; const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true)); double res[9]; DataArrayDouble::GiveBaseForPlane(vectorPtr,res); @@ -1201,7 +1279,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true); const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true); return self->fromCartToCylGiven(coords,centerPtr,vectorPtr); @@ -1210,11 +1288,11 @@ namespace MEDCoupling DataArrayDouble *renumber(PyObject *li) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType 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 !"); @@ -1223,11 +1301,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1239,11 +1317,11 @@ namespace MEDCoupling DataArrayDouble *renumberR(PyObject *li) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType 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 !"); @@ -1252,11 +1330,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1265,14 +1343,14 @@ namespace MEDCoupling } } - DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) + DataArrayDouble *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType 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 !"); @@ -1281,11 +1359,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1296,7 +1374,7 @@ namespace MEDCoupling PyObject *minimalDistanceTo(const DataArrayDouble *other) const { - int thisTupleId,otherTupleId; + mcIdType thisTupleId,otherTupleId; double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0)); @@ -1307,7 +1385,7 @@ namespace MEDCoupling PyObject *getMaxValue() const { - int tmp; + mcIdType tmp; double r1=self->getMaxValue(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1)); @@ -1327,17 +1405,17 @@ namespace MEDCoupling PyObject *getMaxValue2() const { - DataArrayInt *tmp; + DataArrayIdType *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_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getMinValue() const { - int tmp; + mcIdType tmp; double r1=self->getMinValue(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1)); @@ -1347,17 +1425,17 @@ namespace MEDCoupling PyObject *getMinValue2() const { - DataArrayInt *tmp; + DataArrayIdType *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_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getMinMaxPerComponent() const { - int nbOfCompo(self->getNumberOfComponents()); + std::size_t nbOfCompo(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp(new double[2*nbOfCompo]); self->getMinMaxPerComponent(tmp); PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo); @@ -1366,7 +1444,7 @@ namespace MEDCoupling PyObject *normMaxPerComponent() const { - int nbOfCompo(self->getNumberOfComponents()); + std::size_t nbOfCompo(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp(new double[nbOfCompo]); self->normMaxPerComponent(tmp); return convertDblArrToPyList(tmp,nbOfCompo); @@ -1374,7 +1452,7 @@ namespace MEDCoupling PyObject *accumulate() const { - int sz=self->getNumberOfComponents(); + std::size_t sz=self->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->accumulate(tmp); return convertDblArrToPyList(tmp,sz); @@ -1382,19 +1460,19 @@ namespace MEDCoupling DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const { - int sw,sz,val; - std::vector val2; - const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2); + mcIdType sw, sz,val; + std::vector val2; + const mcIdType *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2); return self->accumulatePerChunck(bg,bg+sz); } - PyObject *findCommonTuples(double prec, int limitNodeId=-1) const + PyObject *findCommonTuples(double prec, mcIdType limitNodeId=-1) const { - DataArrayInt *comm, *commIndex; + DataArrayIdType *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_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return res; } @@ -1404,8 +1482,8 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; - int tupleId=-1,nbOfCompo=self->getNumberOfComponents(); + mcIdType sw; + mcIdType tupleId=-1,nbOfCompo=self->getNumberOfComponents(); const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true); // double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId); @@ -1417,7 +1495,7 @@ namespace MEDCoupling void setSelectedComponents(const DataArrayDouble *a, PyObject *li) { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); self->setSelectedComponents(a,tmp); } @@ -1432,9 +1510,9 @@ namespace MEDCoupling return res; } - PyObject *getTuple(int tupleId) + PyObject *getTuple(mcIdType tupleId) { - int sz=self->getNumberOfComponents(); + std::size_t sz=self->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->getTuple(tupleId,tmp); return convertDblArrToPyList(tmp,sz); @@ -1460,28 +1538,28 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; - int nbComp=self->getNumberOfComponents(),nbTuples=-1; + mcIdType sw; + mcIdType 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); MCAuto inpu=DataArrayDouble::New(); inpu->useArray(pos,false,DeallocType::CPP_DEALLOC,nbTuples,nbComp); - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; self->computeTupleIdsNearTuples(inpu,eps,c,cI); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const { - DataArrayInt *ret1=0; + DataArrayIdType *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_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -1507,7 +1585,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; // #ifndef WITHOUT_AUTOFIELD void *argp; @@ -1546,7 +1624,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1561,7 +1639,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1578,7 +1656,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Add(self,aaa); } default: @@ -1598,7 +1676,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; // #ifndef WITHOUT_AUTOFIELD void *argp; @@ -1637,7 +1715,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1652,7 +1730,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1669,7 +1747,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Substract(aaa,self); } default: @@ -1689,7 +1767,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; // #ifndef WITHOUT_AUTOFIELD void *argp; @@ -1728,7 +1806,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1753,7 +1831,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; // #ifndef WITHOUT_AUTOFIELD void *argp; @@ -1794,7 +1872,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1809,7 +1887,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1826,7 +1904,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Divide(aaa,self); } default: @@ -1846,7 +1924,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1867,7 +1945,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Pow(self,aaa); } default: @@ -1882,7 +1960,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1899,7 +1977,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Pow(aaa,self); } default: @@ -1914,7 +1992,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1939,7 +2017,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->powEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -1951,22 +2029,22 @@ namespace MEDCoupling PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps) { - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; // self->computeTupleIdsNearTuples(other,eps,c,cI); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *maxPerTupleWithCompoId() const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } } @@ -1998,7 +2076,7 @@ namespace MEDCoupling class DataArrayDoubleTuple { public: - int getNumberOfCompo() const; + std::size_t getNumberOfCompo() const; DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const; %extend { @@ -2057,13 +2135,13 @@ namespace MEDCoupling PyObject *__getitem__(PyObject *obj) { const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; const double *pt=self->getConstPointer(); - int nbc=self->getNumberOfCompo(); + mcIdType nbc=self->getNumberOfCompo(); convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2093,9 +2171,9 @@ namespace MEDCoupling case 2: { PyObject *t=PyTuple_New(multiVal.size()); - for(int j=0;j<(int)multiVal.size();j++) + for(std::size_t j=0;j=nbc) { std::ostringstream oss; @@ -2108,9 +2186,9 @@ namespace MEDCoupling } case 3: { - int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); + mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); PyObject *t=PyTuple_New(sz); - for(int j=0;j multiValV; MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0; - int nbc=self->getNumberOfCompo(); + mcIdType nbc=self->getNumberOfCompo(); convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV); - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; double *pt=self->getPointer(); convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp); switch(sw2) @@ -2178,7 +2256,7 @@ namespace MEDCoupling { case 1: { - for(std::vector::const_iterator it=multiVal.begin();it!=multiVal.end();it++) + for(std::vector::const_iterator it=multiVal.begin();it!=multiVal.end();it++) { if(*it>=nbc) { @@ -2198,9 +2276,9 @@ namespace MEDCoupling 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++) + for(std::size_t i=0;i=nbc) { std::ostringstream oss; @@ -2214,7 +2292,7 @@ namespace MEDCoupling case 3: { const double *ptV=daIntTyyppV->getConstPointer(); - if(nbc>daIntTyyppV->getNumberOfCompo()) + if(nbc>(mcIdType)daIntTyyppV->getNumberOfCompo()) { std::ostringstream oss; oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; @@ -2229,37 +2307,37 @@ namespace MEDCoupling } case 3: { - int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); + mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); switch(sw1) { case 1: { - for(int j=0;jgetConstPointer(); - if(sz>daIntTyyppV->getNumberOfCompo()) + if(sz>(mcIdType)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 invertArrayN2O2O2NOptimized() const; - MCAuto< MapII > giveN2OOptimized() const; - DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const; - DataArrayInt *fromNoInterlace() const; - DataArrayInt *toNoInterlace() const; - DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const; - DataArrayInt *checkAndPreparePermutation() const; - DataArrayInt *buildPermArrPerLevel() const; - bool isIota(int sizeExpected) const; - bool isUniform(int val) const; - int checkUniformAndGuess() const; - bool hasUniqueValues() const; - DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const; - void transpose(); - DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const; - void meldWith(const DataArrayInt *other); - void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp); - void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec); - void getTuple(int tupleId, int *res) const; - int getIJ(int tupleId, int compoId) const; - int getIJSafe(int tupleId, int compoId) const; - int front() const; - int back() const; - void setIJ(int tupleId, int compoId, int newVal); - void setIJSilent(int tupleId, int compoId, int newVal); - int *getPointer(); - const int *getConstPointer() const; - DataArrayIntIterator *iterator(); - const int *begin() const; - const int *end() const; - DataArrayInt *findIdsEqual(int val) const; - DataArrayInt *findIdsNotEqual(int val) const; - int changeValue(int oldValue, int newValue); - int findIdFirstEqualTuple(const std::vector& tupl) const; - int findIdFirstEqual(int value) const; - int findIdFirstEqual(const std::vector& vals) const; - int findIdSequence(const std::vector& vals) const; - bool presenceOfTuple(const std::vector& tupl) const; - bool presenceOfValue(int value) const; - bool presenceOfValue(const std::vector& vals) const; - int count(int value) const; - int accumulate(int compId) const; - int getMaxValueInArray() const; - int getMaxAbsValueInArray() const; - int getMinValueInArray() const; - void abs(); - DataArrayInt *computeAbs() const; - void applyLin(int a, int b, int compoId); - void applyLin(int a, int b); - void applyInv(int numerator); - DataArrayInt *negate() const; - void applyDivideBy(int val); - void applyModulus(int val); - void applyRModulus(int val); - void applyPow(int val); - void applyRPow(int val); - DataArrayInt *findIdsInRange(int vmin, int vmax) const; - DataArrayInt *findIdsNotInRange(int vmin, int vmax) const; - DataArrayInt *findIdsStrictlyNegative() const; - bool checkAllIdsInRange(int vmin, int vmax) const; - static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2); - static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2); - static DataArrayInt *MakePartition(const std::vector& groups, int newNb, std::vector< std::vector >& fidsOfGroups); - static DataArrayInt *BuildUnion(const std::vector& arr); - static DataArrayInt *BuildIntersection(const std::vector& arr); - static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2); - DataArrayInt *buildComplement(int nbOfElement) const; - DataArrayInt *buildSubstraction(const DataArrayInt *other) const; - DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const; - DataArrayInt *buildUnion(const DataArrayInt *other) const; - DataArrayInt *buildIntersection(const DataArrayInt *other) const; - DataArrayInt *buildUnique() const; - DataArrayInt *buildUniqueNotSorted() const; - DataArrayInt *deltaShiftIndex() const; - void computeOffsets(); - void computeOffsetsFull(); - DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const; - DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const; - DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const; - void sortEachPairToMakeALinkedList(); - DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const; - DataArrayInt *getDifferentValues() const; - static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2); - void addEqual(const DataArrayInt *other); - static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2); - void substractEqual(const DataArrayInt *other); - static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2); - void multiplyEqual(const DataArrayInt *other); - static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2); - void divideEqual(const DataArrayInt *other); - static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2); - void modulusEqual(const DataArrayInt *other); - static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2); - void powEqual(const DataArrayInt *other); - MCAuto fromLinkedListOfPairToList() const; - MCAuto findIdsGreaterOrEqualTo(int val) const; - MCAuto findIdsGreaterThan(int val) const; - MCAuto findIdsLowerOrEqualTo(int val) const; - MCAuto findIdsLowerThan(int val) const; - MCAuto selectPartDef(const PartDefinition* pd) const; - MCAuto convertToDblArr() const; - MCAuto convertToFloatArr() const; + DataArrayIdType *convertToIntArr() const; + DataArrayChar *renumber(const mcIdType *old2New) const; + DataArrayChar *renumberR(const mcIdType *new2Old) const; + DataArrayChar *renumberAndReduce(const mcIdType *old2NewBg, mcIdType newNbOfTuple) const; + bool isUniform(char val) const; + void sort(bool asc=true); + DataArrayChar *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const; + DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const; + void meldWith(const DataArrayChar *other); + void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayIdType *tuplesSelec); + char front() const; + char back() const; + void setIJ(mcIdType tupleId, int compoId, char newVal); + void setIJSilent(mcIdType tupleId, int compoId, char newVal); + char *getPointer(); + DataArrayIdType *findIdsEqual(char val) const; + DataArrayIdType *findIdsNotEqual(char val) const; + int findIdFirstEqualTuple(const std::vector& tupl) const; + bool presenceOfTuple(const std::vector& tupl) const; + char getMaxValue(mcIdType& tupleId) const; + char getMaxValueInArray() const; + char getMinValue(mcIdType& tupleId) const; + char getMinValueInArray() const; + DataArrayIdType *findIdsInRange(char vmin, char vmax) const; + static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2); + static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2); + %extend + { + mcIdType __len__() const + { + if(self->isAllocated()) + { + return self->getNumberOfTuples(); + } + else + { + throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !"); + } + } + + PyObject *isEqualIfNotWhy(const DataArrayChar& other) const + { + 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; + } + + DataArrayChar *renumber(PyObject *li) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType 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 !"); + } + return self->renumber(tmp); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); + da2->checkAllocated(); + mcIdType 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()); + } + } + + DataArrayChar *renumberR(PyObject *li) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType 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 !"); + } + return self->renumberR(tmp); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); + da2->checkAllocated(); + mcIdType 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()); + } + } + + DataArrayChar *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType 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 !"); + } + return self->renumberAndReduce(tmp,newNbOfTuple); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); + da2->checkAllocated(); + mcIdType 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); + } + } + + static DataArrayChar *Aggregate(PyObject *dachs) + { + std::vector tmp; + convertFromPyObjVectorOfObj(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp); + return DataArrayChar::Aggregate(tmp); + } + + static DataArrayChar *Meld(PyObject *dachs) + { + std::vector tmp; + convertFromPyObjVectorOfObj(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp); + return DataArrayChar::Meld(tmp); + } + } + }; + + class DataArrayByteIterator; + + class DataArrayByte : public DataArrayChar + { public: - static DataArrayInt *Range(int begin, int end, int step); + static DataArrayByte *New(); + DataArrayByteIterator *iterator(); + DataArrayByte *performCopyOrIncrRef(bool deepCopy) const; + char byteValue() const; %extend { - DataArrayInt() + DataArrayByte() { - return DataArrayInt::New(); + return DataArrayByte::New(); } - static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) { - const char *msgBase="MEDCoupling::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)"; - std::string msg(msgBase); -#ifdef WITH_NUMPY - msg+="\n-DataArrayInt.New(numpy array with dtype=int32)"; -#endif - msg+=" !"; + const char *msg="MEDCoupling::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !"; if(PyList_Check(elt0) || PyTuple_Check(elt0)) { if(nbOfTuples) { if(PyInt_Check(nbOfTuples)) { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples); if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !"); + throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !"); if(nbOfComp) { if(PyInt_Check(nbOfComp)) - {//DataArrayInt.New([1,3,4,5],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); + {//DataArrayByte.New([1,3,4,5],2,2) + mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp); if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !"); - MCAuto ret=DataArrayInt::New(); - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); + throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); + MCAuto ret=DataArrayByte::New(); + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } else - throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg); } else - {//DataArrayInt.New([1,3,4],3) - MCAuto ret=DataArrayInt::New(); - int tmpp1=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); + {//DataArrayByte.New([1,3,4],3) + MCAuto ret=DataArrayByte::New(); + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } } else - throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg); } else - {// DataArrayInt.New([1,3,4]) - MCAuto ret=DataArrayInt::New(); - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); + {// DataArrayByte.New([1,3,4]) + MCAuto ret=DataArrayByte::New(); + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } } else if(PyInt_Check(elt0)) { - int nbOfTuples1=PyInt_AS_LONG(elt0); + mcIdType nbOfTuples1=PyInt_AS_LONG(elt0); if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !"); + throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !"); if(nbOfTuples) { if(!nbOfComp) { if(PyInt_Check(nbOfTuples)) - {//DataArrayInt.New(5,2) - int nbOfCompo=PyInt_AS_LONG(nbOfTuples); + {//DataArrayByte.New(5,2) + mcIdType nbOfCompo=PyInt_AS_LONG(nbOfTuples); if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !"); - MCAuto ret=DataArrayInt::New(); + throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); + MCAuto ret=DataArrayByte::New(); ret->alloc(nbOfTuples1,nbOfCompo); return ret.retn(); } else - throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg); } else - throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg); } else - {//DataArrayInt.New(5) - MCAuto ret=DataArrayInt::New(); + {//DataArrayByte.New(5) + MCAuto ret=DataArrayByte::New(); ret->alloc(nbOfTuples1,1); return ret.retn(); } } #ifdef WITH_NUMPY else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL) - {//DataArrayInt.New(numpyArray) - return BuildNewInstance(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32"); + {//DataArrayDouble.New(numpyArray) + return BuildNewInstance(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8"); } #endif else - throw INTERP_KERNEL::Exception(msg.c_str()); - throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy + throw INTERP_KERNEL::Exception(msg); } - DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) { - return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp); + return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp); } - - std::string __str__() const + + std::string __repr__() const { - return self->reprNotTooLong(); + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); } - - int __len__() const + + int __int__() const { - if(self->isAllocated()) - { - return self->getNumberOfTuples(); - } - else - { - throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !"); - } + return (int) self->byteValue(); } - int __int__() const + DataArrayByteIterator *__iter__() { - return self->intValue(); + return self->iterator(); } - DataArrayIntIterator *__iter__() + mcIdType getIJ(mcIdType tupleId, mcIdType compoId) const { - return self->iterator(); + return (mcIdType)self->getIJ(tupleId,compoId); } - - PyObject *accumulate() const + + mcIdType getIJSafe(mcIdType tupleId, mcIdType compoId) const { - int sz=self->getNumberOfComponents(); - INTERP_KERNEL::AutoPtr tmp=new int[sz]; - self->accumulate(tmp); - return convertIntArrToPyList(tmp,sz); + return (mcIdType)self->getIJSafe(tupleId,compoId); } - DataArrayInt *accumulatePerChunck(PyObject *indexArr) const + std::string __str__() const { - int sw,sz,val; - std::vector val2; - const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2); - return self->accumulatePerChunck(bg,bg+sz); + return self->repr(); + } + + PyObject *toStrList() const + { + const char *vals=self->getConstPointer(); + mcIdType nbOfComp=self->getNumberOfComponents(); + mcIdType nbOfTuples=self->getNumberOfTuples(); + return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); + } + + bool presenceOfTuple(PyObject *tupl) const + { + mcIdType sz=-1,sw=-1; + mcIdType ival=-1; std::vector ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval); + std::vector vals(sz); + std::copy(pt,pt+sz,vals.begin()); + return self->presenceOfTuple(vals); } - DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const + bool presenceOfValue(PyObject *vals) const { - int sw,sz,val; - std::vector val2; - const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2)); - return self->findIdsEqualTuple(bg,bg+sz); + mcIdType sz=-1,sw=-1; + mcIdType ival=-1; std::vector ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval); + std::vector vals2(sz); + std::copy(pt,pt+sz,vals2.begin()); + return self->presenceOfValue(vals2); } - DataArrayInt *findIdForEach(PyObject *vals) const + mcIdType findIdFirstEqual(PyObject *vals) const { - int sw,sz,val; - std::vector val2; - const int *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2)); - MCAuto ret(self->findIdForEach(bg,bg+sz)); - return ret.retn(); + mcIdType sz=-1,sw=-1; + mcIdType ival=-1; std::vector ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval); + std::vector vals2(sz); + std::copy(pt,pt+sz,vals2.begin()); + return self->findIdFirstEqual(vals2); } - PyObject *splitInBalancedSlices(int nbOfSlices) const + mcIdType findIdFirstEqualTuple(PyObject *tupl) const { - std::vector< std::pair > slcs(self->splitInBalancedSlices(nbOfSlices)); - PyObject *ret=PyList_New(slcs.size()); - for(std::size_t i=0;i ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval); + std::vector vals(sz); + std::copy(pt,pt+sz,vals.begin()); + return self->findIdFirstEqualTuple(vals); } - DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const + mcIdType findIdSequence(PyObject *strOrListOfInt) const { - if(!PySlice_Check(slic)) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !"); - Py_ssize_t strt=2,stp=2,step=2; - GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !"); - if(strt==std::numeric_limits::max() || stp==std::numeric_limits::max()) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !"); - return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step); + mcIdType sz=-1,sw=-1; + mcIdType ival=-1; std::vector ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval); + std::vector vals(sz); + std::copy(pt,pt+sz,vals.begin()); + return self->findIdSequence(vals); } - PyObject *getMinMaxValues() const + PyObject *getTuple(mcIdType tupleId) { - int a,b; - self->getMinMaxValues(a,b); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,PyInt_FromLong(a)); - PyTuple_SetItem(ret,1,PyInt_FromLong(b)); + mcIdType sz=self->getNumberOfComponents(); + INTERP_KERNEL::AutoPtr tmp=new char[sz]; + self->getTuple(tupleId,tmp); + PyObject *ret=PyTuple_New(sz); + for(mcIdType i=0;i stdvecTyyppArr,stdvecTyyppArrI; - const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr); - const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI); - DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples); + + PyObject *getMaxValue() const + { + mcIdType tmp; + mcIdType r1=(mcIdType)self->getMaxValue(tmp); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); - PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples)); + PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); + PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); return ret; } - static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) + PyObject *getMinValue() const { - MCAuto ret(DataArrayInt::New()); - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr)); - int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr)); - ret->useArray(pt,true,MEDCoupling::DeallocType::C_DEALLOC,szArr,1); - return ret.retn(); - } - - void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) - { - const char *msg="MEDCoupling::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !"; - if(PyList_Check(li) || PyTuple_Check(li)) - { - if(nbOfTuples && nbOfTuples != Py_None) - { - if(PyInt_Check(nbOfTuples)) - { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); - if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !"); - if(nbOfComp && nbOfComp != Py_None) - { - if(PyInt_Check(nbOfComp)) - {//DataArrayInt.setValues([1,3,4,5],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); - if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !"); - std::vector tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo); - self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer()); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {//DataArrayInt.setValues([1,3,4],3) - int tmpp1=-1; - std::vector tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1); - self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer()); - } - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {// DataArrayInt.setValues([1,3,4]) - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2); - self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer()); - } - } - else - throw INTERP_KERNEL::Exception(msg); - } - - PyObject *getValues() const - { - const int *vals=self->getConstPointer(); - return convertIntArrToPyList(vals,self->getNbOfElems()); - } - -#ifdef WITH_NUMPY - PyObject *toNumPyArray() // not const. It is not a bug ! - { - return ToNumPyArray(self,NPY_INT32,"DataArrayInt"); - } -#endif - - PyObject *isEqualIfNotWhy(const DataArrayInt& other) const - { - std::string ret1; - bool ret0=self->isEqualIfNotWhy(other,ret1); - PyObject *ret=PyTuple_New(2); - PyObject *ret0Py=ret0?Py_True:Py_False; - Py_XINCREF(ret0Py); - PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); - return ret; - } - - PyObject *getValuesAsTuple() const - { - const int *vals=self->getConstPointer(); - int nbOfComp=self->getNumberOfComponents(); - int nbOfTuples=self->getNumberOfTuples(); - return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); - } - - static PyObject *MakePartition(PyObject *gps, int newNb) - { - std::vector groups; - std::vector< std::vector > fidsOfGroups; - convertFromPyObjVectorOfObj(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups); - MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups); - PyObject *ret = PyList_New(2); - PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - int sz=fidsOfGroups.size(); - PyObject *ret1 = PyList_New(sz); - for(int i=0;i(da); - self->transformWithIndArr(*m); - } - else - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - self->transformWithIndArr(tmp,tmp+size); - } - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); - } - } - - DataArrayInt *findIdsEqualList(PyObject *obj) - { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - return self->findIdsEqualList(&singleVal,&singleVal+1); - case 2: - return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); - case 4: - return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end()); - default: - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - } - - DataArrayInt *findIdsNotEqualList(PyObject *obj) - { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - return self->findIdsNotEqualList(&singleVal,&singleVal+1); - case 2: - return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); - case 4: - return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end()); - default: - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - } - - PyObject *splitByValueRange(PyObject *li) const - { - DataArrayInt *ret0=0,*ret1=0,*ret2=0; - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2); - } - PyObject *ret = PyList_New(3); - PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - DataArrayInt *transformWithIndArrR(PyObject *li) const - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - return self->transformWithIndArrR(tmp,tmp+size); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); - } - } - - DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !"); - } - 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) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !"); - } - 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) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !"); - } - return self->renumberR(tmp); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - int size=self->getNumberOfTuples(); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberR(da2->getConstPointer()); - } - } - - void setSelectedComponents(const DataArrayInt *a, PyObject *li) - { - std::vector tmp; - convertPyToNewIntArr3(li,tmp); - self->setSelectedComponents(a,tmp); - } - - PyObject *explodeComponents() const - { - std::vector< MCAuto > retCpp(self->explodeComponents()); - std::size_t sz(retCpp.size()); - PyObject *res(PyList_New(sz)); - for(std::size_t i=0;igetNumberOfComponents(); - INTERP_KERNEL::AutoPtr tmp=new int[sz]; - self->getTuple(tupleId,tmp); - return convertIntArrToPyList(tmp,sz); - } - - PyObject *changeSurjectiveFormat(int targetNb) const - { - DataArrayInt *arr=0; - DataArrayInt *arrI=0; - self->changeSurjectiveFormat(targetNb,arr,arrI); - PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); - PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); - return res; - } - - static DataArrayInt *Meld(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::Meld(tmp); - } - - static DataArrayInt *Aggregate(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::Aggregate(tmp); - } - - static DataArrayInt *AggregateIndexes(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::AggregateIndexes(tmp); - } - - static DataArrayInt *BuildUnion(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::BuildUnion(tmp); - } - - static DataArrayInt *BuildIntersection(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::BuildIntersection(tmp); - } - - PyObject *getMaxValue() const - { - 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 *getMaxAbsValue(std::size_t& tupleId) const - { - std::size_t tmp; - int r1=self->getMaxAbsValue(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 - { - 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 - { - int nbOfCompo=self->getNumberOfComponents(); - switch(nbOfCompo) - { - case 1: - { - if(PyInt_Check(obj)) - { - int val=(int)PyInt_AS_LONG(obj); - return self->findIdFirstEqual(val); - } - else - throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !"); - } - default: - { - std::vector arr; - convertPyToNewIntArr3(obj,arr); - return self->findIdFirstEqualTuple(arr); - } - } - } - - bool __contains__(PyObject *obj) const - { - 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 arr; - convertPyToNewIntArr3(obj,arr); - return self->presenceOfTuple(arr); - } - } - } - - PyObject *__getitem__(PyObject *obj) - { - const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !"; - const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; - self->checkAllocated(); - int nbOfTuples=self->getNumberOfTuples(); - int nbOfComponents=self->getNumberOfComponents(); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - DataArrayInt *dt1=0,*dc1=0; - int sw; - convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MCAuto ret; - switch(sw) - { - case 1: - { - if(nbOfComponents==1) - return PyInt_FromLong(self->getIJSafe(it1,0)); - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 2: - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - case 3: - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - case 4: - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - case 5: - return PyInt_FromLong(self->getIJSafe(it1,ic1)); - case 6: - { - ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - std::vector v2(1,ic1); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 7: - { - ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - std::vector v2(1,ic1); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 8: - { - ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - std::vector v2(1,ic1); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 9: - { - ret=self->selectByTupleIdSafe(&it1,&it1+1); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 10: - { - ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 11: - { - ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 12: - { - ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 13: - { - ret=self->selectByTupleIdSafe(&it1,&it1+1); - int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); - std::vector v2(nbOfComp); - for(int i=0;ikeepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 14: - { - ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); - std::vector v2(nbOfComp); - for(int i=0;ikeepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 15: - { - ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); - std::vector v2(nbOfComp); - for(int i=0;ikeepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 16: - { - ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); - std::vector v2(nbOfComp); - for(int i=0;ikeepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__setitem__(PyObject *obj, PyObject *value) - { - self->checkAllocated(); - const char msg[]="Unexpected situation in __setitem__ !"; - int nbOfTuples=self->getNumberOfTuples(); - int nbOfComponents=self->getNumberOfComponents(); - int sw1,sw2; - int i1; - std::vector v1; - DataArrayInt *d1=0; - DataArrayIntTuple *dd1=0; - convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - DataArrayInt *dt1=0,*dc1=0; - convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MCAuto 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,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false); - return self; - case 3: - self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 2: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::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,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false); - return self; - case 3: - self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 4: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::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,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false); - return self; - case 3: - self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 6: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::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,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false); - return self; - case 3: - self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 8: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::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,DeallocType::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,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false); - return self; - case 3: - self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 11: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false); - return self; - case 3: - self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 12: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size()); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::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,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false); - return self; - case 3: - self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 14: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::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,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false); - return self; - case 3: - self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 16: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::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 - { - return self->negate(); - } - - DataArrayInt *__add__(PyObject *obj) - { - const char msg[]="Unexpected situation in __add__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(1,val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Add(self,aaaa); - } - case 3: - { - return DataArrayInt::Add(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Add(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__radd__(PyObject *obj) - { - const char msg[]="Unexpected situation in __radd__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(1,val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Add(self,aaaa); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Add(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __iadd__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyLin(1,val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 2: - { - MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - self->addEqual(bb); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->addEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->addEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__sub__(PyObject *obj) - { - const char msg[]="Unexpected situation in __sub__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(1,-val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Substract(self,aaaa); - } - case 3: - { - return DataArrayInt::Substract(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Substract(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rsub__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rsub__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(-1,val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Substract(aaaa,self); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Substract(aaaa,self); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___isub___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __isub__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyLin(1,-val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 2: - { - MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - self->substractEqual(bb); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->substractEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->substractEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__mul__(PyObject *obj) - { - const char msg[]="Unexpected situation in __mul__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(val,0); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Multiply(self,aaaa); - } - case 3: - { - return DataArrayInt::Multiply(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Multiply(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rmul__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rmul__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(val,0); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Multiply(self,aaaa); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Multiply(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___imul___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __imul__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyLin(val,0); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 2: - { - MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - self->multiplyEqual(bb); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->multiplyEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->multiplyEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__div__(PyObject *obj) - { - const char msg[]="Unexpected situation in __div__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyDivideBy(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Divide(self,aaaa); - } - case 3: - { - return DataArrayInt::Divide(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Divide(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rdiv__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rdiv__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyInv(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Divide(aaaa,self); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Divide(aaaa,self); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __idiv__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyDivideBy(val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 2: - { - MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - self->divideEqual(bb); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->divideEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->divideEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__mod__(PyObject *obj) - { - const char msg[]="Unexpected situation in __mod__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyModulus(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Modulus(self,aaaa); - } - case 3: - { - return DataArrayInt::Modulus(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Modulus(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rmod__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rmod__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyRModulus(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Modulus(aaaa,self); - } - case 3: - { - return DataArrayInt::Modulus(a,self); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Modulus(aaaa,self); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___imod___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __imod__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(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: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->modulusEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__pow__(PyObject *obj) - { - const char msg[]="Unexpected situation in __pow__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyPow(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Pow(self,aaaa); - } - case 3: - { - return DataArrayInt::Pow(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Pow(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rpow__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rpow__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyRPow(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Pow(aaaa,self); - } - case 3: - { - return DataArrayInt::Pow(a,self); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Pow(aaaa,self); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __ipow__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyPow(val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->powEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->powEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - std::string __repr__() const - { - std::ostringstream oss; - self->reprQuickOverview(oss); - return oss.str(); - } - - void pushBackValsSilent(PyObject *li) - { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); - self->pushBackValsSilent(tmp,tmp+szArr); - } - - PyObject *partitionByDifferentValues() const - { - std::vector ret1; - std::vector ret0=self->partitionByDifferentValues(ret1); - std::size_t sz=ret0.size(); - PyObject *pyRet=PyTuple_New(2); - PyObject *pyRet0=PyList_New((int)sz); - PyObject *pyRet1=PyList_New((int)sz); - for(std::size_t i=0;ifindIdsRangesInListOfIds(listOfIds,ret0,ret1); - PyObject *pyRet=PyTuple_New(2); - PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return pyRet; - } - - PyObject *isRange() const - { - int a(0),b(0),c(0); - bool ret(self->isRange(a,b,c)); - PyObject *pyRet=PyTuple_New(2); - PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0); - Py_XINCREF(ret0Py); - PyTuple_SetItem(pyRet,0,ret0Py); - if(ret) - ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c)); - else - { - ret1Py=Py_None; - Py_XINCREF(ret1Py); - } - PyTuple_SetItem(pyRet,1,ret1Py); - return pyRet; - } - - static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception) - { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - if(!arrIndx) - throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : null pointer as arrIndex !"); - convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - return DataArrayInt::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval); - case 2: - return DataArrayInt::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval); - case 4: - return DataArrayInt::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval); - default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - } - - static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) - { - DataArrayInt *arrOut=0,*arrIndexOut=0; - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - if(!arrIndxIn) - throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : null pointer as arrIndxIn !"); - convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - { - DataArrayInt::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut); - break; - } - case 2: - { - DataArrayInt::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut); - break; - } - case 4: - { - DataArrayInt::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut); - break; - } - default: - throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - static PyObject *ExtractFromIndexedArraysSlice(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) - { - DataArrayInt *arrOut=0,*arrIndexOut=0; - DataArrayInt::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) - { - if(!PySlice_Check(slic)) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !"); - Py_ssize_t strt=2,stp=2,step=2; - if(!arrIndxIn) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !"); - arrIndxIn->checkAllocated(); - if(arrIndxIn->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !"); - GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !"); - DataArrayInt *arrOut=0,*arrIndexOut=0; - DataArrayInt::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - static PyObject *SetPartOfIndexedArrays(PyObject *li, - const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception) - { - DataArrayInt *arrOut=0,*arrIndexOut=0; - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - if(!arrIndxIn) - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : null pointer as arrIndex !"); - convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - { - DataArrayInt::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); - break; - } - case 2: - { - DataArrayInt::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); - break; - } - case 4: - { - DataArrayInt::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); - break; - } - default: - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception) - { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - if(!arrIndxIn) - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !"); - convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - { - DataArrayInt::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex); - break; - } - case 2: - { - DataArrayInt::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex); - break; - } - case 4: - { - DataArrayInt::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex); - break; - } - default: - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - } - - } // end extent - }; - - class DataArrayIntTuple; - - class DataArrayIntIterator - { - public: - DataArrayIntIterator(DataArrayInt *da); - ~DataArrayIntIterator(); - %extend - { - PyObject *next() - { - DataArrayIntTuple *ret=self->nextt(); - if(ret) - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0); - else - { - PyErr_SetString(PyExc_StopIteration,"No more data."); - return 0; - } - } - } - }; - - class DataArrayIntTuple - { - public: - int getNumberOfCompo() const; - DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const; - %extend - { - std::string __str__() const - { - return self->repr(); - } - - int __int__() const - { - return self->intValue(); - } - - DataArrayInt *buildDAInt() - { - return self->buildDAInt(1,self->getNumberOfCompo()); - } - - PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____iadd___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - - PyObject *___isub___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____isub___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - - PyObject *___imul___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____imul___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____idiv___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - - PyObject *___imod___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____imod___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - - PyObject *__len__() - { - return PyInt_FromLong(self->getNumberOfCompo()); - } - - PyObject *__getitem__(PyObject *obj) - { - const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - const int *pt=self->getConstPointer(); - int nbc=self->getNumberOfCompo(); - convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - { - if(singleVal>=nbc) - { - std::ostringstream oss; - oss << "Requesting for id " << singleVal << " having only " << nbc << " components !"; - PyErr_SetString(PyExc_StopIteration,oss.str().c_str()); - return 0; - } - if(singleVal>=0) - return 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,msg2); - PyObject *t=PyTuple_New(sz); - for(int j=0;j multiValV; - std::pair > slicV; - MEDCoupling::DataArrayIntTuple *daIntTyyppV=0; - int nbc=self->getNumberOfCompo(); - convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV); - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int *pt=self->getPointer(); - convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(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::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,msg2); - switch(sw1) - { - case 1: - { - for(int j=0;jgetConstPointer(); - 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& tupl) const; - bool presenceOfTuple(const std::vector& tupl) const; - char getMaxValue(int& tupleId) const; - char getMaxValueInArray() const; - char getMinValue(int& tupleId) const; - char getMinValueInArray() const; - DataArrayInt *findIdsInRange(char vmin, char vmax) const; - static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2); - static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2); - %extend - { - int __len__() const - { - if(self->isAllocated()) - { - return self->getNumberOfTuples(); - } - else - { - throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !"); - } - } - - PyObject *isEqualIfNotWhy(const DataArrayChar& other) const - { - 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; - } - - DataArrayChar *renumber(PyObject *li) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !"); - } - 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()); - } - } - - DataArrayChar *renumberR(PyObject *li) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !"); - } - 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()); - } - } - - DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__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 !"); - } - 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); - } - } - - static DataArrayChar *Aggregate(PyObject *dachs) - { - std::vector tmp; - convertFromPyObjVectorOfObj(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp); - return DataArrayChar::Aggregate(tmp); - } - - static DataArrayChar *Meld(PyObject *dachs) - { - std::vector tmp; - convertFromPyObjVectorOfObj(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp); - return DataArrayChar::Meld(tmp); - } - } - }; - - class DataArrayByteIterator; - - class DataArrayByte : public DataArrayChar - { - public: - static DataArrayByte *New(); - DataArrayByteIterator *iterator(); - DataArrayByte *performCopyOrIncrRef(bool deepCopy) const; - char byteValue() const; - %extend - { - DataArrayByte() - { - return DataArrayByte::New(); - } - - static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) - { - const char *msg="MEDCoupling::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !"; - if(PyList_Check(elt0) || PyTuple_Check(elt0)) - { - if(nbOfTuples) - { - if(PyInt_Check(nbOfTuples)) - { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); - if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !"); - if(nbOfComp) - { - if(PyInt_Check(nbOfComp)) - {//DataArrayByte.New([1,3,4,5],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); - if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); - MCAuto ret=DataArrayByte::New(); - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); - ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return ret.retn(); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {//DataArrayByte.New([1,3,4],3) - MCAuto ret=DataArrayByte::New(); - int tmpp1=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); - ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return ret.retn(); - } - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {// DataArrayByte.New([1,3,4]) - MCAuto ret=DataArrayByte::New(); - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); - ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return ret.retn(); - } - } - else if(PyInt_Check(elt0)) - { - int nbOfTuples1=PyInt_AS_LONG(elt0); - if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !"); - if(nbOfTuples) - { - if(!nbOfComp) - { - if(PyInt_Check(nbOfTuples)) - {//DataArrayByte.New(5,2) - int nbOfCompo=PyInt_AS_LONG(nbOfTuples); - if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); - MCAuto ret=DataArrayByte::New(); - ret->alloc(nbOfTuples1,nbOfCompo); - return ret.retn(); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {//DataArrayByte.New(5) - MCAuto ret=DataArrayByte::New(); - ret->alloc(nbOfTuples1,1); - return ret.retn(); - } - } -#ifdef WITH_NUMPY - else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL) - {//DataArrayDouble.New(numpyArray) - return BuildNewInstance(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8"); - } -#endif - else - throw INTERP_KERNEL::Exception(msg); - } - - DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) - { - return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp); - } - - std::string __repr__() const - { - std::ostringstream oss; - self->reprQuickOverview(oss); - return oss.str(); - } - - int __int__() const - { - return (int) self->byteValue(); - } - - DataArrayByteIterator *__iter__() - { - return self->iterator(); - } - - int getIJ(int tupleId, int compoId) const - { - return (int)self->getIJ(tupleId,compoId); - } - - int getIJSafe(int tupleId, int compoId) const - { - return (int)self->getIJSafe(tupleId,compoId); - } - - std::string __str__() const - { - return self->repr(); - } - - PyObject *toStrList() const - { - const char *vals=self->getConstPointer(); - int nbOfComp=self->getNumberOfComponents(); - int nbOfTuples=self->getNumberOfTuples(); - return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); - } - - bool presenceOfTuple(PyObject *tupl) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval); - std::vector vals(sz); - std::copy(pt,pt+sz,vals.begin()); - return self->presenceOfTuple(vals); - } - - bool presenceOfValue(PyObject *vals) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval); - std::vector vals2(sz); - std::copy(pt,pt+sz,vals2.begin()); - return self->presenceOfValue(vals2); - } - - int findIdFirstEqual(PyObject *vals) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval); - std::vector vals2(sz); - std::copy(pt,pt+sz,vals2.begin()); - return self->findIdFirstEqual(vals2); - } - - int findIdFirstEqualTuple(PyObject *tupl) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval); - std::vector vals(sz); - std::copy(pt,pt+sz,vals.begin()); - return self->findIdFirstEqualTuple(vals); - } - - int findIdSequence(PyObject *strOrListOfInt) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval); - std::vector vals(sz); - std::copy(pt,pt+sz,vals.begin()); - return self->findIdSequence(vals); - } - - PyObject *getTuple(int tupleId) - { - int sz=self->getNumberOfComponents(); - INTERP_KERNEL::AutoPtr tmp=new char[sz]; - self->getTuple(tupleId,tmp); - PyObject *ret=PyTuple_New(sz); - for(int i=0;igetMaxValue(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 - { - int tmp; - int r1=(int)self->getMinValue(tmp); + mcIdType tmp; + mcIdType r1=(mcIdType)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 + mcIdType index(PyObject *obj) const { - int nbOfCompo=self->getNumberOfComponents(); + mcIdType nbOfCompo=self->getNumberOfComponents(); switch(nbOfCompo) { case 1: { if(PyInt_Check(obj)) { - int val=(int)PyInt_AS_LONG(obj); + mcIdType val=(mcIdType)PyInt_AS_LONG(obj); return self->findIdFirstEqual(val); } else @@ -5222,7 +2778,7 @@ namespace MEDCoupling bool __contains__(PyObject *obj) const { - int nbOfCompo=self->getNumberOfComponents(); + mcIdType nbOfCompo=self->getNumberOfComponents(); switch(nbOfCompo) { case 0: @@ -5231,7 +2787,7 @@ namespace MEDCoupling { if(PyInt_Check(obj)) { - int val=(int)PyInt_AS_LONG(obj); + mcIdType val=(mcIdType)PyInt_AS_LONG(obj); return self->presenceOfValue(val); } else @@ -5253,19 +2809,19 @@ namespace MEDCoupling { self->checkAllocated(); const char msg[]="Unexpected situation in __setitem__ !"; - int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); - int sw1,sw2; - int i1; - std::vector v1; - DataArrayInt *d1=0; - DataArrayIntTuple *dd1=0; + mcIdType nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); + mcIdType sw1,sw2; + mcIdType i1; + std::vector v1; + DataArrayIdType *d1=0; + DataArrayIdTypeTuple *dd1=0; convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - DataArrayInt *dt1=0,*dc1=0; + mcIdType it1,ic1; + std::vector vt1,vc1; + std::pair > pt1,pc1; + DataArrayIdType *dt1=0,*dc1=0; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MCAuto tmp; + MCAuto tmp; switch(sw2) { case 1: @@ -5481,7 +3037,7 @@ namespace MEDCoupling { public: std::string repr() const; - DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const; + DataArrayByte *buildDAByte(mcIdType nbOfTuples, mcIdType nbOfCompo) const; %extend { std::string __str__() const @@ -5526,18 +3082,18 @@ namespace MEDCoupling { if(PyInt_Check(nbOfTuples)) { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !"); if(nbOfComp) { if(PyInt_Check(nbOfComp)) {//DataArrayAsciiChar.New([1,3,4,5],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); + mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !"); MCAuto ret=DataArrayAsciiChar::New(); - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } @@ -5547,8 +3103,8 @@ namespace MEDCoupling else {//DataArrayAsciiChar.New([1,3,4],3) MCAuto ret=DataArrayAsciiChar::New(); - int tmpp1=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } @@ -5590,8 +3146,8 @@ namespace MEDCoupling { // DataArrayAsciiChar.New([1,3,4]) MCAuto ret=DataArrayAsciiChar::New(); - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } @@ -5599,7 +3155,7 @@ namespace MEDCoupling } else if(PyInt_Check(elt0)) { - int nbOfTuples1=PyInt_AS_LONG(elt0); + mcIdType nbOfTuples1=PyInt_AS_LONG(elt0); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !"); if(nbOfTuples) @@ -5608,7 +3164,7 @@ namespace MEDCoupling { if(PyInt_Check(nbOfTuples)) {//DataArrayAsciiChar.New(5,2) - int nbOfCompo=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfCompo=PyInt_AS_LONG(nbOfTuples); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !"); MCAuto ret=DataArrayAsciiChar::New(); @@ -5649,14 +3205,14 @@ namespace MEDCoupling return self->iterator(); } - std::string getIJ(int tupleId, int compoId) const + std::string getIJ(mcIdType tupleId, mcIdType compoId) const { char tmp[2]; tmp[1]='\0'; tmp[0]=self->getIJ(tupleId,compoId); return std::string(tmp); } - std::string getIJSafe(int tupleId, int compoId) const + std::string getIJSafe(mcIdType tupleId, mcIdType compoId) const { char tmp[2]; tmp[1]='\0'; tmp[0]=self->getIJSafe(tupleId,compoId); @@ -5671,8 +3227,8 @@ namespace MEDCoupling PyObject *toStrList() const { const char *vals=self->getConstPointer(); - int nbOfComp=self->getNumberOfComponents(); - int nbOfTuples=self->getNumberOfTuples(); + mcIdType nbOfComp=self->getNumberOfComponents(); + mcIdType nbOfTuples=self->getNumberOfTuples(); return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); } @@ -5720,7 +3276,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !"); } - int findIdFirstEqual(PyObject *vals) const + mcIdType findIdFirstEqual(PyObject *vals) const { if(PyString_Check(vals)) { @@ -5742,7 +3298,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !"); } - int findIdFirstEqualTuple(PyObject *tupl) const + mcIdType findIdFirstEqualTuple(PyObject *tupl) const { if(PyString_Check(tupl)) { @@ -5764,7 +3320,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !"); } - int findIdSequence(PyObject *strOrListOfInt) const + mcIdType findIdSequence(PyObject *strOrListOfInt) const { if(PyString_Check(strOrListOfInt)) { @@ -5786,9 +3342,9 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !"); } - PyObject *getTuple(int tupleId) const + PyObject *getTuple(mcIdType tupleId) const { - int sz=self->getNumberOfComponents(); + mcIdType sz=self->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp=new char[sz+1]; tmp[sz]='\0'; self->getTuple(tupleId,tmp); return PyString_FromString(tmp); @@ -5796,7 +3352,7 @@ namespace MEDCoupling PyObject *getMaxValue() const { - int tmp; + mcIdType tmp; char tmp2[2]; tmp2[1]='\0'; tmp2[0]=self->getMaxValue(tmp); PyObject *ret=PyTuple_New(2); @@ -5807,7 +3363,7 @@ namespace MEDCoupling PyObject *getMinValue() const { - int tmp; + mcIdType tmp; char tmp2[2]; tmp2[1]='\0'; tmp2[0]=self->getMinValue(tmp); PyObject *ret=PyTuple_New(2); @@ -5816,9 +3372,9 @@ namespace MEDCoupling return ret; } - int index(PyObject *obj) const + mcIdType index(PyObject *obj) const { - int nbOfCompo=self->getNumberOfComponents(); + mcIdType nbOfCompo=self->getNumberOfComponents(); switch(nbOfCompo) { case 1: @@ -5853,7 +3409,7 @@ namespace MEDCoupling bool __contains__(PyObject *obj) const { - int nbOfCompo=self->getNumberOfComponents(); + mcIdType nbOfCompo=self->getNumberOfComponents(); switch(nbOfCompo) { case 0: @@ -5890,10 +3446,10 @@ namespace MEDCoupling PyObject *__getitem__(PyObject *obj) const { - int sw,iTypppArr; - std::vector stdvecTyyppArr; - std::pair > sTyyppArr; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw,iTypppArr; + std::vector stdvecTyyppArr; + std::pair > sTyyppArr; + MEDCoupling::DataArrayIdType *daIntTyypp=0; convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp); switch(sw) { @@ -5906,21 +3462,21 @@ namespace MEDCoupling case 4: return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 ); default: - throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !"); + throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayIdType and slice in input !"); } } DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) { - static const char msg[]="DataArrayAsciiChar::__setitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input, and 4 types accepted in value : string, list or tuple of strings having same size, not null DataArrayChar instance."; - int sw1,iTypppArr; - std::vector stdvecTyyppArr; - std::pair > sTyyppArr; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int nbOfCompo=self->getNumberOfComponents(); - int nbOfTuples=self->getNumberOfTuples(); + static const char msg[]="DataArrayAsciiChar::__setitem__ : supporting int, list of int, tuple of int, DataArrayIdType and slice in input, and 4 types accepted in value : string, list or tuple of strings having same size, not null DataArrayChar instance."; + mcIdType sw1,iTypppArr; + std::vector stdvecTyyppArr; + std::pair > sTyyppArr; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + mcIdType nbOfCompo=self->getNumberOfComponents(); + mcIdType nbOfTuples=self->getNumberOfTuples(); convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp); - int sw2; + mcIdType sw2; char vc; std::string sc; std::vector vsc; DataArrayChar *dacc=0; convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc); switch(sw1) @@ -6029,7 +3585,7 @@ namespace MEDCoupling } } case 4: - {//DataArrayInt + {//DataArrayIdType switch(sw2) { {//value char @@ -6096,8 +3652,8 @@ namespace MEDCoupling class DataArrayAsciiCharTuple { public: - int getNumberOfCompo() const; - DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const; + std::size_t getNumberOfCompo() const; + DataArrayAsciiChar *buildDAAsciiChar(mcIdType nbOfTuples, mcIdType nbOfCompo) const; %extend { std::string __str__() const @@ -6113,6 +3669,8 @@ namespace MEDCoupling }; } +%include "DataArrayInt.i" + %pythoncode %{ def MEDCouplingStdReduceFunct(cls,params): a,b=params @@ -6128,8 +3686,8 @@ def MEDCouplingDataArrayDoubleReduce(self): def MEDCouplingDataArrayIntReduce(self): if not MEDCouplingHasNumPyBindings(): - raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !") - return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),)) + raise InterpKernelException("PyWrap of DataArrayIdType.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !") + return MEDCouplingStdReduceFunct,(DataArrayIdType,((self.toNumPyArray(),),(self.__getstate__()),)) def MEDCouplingDataArrayByteReduce(self): if not MEDCouplingHasNumPyBindings(): @@ -6140,4 +3698,11 @@ def MEDCouplingDataArrayFloatReduce(self): if not MEDCouplingHasNumPyBindings(): raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !") return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),)) + +if MEDCouplingUse64BitIDs(): + DataArrayInt=DataArrayInt64 +else: + DataArrayInt=DataArrayInt32 +pass + %} diff --git a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i index 665c95f50..7f9bdad56 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i +++ b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i @@ -187,6 +187,15 @@ namespace MEDCoupling return false; #endif } + + bool MEDCouplingUse64BitIDs() + { +#ifndef MEDCOUPLING_USE_64BIT_IDS + return false; +#else + return true; +#endif + } std::string MEDCouplingCompletionScript() { diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapperCommon.i b/src/MEDCoupling_Swig/MEDCouplingRemapperCommon.i index 1a7364d69..6c4e27c31 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapperCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingRemapperCommon.i @@ -69,14 +69,14 @@ namespace MEDCoupling { PyObject *getCrudeMatrix() const { - const std::vector >& m=self->getCrudeMatrix(); + const std::vector >& m=self->getCrudeMatrix(); std::size_t sz=m.size(); PyObject *ret=PyList_New(sz); for(std::size_t i=0;i& row=m[i]; + const std::map& row=m[i]; PyObject *ret0=PyDict_New(); - for(std::map::const_iterator it=row.begin();it!=row.end();it++) + for(std::map::const_iterator it=row.begin();it!=row.end();it++) PyDict_SetItem(ret0,PyInt_FromLong((*it).first),PyFloat_FromDouble((*it).second)); PyList_SetItem(ret,i,ret0); } @@ -90,15 +90,21 @@ namespace MEDCoupling #endif void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, PyObject *m) { - std::vector > mCpp; + std::vector > mCpp; if(isCSRMatrix(m)) { #if defined(WITH_NUMPY) && defined(WITH_SCIPY) PyObject *indptr(PyObject_GetAttrString(m,"indptr")); PyObject *indices(PyObject_GetAttrString(m,"indices")); PyObject *data(PyObject_GetAttrString(m,"data")); - MCAuto indptrPtr(MEDCoupling_DataArrayInt_New__SWIG_1(indptr,NULL,NULL)); - MCAuto indicesPtr(MEDCoupling_DataArrayInt_New__SWIG_1(indices,NULL,NULL)); + MCAuto indptrPtr, indicesPtr; +#if defined(MEDCOUPLING_USE_64BIT_IDS) + indptrPtr = MEDCoupling_DataArrayInt64_New__SWIG_1(indptr,NULL,NULL); + indicesPtr = MEDCoupling_DataArrayInt64_New__SWIG_1(indices,NULL,NULL); +#else + indptrPtr = MEDCoupling_DataArrayInt32_New__SWIG_1(indptr,NULL,NULL); + indicesPtr = MEDCoupling_DataArrayInt32_New__SWIG_1(indices,NULL,NULL); +#endif MCAuto dataPtr(MEDCoupling_DataArrayDouble_New__SWIG_1(data,NULL,NULL)); convertCSR_MCDataToVectMapIntDouble(indptrPtr,indicesPtr,dataPtr,mCpp); Py_XDECREF(data); Py_XDECREF(indptr); Py_XDECREF(indices); @@ -113,7 +119,7 @@ namespace MEDCoupling void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, PyObject *m) { - std::vector > mCpp; + std::vector > mCpp; convertToVectMapIntDouble(m,mCpp); self->setCrudeMatrixEx(src,target,mCpp); } diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 31de2db56..e38e5c7ff 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -186,7 +186,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ MEDCoupling::DataArrayDouble *a; MEDCoupling::DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -258,7 +258,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ MEDCoupling::DataArrayDouble *a; MEDCoupling::DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -325,7 +325,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ MEDCoupling::DataArrayDouble *a; MEDCoupling::DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -397,7 +397,7 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__ MEDCoupling::DataArrayDouble *a; MEDCoupling::DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -448,15 +448,15 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__ template typename MEDCoupling::Traits::FieldType *fieldT_buildSubPart(const MEDCoupling::MEDCouplingFieldT *self, PyObject *li) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; const MEDCoupling::MEDCouplingMesh *mesh=self->getMesh(); if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !"); - int nbc=mesh->getNumberOfCells(); + mcIdType nbc=mesh->getNumberOfCells(); convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -474,7 +474,7 @@ typename MEDCoupling::Traits::FieldType *fieldT_buildSubPart(const MEDCouplin { if(nbc+singleVal>0) { - int tmp=nbc+singleVal; + mcIdType tmp=nbc+singleVal; return self->buildSubPart(&tmp,&tmp+1); } else @@ -501,25 +501,25 @@ typename MEDCoupling::Traits::FieldType *fieldT_buildSubPart(const MEDCouplin return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end()); } default: - throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !"); + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !"); } } template typename MEDCoupling::Traits::FieldType *fieldT__getitem__(const MEDCoupling::MEDCouplingFieldT *self, PyObject *li) { - const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n"; + const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[DataArrayIdType]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[DataArrayIdType,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n"; if(PyTuple_Check(li)) { Py_ssize_t sz=PyTuple_Size(li); if(sz!=2) throw INTERP_KERNEL::Exception(msg); PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1); - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + std::size_t singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; if(!self->getArray()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !"); try @@ -534,7 +534,7 @@ typename MEDCoupling::Traits::FieldType *fieldT__getitem__(const MEDCoupling: { case 1: { - std::vector v2(1,singleVal); + std::vector v2(1,singleVal); MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); return ret0.retn(); @@ -547,9 +547,9 @@ typename MEDCoupling::Traits::FieldType *fieldT__getitem__(const MEDCoupling: } case 3: { - int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !")); - std::vector v2(nbOfComp); - for(int i=0;i v2(nbOfComp); + for(mcIdType i=0;i::ArrayType > aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); @@ -567,7 +567,7 @@ template PyObject *field_getTinySerializationInformation(const FIELDT *self) { std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; self->getTinySerializationDbleInformation(a0); self->getTinySerializationIntInformation(a1); @@ -576,10 +576,10 @@ PyObject *field_getTinySerializationInformation(const FIELDT *self) PyObject *ret(PyTuple_New(3)); PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0)); PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1)); - int sz(a2.size()); + mcIdType sz(a2.size()); PyObject *ret2(PyList_New(sz)); { - for(int i=0;i PyObject *field_serialize(const typename MEDCoupling::Traits::FieldType *self) { - MEDCoupling::DataArrayInt *ret0(0); + MEDCoupling::DataArrayIdType *ret0(0); std::vector::ArrayType *> ret1; self->serialize(ret0,ret1); if(ret0) ret0->incrRef(); std::size_t sz(ret1.size()); PyObject *ret(PyTuple_New(2)); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyObject *ret1Py(PyList_New(sz)); for(std::size_t i=0;i::FieldType *self, PyObjec static const char MSG[]="MEDCouplingFieldDouble.__setstate__ : expected input is a tuple of size 3 !"; if(!PyTuple_Check(inp)) throw INTERP_KERNEL::Exception(MSG); - int sz(PyTuple_Size(inp)); + mcIdType sz(PyTuple_Size(inp)); if(sz!=3) throw INTERP_KERNEL::Exception(MSG); // mesh @@ -660,15 +660,15 @@ void field__setstate__(typename MEDCoupling::Traits::FieldType *self, PyObjec PyObject *elt0(PyTuple_GetItem(inp,0)); PyObject *elt1(PyTuple_GetItem(inp,1)); std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; - MEDCoupling::DataArrayInt *b0(0); + MEDCoupling::DataArrayIdType *b0(0); std::vector::ArrayType *>b1; { if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3) throw INTERP_KERNEL::Exception(MSG); PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2)); - int tmp(-1); + mcIdType tmp(-1); fillArrayWithPyListDbl3(a0py,tmp,a0); convertPyToNewIntArr3(a1py,a1); fillStringVector(a2py,a2); @@ -678,10 +678,10 @@ void field__setstate__(typename MEDCoupling::Traits::FieldType *self, PyObjec throw INTERP_KERNEL::Exception(MSG); PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1)); void *argp(0); - int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0)); + int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits::TI,0|0)); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception(MSG); - b0=reinterpret_cast(argp); + b0=reinterpret_cast(argp); convertFromPyObjVectorOfObj::ArrayType *>(b1py,SWIGTITraits::TI,MEDCoupling::Traits::ArrayTypeName,b1); } self->checkForUnserialization(a1,b0,b1); @@ -689,17 +689,17 @@ void field__setstate__(typename MEDCoupling::Traits::FieldType *self, PyObjec self->finishUnserialization(a1,a0,a2); } -PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCoupling::MEDCouplingMesh *self, std::function&,MEDCoupling::MCAuto&)> func) +PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCoupling::MEDCouplingMesh *self, std::function&,MEDCoupling::MCAuto&)> func) { - MEDCoupling::MCAuto elts,eltsIndex; + MEDCoupling::MCAuto elts,eltsIndex; int spaceDim=self->getSpaceDimension(); void *da=0; int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; + mcIdType size; INTERP_KERNEL::AutoCPtr tmp=convertPyToNewDblArr2(p,&size); - int nbOfPoints=size/spaceDim; + mcIdType nbOfPoints=size/spaceDim; if(size%spaceDim!=0) { throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !"); @@ -712,8 +712,8 @@ PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCo if(!da2) throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !"); da2->checkAllocated(); - int size=da2->getNumberOfTuples(); - int nbOfCompo=da2->getNumberOfComponents(); + mcIdType size=da2->getNumberOfTuples(); + mcIdType nbOfCompo=da2->getNumberOfComponents(); if(nbOfCompo!=spaceDim) { throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !"); @@ -721,8 +721,8 @@ PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCo func(da2->getConstPointer(),size,eps,elts,eltsIndex); } PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; }