MEDCOUPLING_EXPORT void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const;
MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<std::size_t>& compoIds);
- MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<mcIdType>& compoIds);
MEDCOUPLING_EXPORT void sortPerTuple(bool asc);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *MergeFields(const std::vector<const MEDCouplingFieldDouble *>& a);
MEDCOUPLING_EXPORT static mcIdType *CheckAndPreparePermutation(const T *start, const T *end);
MEDCOUPLING_EXPORT static DataArrayType *BuildListOfSwitchedOn(const std::vector<bool>& v);
MEDCOUPLING_EXPORT static DataArrayType *BuildListOfSwitchedOff(const std::vector<bool>& v);
- MEDCOUPLING_EXPORT static DataArrayIdType *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const T *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples);
+ MEDCOUPLING_EXPORT static DataArrayIdType *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const mcIdType *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples);
MEDCOUPLING_EXPORT static DataArrayIdType *MakePartition(const std::vector<const DataArrayType *>& groups, mcIdType newNb, std::vector< std::vector<mcIdType> >& fidsOfGroups);
public:
MEDCOUPLING_EXPORT static void ExtractFromIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd,
* \throw If any value of \a arr breaks condition ( 0 <= \a arr[ i ] < \a nbOfOldTuples ).
*/
template <class T>
- DataArrayIdType *DataArrayDiscrete<T>::ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const T *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples)
+ DataArrayIdType *DataArrayDiscrete<T>::ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const mcIdType *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples)
{
MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
ret->alloc(nbOfOldTuples,1);
bool isEqual(const ARRAY& other) const;
bool isEqualWithoutConsideringStr(const ARRAY& other) const;
bool isEqualWithoutConsideringStrAndOrder(const ARRAY& other) const;
- ARRAY *buildPermutationArr(const ARRAY& other) const;
+ DataArrayIdType *buildPermutationArr(const ARRAY& other) const;
ARRAY *sumPerTuple() const;
void sort(bool asc=true);
void reverse();
ARRAY *invertArrayO2N2N2O(INT newNbOfElem) const;
ARRAY *invertArrayN2O2O2N(INT oldNbOfElem) const;
ARRAY *invertArrayO2N2N2OBis(INT newNbOfElem) const;
- ARRAY *indicesOfSubPart(const ARRAY& partOfThis) const;
+ DataArrayIdType *indicesOfSubPart(const ARRAY& partOfThis) const;
ARRAY *fromNoInterlace() const;
ARRAY *toNoInterlace() const;
ARRAY *selectByTupleIdSafeSlice(INT bg, INT end, INT step) const;
- ARRAY *checkAndPreparePermutation() const;
- ARRAY *buildPermArrPerLevel() const;
+ DataArrayIdType *checkAndPreparePermutation() const;
+ DataArrayIdType *buildPermArrPerLevel() const;
bool isIota(INT sizeExpected) const;
bool isUniform(INT val) const;
INT checkUniformAndGuess() const;
bool hasUniqueValues() const;
ARRAY *subArray(INT tupleIdBg, INT tupleIdEnd=-1) const;
void transpose();
- ARRAY *changeNbOfComponents(INT newNbOfComp, INT dftValue) const;
+ ARRAY *changeNbOfComponents(std::size_t newNbOfComp, INT dftValue) const;
void meldWith(const ARRAY *other);
void setPartOfValues1(const ARRAY *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 ARRAY *a, const DataArrayIdType *tuplesSelec);
void getTuple(INT tupleId, INT *res) const;
- INT getIJ(INT tupleId, INT compoId) const;
+ INT getIJ(std::size_t tupleId, std::size_t compoId) const;
INT getIJSafe(INT tupleId, INT compoId) const;
INT front() const;
INT back() const;
ARRAY ## Iterator *iterator();
const INT *begin() const;
const INT *end() const;
- ARRAY *findIdsEqual(INT val) const;
- ARRAY *findIdsNotEqual(INT val) const;
- INT changeValue(INT oldValue, INT newValue);
- INT findIdFirstEqualTuple(const std::vector<INT>& tupl) const;
- INT findIdFirstEqual(INT value) const;
- INT findIdFirstEqual(const std::vector<INT>& vals) const;
- INT findIdSequence(const std::vector<INT>& vals) const;
+ DataArrayIdType *findIdsEqual(INT val) const;
+ DataArrayIdType *findIdsNotEqual(INT val) const;
+ mcIdType changeValue(INT oldValue, INT newValue);
+ mcIdType findIdFirstEqualTuple(const std::vector<INT>& tupl) const;
+ mcIdType findIdFirstEqual(INT value) const;
+ mcIdType findIdFirstEqual(const std::vector<INT>& vals) const;
+ mcIdType findIdSequence(const std::vector<INT>& vals) const;
bool presenceOfTuple(const std::vector<INT>& tupl) const;
bool presenceOfValue(INT value) const;
bool presenceOfValue(const std::vector<INT>& vals) const;
static DataArrayIdType *MakePartition(const std::vector<const ARRAY *>& groups, mcIdType newNb, std::vector< std::vector<mcIdType> >& fidsOfGroups);
static ARRAY *BuildUnion(const std::vector<const ARRAY *>& arr);
static ARRAY *BuildIntersection(const std::vector<const ARRAY *>& arr);
- static ARRAY *FindPermutationFromFirstToSecond(const ARRAY *ids1, const ARRAY *ids2);
- ARRAY *buildComplement(INT nbOfElement) const;
+ static DataArrayIdType *FindPermutationFromFirstToSecond(const ARRAY *ids1, const ARRAY *ids2);
+ DataArrayIdType *buildComplement(mcIdType nbOfElement) const;
ARRAY *buildSubstraction(const ARRAY *other) const;
ARRAY *buildSubstractionOptimized(const ARRAY *other) const;
ARRAY *buildUnion(const ARRAY *other) const;
void computeOffsets();
void computeOffsetsFull();
ARRAY *buildExplicitArrByRanges(const ARRAY *offsets) const;
- ARRAY *findRangeIdForEachTuple(const ARRAY *ranges) const;
+ DataArrayIdType *findRangeIdForEachTuple(const ARRAY *ranges) const;
ARRAY *findIdInRangeForEachTuple(const ARRAY *ranges) const;
void sortEachPairToMakeALinkedList();
ARRAY *duplicateEachTupleNTimes(INT nbTimes) const;
static PyObject *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, PyObject *arr, PyObject *arrI)
{
mcIdType newNbOfTuples=-1;
- mcIdType szArr,szArrI,sw,iTypppArrI;
- INT iTypppArr;
- std::vector<INT> stdvecTyyppArr;
+ mcIdType szArr,szArrI,sw,iTypppArr,iTypppArrI;
+ std::vector<mcIdType> stdvecTyyppArr;
std::vector<mcIdType> stdvecTyyppArrI;
- const INT *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
+ const mcIdType *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
const mcIdType *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
DataArrayIdType *ret0=MEDCoupling::ARRAY::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
PyObject *ret=PyTuple_New(2);
{
std::vector<const ARRAY *> groups;
std::vector< std::vector<mcIdType> > fidsOfGroups;
- convertFromPyObjVectorOfObj<const MEDCoupling::ARRAY *>(gps,SWIGTITraits<mcIdType>::TI,"ARRAY",groups);
+ convertFromPyObjVectorOfObj(gps,SWIGTITraits<INT>::TI,"ARRAY",groups);
DataArrayIdType *ret0=MEDCoupling::ARRAY::MakePartition(groups,newNb,fidsOfGroups);
PyObject *ret = PyList_New(2);
PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
{
ARRAY *ret0=0,*ret1=0,*ret2=0;
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
mcIdType size;
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<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
DataArrayIdType *transformWithIndArrR(PyObject *li) const
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 | 0 );
if (!SWIG_IsOK(res1))
{
mcIdType size;
static ARRAY *Meld(PyObject *li)
{
std::vector<const ARRAY *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::ARRAY *>(li,SWIGTITraits<mcIdType>::TI,"ARRAY",tmp);
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
return ARRAY::Meld(tmp);
}
static ARRAY *Aggregate(PyObject *li)
{
std::vector<const ARRAY *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::ARRAY *>(li,SWIGTITraits<mcIdType>::TI,"ARRAY",tmp);
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
return ARRAY::Aggregate(tmp);
}
static ARRAY *AggregateIndexes(PyObject *li)
{
std::vector<const ARRAY *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::ARRAY *>(li,SWIGTITraits<mcIdType>::TI,"ARRAY",tmp);
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
return ARRAY::AggregateIndexes(tmp);
}
static ARRAY *BuildUnion(PyObject *li)
{
std::vector<const ARRAY *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::ARRAY *>(li,SWIGTITraits<mcIdType>::TI,"ARRAY",tmp);
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
return ARRAY::BuildUnion(tmp);
}
static ARRAY *BuildIntersection(PyObject *li)
{
std::vector<const ARRAY *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::ARRAY *>(li,SWIGTITraits<mcIdType>::TI,"ARRAY",tmp);
+ convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
return ARRAY::BuildIntersection(tmp);
}
{
if(nbOfComponents==1)
return PyInt_FromLong(self->getIJSafe(it1,0));
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
case 2:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
case 3:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
case 4:
- return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTITraits<INT>::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<std::size_t> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
case 7:
{
ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
std::vector<std::size_t> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
case 8:
{
ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
std::vector<std::size_t> v2(1,ic1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
case 9:
{
ret=self->selectByTupleIdSafe(&it1,&it1+1);
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::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<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::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<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::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<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
case 13:
{
std::vector<std::size_t> v2(nbOfComp);
for(INT i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
case 14:
{
std::vector<std::size_t> v2(nbOfComp);
for(INT i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
case 15:
{
std::vector<std::size_t> v2(nbOfComp);
for(mcIdType i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
case 16:
{
std::vector<std::size_t> v2(nbOfComp);
for(INT i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
}
default:
throw INTERP_KERNEL::Exception(msg);
void transformWithIndArr(PyObject *li)
{
void *da=0;
- int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 | 0 ));
+ int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 | 0 ));
if (!SWIG_IsOK(res1))
{
int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
namespace MEDCoupling
{
+ typedef int Int32;
+ typedef long int Int64;
+
+
class DataArrayInt32Iterator;
class DataArrayInt32 : public DataArray
TRANSFORMWITHINDARR( DataArrayInt64, Int64 )
#endif
};
-
+
}
pass
def testDAITransformWithIndArr1(self):
+ if not MEDCouplingUse64BitIDs():
+ return
tab1=[17,18,22,19]
tab2=[0,1,1,3,3,0,1,3,2,2,3,0]
expected=[17,18,18,19,19,17,18,19,22,22,19,17]
def testDAIBuildOld2NewArrayFromSurjectiveFormat2(self):
arr=[0,3, 5,7,9]
arrI=[0,2,5]
- a=DataArrayInt64.New();
+ a=DataArrayInt.New();
a.setValues(arr,5,1);
- b=DataArrayInt64.New();
+ b=DataArrayInt.New();
b.setValues(arrI,3,1);
ret,newNbTuple=DataArrayInt64.ConvertIndexArrayToO2N(10,a,b);
expected=[0,1,2,0,3,4,5,4,6,4]
a=DataArrayInt64([9,10,0,6,4,11,3,8])
b=DataArrayInt64([6,0,11,8])
c=a.indicesOfSubPart(b)
- self.assertTrue(c.isEqual(DataArrayInt64([3,2,5,7])))
+ self.assertTrue(c.isEqual(DataArrayInt([3,2,5,7])))
#
d=DataArrayInt64([9,10,0,6,4,11,0,8])
self.assertRaises(InterpKernelException,d.indicesOfSubPart,b) # 0 appears twice in the d array
def testDAIfindIdsExt1(self):
d=DataArrayInt64([4,6,-2,3,7,0,10])
- self.assertTrue(d.findIdsGreaterOrEqualTo(3).isEqual(DataArrayInt64([0,1,3,4,6])))
- self.assertTrue(d.findIdsGreaterThan(3).isEqual(DataArrayInt64([0,1,4,6])))
- self.assertTrue(d.findIdsLowerThan(3).isEqual(DataArrayInt64([2,5])))
- self.assertTrue(d.findIdsLowerOrEqualTo(3).isEqual(DataArrayInt64([2,3,5])))
+ self.assertTrue(d.findIdsGreaterOrEqualTo(3).isEqual(DataArrayInt([0,1,3,4,6])))
+ self.assertTrue(d.findIdsGreaterThan(3).isEqual(DataArrayInt([0,1,4,6])))
+ self.assertTrue(d.findIdsLowerThan(3).isEqual(DataArrayInt([2,5])))
+ self.assertTrue(d.findIdsLowerOrEqualTo(3).isEqual(DataArrayInt([2,3,5])))
pass
def testDAICheckUniformAndGuess1(self):
a1=DataArrayInt64([17,27,2,10,-4,3,12,27,16])
b1=DataArrayInt64([3,16,-4,27,17])
ret=a1.findIdForEach(b1)
- self.assertTrue(ret.isEqual(DataArrayInt64([5,8,4,7,0])))
+ self.assertTrue(ret.isEqual(DataArrayInt([5,8,4,7,0])))
self.assertTrue(a1[ret].isEqual(b1))
b2=DataArrayInt64([3,16,22,27,17])
self.assertRaises(InterpKernelException,a1.findIdForEach,b2) # 22 not in a1 !
%{
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingCMesh.hxx"
%}
%template(ivec) std::vector<int>;
+%template(lvec) std::vector<long>;
%template(dvec) std::vector<double>;
%template(svec) std::vector<std::string>;
+//%include stdint.i
+
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+//typedef std::int32_t mcIdType;
+typedef int mcIdType;
+typedef DataArrayInt32 DataArrayIdType;
+#else
+//typedef std::int64_t mcIdType;
+typedef long int mcIdType;
+typedef DataArrayInt64 DataArrayIdType;
+#endif
+
+
////////////////////
%typemap(out) MEDCoupling::MEDCouplingMesh*
{
bool checkConsecutiveCellTypesAndOrder(PyObject *li) const
{
mcIdType sz;
- INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
+ INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz);
return ret;
}
DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const
{
mcIdType sz;
- INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
+ INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz);
return ret;
}
PyObject *getLevArrPerCellTypes(PyObject *li) const
{
mcIdType sz;
- INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz);
+ INTERP_KERNEL::AutoPtr<INTERP_KERNEL::NormalizedCellType> order=convertPyToNewIntArr2<INTERP_KERNEL::NormalizedCellType>(li,&sz);
DataArrayIdType *tmp0,*tmp1=0;
tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1);
PyObject *ret=PyTuple_New(2);
MEDCouplingFieldDouble *deviator() const;
MEDCouplingFieldDouble *magnitude() const;
MEDCouplingFieldDouble *maxPerTuple() const;
- void changeNbOfComponents(int newNbOfComp, double dftValue=0.);
+ void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.);
void sortPerTuple(bool asc);
MEDCouplingFieldDouble &operator=(double value);
void fillFromAnalytic(int nbOfComp, const std::string& func);
void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li)
{
- std::vector<mcIdType> tmp;
+ std::vector<std::size_t> tmp;
convertPyToNewIntArr3(li,tmp);
self->setSelectedComponents(f,tmp);
}
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyInt_Check(o))
{
- mcIdType val=(int)PyInt_AS_LONG(o);
+ T val=(T)PyInt_AS_LONG(o);
tmp[i]=val;
}
else
DataArrayDouble.__ifloordiv__=MEDCouplingDataArrayDoubleIdiv
DataArrayDouble.__rfloordiv__=DataArrayDouble.__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__
+DataArrayInt32.__reduce__=MEDCouplingDataArrayInt32Reduce
+DataArrayInt32.__iadd__=MEDCouplingDataArrayInt32Iadd
+DataArrayInt32.__isub__=MEDCouplingDataArrayInt32Isub
+DataArrayInt32.__imul__=MEDCouplingDataArrayInt32Imul
+DataArrayInt32.__idiv__=MEDCouplingDataArrayInt32Idiv
+DataArrayInt32.__imod__=MEDCouplingDataArrayInt32Imod
+DataArrayInt32.__ipow__=MEDCouplingDataArrayInt32Ipow
+DataArrayInt32.__truediv__=DataArrayInt32.__div__
+DataArrayInt32.__itruediv__=MEDCouplingDataArrayInt32Idiv
+DataArrayInt32.__rtruediv__=DataArrayInt32.__rdiv__
+DataArrayInt32.__floordiv__=DataArrayInt32.__div__
+DataArrayInt32.__ifloordiv__=MEDCouplingDataArrayInt32Idiv
+DataArrayInt32.__rfloordiv__=DataArrayInt32.__rdiv__
+
+DataArrayInt64.__reduce__=MEDCouplingDataArrayInt64Reduce
+DataArrayInt64.__iadd__=MEDCouplingDataArrayInt64Iadd
+DataArrayInt64.__isub__=MEDCouplingDataArrayInt64Isub
+DataArrayInt64.__imul__=MEDCouplingDataArrayInt64Imul
+DataArrayInt64.__idiv__=MEDCouplingDataArrayInt64Idiv
+DataArrayInt64.__imod__=MEDCouplingDataArrayInt64Imod
+DataArrayInt64.__ipow__=MEDCouplingDataArrayInt64Ipow
+DataArrayInt64.__truediv__=DataArrayInt64.__div__
+DataArrayInt64.__itruediv__=MEDCouplingDataArrayInt64Idiv
+DataArrayInt64.__rtruediv__=DataArrayInt64.__rdiv__
+DataArrayInt64.__floordiv__=DataArrayInt64.__div__
+DataArrayInt64.__ifloordiv__=MEDCouplingDataArrayInt64Idiv
+DataArrayInt64.__rfloordiv__=DataArrayInt64.__rdiv__
DataArrayByte.__reduce__=MEDCouplingDataArrayByteReduce
MEDCouplingFieldTemplate.__reduce__=MEDCouplingFieldTemplateReduce
-MEDCouplingFieldInt32.__reduce__=MEDCouplingFieldIntReduce
-MEDCouplingFieldInt64.__reduce__=MEDCouplingFieldIntReduce
+MEDCouplingFieldInt.__reduce__=MEDCouplingFieldIntReduce
MEDCouplingFieldFloat.__reduce__=MEDCouplingFieldFloatReduce
DataArrayDoubleTuple.__itruediv__=MEDCouplingDataArrayDoubleTupleIdiv
DataArrayDoubleTuple.__ifloordiv__=MEDCouplingDataArrayDoubleTupleIdiv
-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
+DataArrayInt32Tuple.__iadd__=MEDCouplingDataArrayInt32TupleIadd
+DataArrayInt32Tuple.__isub__=MEDCouplingDataArrayInt32TupleIsub
+DataArrayInt32Tuple.__imul__=MEDCouplingDataArrayInt32TupleImul
+DataArrayInt32Tuple.__idiv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__itruediv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__ifloordiv__=MEDCouplingDataArrayInt32TupleIdiv
+DataArrayInt32Tuple.__imod__=MEDCouplingDataArrayInt32TupleImod
+
+DataArrayInt64Tuple.__iadd__=MEDCouplingDataArrayInt64TupleIadd
+DataArrayInt64Tuple.__isub__=MEDCouplingDataArrayInt64TupleIsub
+DataArrayInt64Tuple.__imul__=MEDCouplingDataArrayInt64TupleImul
+DataArrayInt64Tuple.__idiv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__itruediv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__ifloordiv__=MEDCouplingDataArrayInt64TupleIdiv
+DataArrayInt64Tuple.__imod__=MEDCouplingDataArrayInt64TupleImod
DenseMatrix.__iadd__=MEDCouplingDenseMatrixIadd
DenseMatrix.__isub__=MEDCouplingDenseMatrixIsub
del INTERPKERNELExceptionReduce
-del MEDCoupling1DGTUMeshReduce
del MEDCoupling1SGTUMeshReduce
del MEDCouplingCMeshReduce
del MEDCouplingCurveLinearMeshReduce
del MEDCouplingDataArrayByteReduce
del MEDCouplingDataArrayDoubleIadd
+del MEDCouplingDataArrayDoubleIdiv
del MEDCouplingDataArrayDoubleImul
del MEDCouplingDataArrayDoubleIpow
del MEDCouplingDataArrayDoubleIsub
del MEDCouplingDataArrayDoubleReduce
del MEDCouplingDataArrayDoubleTupleIadd
+del MEDCouplingDataArrayDoubleTupleIdiv
del MEDCouplingDataArrayDoubleTupleImul
del MEDCouplingDataArrayDoubleTupleIsub
del MEDCouplingDataArrayFloatIadd
+del MEDCouplingDataArrayFloatIdiv
del MEDCouplingDataArrayFloatImul
del MEDCouplingDataArrayFloatIsub
del MEDCouplingDataArrayFloatReduce
-del MEDCouplingDataArrayIntIadd
-del MEDCouplingDataArrayIntIadd
-del MEDCouplingDataArrayIntImod
-del MEDCouplingDataArrayIntImul
-del MEDCouplingDataArrayIntIpow
-del MEDCouplingDataArrayIntIsub
-del MEDCouplingDataArrayIntReduce
-del MEDCouplingDataArrayIntTupleIadd
-del MEDCouplingDataArrayIntTupleIdiv
-del MEDCouplingDataArrayIntTupleImod
-del MEDCouplingDataArrayIntTupleImul
-del MEDCouplingDataArrayIntTupleIsub
+del MEDCouplingDataArrayInt32Iadd
+del MEDCouplingDataArrayInt32Idiv
+del MEDCouplingDataArrayInt32Imod
+del MEDCouplingDataArrayInt32Imul
+del MEDCouplingDataArrayInt32Ipow
+del MEDCouplingDataArrayInt32Isub
+del MEDCouplingDataArrayInt32Reduce
+del MEDCouplingDataArrayInt32TupleIadd
+del MEDCouplingDataArrayInt32TupleIdiv
+del MEDCouplingDataArrayInt32TupleImod
+del MEDCouplingDataArrayInt32TupleImul
+del MEDCouplingDataArrayInt32TupleIsub
+del MEDCouplingDataArrayInt64Iadd
+del MEDCouplingDataArrayInt64Idiv
+del MEDCouplingDataArrayInt64Imod
+del MEDCouplingDataArrayInt64Imul
+del MEDCouplingDataArrayInt64Ipow
+del MEDCouplingDataArrayInt64Isub
+del MEDCouplingDataArrayInt64Reduce
+del MEDCouplingDataArrayInt64TupleIadd
+del MEDCouplingDataArrayInt64TupleIdiv
+del MEDCouplingDataArrayInt64TupleImod
+del MEDCouplingDataArrayInt64TupleImul
+del MEDCouplingDataArrayInt64TupleIsub
del MEDCouplingDenseMatrixIadd
del MEDCouplingDenseMatrixIsub
del MEDCouplingFieldDoubleIadd
+del MEDCouplingFieldDoubleIdiv
del MEDCouplingFieldDoubleImul
del MEDCouplingFieldDoubleIpow
del MEDCouplingFieldDoubleIsub
del MEDCouplingFieldDoubleReduce
del MEDCouplingFieldFloatReduce
-del MEDCouplingFieldIntReduce
+del MEDCouplingFieldIntReduce
del MEDCouplingFieldTemplateReduce
del MEDCouplingIMeshReduce
del MEDCouplingMappedExtrudedMeshReduce
$result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt64,SWIG_POINTER_OWN|0);
}
+%typemap(out) MCAuto<MEDCoupling::DataArrayIdType>
+{
+ $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN|0);
+}
+
%typemap(out) MCAuto<MEDCoupling::DataArrayDouble>
{
$result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN|0);
class DataArrayInt32;
class DataArrayInt64;
+#ifndef MEDCOUPLING_USE_64BIT_IDS
+typedef DataArrayInt32 DataArrayIdType;
+#define DataArrayIdType DataArrayInt32
+#else
+typedef DataArrayInt64 DataArrayIdType;
+#define DataArrayIdType DataArrayInt64
+#endif
+
class MapII : public RefCountObject, public TimeLabel
{
public:
DataArrayDouble *toNoInterlace() const;
DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const;
void transpose();
- DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const;
+ DataArrayDouble *changeNbOfComponents(std::size_t newNbOfComp, double dftValue) const;
void meldWith(const DataArrayDouble *other);
DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const;
DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) 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;
+ DataArrayChar *changeNbOfComponents(std::size_t newNbOfComp, char dftValue) const;
void meldWith(const DataArrayChar *other);
void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayIdType *tuplesSelec);
char front() const;
raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),))
-def MEDCouplingDataArrayIntReduce(self):
+def MEDCouplingDataArrayInt32Reduce(self):
+ if not MEDCouplingHasNumPyBindings():
+ raise InterpKernelException("PyWrap of DataArrayIdType.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
+ return MEDCouplingStdReduceFunct,(DataArrayInt32,((self.toNumPyArray(),),(self.__getstate__()),))
+
+def MEDCouplingDataArrayInt64Reduce(self):
if not MEDCouplingHasNumPyBindings():
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__()),))
+ return MEDCouplingStdReduceFunct,(DataArrayInt64,((self.toNumPyArray(),),(self.__getstate__()),))
def MEDCouplingDataArrayByteReduce(self):
if not MEDCouplingHasNumPyBindings():