}
case NORM_POLYHED:
{
- std::size_t nbOfFaces(std::count(nodalConnBg,nodalConnEnd,-1)+1);
- std::size_t nbOfTetra(std::distance(nodalConnBg,nodalConnEnd)-nbOfFaces+1);
+ mcIdType nbOfFaces(ToIdType(std::count(nodalConnBg,nodalConnEnd,-1)+1));
+ mcIdType nbOfTetra(ToIdType(std::distance(nodalConnBg,nodalConnEnd)-nbOfFaces+1));
addCoords.resize((nbOfFaces+1)*3);
tetrasNodalConn.resize(nbOfTetra*4);
mcIdType *conn(&tetrasNodalConn[0]);
const mcIdType *work(nodalConnBg);
double *tmp(&addCoords[0]),*tmp2(&addCoords[3*nbOfFaces]);
tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.;
- for(unsigned int i=0;i<nbOfFaces;i++,tmp+=3)
+ for(int i=0;i<nbOfFaces;i++,tmp+=3)
{
tmp[0]=0.; tmp[1]=0.; tmp[2]=0.;
std::size_t nbOfNodesOfFace(std::distance(work,std::find(work,nodalConnEnd,-1)));
- for(unsigned int j=0;j<nbOfNodesOfFace;j++,conn+=4)
+ for(std::size_t j=0;j<nbOfNodesOfFace;j++,conn+=4)
{
conn[0]=work[j]; conn[1]=work[(j+1)%nbOfNodesOfFace]; conn[2]=-(i+1); conn[3]=ToIdType(-(nbOfFaces+1));
tmp[0]+=coords[3*work[j]+0]; tmp[1]+=coords[3*work[j]+1]; tmp[2]+=coords[3*work[j]+2];
* \throw If the spatial discretization of \a this field is NULL.
* \throw If no Gauss localization object found for the given cell.
*/
-mcIdType MEDCouplingField::getGaussLocalizationIdOfOneCell(int cellId) const
+mcIdType MEDCouplingField::getGaussLocalizationIdOfOneCell(mcIdType cellId) const
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneCell method !");
MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
MEDCOUPLING_EXPORT std::set<mcIdType> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const;
- MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(int cellId) const;
+ MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector<mcIdType>& cellIds) const;
MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
MEDCOUPLING_EXPORT void updateTime() const;
* \ref py_mcfielddouble_getValueOnPos "Here is a Python example".
* \endif
*/
-void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) const
+void MEDCouplingFieldDouble::getValueOnPos(mcIdType i, mcIdType j, mcIdType k, double *res) const
{
const DataArrayDouble *arr=timeDiscr()->getArray();
if(!_mesh)
MEDCOUPLING_EXPORT void normMax(double *res) const;
MEDCOUPLING_EXPORT double integral(int compId, bool isWAbs) const;
MEDCOUPLING_EXPORT void integral(bool isWAbs, double *res) const;
- MEDCOUPLING_EXPORT void getValueOnPos(int i, int j, int k, double *res) const;
+ MEDCOUPLING_EXPORT void getValueOnPos(mcIdType i, mcIdType j, mcIdType k, double *res) const;
MEDCOUPLING_EXPORT void getValueOn(const double *spaceLoc, double *res) const;
MEDCOUPLING_EXPORT void getValueOn(const double *spaceLoc, double time, double *res) const;
MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const double *spaceLoc, int nbOfPoints) const;
{
public:
MEDCOUPLING_EXPORT MCAuto<DataArrayDouble> convertToDblArr() const;
- MEDCOUPLING_EXPORT MCAuto<DataArrayIdType> convertToIntArr() const;
+ MEDCOUPLING_EXPORT MCAuto<DataArrayInt> convertToIntArr() const;
MEDCOUPLING_EXPORT MCAuto<DataArrayFloat> convertToFloatArr() const;
MEDCOUPLING_EXPORT void applyLin(T a, T b, std::size_t compoId);
MEDCOUPLING_EXPORT void applyLin(T a, T b);
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayChar& other) const;
MEDCOUPLING_EXPORT std::string repr() const;
MEDCOUPLING_EXPORT std::string reprZip() const;
- MEDCOUPLING_EXPORT DataArrayIdType *convertToIntArr() const;
+ MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const;
MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate<char>::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
* \return DataArrayInt * - the new instance of DataArrayInt.
*/
template<class T>
- MCAuto<DataArrayIdType> DataArrayTemplateClassic<T>::convertToIntArr() const
+ MCAuto<DataArrayInt> DataArrayTemplateClassic<T>::convertToIntArr() const
{
- return convertToOtherTypeOfArr<mcIdType>();
+ return convertToOtherTypeOfArr<int>();
}
/*!
* array to the new one.
* \return DataArrayIdType * - the new instance of DataArrayChar.
*/
-DataArrayIdType *DataArrayChar::convertToIntArr() const
+DataArrayInt *DataArrayChar::convertToIntArr() const
{
checkAllocated();
- DataArrayIdType *ret=DataArrayIdType::New();
+ DataArrayInt *ret=DataArrayInt::New();
ret->alloc(getNumberOfTuples(),getNumberOfComponents());
std::size_t nbOfVals=getNbOfElems();
const char *src=getConstPointer();
- mcIdType *dest=ret->getPointer();
+ int *dest=ret->getPointer();
std::copy(src,src+nbOfVals,dest);
ret->copyStringInfoFrom(*this);
return ret;
class DataArrayInt64Tuple;
class DataArrayFloatTuple;
class DataArrayDoubleTuple;
+ class DataArrayByteTuple;
class DataArrayInt32Iterator;
class DataArrayInt64Iterator;
+ class DataArrayByteIterator;
template<>
struct MEDCOUPLING_EXPORT Traits<double>
static const char ArrayTypeName[];
typedef DataArrayByte ArrayTypeCh;
typedef DataArrayChar ArrayType;
+ typedef DataArrayByteTuple ArrayTuple;
+ typedef DataArrayByteIterator IteratorType;
};
}
}
types->transformWithIndArr(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+INTERP_KERNEL::NORM_MAXTYPE+1);
types->writeVTK(ofs,8,"UInt8","types",byteData);
- offsets->writeVTK(ofs,8,"Int32","offsets",byteData);
+ std::string vtkTypeName = Traits<mcIdType>::VTKReprStr;
+ offsets->writeVTK(ofs,8,vtkTypeName,"offsets",byteData);
if(szFaceOffsets!=0)
{//presence of Polyhedra
connectivity->reAlloc(szConn);
- faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets",byteData);
+ faceoffsets->writeVTK(ofs,8,vtkTypeName,"faceoffsets",byteData);
MCAuto<DataArrayIdType> faces=DataArrayIdType::New(); faces->alloc(szFaceOffsets,1);
w1=faces->getPointer();
for(mcIdType i=0;i<nbOfCells;i++)
w6=w5+1;
}
}
- faces->writeVTK(ofs,8,"Int32","faces",byteData);
+ faces->writeVTK(ofs,8,vtkTypeName,"faces",byteData);
}
- connectivity->writeVTK(ofs,8,"Int32","connectivity",byteData);
+ connectivity->writeVTK(ofs,8,vtkTypeName,"connectivity",byteData);
ofs << " </Cells>\n";
ofs << " </Piece>\n";
ofs << " </" << getVTKDataSetType() << ">\n";
arr->setInfoOnComponent(1,"hhhh");
arr->setInfoOnComponent(2,"jj");
arr->setInfoOnComponent(3,"kkkkkk");
- MCAuto<DataArrayIdType> arr2(arr->convertToIntArr());
+ MCAuto<DataArrayInt> arr2(arr->convertToIntArr());
MCAuto<DataArrayDouble> arr3(arr2->convertToDblArr());
CPPUNIT_ASSERT(arr->isEqual(*arr3,1e-14));
arr->decrRef();
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingGaussLocalization.hxx"
#include <cmath>
const double expected1[30]={2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.};
for(int i=0;i<30;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a2->getIJ(0,i),1e-14);
- MCAuto<DataArrayIdType> a3(a1->convertToIntArr());
- DataArrayIdType *a4=static_cast<DataArrayIdType *>(a3->keepSelectedComponents(arr2V));
+ MCAuto<DataArrayInt> a3(a1->convertToIntArr());
+ DataArrayInt *a4=static_cast<DataArrayInt *>(a3->keepSelectedComponents(arr2V));
CPPUNIT_ASSERT_EQUAL(6,(int)a4->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(5,(int)a4->getNumberOfTuples());
CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_EQUAL(ToIdType(expected1[i]),a4->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL((int)expected1[i],a4->getIJ(0,i));
// setSelectedComponents
const mcIdType arr3[2]={3,2};
std::vector<std::size_t> arr3V(arr3,arr3+2);
const double expected2[30]={2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.};
for(int i=0;i<30;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],a2->getIJ(0,i),1e-14);
- MCAuto<DataArrayIdType> a6=a5->convertToIntArr();
+ MCAuto<DataArrayInt> a6=a5->convertToIntArr();
a6->setInfoOnComponent(0,"eeee");
a6->setInfoOnComponent(1,"ffff");
a4->setSelectedComponents(a6,arr4V);
for(int i=0;i<35;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da1->getIJ(0,i),1e-10);
//
- MCAuto<DataArrayIdType> dai1=da1C->convertToIntArr();
- MCAuto<DataArrayIdType> dai3=da3->convertToIntArr();
+ MCAuto<DataArrayInt> dai1=da1C->convertToIntArr();
+ MCAuto<DataArrayInt> dai3=da3->convertToIntArr();
dai1->meldWith(dai3);
CPPUNIT_ASSERT_EQUAL(5,(int)dai1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(7,(int)dai1->getNumberOfTuples());
CPPUNIT_ASSERT(dai1->getInfoOnComponent(3)=="c1da3");
CPPUNIT_ASSERT(dai1->getInfoOnComponent(4)=="c2da3");
for(int i=0;i<35;i++)
- CPPUNIT_ASSERT_EQUAL(ToIdType(expected1[i]),dai1->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL((int)expected1[i],dai1->getIJ(0,i));
// test of static method DataArrayDouble::meld
DataArrayDouble *da4=DataArrayDouble::Meld(da1C,da3);
CPPUNIT_ASSERT_EQUAL(5,(int)da4->getNumberOfComponents());
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da4->getIJ(0,i),1e-10);
// test of static method DataArrayIdType::meld
dai1=da1C->convertToIntArr();
- DataArrayIdType *dai4=DataArrayIdType::Meld(dai1,dai3);
+ DataArrayInt *dai4=DataArrayInt::Meld(dai1,dai3);
CPPUNIT_ASSERT_EQUAL(5,(int)dai4->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(7,(int)dai4->getNumberOfTuples());
CPPUNIT_ASSERT(dai4->getInfoOnComponent(0)=="c0da1");
d1->deepCopyFrom(*d);
CPPUNIT_ASSERT(d->isEqual(*d1,1e-12));
//
- MCAuto<DataArrayIdType> d2=d->convertToIntArr();
- DataArrayIdType *d4=DataArrayIdType::New();
+ MCAuto<DataArrayInt> d2=d->convertToIntArr();
+ DataArrayInt *d4=DataArrayInt::New();
CPPUNIT_ASSERT(!d2->isEqual(*d4));
d4->deepCopyFrom(*d2);
CPPUNIT_ASSERT(d2->isEqual(*d4));
#include "MEDCouplingMappedExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MEDCouplingMultiFields.hxx"
#include "MEDCouplingFieldOverTime.hxx"
const double expected1[12]={2.,3.,5.,6.,7.,8.,9.,10.,11.,12.,13.,15.};
d1->alloc(6,2);
std::copy(val1,val1+12,d1->getPointer());
- MCAuto<DataArrayIdType> d2=d1->convertToIntArr();
+ MCAuto<DataArrayInt> d2=d1->convertToIntArr();
//
d1->abs();
for(int i=0;i<12;i++)
const mcIdType expected2[12]={2,3,5,6,7,8,9,10,11,12,13,15};
d2->abs();
for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],d2->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL((int)expected2[i],d2->getIJ(0,i));
//
d1->decrRef();
}
std::string repr() const;
std::string reprZip() const;
std::string reprNotTooLong() const;
- ARRAY *invertArrayO2N2N2O(INT newNbOfElem) const;
- ARRAY *invertArrayN2O2O2N(INT oldNbOfElem) const;
- ARRAY *invertArrayO2N2N2OBis(INT newNbOfElem) const;
+ ARRAY *invertArrayO2N2N2O(mcIdType newNbOfElem) const;
+ ARRAY *invertArrayN2O2O2N(mcIdType oldNbOfElem) const;
+ ARRAY *invertArrayO2N2N2OBis(mcIdType newNbOfElem) const;
DataArrayIdType *indicesOfSubPart(const ARRAY& partOfThis) const;
ARRAY *fromNoInterlace() const;
ARRAY *toNoInterlace() const;
- ARRAY *selectByTupleIdSafeSlice(INT bg, INT end, INT step) const;
+ ARRAY *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end, mcIdType step) const;
DataArrayIdType *checkAndPreparePermutation() const;
DataArrayIdType *buildPermArrPerLevel() const;
- bool isIota(INT sizeExpected) const;
+ bool isIota(mcIdType sizeExpected) const;
bool isUniform(INT val) const;
INT checkUniformAndGuess() const;
bool hasUniqueValues() const;
- ARRAY *subArray(INT tupleIdBg, INT tupleIdEnd=-1) const;
+ ARRAY *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const;
void transpose();
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 setPartOfValues1(const ARRAY *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true);
+ void setPartOfValuesSimple1(INT a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp);
void setPartOfValuesAdv(const ARRAY *a, const DataArrayIdType *tuplesSelec);
- void getTuple(INT tupleId, INT *res) const;
+ void getTuple(mcIdType tupleId, INT *res) const;
INT getIJ(std::size_t tupleId, std::size_t compoId) const;
- INT getIJSafe(INT tupleId, INT compoId) const;
+ INT getIJSafe(std::size_t tupleId, std::size_t compoId) const;
INT front() const;
INT back() const;
- void setIJ(INT tupleId, INT compoId, INT newVal);
- void setIJSilent(INT tupleId, INT compoId, INT newVal);
+ void setIJ(mcIdType tupleId, mcIdType compoId, INT newVal);
+ void setIJSilent(mcIdType tupleId, mcIdType compoId, INT newVal);
INT *getPointer();
const INT *getConstPointer() const;
ARRAY ## Iterator *iterator();
DataArrayIdType *findRangeIdForEachTuple(const ARRAY *ranges) const;
ARRAY *findIdInRangeForEachTuple(const ARRAY *ranges) const;
void sortEachPairToMakeALinkedList();
- ARRAY *duplicateEachTupleNTimes(INT nbTimes) const;
+ ARRAY *duplicateEachTupleNTimes(mcIdType nbTimes) const;
ARRAY *getDifferentValues() const;
static ARRAY *Add(const ARRAY *a1, const ARRAY *a2);
void addEqual(const ARRAY *other);
{
if(PyInt_Check(nbOfTuples))
{
- mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive set of allocated memory !");
if(nbOfComp)
{
if(PyInt_Check(nbOfComp))
{//ARRAY.New([1,3,4,5],2,2)
- mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive number of components !");
MCAuto<ARRAY> ret=ARRAY::New();
}
else if(PyInt_Check(elt0))
{
- INT nbOfTuples1=PyInt_AS_LONG(elt0);
+ INT nbOfTuples1=(INT)PyInt_AS_LONG(elt0);
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive set of allocated memory !");
if(nbOfTuples)
{
if(PyInt_Check(nbOfTuples))
{//ARRAY.New(5,2)
- INT nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ INT nbOfCompo=(INT)PyInt_AS_LONG(nbOfTuples);
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive number of components !");
MCAuto<ARRAY> ret=ARRAY::New();
return self->reprNotTooLong();
}
- INT __len__() const
+ mcIdType __len__() const
{
if(self->isAllocated())
{
PyObject *accumulate() const
{
- mcIdType sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<INT> tmp=new INT[sz];
self->accumulate((INT *)tmp);
return convertIntArrToPyList((const INT *)tmp,sz);
GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"ARRAY::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
if(strt==std::numeric_limits<INT>::max() || stp==std::numeric_limits<INT>::max())
throw INTERP_KERNEL::Exception("ARRAY::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);
+ return self->buildExplicitArrOfSliceOnScaledArr((INT)strt,(INT)stp,(INT)step);
}
PyObject *getMinMaxValues() const
{
if(PyInt_Check(nbOfTuples))
{
- mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("ARRAY::setValue : should be a positive set of allocated memory !");
if(nbOfComp && nbOfComp != Py_None)
{
if(PyInt_Check(nbOfComp))
{//ARRAY.setValues([1,3,4,5],2,2)
- mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("ARRAY::setValue : should be a positive number of components !");
std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(li,nbOfTuples1,nbOfCompo);
PyObject *getValuesAsTuple() const
{
const INT *vals=self->getConstPointer();
- mcIdType nbOfComp=self->getNumberOfComponents();
+ mcIdType nbOfComp=ToIdType(self->getNumberOfComponents());
mcIdType nbOfTuples=self->getNumberOfTuples();
return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
}
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 ));
- mcIdType sz=fidsOfGroups.size();
+ std::size_t sz=fidsOfGroups.size();
PyObject *ret1 = PyList_New(sz);
- for(mcIdType i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
PyList_SetItem(ret,1,ret1);
return ret;
PyObject *getTuple(mcIdType tupleId)
{
- mcIdType sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<INT> tmp=new INT[sz];
self->getTuple(tupleId,tmp);
return convertIntArrToPyList((const INT*)tmp,sz);
mcIdType index(PyObject *obj) const
{
- mcIdType nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 1:
bool __contains__(PyObject *obj) const
{
- mcIdType nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 0:
const char msg2[]="ARRAY::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
self->checkAllocated();
mcIdType nbOfTuples=self->getNumberOfTuples();
- mcIdType nbOfComponents=self->getNumberOfComponents();
+ std::size_t nbOfComponents=self->getNumberOfComponents();
mcIdType it1;
std::size_t ic1;
std::vector<mcIdType> vt1;
std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
DataArrayIdType *dt1=0,*dc1=0;
mcIdType sw;
- convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
+ convertObjToPossibleCpp3(obj,nbOfTuples,(int)nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
MCAuto<ARRAY> ret;
switch(sw)
{
self->checkAllocated();
const char msg[]="Unexpected situation in __setitem__ !";
mcIdType nbOfTuples=self->getNumberOfTuples();
- mcIdType nbOfComponents=self->getNumberOfComponents();
+ int nbOfComponents=(int)self->getNumberOfComponents();
mcIdType sw1,sw2;
INT i1;
std::vector<INT> v1;
{
const char msg2[]="ARRAY ## Tuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
mcIdType sw;
- mcIdType singleVal;
- std::vector<mcIdType> multiVal;
+ INT singleVal;
+ std::vector<INT> multiVal;
std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
MEDCoupling::DataArrayIdType *daIntTyypp=0;
const INT *pt=self->getConstPointer();
- INT nbc=self->getNumberOfCompo();
- convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ INT nbc=(INT)self->getNumberOfCompo();
+ convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,ToIdType(nbc),sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
case 1:
{
- if(singleVal>=nbc)
+ if(singleVal>=(INT)nbc)
{
std::ostringstream oss;
oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
case 2:
{
PyObject *t=PyTuple_New(multiVal.size());
- for(INT j=0;j<(INT)multiVal.size();j++)
+ for(std::size_t j=0;j<multiVal.size();j++)
{
INT cid=multiVal[j];
- if(cid>=nbc)
+ if(cid>=(INT)nbc)
{
std::ostringstream oss;
oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
}
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<sz;j++)
PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
std::vector<mcIdType> multiValV;
std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slicV;
MEDCoupling::ARRAY ## Tuple *daIntTyyppV=0;
- INT nbc=self->getNumberOfCompo();
+ mcIdType nbc=ToIdType(self->getNumberOfCompo());
convertObjToPossibleCpp22<INT>(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
INT singleVal;
std::vector<INT> multiVal;
{
case 1:
{
- pt[singleVal]=singleValV;
+ pt[singleVal]=(INT)singleValV;
return self;
}
case 2:
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];
+ pt[singleVal]=(INT)multiValV[0];
return self;
}
case 4:
oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- pt[*it]=singleValV;
+ pt[*it]=(INT)singleValV;
}
return self;
}
oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- pt[multiVal[i]]=multiValV[i];
+ pt[multiVal[i]]=(INT)multiValV[i];
}
return self;
}
}
case 3:
{
- INT sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
+ std::size_t sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
switch(sw1)
{
case 1:
{
- for(INT j=0;j<sz;j++)
- pt[slic.first+j*slic.second.second]=singleValV;
+ for(std::size_t j=0;j<sz;j++)
+ pt[slic.first+j*slic.second.second]=(INT)singleValV;
return self;
}
case 2:
{
- if(sz!=(INT)multiValV.size())
+ if(sz!=multiValV.size())
{
std::ostringstream oss;
oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(INT j=0;j<sz;j++)
- pt[slic.first+j*slic.second.second]=multiValV[j];
+ for(std::size_t j=0;j<sz;j++)
+ pt[slic.first+j*slic.second.second]=(INT)multiValV[j];
return self;
}
case 4:
{
const INT *ptV=daIntTyyppV->getConstPointer();
- if(sz>(INT)daIntTyyppV->getNumberOfCompo())
+ if(sz>daIntTyyppV->getNumberOfCompo())
{
std::ostringstream oss;
oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- for(INT j=0;j<sz;j++)
+ for(std::size_t j=0;j<sz;j++)
pt[slic.first+j*slic.second.second]=ptV[j];
return self;
}
pass
# test of static method DataArrayInt::meld
dai1=da1C.convertToIntArr();
- dai4=DataArrayInt.Meld(dai1,dai3);
- tmp=DataArrayInt.Meld([dai1,dai3]);
+ dai4=DataArrayInt32.Meld(dai1,dai3);
+ tmp=DataArrayInt32.Meld([dai1,dai3]);
self.assertTrue(dai4.isEqual(tmp))
self.assertEqual(5,dai4.getNumberOfComponents());
self.assertEqual(7,dai4.getNumberOfTuples());
self.assertTrue(d.isEqual(d1,1e-12));
#
d2=d.convertToIntArr();
- d4=DataArrayInt.New();
+ d4=DataArrayInt32.New();
self.assertTrue(not d2.isEqual(d4));
d4.deepCopyFrom(d2);
self.assertTrue(d2.isEqual(d4));
typedef int mcIdType;
typedef DataArrayInt32 DataArrayIdType;
%template(ivec) std::vector<int>;
+%template(i64vec) std::vector<long>;
#else
//typedef std::int64_t mcIdType;
typedef long int mcIdType;
typedef DataArrayInt64 DataArrayIdType;
%template(ivec) std::vector<long>;
+%template(i32vec) std::vector<int>;
#endif
Py_ssize_t sz(sizeof(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[0])));
auto maxElt(*std::max_element(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER,MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz));
auto szOut(maxElt+1);
- std::vector< int > retCpp(szOut,-1);
+ std::vector< mcIdType > retCpp(szOut,-1);
mcIdType id(0);
for(const mcIdType *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++)
{
return ret2;
}
- int getCellContainingPoint(PyObject *p, double eps) const
+ mcIdType getCellContainingPoint(PyObject *p, double eps) const
{
double val;
DataArrayDouble *a;
for(std::size_t j=0;j<vals.size()/3;j++)
{
PyObject *ret1=PyList_New(3);
- PyList_SetItem(ret1,0,SWIG_From_int(vals[3*j]));
- PyList_SetItem(ret1,1,SWIG_From_int(vals[3*j+1]));
- PyList_SetItem(ret1,2,SWIG_From_int(vals[3*j+2]));
+ PyList_SetItem(ret1,0,PyInt_FromLong(vals[3*j]));
+ PyList_SetItem(ret1,1,PyInt_FromLong(vals[3*j+1]));
+ PyList_SetItem(ret1,2,PyInt_FromLong(vals[3*j+2]));
PyList_SetItem(ret,j,ret1);
}
return ret;
for(std::size_t j=0;j<code.size()/3;j++)
{
PyObject *ret00=PyList_New(3);
- PyList_SetItem(ret00,0,SWIG_From_int(code[3*j]));
- PyList_SetItem(ret00,1,SWIG_From_int(code[3*j+1]));
- PyList_SetItem(ret00,2,SWIG_From_int(code[3*j+2]));
+ PyList_SetItem(ret00,0,PyInt_FromLong(code[3*j]));
+ PyList_SetItem(ret00,1,PyInt_FromLong(code[3*j+1]));
+ PyList_SetItem(ret00,2,PyInt_FromLong(code[3*j+2]));
PyList_SetItem(ret0,j,ret00);
}
PyTuple_SetItem(ret,0,ret0);
PyObject *ret(PyTuple_New(3));
PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
- mcIdType sz(a2.size());
+ std::size_t sz(a2.size());
PyObject *ret2(PyList_New(sz));
{
- for(mcIdType i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
}
PyTuple_SetItem(ret,2,ret2);
static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !";
if(!PyTuple_Check(inp))
throw INTERP_KERNEL::Exception(MSG);
- mcIdType sz(PyTuple_Size(inp));
+ std::size_t sz(PyTuple_Size(inp));
if(sz!=2)
throw INTERP_KERNEL::Exception(MSG);
PyObject *elt0(PyTuple_GetItem(inp,0));
DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes);
PyObject *res = PyList_New(2);
PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes));
+ PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes));
return res;
}
PyObject *res = PyList_New(3);
PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyList_SetItem(res,1,SWIG_From_bool(ret1));
- PyList_SetItem(res,2,SWIG_From_int(ret2));
+ PyList_SetItem(res,2,PyInt_FromLong(ret2));
return res;
}
PyObject *res = PyList_New(3);
PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyList_SetItem(res,1,SWIG_From_bool(ret1));
- PyList_SetItem(res,2,SWIG_From_int(ret2));
+ PyList_SetItem(res,2,PyInt_FromLong(ret2));
return res;
}
static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType)
{
- mcIdType sz;
+ std::size_t sz;
std::vector<const MEDCouplingUMesh *> meshes;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes);
std::vector<DataArrayIdType *> corr;
MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr);
sz=corr.size();
PyObject *ret1=PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret1,i,SWIG_NewPointerObj(SWIG_as_voidptr(corr[i]),SWIGTITraits<mcIdType>::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 ));
{
return MEDCouplingIMesh::New();
}
- static MEDCouplingIMesh *New(const std::string& meshName, mcIdType spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
+ static MEDCouplingIMesh *New(const std::string& meshName, int 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 !";
return MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctPtr,nodeStrctPtr+sz,originPtr,originPtr+sz1,dxyzPtr,dxyzPtr+sz2);
}
- MEDCouplingIMesh(const std::string& meshName, mcIdType spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
+ MEDCouplingIMesh(const std::string& meshName, int spaceDim, PyObject *nodeStrct, PyObject *origin, PyObject *dxyz)
{
return MEDCoupling_MEDCouplingIMesh_New__SWIG_1(meshName,spaceDim,nodeStrct,origin,dxyz);
}
void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg);
void clearGaussLocalizations();
- MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId);
+ MEDCouplingGaussLocalization& getGaussLocalization(int locId);
mcIdType getNbOfGaussLocalization() const;
mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
- const MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId) const;
+ const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
%extend {
}
}
- PyObject *getCellIdsHavingGaussLocalization(mcIdType locId) const
+ PyObject *getCellIdsHavingGaussLocalization(int locId) const
{
std::vector<mcIdType> tmp;
self->getCellIdsHavingGaussLocalization(locId,tmp);
for(std::vector<DataArrayDouble *>::iterator it=arrs.begin();it!=arrs.end();it++)
if(*it)
(*it)->incrRef();
- int sz=arrs.size();
+ std::size_t sz=arrs.size();
PyObject *ret=PyTuple_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(arrs[i])
PyTuple_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(arrs[i]),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : ";
const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
//
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOn(spaceLoc,res);
return convertDblArrToPyList<double>(res,sz);
PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOnPos(i,j,k,res);
return convertDblArrToPyList<double>(res,sz);
double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector<double> v3;
const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti",
mesh->getSpaceDimension(),true,nbPts);
- return self->getValueOnMulti(inp,nbPts);
+ return self->getValueOnMulti(inp,(int)nbPts);
}
PyObject *getValueOn(PyObject *sl, double time) const
const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true);
//
//
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOn(spaceLoc,time,res);
return convertDblArrToPyList<double>(res,sz);
}
PyObject *accumulate() const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->accumulate(tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *integral(bool isWAbs) const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->integral(isWAbs,tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *getWeightedAverageValue(bool isWAbs=true) const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->getWeightedAverageValue(tmp,isWAbs);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *normL1() const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normL1(tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *normL2() const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normL2(tmp);
return convertDblArrToPyList<double>(tmp,sz);
}
PyObject *normMax() const
{
- int sz=self->getNumberOfComponents();
+ mcIdType sz=ToIdType(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normMax(tmp);
return convertDblArrToPyList<double>(tmp,sz);
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
mcIdType sw;
- mcIdType spaceDim=3;
+ int 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);
{
std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
+ std::size_t sz=tmp.size();
std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
return MEDCouplingMultiFields::New(fs);
}
{
std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
+ std::size_t sz=tmp.size();
std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
return MEDCouplingMultiFields::New(fs);
}
PyObject *getFields() const
{
std::vector<const MEDCouplingFieldDouble *> fields=self->getFields();
- int sz=fields.size();
+ std::size_t sz=fields.size();
PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(fields[i])
{
PyObject *getMeshes() const
{
std::vector<MEDCouplingMesh *> ms=self->getMeshes();
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(ms[i])
{
{
std::vector<int> refs;
std::vector<MEDCouplingMesh *> ms=self->getDifferentMeshes(refs);
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(ms[i])
{
PyObject *getArrays() const
{
std::vector<DataArrayDouble *> ms=self->getArrays();
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *res = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(ms[i])
{
{
std::vector< std::vector<int> > refs;
std::vector<DataArrayDouble *> ms=self->getDifferentArrays(refs);
- int sz=ms.size();
+ std::size_t sz=ms.size();
PyObject *res = PyList_New(sz);
PyObject *res2 = PyList_New(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
if(ms[i])
{
{
std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
+ std::size_t sz=tmp.size();
std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
return MEDCouplingFieldOverTime::New(fs);
}
return self->simpleRepr();
}
static MEDCouplingFieldOverTime *New(PyObject *li)
- {
- std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
- int sz=tmp.size();
- std::vector<MEDCouplingFieldDouble *> fs(sz);
- for(int i=0;i<sz;i++)
- fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
- return MEDCouplingFieldOverTime::New(fs);
- }
+ {
+ std::vector<const MEDCoupling::MEDCouplingFieldDouble *> tmp;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingFieldDouble *>(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp);
+ std::size_t sz=tmp.size();
+ std::vector<MEDCouplingFieldDouble *> fs(sz);
+ for(std::size_t i=0;i<sz;i++)
+ fs[i]=const_cast<MEDCouplingFieldDouble *>(tmp[i]);
+ return MEDCouplingFieldOverTime::New(fs);
+ }
}
};
PyObject *getPatches() const
{
std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches());
- mcIdType sz(ps.size());
+ std::size_t sz(ps.size());
PyObject *ret = PyList_New(sz);
- for(mcIdType i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
{
MEDCouplingCartesianAMRPatch *elt(const_cast<MEDCouplingCartesianAMRPatch *>(ps[i]));
if(elt)
virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const
{
std::vector<MEDCouplingCartesianAMRPatchGen *> ps(self->retrieveGridsAt(absoluteLev));
- mcIdType sz(ps.size());
+ std::size_t sz(ps.size());
PyObject *ret = PyList_New(sz);
- for(mcIdType i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret,i,convertCartesianAMRPatch(ps[i], SWIG_POINTER_OWN | 0 ));
return ret;
}
throw INTERP_KERNEL::Exception(msgInCaseOfFailure);
}
-int InterpreteNegativeInt(int val, int nbelem)
+int InterpreteNegativeInt(long val, mcIdType nbelem)
{
if(val<0)
{
- int newVal(nbelem+val);
+ int newVal((int)(nbelem+val));
if(newVal<0)
{
std::ostringstream oss; oss << "interpreteNegativeInt : request for negative int=" << val << " but number of elems is equal to " << nbelem << " !";
return newVal;
}
else
- return val;
+ return (int)val;
}
#ifdef WITH_NUMPY
}
template<class MCData, class T>
-PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *MCDataStr, int nbTuples, int nbComp)
+PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *MCDataStr, mcIdType nbTuples, std::size_t nbComp)
{
if(!self->isAllocated())
{
}
int nbDims=nbComp==1?1:2;
npy_intp dim[2];
- dim[0]=(npy_intp)nbTuples; dim[1]=nbComp;
+ dim[0]=(npy_intp)nbTuples; dim[1]=(npy_intp)nbComp;
const T *bg=self->getConstPointer();
PyObject *ret(PyArray_SimpleNewFromData(nbDims,dim,npyObjectType,const_cast<T *>(bg)));
if(mem.isDeallocatorCalled())
template<class T>
static PyObject *convertIntArrToPyList2(const std::vector<T>& v)
{
- T size=v.size();
+ std::size_t size=v.size();
PyObject *ret=PyList_New(size);
- for(T i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
PyList_SetItem(ret,i,PyInt_FromLong(v[i]));
return ret;
}
template<class T>
static PyObject *convertIntArrToPyList3(const std::set<T>& v)
{
- T size=v.size();
+ std::size_t size=v.size();
PyObject *ret=PyList_New(size);
typename std::set<T>::const_iterator it=v.begin();
- for(T i=0;i<size;i++,it++)
+ for(std::size_t i=0;i<size;i++,it++)
PyList_SetItem(ret,i,PyInt_FromLong(*it));
return ret;
}
{
if(PyList_Check(pyLi))
{
- *size=PyList_Size(pyLi);
+ *size=ToIdType(PyList_Size(pyLi));
T *tmp=new T[*size];
for(mcIdType i=0;i<*size;i++)
{
}
else if(PyTuple_Check(pyLi))
{
- *size=PyTuple_Size(pyLi);
+ *size=ToIdType(PyTuple_Size(pyLi));
T *tmp=new T[*size];
for(mcIdType i=0;i<*size;i++)
{
const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !";
if(PyList_Check(pyLi))
{
- mcIdType size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
arr.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- mcIdType sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o_0=PyTuple_GetItem(o,0);
}
else if(PyTuple_Check(pyLi))
{
- mcIdType size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
arr.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- mcIdType sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o_0=PyTuple_GetItem(o,0);
const char msg[]="convertPyToVectorPairStringInt : list must contain tuples of 2 integers only or tuple must contain tuples of 1 string and 1 integer only !";
if(PyList_Check(pyLi))
{
- mcIdType size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
arr.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- mcIdType sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o_0=PyTuple_GetItem(o,0);
arr[i].first=convertPyObjectToStr(o_0,msg);
if(!PyInt_Check(o_1))
throw INTERP_KERNEL::Exception(msg);
- arr[i].second=(mcIdType)PyInt_AS_LONG(o_1);
+ arr[i].second=(int)PyInt_AS_LONG(o_1);
}
else
throw INTERP_KERNEL::Exception(msg);
}
else if(PyTuple_Check(pyLi))
{
- mcIdType size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
arr.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- mcIdType sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
PyObject *o_0=PyTuple_GetItem(o,0);
arr[i].first=convertPyObjectToStr(o_0,msg);
if(!PyInt_Check(o_1))
throw INTERP_KERNEL::Exception(msg);
- arr[i].second=(mcIdType)PyInt_AS_LONG(o_1);
+ arr[i].second=(int)PyInt_AS_LONG(o_1);
}
else
throw INTERP_KERNEL::Exception(msg);
arr.clear();
if(PyList_Check(pyLi))
{
- mcIdType size=PyList_Size(pyLi);
- for(mcIdType i=0;i<size;i++)
+ std::size_t size=PyList_Size(pyLi);
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyInt_Check(o))
}
else if(PyTuple_Check(pyLi))
{
- mcIdType size=PyTuple_Size(pyLi);
- for(mcIdType i=0;i<size;i++)
+ std::size_t size=PyTuple_Size(pyLi);
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyInt_Check(o))
{
- mcIdType val=(int)PyInt_AS_LONG(o);
+ mcIdType val=ToIdType(PyInt_AS_LONG(o));
arr.push_back(val);
}
else
static const char MSG[]="fillArrayWithPyListInt3 : It appears that the input list or tuple is composed by elts having different sizes !";
if(PyInt_Check(pyLi))
{
- T val=PyInt_AS_LONG(pyLi);
+ T val=(T)PyInt_AS_LONG(pyLi);
if(nbOfElt==-1)
nbOfElt=1;
else
}
else if(PyList_Check(pyLi))
{
- mcIdType size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
mcIdType tmp=0;
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
mcIdType tmp1=-1;
}
else if(PyTuple_Check(pyLi))
{
- mcIdType size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
mcIdType tmp=0;
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
mcIdType tmp1=-1;
mcIdType size1=-1,size2=-1;
if(PyList_Check(pyLi))
{
- size1=PyList_Size(pyLi);
+ size1=ToIdType(PyList_Size(pyLi));
for(mcIdType i=0;i<size1;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
}
else if(PyTuple_Check(pyLi))
{
- size1=PyTuple_Size(pyLi);
+ size1=ToIdType(PyTuple_Size(pyLi));
for(mcIdType i=0;i<size1;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
{
PyObject *o=PyList_GetItem(pyLi,i);
if(PyInt_Check(o))
- vec[i]=PyInt_AS_LONG(o);
+ vec[i]=ToIdType(PyInt_AS_LONG(o));
else
return false;
}
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyInt_Check(o))
- vec[i]=PyInt_AS_LONG(o);
+ vec[i]=ToIdType(PyInt_AS_LONG(o));
else
return false;
}
PyObject *o=PyList_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- mcIdType sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
std::pair<std::string, std::vector<std::string> > item;
{
Py_ssize_t sz=PyTuple_Size(pyLi);
arr.resize(sz);
- for(mcIdType i=0;i<sz;i++)
+ for(Py_ssize_t i=0;i<sz;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
if(PyTuple_Check(o))
{
- mcIdType sz2=PyTuple_Size(o);
+ std::size_t sz2=PyTuple_Size(o);
if(sz2!=2)
throw INTERP_KERNEL::Exception(msg);
std::pair<std::string, std::vector<std::string> > item;
}
template<class T>
-PyObject *convertDblArrToPyList(const T *ptr, mcIdType size)
+PyObject *convertDblArrToPyList(const T *ptr, std::size_t size)
{
PyObject *ret(PyList_New(size));
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
PyList_SetItem(ret,i,PyFloat_FromDouble(ptr[i]));
return ret;
}
static PyObject *convertDblArrToPyList2(const std::vector<double>& v)
{
- mcIdType size(v.size());
+ std::size_t size(v.size());
PyObject *ret(PyList_New(size));
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
PyList_SetItem(ret,i,PyFloat_FromDouble(v[i]));
return ret;
}
template<class T>
-PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, mcIdType nbOfTuples)
+PyObject *convertDblArrToPyListOfTuple(const T *vals, std::size_t nbOfComp, mcIdType nbOfTuples)
{
PyObject *ret(PyList_New(nbOfTuples));
for(mcIdType i=0;i<nbOfTuples;i++)
{
PyObject *t=PyTuple_New(nbOfComp);
- for(mcIdType j=0;j<nbOfComp;j++)
+ for(std::size_t j=0;j<nbOfComp;j++)
PyTuple_SetItem(t,j,PyFloat_FromDouble(vals[i*nbOfComp+j]));
PyList_SetItem(ret,i,t);
}
{
if(PyList_Check(pyLi))
{
- *size=PyList_Size(pyLi);
+ *size=ToIdType(PyList_Size(pyLi));
double *tmp=(double *)malloc((*size)*sizeof(double));
for(mcIdType i=0;i<*size;i++)
{
}
else if(PyInt_Check(o))
{
- mcIdType val0=PyInt_AS_LONG(o);
- double val=val0;
+ long val0=PyInt_AS_LONG(o);
+ double val=(double)val0;
tmp[i]=val;
}
else
}
else if(PyTuple_Check(pyLi))
{
- *size=PyTuple_Size(pyLi);
+ *size=ToIdType(PyTuple_Size(pyLi));
double *tmp=(double *)malloc((*size)*sizeof(double));
for(mcIdType i=0;i<*size;i++)
{
}
else if(PyInt_Check(o))
{
- mcIdType val0=PyInt_AS_LONG(o);
- double val=val0;
+ long val0=PyInt_AS_LONG(o);
+ double val=(double)val0;
tmp[i]=val;
}
else
}
else if(PyInt_Check(pyLi))
{
- mcIdType val0=PyInt_AS_LONG(pyLi);
- double val=val0;
+ mcIdType val0=ToIdType(PyInt_AS_LONG(pyLi));
+ double val=(double)val0;
if(nbOfElt==-1)
nbOfElt=1;
else
}
else if(PyList_Check(pyLi))
{
- mcIdType size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
mcIdType tmp=0;
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
mcIdType tmp1=-1;
}
else if(PyTuple_Check(pyLi))
{
- mcIdType size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
mcIdType tmp=0;
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
mcIdType tmp1=-1;
static std::vector<double> fillArrayWithPyListDbl2(PyObject *pyLi, mcIdType& nbOfTuples, mcIdType& nbOfComp)
{
std::vector<double> ret;
- mcIdType size1=-1,size2=-1;
+ std::size_t size1=-1;
+ mcIdType size2=-1;
if(PyList_Check(pyLi))
{
size1=PyList_Size(pyLi);
- for(mcIdType i=0;i<size1;i++)
+ for(std::size_t i=0;i<size1;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
fillArrayWithPyListDbl3(o,size2,ret);
else if(PyTuple_Check(pyLi))
{
size1=PyTuple_Size(pyLi);
- for(mcIdType i=0;i<size1;i++)
+ for(std::size_t i=0;i<size1;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
fillArrayWithPyListDbl3(o,size2,ret);
else
throw INTERP_KERNEL::Exception("fillArrayWithPyListDbl2 : Unrecognized type ! Should be a tuple or a list !");
//
- checkFillArrayWithPyList(size1,size2,nbOfTuples,nbOfComp);
+ checkFillArrayWithPyList(ToIdType(size1),ToIdType(size2),nbOfTuples,nbOfComp);
return ret;
}
void *argp=0;
if(PyList_Check(pyLi))
{
- mcIdType size=PyList_Size(pyLi);
+ std::size_t size=PyList_Size(pyLi);
ret.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *obj=PyList_GetItem(pyLi,i);
int status=SWIG_ConvertPtr(obj,&argp,ty,0|0);
}
else if(PyTuple_Check(pyLi))
{
- mcIdType size=PyTuple_Size(pyLi);
+ std::size_t size=PyTuple_Size(pyLi);
ret.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *obj=PyTuple_GetItem(pyLi,i);
int status=SWIG_ConvertPtr(obj,&argp,ty,0|0);
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyInt_Check(o))
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyInt_Check(o))
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyInt_Check(o))
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- sw=2; sz=size;
+ sw=2; sz=ToIdType(size);
return &stdvecTyypp[0];
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyInt_Check(o))
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- sw=2; sz=size;
+ sw=2; sz=ToIdType(size);
return &stdvecTyypp[0];
}
void *argp;
{
typedef typename MEDCoupling::Traits< T >::ArrayTuple ARRAYTUPLE;
ARRAYTUPLE *daIntTuple=reinterpret_cast< ARRAYTUPLE * >(argp);
- sw=4; sz=daIntTuple->getNumberOfCompo();
+ sw=4; sz=ToIdType(daIntTuple->getNumberOfCompo());
return daIntTuple->getConstPointer();
}
throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayIdType, DataArrayIdTypeTuple");
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
sw=-1;
if(PyFloat_Check(value))
{
- val=PyFloat_AS_DOUBLE(value);
+ val=(T)PyFloat_AS_DOUBLE(value);
sw=1;
return;
}
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
f.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
- f[i]=PyFloat_AS_DOUBLE(o);
+ f[i]=(T)PyFloat_AS_DOUBLE(o);
else if(PyInt_Check(o))
f[i]=(T)PyInt_AS_LONG(o);
else
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
f.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
- f[i]=PyFloat_AS_DOUBLE(o);
+ f[i]=(T)PyFloat_AS_DOUBLE(o);
else if(PyInt_Check(o))
f[i]=(T)PyInt_AS_LONG(o);
else
sw=-1;
if(PyInt_Check(value))
{
- iTyypp=(mcIdType)PyInt_AS_LONG(value);
+ iTyypp=(T)PyInt_AS_LONG(value);
sw=1;
return;
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(mcIdType)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyInt_Check(o))
- stdvecTyypp[i]=(mcIdType)PyInt_AS_LONG(o);
+ stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
else
{
std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
- p.first=strt;
- p.second.first=stp;
- p.second.second=step;
+ p.first=ToIdType(strt);
+ p.second.first=ToIdType(stp);
+ p.second.second=ToIdType(step);
sw=3;
return ;
}
convertIntStarOrSliceLikePyObjToCpp(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp);
if(sw==1)
{
- iTyypp=InterpreteNegativeInt(iTyypp,nbelem);
+ iTyypp=(T)InterpreteNegativeInt(iTyypp,nbelem);
}
}
sw=-1;
if(PyInt_Check(value))
{
- iTyypp=(mcIdType)PyInt_AS_LONG(value);
+ iTyypp=ToIdType(PyInt_AS_LONG(value));
sw=1;
return;
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyInt_Check(o))
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
stdvecTyypp.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyInt_Check(o))
{
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
- p.first=strt;
- p.second.first=stp;
- p.second.second=step;
+ p.first=ToIdType(strt);
+ p.second.first=ToIdType(stp);
+ p.second.second=ToIdType(step);
sw=3;
return ;
}
#endif
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
vsType.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
try
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
vsType.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
try
}
else
{
- mcIdType sz=PyTuple_Size(value);
+ std::size_t 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);
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
f.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- nbTuples=size/nbCompExpected;
+ nbTuples=ToIdType(size/nbCompExpected);
return &f[0];
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
f.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- nbTuples=size/nbCompExpected;
+ nbTuples=ToIdType(size/nbCompExpected);
return &f[0];
}
void *argp;
}
if(PyTuple_Check(value))
{
- mcIdType size=PyTuple_Size(value);
+ std::size_t size=PyTuple_Size(value);
f.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(value,i);
if(PyFloat_Check(o))
}
}
sw=4;
- nbTuples=size;
+ nbTuples=ToIdType(size);
return &f[0];
}
if(PyList_Check(value))
{
- mcIdType size=PyList_Size(value);
+ std::size_t size=PyList_Size(value);
f.resize(size);
- for(mcIdType i=0;i<size;i++)
+ for(std::size_t i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(value,i);
if(PyFloat_Check(o))
}
}
sw=4;
- nbTuples=size;
+ nbTuples=ToIdType(size);
return &f[0];
}
void *argp;
sw=3;
if(e)
{
- nbTuples=e->getNumberOfCompo();
+ nbTuples=ToIdType(e->getNumberOfCompo());
return e->getConstPointer();
}
else
{
if(PyInt_Check(nbOfTuples))
{
- mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(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)
- mcIdType nbOfCompo=PyInt_AS_LONG(elt2);
+ mcIdType nbOfCompo=ToIdType(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<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
}
else if(PyInt_Check(elt0))
{
- mcIdType nbOfTuples1(PyInt_AS_LONG(elt0));
+ mcIdType nbOfTuples1(ToIdType(PyInt_AS_LONG(elt0)));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
if(nbOfTuples)
{
if(PyInt_Check(nbOfTuples))
{//DataArrayDouble.New(5,2)
- mcIdType nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfCompo=ToIdType(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<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
{
self->checkAllocated();
const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
- mcIdType nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
+ mcIdType nbOfTuples(self->getNumberOfTuples());
+ int nbOfComponents((int)(self->getNumberOfComponents()));
mcIdType sw1,sw2;
T i1;
std::vector<T> v1;
const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
self->checkAllocated();
- mcIdType nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
+ mcIdType nbOfTuples(self->getNumberOfTuples());
+ int nbOfComponents((int)(self->getNumberOfComponents()));
mcIdType it1;
std::size_t ic1;
std::vector<mcIdType> vt1;
case 13:
{
ret=self->selectByTupleIdSafe(&it1,&it1+1);
- int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
std::vector<std::size_t> v2(nbOfComp);
for(mcIdType i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
case 14:
{
ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
std::vector<std::size_t> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
case 15:
{
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));
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
std::vector<std::size_t> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
case 16:
{
ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
+ mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
std::vector<std::size_t> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
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[(mcIdType)PyInt_AS_LONG(key)]=PyFloat_AS_DOUBLE(value);
+ mapCpp[ToIdType(PyInt_AS_LONG(key))]=PyFloat_AS_DOUBLE(value);
}
}
}
{
if(val==0.)
throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
- self->applyLin(1./val,0.);
+ self->applyLin((T)(1./val),(T)0.);
Py_XINCREF(trueSelf);
return trueSelf;
}
{
if(!arr)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::normL1 : input array is null !");
- int sz(arr->getNumberOfComponents());
+ std::size_t sz(arr->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normL1(mesh,arr,tmp);
return convertDblArrToPyList<double>(tmp,sz);
{
if(!arr)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::normL2 : input array is null !");
- int sz(arr->getNumberOfComponents());
+ std::size_t sz(arr->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->normL2(mesh,arr,tmp);
return convertDblArrToPyList<double>(tmp,sz);
{
if(!arr)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::integral : input array is null !");
- int sz(arr->getNumberOfComponents());
+ std::size_t sz(arr->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->integral(mesh,arr,isWAbs,tmp);
return convertDblArrToPyList<double>(tmp,sz);
{
if(!arr)
throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::getValueOnPos : input array is null !");
- int sz(arr->getNumberOfComponents());
+ std::size_t sz(arr->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> res=new double[sz];
self->getValueOnPos(arr,mesh,i,j,k,res);
return convertDblArrToPyList<double>(res,sz);
{
std::size_t sz(0);
const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType(geoType,sz));
- return convertDblArrToPyList<double>(ret,sz);
+ return convertDblArrToPyList<double>(ret,ToIdType(sz));
}
static PyObject *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType)
{
std::size_t sz(0);
const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType(geoType,sz));
- return convertDblArrToPyList<double>(ret,sz);
+ return convertDblArrToPyList<double>(ret,ToIdType(sz));
}
static PyObject *GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType)
{
std::size_t sz(0);
const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType(geoType,sz));
- return convertDblArrToPyList<double>(ret,sz);
+ return convertDblArrToPyList<double>(ret,ToIdType(sz));
}
}
};
void checkNbOfComps(int nbOfCompo, const std::string& msg) const;
void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const;
void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const;
- void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const;
+ void checkNbOfElems(mcIdType nbOfElems, const std::string& msg) const;
static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg);
static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg);
static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step);
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
mcIdType a,b;
- DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
+ DataArray::GetSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),sliceId,nbOfSlices,a,b);
return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
}
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
mcIdType a,b;
- DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
+ DataArray::GetSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),sliceId,nbOfSlices,a,b);
return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
}
throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
- return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
+ return DataArray::GetNumberOfItemGivenBES(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
static mcIdType GetNumberOfItemGivenBESRelative(PyObject *slic)
throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
Py_ssize_t strt=2,stp=2,step=2;
GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
- return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
+ return DataArray::GetNumberOfItemGivenBESRelative(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
static DataArray *Aggregate(PyObject *arrs)
throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (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::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
- return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
+ return DataArray::GetNumberOfItemGivenBES(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
mcIdType getNumberOfItemGivenBESRelative(PyObject *slic)
throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (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::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
- return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
+ return DataArray::GetNumberOfItemGivenBESRelative(ToIdType(strt),ToIdType(stp),ToIdType(step),"");
}
PyObject *__getstate__() const
const std::vector<std::string> &a1(self->getInfoOnComponents());
PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
//
- mcIdType sz(a1.size());
+ std::size_t sz(a1.size());
PyObject *ret1(PyList_New(sz));
- for(mcIdType i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
PyTuple_SetItem(ret,1,ret1);
//
static const char MSG[]="DataArrayDouble.__setstate__ : expected input is a tuple of size 2 with string as 1st arg and list of string as 2nd arg !";
if(!PyTuple_Check(inp))
throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
- mcIdType sz(PyTuple_Size(inp));
+ std::size_t sz(PyTuple_Size(inp));
if(sz!=2)
throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
PyObject *a0(PyTuple_GetItem(inp,0));
PyObject *getValuesAsTuple() const
{
const float *vals(self->begin());
- mcIdType nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
+ std::size_t nbOfComp(self->getNumberOfComponents());
+ mcIdType nbOfTuples(self->getNumberOfTuples());
return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
}
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 setPartOfValuesSimple1(double a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp);
void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayIdType *tuplesSelec);
double getIJ(int tupleId, int compoId) const;
double front() const;
MCAuto<DataArrayIdType> findIdsGreaterThan(double val) const;
MCAuto<DataArrayIdType> findIdsLowerOrEqualTo(double val) const;
MCAuto<DataArrayIdType> findIdsLowerThan(double val) const;
- MCAuto<DataArrayIdType> convertToIntArr() const;
+ MCAuto<DataArrayInt32> convertToIntArr() const;
MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const;
MCAuto<DataArrayDouble> cumSum() const;
MCAuto<DataArrayFloat> convertToFloatArr() const;
return self->doubleValue();
}
- int __len__() const
+ mcIdType __len__() const
{
if(self->isAllocated())
{
{
if(PyInt_Check(nbOfTuples))
{
- mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(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)
- mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
PyObject *getValuesAsTuple() const
{
const double *vals(self->begin());
- mcIdType nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
+ std::size_t nbOfComp(self->getNumberOfComponents());
+ mcIdType nbOfTuples(self->getNumberOfTuples());
return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
}
std::size_t nbOfCompo(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
self->getMinMaxPerComponent(tmp);
- PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
+ PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,ToIdType(nbOfCompo));
return ret;
}
std::size_t nbOfCompo(self->getNumberOfComponents());
INTERP_KERNEL::AutoPtr<double> tmp(new double[nbOfCompo]);
self->normMaxPerComponent(tmp);
- return convertDblArrToPyList<double>(tmp,nbOfCompo);
+ return convertDblArrToPyList<double>(tmp,ToIdType(nbOfCompo));
}
PyObject *accumulate() const
std::size_t sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->accumulate(tmp);
- return convertDblArrToPyList<double>(tmp,sz);
+ return convertDblArrToPyList<double>(tmp,ToIdType(sz));
}
DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const
DataArrayDoubleTuple *aa;
std::vector<double> bb;
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);
+ mcIdType tupleId=-1;
+ std::size_t nbOfCompo=self->getNumberOfComponents();
+ const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,(int)nbOfCompo,true);
//
double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
PyObject *ret=PyTuple_New(2);
std::size_t sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
self->getTuple(tupleId,tmp);
- return convertDblArrToPyList<double>(tmp,sz);
+ return convertDblArrToPyList<double>(tmp,ToIdType(sz));
}
static DataArrayDouble *Aggregate(PyObject *li)
DataArrayDoubleTuple *aa;
std::vector<double> bb;
mcIdType sw;
- mcIdType nbComp=self->getNumberOfComponents(),nbTuples=-1;
+ std::size_t nbComp=self->getNumberOfComponents();
+ mcIdType 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);
+ const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,(int)nbComp,true,nbTuples);
MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,DeallocType::CPP_DEALLOC,nbTuples,nbComp);
DataArrayIdType *c=0,*cI=0;
self->computeTupleIdsNearTuples(inpu,eps,c,cI);
std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
MEDCoupling::DataArrayIdType *daIntTyypp=0;
const double *pt=self->getConstPointer();
- mcIdType nbc=self->getNumberOfCompo();
+ mcIdType nbc=ToIdType(self->getNumberOfCompo());
convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
switch(sw)
{
double singleValV;
std::vector<double> multiValV;
MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
- mcIdType nbc=self->getNumberOfCompo();
+ mcIdType nbc=ToIdType(self->getNumberOfCompo());
convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
mcIdType singleVal;
std::vector<mcIdType> multiVal;
void fillWithValue(char val);
std::string repr() const;
std::string reprZip() const;
- DataArrayIdType *convertToIntArr() const;
+ DataArrayInt *convertToIntArr() const;
DataArrayChar *renumber(const mcIdType *old2New) const;
DataArrayChar *renumberR(const mcIdType *new2Old) const;
DataArrayChar *renumberAndReduce(const mcIdType *old2NewBg, mcIdType newNbOfTuple) const;
{
if(PyInt_Check(nbOfTuples))
{
- mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(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)
- mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
MCAuto<DataArrayByte> ret=DataArrayByte::New();
}
else if(PyInt_Check(elt0))
{
- mcIdType nbOfTuples1=PyInt_AS_LONG(elt0);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(elt0));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
if(nbOfTuples)
{
if(PyInt_Check(nbOfTuples))
{//DataArrayByte.New(5,2)
- mcIdType nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
MCAuto<DataArrayByte> ret=DataArrayByte::New();
PyObject *toStrList() const
{
const char *vals=self->getConstPointer();
- mcIdType nbOfComp=self->getNumberOfComponents();
+ std::size_t nbOfComp=self->getNumberOfComponents();
mcIdType nbOfTuples=self->getNumberOfTuples();
- return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
+ return convertCharArrToPyListOfTuple(vals,(int)nbOfComp,nbOfTuples);
}
bool presenceOfTuple(PyObject *tupl) const
PyObject *getTuple(mcIdType tupleId)
{
- mcIdType sz=self->getNumberOfComponents();
+ std::size_t sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
self->getTuple(tupleId,tmp);
PyObject *ret=PyTuple_New(sz);
- for(mcIdType i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((mcIdType)tmp[i]));
+ for(std::size_t i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((mcIdType)tmp[i]));
return ret;
}
mcIdType index(PyObject *obj) const
{
- mcIdType nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 1:
{
if(PyInt_Check(obj))
{
- mcIdType val=(mcIdType)PyInt_AS_LONG(obj);
+ char val=(char)PyInt_AS_LONG(obj);
return self->findIdFirstEqual(val);
}
else
bool __contains__(PyObject *obj) const
{
- mcIdType nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 0:
{
if(PyInt_Check(obj))
{
- mcIdType val=(mcIdType)PyInt_AS_LONG(obj);
+ char val=(char)PyInt_AS_LONG(obj);
return self->presenceOfValue(val);
}
else
{
self->checkAllocated();
const char msg[]="Unexpected situation in __setitem__ !";
- mcIdType nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
+ mcIdType nbOfTuples(self->getNumberOfTuples());
+ int nbOfComponents((int)self->getNumberOfComponents());
mcIdType sw1,sw2;
- mcIdType i1;
- std::vector<mcIdType> v1;
+ int int1;
+ std::vector<int> v1;
DataArrayIdType *d1=0;
- DataArrayIdTypeTuple *dd1=0;
- convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
+ DataArrayIntTuple *dd1=0;
+ convertIntStarLikePyObjToCpp(value,sw1,int1,v1,d1,dd1);
mcIdType it1,ic1;
std::vector<mcIdType> vt1,vc1;
std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
DataArrayIdType *dt1=0,*dc1=0;
convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
MCAuto<DataArrayIdType> tmp;
+ char i1 = (char)int1;
switch(sw2)
{
case 1:
{
if(PyInt_Check(nbOfTuples))
{
- mcIdType nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfTuples1=ToIdType(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)
- mcIdType nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
}
else if(PyInt_Check(elt0))
{
- mcIdType nbOfTuples1=PyInt_AS_LONG(elt0);
+ mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(elt0));
if(nbOfTuples1<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
if(nbOfTuples)
{
if(PyInt_Check(nbOfTuples))
{//DataArrayAsciiChar.New(5,2)
- mcIdType nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfTuples));
if(nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
PyObject *toStrList() const
{
const char *vals=self->getConstPointer();
- mcIdType nbOfComp=self->getNumberOfComponents();
+ std::size_t nbOfComp=self->getNumberOfComponents();
mcIdType nbOfTuples=self->getNumberOfTuples();
- return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
+ return convertCharArrToPyListOfTuple(vals,(int)nbOfComp,nbOfTuples);
}
bool presenceOfTuple(PyObject *tupl) const
PyObject *getTuple(mcIdType tupleId) const
{
- mcIdType sz=self->getNumberOfComponents();
+ std::size_t sz=self->getNumberOfComponents();
INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
self->getTuple(tupleId,tmp);
return PyString_FromString(tmp);
mcIdType index(PyObject *obj) const
{
- mcIdType nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 1:
bool __contains__(PyObject *obj) const
{
- mcIdType nbOfCompo=self->getNumberOfComponents();
+ std::size_t nbOfCompo=self->getNumberOfComponents();
switch(nbOfCompo)
{
case 0:
std::vector<mcIdType> stdvecTyyppArr;
std::pair<mcIdType, std::pair<mcIdType,mcIdType> > sTyyppArr;
MEDCoupling::DataArrayIdType *daIntTyypp=0;
- mcIdType nbOfCompo=self->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(self->getNumberOfComponents());
mcIdType nbOfTuples=self->getNumberOfTuples();
convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
mcIdType sw2;
if(!self->getArray())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !");
try
- { convertIntStarOrSliceLikePyObjToCpp(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); }
+ { convertIntStarOrSliceLikePyObjToCpp(elt1,ToIdType(self->getArray()->getNumberOfComponents()),sw,singleVal,multiVal,slic,daIntTyypp); }
catch(INTERP_KERNEL::Exception& e)
{ std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); }
typename MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::FieldType > ret0(fieldT_buildSubPart<T>(self,elt0));
PyObject *ret(PyTuple_New(3));
PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0));
PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1));
- mcIdType sz(a2.size());
+ std::size_t sz(a2.size());
PyObject *ret2(PyList_New(sz));
{
- for(mcIdType i=0;i<sz;i++)
+ for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret2,i,PyString_FromString(a2[i].c_str()));
}
PyTuple_SetItem(ret,2,ret2);
static const char MSG[]="MEDCouplingFieldDouble.__setstate__ : expected input is a tuple of size 3 !";
if(!PyTuple_Check(inp))
throw INTERP_KERNEL::Exception(MSG);
- mcIdType sz(PyTuple_Size(inp));
+ std::size_t sz(PyTuple_Size(inp));
if(sz!=3)
throw INTERP_KERNEL::Exception(MSG);
// mesh
throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !");
da2->checkAllocated();
mcIdType size=da2->getNumberOfTuples();
- mcIdType nbOfCompo=da2->getNumberOfComponents();
+ mcIdType nbOfCompo=ToIdType(da2->getNumberOfComponents());
if(nbOfCompo!=spaceDim)
{
throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !");