std::ostringstream oss; oss << "DataArray::GetSlice : sliceId (" << nbOfSlices << ") must be in [0 , nbOfSlices (" << nbOfSlices << ") ) !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- mcIdType nbElems=DataArrayTemplate<T>::GetNumberOfItemGivenBESRelative(start,stop,step,"DataArray::GetSlice");
+ mcIdType nbElems=DataArrayTools<T>::GetNumberOfItemGivenBESRelative(start,stop,step,"DataArray::GetSlice");
mcIdType minNbOfElemsPerSlice=nbElems/nbOfSlices;
startSlice=start+minNbOfElemsPerSlice*step*sliceId;
if(sliceId<nbOfSlices-1)
}
/*!
- * This method reserve nbOfElems elements in memory ( nbOfElems*8 bytes ) \b without impacting the number of tuples in \a this.
+ * This method reserve nbOfElems elements in memory ( nbOfElems*sizeof(T) ) \b without impacting the number of tuples in \a this.
* If \a this has already been allocated, this method checks that \a this has only one component. If not an INTERP_KERNEL::Exception will be thrown.
* If \a this has not already been allocated, number of components is set to one.
* This method allows to reduce number of reallocations on invocation of DataArrayDouble::pushBackSilent and DataArrayDouble::pushBackValsSilent on \a this.
* For more info on renumbering see \ref numbering.
* \param [in] new2Old - C array of length equal to \a this->getNumberOfTuples()
* giving a previous position of i-th new value.
- * \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
- * is to delete using decrRef() as it is no more needed.
*/
template<class T>
void DataArrayTemplate<T>::renumberInPlaceR(const mcIdType *new2Old)
* Changes the number of components within \a this array so that its raw data **does
* not** change, instead splitting this data into tuples changes.
* \warning This method erases all (name and unit) component info set before!
- * \param [in] newNbOfComp - number of components for \a this array to have.
+ * \param [in] newNbOfCompo - 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.
std::size_t newNbOfCompo=compoIds.size();
std::size_t oldNbOfCompo=getNumberOfComponents();
for(std::vector<std::size_t>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
- if((*it)<0 || (*it)>=oldNbOfCompo)
+ if((*it)>=oldNbOfCompo) // (*it) >= 0 (it is a size_t)
{
std::ostringstream oss; oss << Traits<T>::ArrayTypeName << "::keepSelectedComponents : invalid requested component : " << *it << " whereas it should be in [0," << oldNbOfCompo << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
T *ptr(this->getPointer());
const T *ptrc(other->begin());
for(mcIdType i=0;i<nbOfTuple;i++)
- std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(FCT(),*ptrc++));
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind(FCT(),std::placeholders::_1,*ptrc++));
}
else
throw INTERP_KERNEL::Exception(msg);
const T *a2Ptr(a2->begin()),*a1Ptr(a1->begin());
T *res(ret->getPointer());
for(mcIdType i=0;i<nbOfTuple1;i++)
- res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(FCT(),a2Ptr[i]));
+ res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind(FCT(),std::placeholders::_1,a2Ptr[i]));
ret->copyStringInfoFrom(*a1);
return ret.retn();
}
const T *aMaxPtr(aMax->begin());
T *res=ret->getPointer();
for(mcIdType i=0;i<nbOfTuple;i++)
- res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(FCT(),aMinPtr[i]));
+ res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind(FCT(),std::placeholders::_1,aMinPtr[i]));
ret->copyStringInfoFrom(*aMax);
}
else
this->checkAllocated();
T *ptr(this->getPointer());
std::size_t nbOfElems(this->getNbOfElems());
- std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun<T,T>(std::abs));
+ std::transform(ptr,ptr+nbOfElems,ptr,[](T c){return std::abs(c);});
this->declareAsNew();
}
mcIdType nbOfTuples(this->getNumberOfTuples());
std::size_t nbOfComp(this->getNumberOfComponents());
newArr->alloc(nbOfTuples,nbOfComp);
- std::transform(this->begin(),this->end(),newArr->getPointer(),std::ptr_fun<T,T>(std::abs));
+ std::transform(this->begin(),this->end(),newArr->getPointer(),[](T c){return std::abs(c);});
newArr->copyStringInfoFrom(*this);
return newArr.retn();
}
std::set<T> castsDetected;
for(mcIdType i=0;i<nbOfTuples;i++)
{
- rintstart res=std::find_if(bg,end2,std::bind2nd(std::less_equal<T>(), work[i]));
+ rintstart res=std::find_if(bg,end2,std::bind(std::less_equal<T>(),std::placeholders::_1,work[i]));
std::size_t pos=std::distance(bg,res);
std::size_t pos2=nbOfCast-pos;
if(pos2<nbOfCast)
* from values of \a this array, which is supposed to contain a renumbering map in
* "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
* To know how to use the renumbering maps see \ref numbering.
- * \param [in] newNbOfElem - the number of tuples in the result array.
+ * \param [in] oldNbOfElem - the number of tuples in the result array.
* \return DataArrayInt * - the new instance of DataArrayInt.
* The caller is to delete this result array using decrRef() as it is no more
* needed.
* from values of \a this array, which is supposed to contain a renumbering map in
* "New to Old" mode. The result array contains a renumbering map in "Old to New" mode.
* To know how to use the renumbering maps see \ref numbering.
- * \param [in] newNbOfElem - the number of tuples in the result array.
* \return MapII - the new instance of Map.
*
* \if ENABLE_EXAMPLES
const T *ptr=this->getConstPointer();
mcIdType nbTuple(this->getNumberOfTuples());
std::size_t nbComps(this->getNumberOfComponents());
- if(compId<0 || compId>=nbComps)
+ if(compId>=nbComps) // compId >= 0 (it is a size_t)
throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !");
T ret=0;
for(mcIdType i=0;i<nbTuple;i++)
this->checkAllocated();
T *ptr=this->getPointer();
std::size_t nbOfElems=this->getNbOfElems();
- std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::divides<T>(),val));
+ std::transform(ptr,ptr+nbOfElems,ptr,std::bind(std::divides<T>(),std::placeholders::_1,val));
this->declareAsNew();
}
this->checkAllocated();
T *ptr=this->getPointer();
std::size_t nbOfElems=this->getNbOfElems();
- std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::modulus<T>(),val));
+ std::transform(ptr,ptr+nbOfElems,ptr,std::bind(std::modulus<T>(),std::placeholders::_1,val));
this->declareAsNew();
}
throw INTERP_KERNEL::Exception("DataArrayInt::indexOfSameConsecutiveValueGroups : only single component allowed !");
const T *pt(this->begin());
const T *const ptEnd(this->end()) , * const ptBg(this->begin());
- const T *oldPt(pt);
// first find nb of different values in this
std::size_t nbOfTuplesOut(0);
while( pt != ptEnd )
T *ptr=this->getPointer();
const T *ptrc=other->getConstPointer();
for(mcIdType i=0;i<nbOfTuple;i++)
- std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::modulus<T>(),*ptrc++));
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind(std::modulus<T>(),std::placeholders::_1,*ptrc++));
}
else
throw INTERP_KERNEL::Exception(msg);
const T *a1Ptr=a1->getConstPointer();
T *res=ret->getPointer();
for(mcIdType i=0;i<nbOfTuple1;i++)
- res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind2nd(std::modulus<T>(),a2Ptr[i]));
+ res=std::transform(a1Ptr+i*nbOfComp1,a1Ptr+(i+1)*nbOfComp1,res,std::bind(std::modulus<T>(),std::placeholders::_1,a2Ptr[i]));
ret->copyStringInfoFrom(*a1);
return ret.retn();
}
ret->alloc(retSz,1);
T *pt=ret->getPointer(); *pt++=0;
for(typename std::vector<const DataArrayType *>::const_iterator it=arrs.begin();it!=arrs.end();it++)
- pt=std::transform((*it)->begin()+1,(*it)->end(),pt,std::bind2nd(std::plus<T>(),pt[-1]));
+ pt=std::transform((*it)->begin()+1,(*it)->end(),pt,std::bind(std::plus<T>(),std::placeholders::_1,pt[-1]));
ret->copyStringInfoFrom(*(arrs[0]));
return ret.retn();
}
*
* \param [in] idsOfSelectStart begin of set of ids of the input extraction (included)
* \param [in] idsOfSelectStop end of set of ids of the input extraction (excluded)
- * \param [in] idsOfSelectStep
+ * \param [in] idsOfSelectStep step of set of ids of the input extraction
* \param [in] arrIn arr origin array from which the extraction will be done.
* \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn
* \param [out] arrOut the resulting array