}
}
-void DataArray::checkNbOfElems(int nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception)
+void DataArray::checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception)
{
if(getNbOfElems()!=nbOfElems)
{
std::size_t DataArrayDouble::getHeapMemorySize() const
{
- std::size_t sz=(std::size_t)_mem.getNbOfElemAllocated();
+ std::size_t sz=_mem.getNbOfElemAllocated();
sz*=sizeof(double);
return DataArray::getHeapMemorySize()+sz;
}
int nbOfTuples=other.getNumberOfTuples();
int nbOfComp=other.getNumberOfComponents();
allocIfNecessary(nbOfTuples,nbOfComp);
- int nbOfElems=nbOfTuples*nbOfComp;
+ std::size_t nbOfElems=(std::size_t)nbOfTuples*nbOfComp;
double *pt=getPointer();
const double *ptI=other.getConstPointer();
- for(int i=0;i<nbOfElems;i++)
+ for(std::size_t i=0;i<nbOfElems;i++)
pt[i]=ptI[i];
copyStringInfoFrom(other);
}
*
* \sa DataArrayDouble::pack, DataArrayDouble::pushBackSilent, DataArrayDouble::pushBackValsSilent
*/
-void DataArrayDouble::reserve(int nbOfElems) throw(INTERP_KERNEL::Exception)
+void DataArrayDouble::reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception)
{
int nbCompo=getNumberOfComponents();
if(nbCompo==1)
if(nbOfTuple<0 || nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayDouble::alloc : request for negative length of data !");
_info_on_compo.resize(nbOfCompo);
- _mem.alloc(nbOfCompo*nbOfTuple);
+ _mem.alloc(nbOfCompo*(std::size_t)nbOfTuple);
declareAsNew();
}
void DataArrayDouble::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- _mem.reAlloc(getNumberOfComponents()*nbOfTuples);
+ _mem.reAlloc(getNumberOfComponents()*(std::size_t)nbOfTuples);
declareAsNew();
}
{
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(getNumberOfTuples(),getNumberOfComponents());
- int nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
const double *src=getConstPointer();
int *dest=ret->getPointer();
std::copy(src,src+nbOfVals,dest);
* \param [in] newNbOfComp - number of components for \a this array to have.
* \throw If \a this is not allocated
* \throw If getNbOfElems() % \a newNbOfCompo != 0.
+ * \throw If \a newNbOfCompo is lower than 1.
+ * \throw If the rearrange method would lead to a number of tuples higher than 2147483647 (maximal capacity of int32 !).
* \warning This method erases all (name and unit) component info set before!
*/
void DataArrayDouble::rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- int nbOfElems=getNbOfElems();
+ if(newNbOfCompo<1)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::rearrange : input newNbOfCompo must be > 0 !");
+ std::size_t nbOfElems=getNbOfElems();
if(nbOfElems%newNbOfCompo!=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::rearrange : nbOfElems%newNbOfCompo!=0 !");
+ if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits<int>::max())
+ throw INTERP_KERNEL::Exception("DataArrayDouble::rearrange : the rearrangement leads to too high number of tuples (> 2147483647) !");
_info_on_compo.clear();
_info_on_compo.resize(newNbOfCompo);
declareAsNew();
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
int newNbOfComp=(int)std::distance(bgComp,endComp);
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
for(const int *z=bgComp;z!=endComp;z++,srcPt++)
{
- pt[(*w)*nbComp+(*z)]=*srcPt;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt;
}
}
}
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
for(const int *z=bgComp;z!=endComp;z++,srcPt2++)
{
- pt[(*w)*nbComp+(*z)]=*srcPt2;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt2;
}
}
}
for(const int *z=bgComp;z!=endComp;z++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+(*z)]=a;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=a;
}
}
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
for(int j=0;j<newNbOfComp;j++,srcPt++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+j*stepComp]=*srcPt;
+ pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt;
}
}
else
for(int j=0;j<newNbOfComp;j++,srcPt2++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+j*stepComp]=*srcPt2;
+ pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt2;
}
}
}
for(int j=0;j<newNbOfComp;j++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+j*stepComp]=a;
+ pt[(std::size_t)(*w)*nbComp+j*stepComp]=a;
}
}
int nbOfTuples=getNumberOfTuples();
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
std::ostringstream oss; oss << "DataArrayDouble::getIJSafe : request for compoId " << compoId << " should be in [0," << getNumberOfComponents() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- return _mem[tupleId*((int)_info_on_compo.size())+compoId];
+ return _mem[tupleId*_info_on_compo.size()+compoId];
}
/*!
void DataArrayDouble::useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
- _mem.useArray(array,ownership,type,nbOfTuple*nbOfCompo);
+ _mem.useArray(array,ownership,type,(std::size_t)nbOfTuple*nbOfCompo);
declareAsNew();
}
void DataArrayDouble::useExternalArrayWithRWAccess(const double *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
- _mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo);
+ _mem.useExternalArrayWithRWAccess(array,(std::size_t)nbOfTuple*nbOfCompo);
declareAsNew();
}
void DataArrayDouble::checkNoNullValues() const throw(INTERP_KERNEL::Exception)
{
const double *tmp=getConstPointer();
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
const double *where=std::find(tmp,tmp+nbOfElems,0.);
if(where!=tmp+nbOfElems)
throw INTERP_KERNEL::Exception("A value 0.0 have been detected !");
{
checkAllocated();
double ret=0.;
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
const double *pt=getConstPointer();
- for(int i=0;i<nbOfElems;i++,pt++)
+ for(std::size_t i=0;i<nbOfElems;i++,pt++)
ret+=(*pt)*(*pt);
return sqrt(ret);
}
{
checkAllocated();
double ret=-1.;
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
const double *pt=getConstPointer();
- for(int i=0;i<nbOfElems;i++,pt++)
+ for(std::size_t i=0;i<nbOfElems;i++,pt++)
{
double val=std::abs(*pt);
if(val>ret)
{
checkAllocated();
double *ptr=getPointer();
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun<double,double>(fabs));
declareAsNew();
}
{
checkAllocated();
double *ptr=getPointer();
- int nbOfElems=getNbOfElems();
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfElems=getNbOfElems();
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=a*(*ptr)+b;
declareAsNew();
}
{
checkAllocated();
double *ptr=getPointer();
- int nbOfElems=getNbOfElems();
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfElems=getNbOfElems();
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
{
if(std::abs(*ptr)>std::numeric_limits<double>::min())
{
std::size_t DataArrayInt::getHeapMemorySize() const
{
- std::size_t sz=(std::size_t)_mem.getNbOfElemAllocated();
+ std::size_t sz=_mem.getNbOfElemAllocated();
sz*=sizeof(int);
return DataArray::getHeapMemorySize()+sz;
}
int DataArrayInt::getHashCode() const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
int ret=nbOfElems*65536;
int delta=3;
if(nbOfElems>48)
delta=nbOfElems/8;
int ret0=0;
const int *pt=begin();
- for(int i=0;i<nbOfElems;i+=delta)
+ for(std::size_t i=0;i<nbOfElems;i+=delta)
ret0+=pt[i] & 0x1FFF;
return ret+ret0;
}
int nbOfTuples=other.getNumberOfTuples();
int nbOfComp=other.getNumberOfComponents();
allocIfNecessary(nbOfTuples,nbOfComp);
- int nbOfElems=nbOfTuples*nbOfComp;
+ std::size_t nbOfElems=(std::size_t)nbOfTuples*nbOfComp;
int *pt=getPointer();
const int *ptI=other.getConstPointer();
- for(int i=0;i<nbOfElems;i++)
+ for(std::size_t i=0;i<nbOfElems;i++)
pt[i]=ptI[i];
copyStringInfoFrom(other);
}
*
* \sa DataArrayInt::pack, DataArrayInt::pushBackSilent, DataArrayInt::pushBackValsSilent
*/
-void DataArrayInt::reserve(int nbOfElems) throw(INTERP_KERNEL::Exception)
+void DataArrayInt::reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception)
{
int nbCompo=getNumberOfComponents();
if(nbCompo==1)
if(nbOfTuple<0 || nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayInt::alloc : request for negative length of data !");
_info_on_compo.resize(nbOfCompo);
- _mem.alloc(nbOfCompo*nbOfTuple);
+ _mem.alloc(nbOfCompo*(std::size_t)nbOfTuple);
declareAsNew();
}
checkAllocated();
DataArrayDouble *ret=DataArrayDouble::New();
ret->alloc(getNumberOfTuples(),getNumberOfComponents());
- int nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
const int *src=getConstPointer();
double *dest=ret->getPointer();
std::copy(src,src+nbOfVals,dest);
* \param [in] newNbOfComp - number of components for \a this array to have.
* \throw If \a this is not allocated
* \throw If getNbOfElems() % \a newNbOfCompo != 0.
+ * \throw If \a newNbOfCompo is lower than 1.
+ * \throw If the rearrange method would lead to a number of tuples higher than 2147483647 (maximal capacity of int32 !).
* \warning This method erases all (name and unit) component info set before!
*/
void DataArrayInt::rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- int nbOfElems=getNbOfElems();
+ if(newNbOfCompo<1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::rearrange : input newNbOfCompo must be > 0 !");
+ std::size_t nbOfElems=getNbOfElems();
if(nbOfElems%newNbOfCompo!=0)
throw INTERP_KERNEL::Exception("DataArrayInt::rearrange : nbOfElems%newNbOfCompo!=0 !");
+ if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits<int>::max())
+ throw INTERP_KERNEL::Exception("DataArrayInt::rearrange : the rearrangement leads to too high number of tuples (> 2147483647) !");
_info_on_compo.clear();
_info_on_compo.resize(newNbOfCompo);
declareAsNew();
void DataArrayInt::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- _mem.reAlloc(getNumberOfComponents()*nbOfTuples);
+ _mem.reAlloc(getNumberOfComponents()*(std::size_t)nbOfTuples);
declareAsNew();
}
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
int newNbOfComp=(int)std::distance(bgComp,endComp);
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
for(const int *z=bgComp;z!=endComp;z++,srcPt++)
{
- pt[(*w)*nbComp+(*z)]=*srcPt;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt;
}
}
}
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
for(const int *z=bgComp;z!=endComp;z++,srcPt2++)
{
- pt[(*w)*nbComp+(*z)]=*srcPt2;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt2;
}
}
}
for(const int *z=bgComp;z!=endComp;z++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+(*z)]=a;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=a;
}
}
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
for(int j=0;j<newNbOfComp;j++,srcPt++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+j*stepComp]=*srcPt;
+ pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt;
}
}
else
for(int j=0;j<newNbOfComp;j++,srcPt2++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+j*stepComp]=*srcPt2;
+ pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt2;
}
}
}
for(int j=0;j<newNbOfComp;j++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+j*stepComp]=a;
+ pt[(std::size_t)(*w)*nbComp+j*stepComp]=a;
}
}
int nbOfTuples=getNumberOfTuples();
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
std::ostringstream oss; oss << "DataArrayInt::getIJSafe : request for compoId " << compoId << " should be in [0," << getNumberOfComponents() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- return _mem[tupleId*((int)_info_on_compo.size())+compoId];
+ return _mem[tupleId*_info_on_compo.size()+compoId];
}
/*!
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const int *cptr=getConstPointer();
- int nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
for(const int *work=cptr;work!=cptr+nbOfVals;)
{
work=std::search(work,cptr+nbOfVals,tupl.begin(),tupl.end());
if(nbOfCompo!=1)
throw INTERP_KERNEL::Exception("DataArrayInt::search : works only for DataArrayInt instance with one component !");
const int *cptr=getConstPointer();
- int nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
const int *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end());
if(loc!=cptr+nbOfVals)
return std::distance(cptr,loc);
{
checkAllocated();
int *ptr=getPointer();
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun<int,int>(std::abs));
declareAsNew();
}
{
checkAllocated();
int *ptr=getPointer();
- int nbOfElems=getNbOfElems();
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfElems=getNbOfElems();
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
*ptr=a*(*ptr)+b;
declareAsNew();
}
{
checkAllocated();
int *ptr=getPointer();
- int nbOfElems=getNbOfElems();
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfElems=getNbOfElems();
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
{
if(*ptr!=0)
{
throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to divide by 0 !");
checkAllocated();
int *ptr=getPointer();
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::divides<int>(),val));
declareAsNew();
}
throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to operate modulus on value <= 0 !");
checkAllocated();
int *ptr=getPointer();
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::modulus<int>(),val));
declareAsNew();
}
{
checkAllocated();
int *ptr=getPointer();
- int nbOfElems=getNbOfElems();
- for(int i=0;i<nbOfElems;i++,ptr++)
+ std::size_t nbOfElems=getNbOfElems();
+ for(std::size_t i=0;i<nbOfElems;i++,ptr++)
{
if(*ptr>0)
{
for(std::vector<const DataArrayInt *>::const_iterator iter=groups2.begin();iter!=groups2.end();iter++)
{
const int *ptr=(*iter)->getConstPointer();
- int nbOfElem=(*iter)->getNbOfElems();
+ std::size_t nbOfElem=(*iter)->getNbOfElems();
int sfid=fid;
for(int j=0;j<sfid;j++)
{
bool found=false;
- for(int i=0;i<nbOfElem;i++)
+ for(std::size_t i=0;i<nbOfElem;i++)
{
if(ptr[i]>=0 && ptr[i]<newNb)
{
{
std::set<int> tmp;
const int *ptr=(*iter)->getConstPointer();
- int nbOfElem=(*iter)->getNbOfElems();
+ std::size_t nbOfElem=(*iter)->getNbOfElems();
for(const int *p=ptr;p!=ptr+nbOfElem;p++)
tmp.insert(retPtr[*p]);
fidsOfGroups[grId].insert(fidsOfGroups[grId].end(),tmp.begin(),tmp.end());
void setInternal(T *pointer);
void setExternal(const T *pointer);
const T *getConstPointer() const { if(_internal) return _internal; else return _external; }
- const T *getConstPointerLoc(int offset) const { if(_internal) return _internal+offset; else return _external+offset; }
+ const T *getConstPointerLoc(std::size_t offset) const { if(_internal) return _internal+offset; else return _external+offset; }
T *getPointer() { if(_internal) return _internal; if(_external) throw INTERP_KERNEL::Exception("Trying to write on an external pointer."); else return 0; }
private:
T *_internal;
MemArray():_nb_of_elem(0),_nb_of_elem_alloc(0),_ownership(false),_dealloc(CPP_DEALLOC) { }
MemArray(const MemArray<T>& other);
bool isNull() const { return _pointer.isNull(); }
- const T *getConstPointerLoc(int offset) const { return _pointer.getConstPointerLoc(offset); }
+ const T *getConstPointerLoc(std::size_t offset) const { return _pointer.getConstPointerLoc(offset); }
const T *getConstPointer() const { return _pointer.getConstPointer(); }
- int getNbOfElem() const { return _nb_of_elem; }
- int getNbOfElemAllocated() const { return _nb_of_elem_alloc; }
+ std::size_t getNbOfElem() const { return _nb_of_elem; }
+ std::size_t getNbOfElemAllocated() const { return _nb_of_elem_alloc; }
T *getPointer() { return _pointer.getPointer(); }
MemArray<T> &operator=(const MemArray<T>& other);
- T operator[](int id) const { return _pointer.getConstPointer()[id]; }
- T& operator[](int id) { return _pointer.getPointer()[id]; }
+ T operator[](std::size_t id) const { return _pointer.getConstPointer()[id]; }
+ T& operator[](std::size_t id) { return _pointer.getPointer()[id]; }
bool isEqual(const MemArray<T>& other, T prec, std::string& reason) const;
void repr(int sl, std::ostream& stream) const;
bool reprHeader(int sl, std::ostream& stream) const;
T *toNoInterlace(int nbOfComp) const;
void sort(bool asc);
void reverse();
- void alloc(int nbOfElements) throw(INTERP_KERNEL::Exception);
- void reserve(int newNbOfElements) throw(INTERP_KERNEL::Exception);
- void reAlloc(int newNbOfElements) throw(INTERP_KERNEL::Exception);
- void useArray(const T *array, bool ownership, DeallocType type, int nbOfElem);
- void useExternalArrayWithRWAccess(const T *array, int nbOfElem);
- void writeOnPlace(int id, T element0, const T *others, int sizeOfOthers);
+ void alloc(std::size_t nbOfElements) throw(INTERP_KERNEL::Exception);
+ void reserve(std::size_t newNbOfElements) throw(INTERP_KERNEL::Exception);
+ void reAlloc(std::size_t newNbOfElements) throw(INTERP_KERNEL::Exception);
+ void useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfElem);
+ void useExternalArrayWithRWAccess(const T *array, std::size_t nbOfElem);
+ void writeOnPlace(std::size_t id, T element0, const T *others, std::size_t sizeOfOthers);
template<class InputIterator>
void insertAtTheEnd(InputIterator first, InputIterator last);
void pushBack(T elem) throw(INTERP_KERNEL::Exception);
void destroy();
static void destroyPointer(T *pt, DeallocType type);
private:
- int _nb_of_elem;
- int _nb_of_elem_alloc;
+ std::size_t _nb_of_elem;
+ std::size_t _nb_of_elem_alloc;
bool _ownership;
MEDCouplingPointer<T> _pointer;
DeallocType _dealloc;
MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getNumberOfComponents() const { return (int)_info_on_compo.size(); }
MEDCOUPLING_EXPORT virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) = 0;
- MEDCOUPLING_EXPORT virtual int getNbOfElems() const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) = 0;
MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void checkNbOfElems(int nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
- MEDCOUPLING_EXPORT int getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
+ MEDCOUPLING_EXPORT std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double doubleValue() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *deepCpy() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double popBackSilent() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
+ MEDCOUPLING_EXPORT std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void fillWithZero() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayDouble *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const throw(INTERP_KERNEL::Exception) { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
- MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
+ MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const throw(INTERP_KERNEL::Exception) { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
+ MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
MEDCOUPLING_EXPORT double back() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
- MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
+ MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
+ MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
MEDCOUPLING_EXPORT double *getPointer() throw(INTERP_KERNEL::Exception) { return _mem.getPointer(); }
MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayDouble *newArray, DataArrayDouble* &arrayToSet);
MEDCOUPLING_EXPORT const double *getConstPointer() const throw(INTERP_KERNEL::Exception) { return _mem.getConstPointer(); }
MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const double *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
template<class InputIterator>
void insertAtTheEnd(InputIterator first, InputIterator last) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void writeOnPlace(int id, double element0, const double *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
+ MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, double element0, const double *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
MEDCOUPLING_EXPORT void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void getMinMaxPerComponent(double *bounds) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
- MEDCOUPLING_EXPORT int getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
+ MEDCOUPLING_EXPORT std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int intValue() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *deepCpy() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackValsSilent(const int *valsBg, const int *valsEnd) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int popBackSilent() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
+ MEDCOUPLING_EXPORT std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayInt*a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayInt *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception) { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
- MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception) { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
+ MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception) { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
+ MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception) { return _mem[tupleId*_info_on_compo.size()+compoId]; }
MEDCOUPLING_EXPORT int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int back() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
- MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
+ MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
+ MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
MEDCOUPLING_EXPORT int *getPointer() throw(INTERP_KERNEL::Exception) { return _mem.getPointer(); }
MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet);
MEDCOUPLING_EXPORT const int *getConstPointer() const throw(INTERP_KERNEL::Exception) { return _mem.getConstPointer(); }
MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const int *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
template<class InputIterator>
void insertAtTheEnd(InputIterator first, InputIterator last) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void writeOnPlace(int id, int element0, const int *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
+ MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, int element0, const int *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
MEDCOUPLING_EXPORT static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
- MEDCOUPLING_EXPORT int getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
+ MEDCOUPLING_EXPORT std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getHashCode() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool empty() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT char popBackSilent() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
+ MEDCOUPLING_EXPORT std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setPartOfValues4(const DataArrayChar *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setPartOfValuesSimple4(char a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void getTuple(int tupleId, char *res) const { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
- MEDCOUPLING_EXPORT char getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
+ MEDCOUPLING_EXPORT void getTuple(int tupleId, char *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
+ MEDCOUPLING_EXPORT char getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
MEDCOUPLING_EXPORT char getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT char back() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, char newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
- MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, char newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
+ MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, char newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
+ MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, char newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
MEDCOUPLING_EXPORT char *getPointer() { return _mem.getPointer(); }
MEDCOUPLING_EXPORT const char *getConstPointer() const { return _mem.getConstPointer(); }
MEDCOUPLING_EXPORT const char *begin() const throw(INTERP_KERNEL::Exception) { return getConstPointer(); }
}
template<class T>
- void MemArray<T>::useArray(const T *array, bool ownership, DeallocType type, int nbOfElem)
+ void MemArray<T>::useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfElem)
{
_nb_of_elem=nbOfElem;
_nb_of_elem_alloc=nbOfElem;
}
template<class T>
- void MemArray<T>::useExternalArrayWithRWAccess(const T *array, int nbOfElem)
+ void MemArray<T>::useExternalArrayWithRWAccess(const T *array, std::size_t nbOfElem)
{
_nb_of_elem=nbOfElem;
_nb_of_elem_alloc=nbOfElem;
}
template<class T>
- void MemArray<T>::writeOnPlace(int id, T element0, const T *others, int sizeOfOthers)
+ void MemArray<T>::writeOnPlace(std::size_t id, T element0, const T *others, std::size_t sizeOfOthers)
{
if(id+sizeOfOthers>=_nb_of_elem_alloc)
reserve(2*_nb_of_elem+sizeOfOthers+1);
T *pointer=_pointer.getPointer();
pointer[id]=element0;
std::copy(others,others+sizeOfOthers,pointer+id+1);
- _nb_of_elem=std::max<int>(_nb_of_elem,id+sizeOfOthers+1);
+ _nb_of_elem=std::max<std::size_t>(_nb_of_elem,id+sizeOfOthers+1);
}
template<class T>
}
if(pt1==pt2)
return true;
- for(int i=0;i<_nb_of_elem;i++)
+ for(std::size_t i=0;i<_nb_of_elem;i++)
if(pt1[i]-pt2[i]<-prec || (pt1[i]-pt2[i])>prec)
{
oss << "The content of data differs at pos #" << i << " of coarse data ! this[i]=" << pt1[i] << " other[i]=" << pt2[i];
const T *data=getConstPointer();
if(_nb_of_elem!=0 && sl!=0)
{
- int nbOfTuples=_nb_of_elem/sl;
- for(int i=0;i<nbOfTuples;i++)
+ std::size_t nbOfTuples=_nb_of_elem/std::abs(sl);
+ for(std::size_t i=0;i<nbOfTuples;i++)
{
stream << "Tuple #" << i << " : ";
std::copy(data,data+sl,std::ostream_iterator<T>(stream," "));
{
if(_nb_of_elem!=0 && sl!=0)
{
- int nbOfTuples=_nb_of_elem/sl;
- for(int i=0;i<nbOfTuples;i++)
+ std::size_t nbOfTuples=_nb_of_elem/std::abs(sl);
+ for(std::size_t i=0;i<nbOfTuples;i++)
{
stream << "|";
std::copy(data,data+sl,std::ostream_iterator<T>(stream," "));
template<class T>
T *MemArray<T>::fromNoInterlace(int nbOfComp) const
{
+ if(nbOfComp<1)
+ throw INTERP_KERNEL::Exception("MemArray<T>::fromNoInterlace : number of components must be > 0 !");
const T *pt=_pointer.getConstPointer();
- int nbOfTuples=_nb_of_elem/nbOfComp;
+ std::size_t nbOfTuples=_nb_of_elem/nbOfComp;
T *ret=new T[_nb_of_elem];
T *w=ret;
- for(int i=0;i<nbOfTuples;i++)
+ for(std::size_t i=0;i<nbOfTuples;i++)
for(int j=0;j<nbOfComp;j++,w++)
*w=pt[j*nbOfTuples+i];
return ret;
template<class T>
T *MemArray<T>::toNoInterlace(int nbOfComp) const
{
+ if(nbOfComp<1)
+ throw INTERP_KERNEL::Exception("MemArray<T>::toNoInterlace : number of components must be > 0 !");
const T *pt=_pointer.getConstPointer();
- int nbOfTuples=_nb_of_elem/nbOfComp;
+ std::size_t nbOfTuples=_nb_of_elem/nbOfComp;
T *ret=new T[_nb_of_elem];
T *w=ret;
for(int i=0;i<nbOfComp;i++)
- for(int j=0;j<nbOfTuples;j++,w++)
+ for(std::size_t j=0;j<nbOfTuples;j++,w++)
*w=pt[j*nbOfComp+i];
return ret;
}
}
template<class T>
- void MemArray<T>::alloc(int nbOfElements) throw(INTERP_KERNEL::Exception)
+ void MemArray<T>::alloc(std::size_t nbOfElements) throw(INTERP_KERNEL::Exception)
{
destroy();
if(nbOfElements<0)
/*!
* This method performs systematically an allocation of \a newNbOfElements elements in \a this.
* \a _nb_of_elem and \a _nb_of_elem_alloc will \b NOT be systematically equal (contrary to MemArray<T>::reAlloc method.
- * So after the call of this method \a _nb_of_elem will be equal tostd::min<int>(_nb_of_elem,newNbOfElements) and \a _nb_of_elem_alloc equal to
+ * So after the call of this method \a _nb_of_elem will be equal tostd::min<std::size_t>(_nb_of_elem,newNbOfElements) and \a _nb_of_elem_alloc equal to
* \a newNbOfElements. This method is typically used to perform a pushBack to avoid systematic allocations-copy-deallocation.
* So after the call of this method the accessible content is perfectly set.
*
* So this method should not be confused with MemArray<T>::reserve that is close to MemArray<T>::reAlloc but not same.
*/
template<class T>
- void MemArray<T>::reserve(int newNbOfElements) throw(INTERP_KERNEL::Exception)
+ void MemArray<T>::reserve(std::size_t newNbOfElements) throw(INTERP_KERNEL::Exception)
{
if(newNbOfElements<0)
throw INTERP_KERNEL::Exception("MemArray::reAlloc : request for negative length of data !");
if(_nb_of_elem_alloc==newNbOfElements)
return ;
T *pointer=new T[newNbOfElements];
- std::copy(_pointer.getConstPointer(),_pointer.getConstPointer()+std::min<int>(_nb_of_elem,newNbOfElements),pointer);
+ std::copy(_pointer.getConstPointer(),_pointer.getConstPointer()+std::min<std::size_t>(_nb_of_elem,newNbOfElements),pointer);
if(_ownership)
destroyPointer(const_cast<T *>(_pointer.getConstPointer()),_dealloc);//Do not use getPointer because in case of _external
_pointer.setInternal(pointer);
- _nb_of_elem=std::min<int>(_nb_of_elem,newNbOfElements);
+ _nb_of_elem=std::min<std::size_t>(_nb_of_elem,newNbOfElements);
_nb_of_elem_alloc=newNbOfElements;
_ownership=true;
_dealloc=CPP_DEALLOC;
/*!
* This method performs systematically an allocation of \a newNbOfElements elements in \a this.
- * \a _nb_of_elem and \a _nb_of_elem_alloc will be equal even if only std::min<int>(_nb_of_elem,newNbOfElements) come from the .
+ * \a _nb_of_elem and \a _nb_of_elem_alloc will be equal even if only std::min<std::size_t>(_nb_of_elem,newNbOfElements) come from the .
* The remaing part of the new allocated chunk are available but not set previouly !
*
* So this method should not be confused with MemArray<T>::reserve that is close to MemArray<T>::reAlloc but not same.
*/
template<class T>
- void MemArray<T>::reAlloc(int newNbOfElements) throw(INTERP_KERNEL::Exception)
+ void MemArray<T>::reAlloc(std::size_t newNbOfElements) throw(INTERP_KERNEL::Exception)
{
if(newNbOfElements<0)
throw INTERP_KERNEL::Exception("MemArray::reAlloc : request for negative length of data !");
if(_nb_of_elem==newNbOfElements)
return ;
T *pointer=new T[newNbOfElements];
- std::copy(_pointer.getConstPointer(),_pointer.getConstPointer()+std::min<int>(_nb_of_elem,newNbOfElements),pointer);
+ std::copy(_pointer.getConstPointer(),_pointer.getConstPointer()+std::min<std::size_t>(_nb_of_elem,newNbOfElements),pointer);
if(_ownership)
destroyPointer(const_cast<T *>(_pointer.getConstPointer()),_dealloc);//Do not use getPointer because in case of _external
_pointer.setInternal(pointer);
std::size_t DataArrayChar::getHeapMemorySize() const
{
- std::size_t sz=(std::size_t)_mem.getNbOfElemAllocated();
+ std::size_t sz=_mem.getNbOfElemAllocated();
return DataArray::getHeapMemorySize()+sz;
}
int DataArrayChar::getHashCode() const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- int nbOfElems=getNbOfElems();
+ std::size_t nbOfElems=getNbOfElems();
int ret=nbOfElems*65536;
int delta=3;
if(nbOfElems>48)
delta=nbOfElems/8;
int ret0=0;
const char *pt=begin();
- for(int i=0;i<nbOfElems;i+=delta)
+ for(std::size_t i=0;i<nbOfElems;i+=delta)
ret0+=pt[i];
return ret+ret0;
}
int nbOfTuples=other.getNumberOfTuples();
int nbOfComp=other.getNumberOfComponents();
allocIfNecessary(nbOfTuples,nbOfComp);
- int nbOfElems=nbOfTuples*nbOfComp;
+ std::size_t nbOfElems=(std::size_t)nbOfTuples*nbOfComp;
char *pt=getPointer();
const char *ptI=other.getConstPointer();
- for(int i=0;i<nbOfElems;i++)
+ for(std::size_t i=0;i<nbOfElems;i++)
pt[i]=ptI[i];
copyStringInfoFrom(other);
}
*
* \sa DataArrayChar::pack, DataArrayChar::pushBackSilent, DataArrayChar::pushBackValsSilent
*/
-void DataArrayChar::reserve(int nbOfElems) throw(INTERP_KERNEL::Exception)
+void DataArrayChar::reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception)
{
int nbCompo=getNumberOfComponents();
if(nbCompo==1)
if(nbOfTuple<0 || nbOfCompo<0)
throw INTERP_KERNEL::Exception("DataArrayChar::alloc : request for negative length of data !");
_info_on_compo.resize(nbOfCompo);
- _mem.alloc(nbOfCompo*nbOfTuple);
+ _mem.alloc(nbOfCompo*(std::size_t)nbOfTuple);
declareAsNew();
}
void DataArrayChar::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- _mem.reAlloc(getNumberOfComponents()*nbOfTuples);
+ _mem.reAlloc(getNumberOfComponents()*(std::size_t)nbOfTuples);
declareAsNew();
}
checkAllocated();
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(getNumberOfTuples(),getNumberOfComponents());
- int nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
const char *src=getConstPointer();
int *dest=ret->getPointer();
std::copy(src,src+nbOfVals,dest);
* \param [in] newNbOfComp - number of components for \a this array to have.
* \throw If \a this is not allocated
* \throw If getNbOfElems() % \a newNbOfCompo != 0.
+ * \throw If \a newNbOfCompo is lower than 1.
+ * \throw If the rearrange method would lead to a number of tuples higher than 2147483647 (maximal capacity of int32 !).
* \warning This method erases all (name and unit) component info set before!
*/
void DataArrayChar::rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- int nbOfElems=getNbOfElems();
+ if(newNbOfCompo<1)
+ throw INTERP_KERNEL::Exception("DataArrayChar::rearrange : input newNbOfCompo must be > 0 !");
+ std::size_t nbOfElems=getNbOfElems();
if(nbOfElems%newNbOfCompo!=0)
throw INTERP_KERNEL::Exception("DataArrayChar::rearrange : nbOfElems%newNbOfCompo!=0 !");
+ if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits<int>::max())
+ throw INTERP_KERNEL::Exception("DataArrayChar::rearrange : the rearrangement leads to too high number of tuples (> 2147483647) !");
_info_on_compo.clear();
_info_on_compo.resize(newNbOfCompo);
declareAsNew();
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
int newNbOfComp=(int)std::distance(bgComp,endComp);
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
for(const int *z=bgComp;z!=endComp;z++,srcPt++)
{
- pt[(*w)*nbComp+(*z)]=*srcPt;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt;
}
}
}
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
for(const int *z=bgComp;z!=endComp;z++,srcPt2++)
{
- pt[(*w)*nbComp+(*z)]=*srcPt2;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt2;
}
}
}
for(const int *z=bgComp;z!=endComp;z++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+(*z)]=a;
+ pt[(std::size_t)(*w)*nbComp+(*z)]=a;
}
}
DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
int newNbOfTuples=(int)std::distance(bgTuples,endTuples);
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
for(int j=0;j<newNbOfComp;j++,srcPt++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+j*stepComp]=*srcPt;
+ pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt;
}
}
else
for(int j=0;j<newNbOfComp;j++,srcPt2++)
{
DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
- pt[(*w)*nbComp+j*stepComp]=*srcPt2;
+ pt[(std::size_t)(*w)*nbComp+j*stepComp]=*srcPt2;
}
}
}
int nbOfTuples=getNumberOfTuples();
DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
bool assignTech=true;
- if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+ if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp)
{
if(strictCompoCompare)
a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
std::ostringstream oss; oss << "DataArrayChar::getIJSafe : request for compoId " << compoId << " should be in [0," << getNumberOfComponents() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- return _mem[tupleId*((int)_info_on_compo.size())+compoId];
+ return _mem[tupleId*_info_on_compo.size()+compoId];
}
/*!
if(nbOfCompo!=1)
throw INTERP_KERNEL::Exception("DataArrayChar::search : works only for DataArrayChar instance with one component !");
const char *cptr=getConstPointer();
- int nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
const char *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end());
if(loc!=cptr+nbOfVals)
return std::distance(cptr,loc);
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const char *cptr=getConstPointer();
- int nbOfVals=getNbOfElems();
+ std::size_t nbOfVals=getNbOfElems();
for(const char *work=cptr;work!=cptr+nbOfVals;)
{
work=std::search(work,cptr+nbOfVals,tupl.begin(),tupl.end());
void DataArrayChar::useArray(const char *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
- _mem.useArray(array,ownership,type,nbOfTuple*nbOfCompo);
+ _mem.useArray(array,ownership,type,(std::size_t)nbOfTuple*nbOfCompo);
declareAsNew();
}
void DataArrayChar::useExternalArrayWithRWAccess(const char *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
- _mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo);
+ _mem.useExternalArrayWithRWAccess(array,(std::size_t)nbOfTuple*nbOfCompo);
declareAsNew();
}
releas=(ver & 0xFF);
}
+int ParaMEDMEM::MEDCouplingSizeOfVoidStar()
+{
+ return 8*sizeof(std::size_t);
+}
+
RefCountObject::RefCountObject():_cnt(1)
{
}
MEDCOUPLING_EXPORT const char *MEDCouplingVersionStr();
MEDCOUPLING_EXPORT int MEDCouplingVersion();
MEDCOUPLING_EXPORT void MEDCouplingVersionMajMinRel(int& maj, int& minor, int& releas);
+ MEDCOUPLING_EXPORT int MEDCouplingSizeOfVoidStar();
class MEDCOUPLING_EXPORT RefCountObject
{
{
const int *ptI=_nodal_connec_index->getConstPointer();
const int *pt=_nodal_connec->getConstPointer();
- if(cellId>=0 && cellId<_nodal_connec_index->getNbOfElems()-1)
+ if(cellId>=0 && cellId<(int)_nodal_connec_index->getNbOfElems()-1)
return (INTERP_KERNEL::NormalizedCellType) pt[ptI[cellId]];
else
{
for(int i=0;i<nbOfCells;i++,curConn+=4)
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,curConn);
mesh->finishInsertingCells();
- CPPUNIT_ASSERT_EQUAL(30,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)30,mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells());
//test 0 - no copy no ownership
DataArrayDouble *myCoords=DataArrayDouble::New();
mesh->getReverseNodalConnectivity(revNodal,revNodalIndx);
const int revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4};
const int revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18};
- CPPUNIT_ASSERT_EQUAL(18,revNodal->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(10,revNodalIndx->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,revNodal->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)10,revNodalIndx->getNbOfElems());
CPPUNIT_ASSERT(std::equal(revNodalExpected,revNodalExpected+18,revNodal->getPointer()));
CPPUNIT_ASSERT(std::equal(revNodalIndexExpected,revNodalIndexExpected+10,revNodalIndx->getPointer()));
//
mesh2->checkCoherency();
CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples());
const int expected1[18]={0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9};
CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer()));
const int expected2[6]={0,4,7,10,14,18};
mesh2->checkCoherency();
CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,descIndx->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected3,expected3+14,revDescIndx->getConstPointer()));
mesh2->checkCoherency();
CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(36,mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(9,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,revDesc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)9,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,revDesc->getNumberOfTuples());
const int expected1[9]={0, 6, 12, 18, 24, 30, 36, 42, 48};
const int expected2[48]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 11, 12, 4, 13, 14, 15, 16, 17, 10, 18, 19, 13, 1, 20, 21, 22, 23, 24, 7, 25, 26, 27, 28, 22, 12, 29, 23, 30, 31, 32, 17, 33, 28, 34, 35, 30};
const int expected3[37]={0, 1, 3, 4, 6, 8, 9, 10, 12, 13, 14, 16, 17, 19, 21, 22, 23, 24, 26, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 40, 41, 43, 44, 45, 46, 47, 48};
mesh2->checkCoherency();
CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(36,mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(9,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,revDesc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)9,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,revDesc->getNumberOfTuples());
CPPUNIT_ASSERT(std::equal(expected1,expected1+9,descIndx->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+48,desc->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected3,expected3+37,revDescIndx->getConstPointer()));
CPPUNIT_ASSERT_EQUAL(2,subMesh->getNumberOfCells());
const int subConn[10]={4,0,3,4,1,4,7,8,5,4};
const int subConnIndex[3]={0,5,10};
- CPPUNIT_ASSERT_EQUAL(10,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer()));
subMesh->decrRef();
CPPUNIT_ASSERT_EQUAL(3,subMesh->getNumberOfCells());
const int subConn2[14]={4,0,3,4,1,3,4,5,2,4,6,7,4,3};
const int subConnIndex2[4]={0,5,9,14};
- CPPUNIT_ASSERT_EQUAL(14,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(4,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)14,subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)4,subMesh->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(subConn2,subConn2+14,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex2,subConnIndex2+4,subMesh->getNodalConnectivityIndex()->getPointer()));
const int tab3[3]={0,1,2};
CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getAllTypes().size());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
CPPUNIT_ASSERT_EQUAL(1,subMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(5,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(2,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)5,subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)2,subMesh->getNodalConnectivityIndex()->getNbOfElems());
const int subConn[5]={4,7,8,5,4};
const int subConnIndex[3]={0,5};
CPPUNIT_ASSERT(std::equal(subConn,subConn+5,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllTypes().begin());
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllTypes().begin()));
CPPUNIT_ASSERT_EQUAL(3,subMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(14,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(4,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)14,subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)4,subMesh->getNodalConnectivityIndex()->getNbOfElems());
const int subConn2[14]={3,4,5,2,4,6,7,4,3,4,7,8,5,4};
const int subConnIndex2[4]={0,4,9,14};
CPPUNIT_ASSERT(std::equal(subConn2,subConn2+14,subMesh->getNodalConnectivity()->getPointer()));
const int subConn[10]={4,0,2,3,1,4,5,6,4,3};
const int subConnIndex[3]={0,5,10};
CPPUNIT_ASSERT_EQUAL(7,subMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(10,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer()));
subMesh->decrRef();
CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllTypes().begin());
CPPUNIT_ASSERT_EQUAL(2,subMesh->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(7,subMesh->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(10,subMesh->getNodalConnectivity()->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer()));
CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer()));
subMesh->decrRef();
//
f1->checkCoherency();
DataArrayInt *da=f1->getIdsInRange(2.9,7.1);
- CPPUNIT_ASSERT_EQUAL(5,da->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)5,da->getNbOfElems());
const int expected1[5]={2,3,5,7,9};
CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da->getConstPointer()));
da->decrRef();
da=f1->getIdsInRange(8.,12.);
- CPPUNIT_ASSERT_EQUAL(4,da->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)4,da->getNbOfElems());
const int expected2[4]={1,4,6,8};
CPPUNIT_ASSERT(std::equal(expected2,expected2+4,da->getConstPointer()));
da->decrRef();
da1->iota(0);
const int *ptr=da1->getConstPointer();
//
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(1,da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(12,da1->getNumberOfTuples());
da1->rearrange(4);
CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da1->rearrange(6);
CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(6,da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(2,da1->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da1->rearrange(12);
CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(12,da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(1,da1->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da1->rearrange(3);
CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfTuples());
for(int i=0;i<12;i++)
da1->decrRef();
const double *ptr2=da2->getConstPointer();
//
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
da2->rearrange(4);
CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da2->rearrange(6);
CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(6,da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(2,da2->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da2->rearrange(1);
CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(12,da2->getNumberOfTuples());
for(int i=0;i<12;i++)
//
da2->rearrange(3);
CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
for(int i=0;i<12;i++)
m->convertExtrudedPolyhedra();
DataArrayInt *da=m->getNodalConnectivity();
DataArrayInt *dai=m->getNodalConnectivityIndex();
- CPPUNIT_ASSERT_EQUAL(10,dai->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(159,da->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)10,dai->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)159,da->getNbOfElems());
//
const int expected1[159]={14, 1, 2, 3, 4,
18, 5, 6, 7, 8, 9, 10, 11, 12,
da->findCommonTuples(1e-2,-1,c,cI);
const int expected1[3]={0,3,4};
const int expected2[2]={0,3};
- CPPUNIT_ASSERT_EQUAL(3,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(2,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer()));
c->decrRef();
da->findCommonTuples(2e-1,-1,c,cI);
const int expected3[5]={0,3,4,1,2};
const int expected4[3]={0,3,5};
- CPPUNIT_ASSERT_EQUAL(5,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer()));
c->decrRef();
const double array2[12]={2.3,2.3,1.2,1.2,1.3,1.3,2.3,2.3,2.301,2.301,0.8,0.8};
std::copy(array2,array2+12,da->getPointer());
da->findCommonTuples(1e-2,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL(3,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(2,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer()));
c->decrRef();
cI->decrRef();
//
da->findCommonTuples(2e-1,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL(5,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer()));
c->decrRef();
const double array3[18]={2.3,2.3,2.3,1.2,1.2,1.2,1.3,1.3,1.3,2.3,2.3,2.3,2.301,2.301,2.301,0.8,0.8,0.8};
std::copy(array3,array3+18,da->getPointer());
da->findCommonTuples(1e-2,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL(3,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(2,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer()));
c->decrRef();
cI->decrRef();
//
da->findCommonTuples(2e-1,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL(5,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer()));
CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer()));
c->decrRef();
std::copy(array11,array11+6,da->getPointer());
// nbOftuples=1, no common groups
da->findCommonTuples(1e-2,-1,c,cI);
- CPPUNIT_ASSERT_EQUAL(0,c->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(1,cI->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)0,c->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)1,cI->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(0,cI->getIJ(0,0));
da->alloc(6,4); //bad NumberOfComponents
//
const double expected1[4]={2.301,1.2,1.3,0.8};
DataArrayDouble *dv=da->getDifferentValues(1e-2);
- CPPUNIT_ASSERT_EQUAL(4,dv->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)4,dv->getNbOfElems());
for(int i=0;i<4;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],dv->getIJ(i,0),1e-14);
dv->decrRef();
//
dv=da->getDifferentValues(2e-1);
const double expected2[3]={2.301,1.3,0.8};
- CPPUNIT_ASSERT_EQUAL(3,dv->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)3,dv->getNbOfElems());
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],dv->getIJ(i,0),1e-14);
dv->decrRef();
int newNbTuple=-1;
DataArrayInt *ret=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(10,a->begin(),b->begin(),b->end(),newNbTuple);
const int expected[10]={0,1,2,0,3,4,5,4,6,4};
- CPPUNIT_ASSERT_EQUAL(10,ret->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)10,ret->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(7,newNbTuple);
CPPUNIT_ASSERT_EQUAL(1,ret->getNumberOfComponents());
CPPUNIT_ASSERT(std::equal(expected,expected+10,ret->getConstPointer()));
DataArrayInt *arr=m1->getNodeIdsInUse(newNbOfNodes);
const int expected[9]={-1,0,1,-1,2,3,-1,-1,-1};
CPPUNIT_ASSERT_EQUAL(4,newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL(9,arr->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)9,arr->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected,expected+9,arr->getConstPointer()));
DataArrayInt *arr2=arr->invertArrayO2N2N2O(newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL(4,arr2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)4,arr2->getNbOfElems());
const int expected2[4]={1,2,4,5};
CPPUNIT_ASSERT(std::equal(expected2,expected2+4,arr2->getConstPointer()));
arr2->decrRef();
mesh2->checkCoherency();
CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples());
const int expected1[18]={1,2,3,4,-3,5,6, 7,8,-5,9,10,-2,11, 12,13,-7,-10};
CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer()));
const int expected2[6]={0,4,7,10,14,18};
mesh2->checkCoherency();
CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(30,mesh2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(31,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(31,revDescIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(13,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(13,descIndx->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,desc->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,revDesc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)31,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(31,revDescIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)13,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(13,descIndx->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,desc->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,revDesc->getNumberOfTuples());
const int expected1[48]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,-10,15,-5,-13,16,17,-14,18,-4,19,-2,20,21,22,23,24,25,-11,26,-1,-12,-25,-22,27,28,-7,-20,-24,29,-16,-18,30,-8,-28};
CPPUNIT_ASSERT(std::equal(expected1,expected1+48,desc->getConstPointer()));
const int expected2[13]={0,4,8,12,16,20,24,28,32,36,40,44,48};
CPPUNIT_ASSERT(skin->getCoords()==umesh->getCoords());
const int expected1[19]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54};
const int expected2[54]={1,1,0,1,0,5,1,2,1,1,3,2,1,4,3,1,9,4,1,5,10,1,14,9,1,10,15,1,19,14,1,15,20,1,24,19,1,20,25,1,25,26,1,26,27,1,27,28,1,28,29,1,29,24};
- CPPUNIT_ASSERT_EQUAL(19,skin->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)19,skin->getNodalConnectivityIndex()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected1,expected1+19,skin->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(54,skin->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)54,skin->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected2,expected2+54,skin->getNodalConnectivity()->getConstPointer()));
DataArrayInt *ids=skin->computeFetchedNodeIds();
const int expected3[18]={0,1,2,3,4,5,9,10,14,15,19,20,24,25,26,27,28,29};
- CPPUNIT_ASSERT_EQUAL(18,ids->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,ids->getNbOfElems());
CPPUNIT_ASSERT(std::equal(expected3,expected3+18,ids->getConstPointer()));
MEDCouplingUMesh *part=dynamic_cast<MEDCouplingUMesh *>(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true));
part->setName(skin->getName());
CPPUNIT_ASSERT_EQUAL(9,part->getNumberOfCells());
const int expected4[18]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8};
CPPUNIT_ASSERT(std::equal(expected4,expected4+18,trad->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(18,trad->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)18,trad->getNbOfElems());
trad->decrRef();
part->decrRef();
part2->decrRef();
m->setPartOfMySelf(ids1,ids1+3,*part2);
const int expected1[20]={3,0,4,1,3,1,4,2,3,4,5,2,3,6,7,4,3,7,5,4};
CPPUNIT_ASSERT(std::equal(expected1,expected1+20,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(20,m->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)20,m->getNodalConnectivity()->getNbOfElems());
const int expected2[6]={0,4,8,12,16,20};
CPPUNIT_ASSERT(std::equal(expected2,expected2+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3);
CPPUNIT_ASSERT(s==m->getAllTypes());
m->decrRef(); part->decrRef(); part2->decrRef();
m->setPartOfMySelf(ids1+1,ids1+3,*part);
const int expected3[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
CPPUNIT_ASSERT(std::equal(expected3,expected3+23,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(23,m->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems());
const int expected4[6]={0,5,9,13,18,23};
CPPUNIT_ASSERT(std::equal(expected4,expected4+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
CPPUNIT_ASSERT(s==m->getAllTypes());
m->decrRef(); part->decrRef();
m->setPartOfMySelf2(1,3,1,*part);
const int expected5[25]={4,0,3,4,1,4,6,7,4,3,4,7,8,5,4,4,6,7,4,3,4,7,8,5,4};
CPPUNIT_ASSERT(std::equal(expected5,expected5+25,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(25,m->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)25,m->getNodalConnectivity()->getNbOfElems());
const int expected6[6]={0,5,10,15,20,25};
CPPUNIT_ASSERT(std::equal(expected6,expected6+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_QUAD4);
CPPUNIT_ASSERT(s==m->getAllTypes());
m->decrRef(); part->decrRef();
m->setPartOfMySelf2(3,5,1,*part);
const int expected7[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
CPPUNIT_ASSERT(std::equal(expected7,expected7+23,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(23,m->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems());
const int expected8[6]={0,5,9,13,18,23};
CPPUNIT_ASSERT(std::equal(expected8,expected8+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
CPPUNIT_ASSERT(s==m->getAllTypes());
m->decrRef(); part->decrRef();
m->setPartOfMySelf2(4,2,-1,*part);
const int expected9[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3};
CPPUNIT_ASSERT(std::equal(expected9,expected9+23,m->getNodalConnectivity()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(23,m->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems());
const int expected10[6]={0,5,9,13,18,23};
CPPUNIT_ASSERT(std::equal(expected10,expected10+6,m->getNodalConnectivityIndex()->getConstPointer()));
- CPPUNIT_ASSERT_EQUAL(6,m->getNodalConnectivityIndex()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems());
s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON);
CPPUNIT_ASSERT(s==m->getAllTypes());
part->decrRef();
{
CPPUNIT_ASSERT_EQUAL(expected1[i],f[i]);
}
- CPPUNIT_ASSERT_EQUAL(1,e[0]->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(2,e[1]->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(2,e[2]->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(4,e[3]->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)1,e[0]->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)2,e[1]->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)2,e[2]->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL((std::size_t)4,e[3]->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(1,e[0]->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(1,e[1]->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(1,e[2]->getNumberOfComponents());
self.assertEqual(5,d.popBackSilent())
e=DataArrayInt([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e))
self.assertEqual(8,d.getNbOfElemAllocated())
- self.assertRaises(InterpKernelException,d.reserve,-1)
+ self.assertRaises(OverflowError,d.reserve,-1)
e=DataArrayInt([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e))
self.assertEqual(8,d.getNbOfElemAllocated())
d.reserve(0)
self.assertEqual(5.,d.popBackSilent())
e=DataArrayDouble([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e,1e-14))
self.assertEqual(8,d.getNbOfElemAllocated())
- self.assertRaises(InterpKernelException,d.reserve,-1)
+ self.assertRaises(OverflowError,d.reserve,-1)
e=DataArrayDouble([7,8,9,10]) ; e.copyStringInfoFrom(d) ; self.assertTrue(d.isEqual(e,1e-14))
self.assertEqual(8,d.getNbOfElemAllocated())
d.reserve(0)
self.assertTrue(a.isEqual(DataArrayInt([0,2,4])))
self.assertTrue(b.isEqual(DataArrayInt([0,1,2,7,8,15,16,17])))
pass
+
+ def testSwig2BigMem(self):
+ if MEDCouplingSizeOfVoidStar()==64:
+ d=DataArrayAsciiChar(223456789,16)
+ self.assertTrue(d.getNumberOfTuples(),223456789)
+ self.assertTrue(d.getNumberOfComponents(),16)
+ d.setIJ(223456788,5,"r")
+ self.assertTrue(d.getIJ(223456788,5),'r')
+ d[223456787]="1234567890123456"
+ self.assertTrue(d[223456787],'1234567890123456')
+ self.assertRaises(InterpKernelException,d.rearrange,1)# fails because it would lead to nb of tuples > 2147483647
+ pass
+ pass
def setUp(self):
pass
const char *MEDCouplingVersionStr();
int MEDCouplingVersion();
+ int MEDCouplingSizeOfVoidStar();
PyObject *MEDCouplingVersionMajMinRel()
{
int tmp0=0,tmp1=0,tmp2=0;