Salome HOME
Merge from MrgToV7main1804
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingMemArray.cxx
index fc3e9e8629c7d597f1bd89bf47ae2f89eba98ddf..2f09e0f6e692f9bf35a7d17fe6475ed867f3acb2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -39,7 +39,7 @@ template<int SPACEDIM>
 void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt *c, DataArrayInt *cI) const
 {
   const double *coordsPtr=getConstPointer();
-  BBTree<SPACEDIM,int> myTree(bbox,0,0,nbNodes,prec/10);
+  BBTreePts<SPACEDIM,int> myTree(bbox,0,0,nbNodes,prec);
   std::vector<bool> isDone(nbNodes);
   for(int i=0;i<nbNodes;i++)
     {
@@ -69,7 +69,7 @@ void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int l
 }
 
 template<int SPACEDIM>
-void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTree<SPACEDIM,int>& myTree, const double *pos, int nbOfTuples, double eps,
+void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts<SPACEDIM,int>& myTree, const double *pos, int nbOfTuples, double eps,
                                                 DataArrayInt *c, DataArrayInt *cI)
 {
   for(int i=0;i<nbOfTuples;i++)
@@ -383,10 +383,10 @@ std::string DataArray::GetUnitFromInfo(const std::string& info) throw(INTERP_KER
  * Sets information on a component specified by an index.
  * To know more on format of this information
  * see \ref MEDCouplingArrayBasicsCompoName "DataArrays infos".
+ *  \warning Don't pass NULL as \a info!
  *  \param [in] i - the index (zero based) of the component of interest.
  *  \param [in] info - the string containing the information.
  *  \throw If \a i is not a valid component index.
- *  \warning Don't pass NULL as \a info!
  */
 void DataArray::setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception)
 {
@@ -417,7 +417,7 @@ void DataArray::checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTER
     }
 }
 
-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)
     {
@@ -589,7 +589,7 @@ void DataArrayDouble::checkAllocated() const throw(INTERP_KERNEL::Exception)
 
 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;
 }
@@ -655,7 +655,8 @@ bool DataArrayDouble::empty() const throw(INTERP_KERNEL::Exception)
 /*!
  * Returns a full copy of \a this. For more info on copying data arrays see
  * \ref MEDCouplingArrayBasicsCopyDeep.
- *  \return DataArrayDouble * - a new instance of DataArrayDouble.
+ *  \return DataArrayDouble * - a new instance of DataArrayDouble. The caller is to
+ *          delete this array using decrRef() as it is no more needed. 
  */
 DataArrayDouble *DataArrayDouble::deepCpy() const throw(INTERP_KERNEL::Exception)
 {
@@ -692,10 +693,10 @@ void DataArrayDouble::cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL:
   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);
 }
@@ -708,7 +709,7 @@ void DataArrayDouble::cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL:
  * 
  * \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)
@@ -824,7 +825,7 @@ void DataArrayDouble::alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::E
   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();
 }
 
@@ -909,19 +910,19 @@ void DataArrayDouble::sort(bool asc) throw(INTERP_KERNEL::Exception)
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayDouble::sort : only supported with 'this' array with ONE component !");
   _mem.sort(asc);
+  declareAsNew();
 }
 
 /*!
  * Reverse the array values.
- *  \throw If \a this->getNumberOfComponents() != 1.
+ *  \throw If \a this->getNumberOfComponents() < 1.
  *  \throw If \a this is not allocated.
  */
 void DataArrayDouble::reverse() throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayDouble::reverse : only supported with 'this' array with ONE component !");
-  _mem.reverse();
+  _mem.reverse(getNumberOfComponents());
+  declareAsNew();
 }
 
 /*!
@@ -1063,6 +1064,65 @@ void DataArrayDouble::reprCppStream(const char *varName, std::ostream& stream) c
   stream << varName << "->setName(\"" << getName() << "\");" << std::endl;
 }
 
+/*!
+ * Method that gives a quick overvien of \a this for python.
+ */
+void DataArrayDouble::reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+  static const std::size_t MAX_NB_OF_BYTE_IN_REPR=300;
+  stream << "DataArrayDouble C++ instance at " << this << ". ";
+  if(isAllocated())
+    {
+      int nbOfCompo=(int)_info_on_compo.size();
+      if(nbOfCompo>=1)
+        {
+          int nbOfTuples=getNumberOfTuples();
+          stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
+          reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
+        }
+      else
+        stream << "Number of components : 0.";
+    }
+  else
+    stream << "*** No data allocated ****";
+}
+
+void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception)
+{
+  const double *data=begin();
+  int nbOfTuples=getNumberOfTuples();
+  int nbOfCompo=(int)_info_on_compo.size();
+  std::ostringstream oss2; oss2 << "[";
+  oss2.precision(17);
+  std::string oss2Str(oss2.str());
+  bool isFinished=true;
+  for(int i=0;i<nbOfTuples && isFinished;i++)
+    {
+      if(nbOfCompo>1)
+        {
+          oss2 << "(";
+          for(int j=0;j<nbOfCompo;j++,data++)
+            {
+              oss2 << *data;
+              if(j!=nbOfCompo-1) oss2 << ", ";
+            }
+          oss2 << ")";
+        }
+      else
+        oss2 << *data++;
+      if(i!=nbOfTuples-1) oss2 << ", ";
+      std::string oss3Str(oss2.str());
+      if(oss3Str.length()<maxNbOfByteInRepr)
+        oss2Str=oss3Str;
+      else
+        isFinished=false;
+    }
+  stream << oss2Str;
+  if(!isFinished)
+    stream << "... ";
+  stream << "]";
+}
+
 /*!
  * Equivalent to DataArrayDouble::isEqual except that if false the reason of
  * mismatch is given.
@@ -1114,7 +1174,7 @@ bool DataArrayDouble::isEqualWithoutConsideringStr(const DataArrayDouble& other,
 void DataArrayDouble::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
-  _mem.reAlloc(getNumberOfComponents()*nbOfTuples);
+  _mem.reAlloc(getNumberOfComponents()*(std::size_t)nbOfTuples);
   declareAsNew();
 }
 
@@ -1127,7 +1187,7 @@ DataArrayInt *DataArrayDouble::convertToIntArr() const
 {
   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);
@@ -1140,10 +1200,10 @@ DataArrayInt *DataArrayDouble::convertToIntArr() const
  * arranged in memory. If \a this array holds 2 components of 3 values:
  * \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$, then the result array holds these values arranged
  * as follows: \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$.
+ *  \warning Do not confuse this method with transpose()!
  *  \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
  *          is to delete using decrRef() as it is no more needed.
  *  \throw If \a this is not allocated.
- *  \warning Do not confuse this method with transpose()!
  */
 DataArrayDouble *DataArrayDouble::fromNoInterlace() const throw(INTERP_KERNEL::Exception)
 {
@@ -1160,10 +1220,10 @@ DataArrayDouble *DataArrayDouble::fromNoInterlace() const throw(INTERP_KERNEL::E
  * arranged in memory. If \a this array holds 2 components of 3 values:
  * \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$, then the result array holds these values arranged
  * as follows: \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$.
+ *  \warning Do not confuse this method with transpose()!
  *  \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
  *          is to delete using decrRef() as it is no more needed.
  *  \throw If \a this is not allocated.
- *  \warning Do not confuse this method with transpose()!
  */
 DataArrayDouble *DataArrayDouble::toNoInterlace() const throw(INTERP_KERNEL::Exception)
 {
@@ -1375,7 +1435,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, cons
     if(*w>=0 && *w<oldNbOfTuples)
       std::copy(srcPt+(*w)*nbComp,srcPt+((*w)+1)*nbComp,pt+i*nbComp);
     else
-      throw INTERP_KERNEL::Exception("DataArrayInt::selectByTupleIdSafe : some ids has been detected to be out of [0,this->getNumberOfTuples) !");
+      throw INTERP_KERNEL::Exception("DataArrayDouble::selectByTupleIdSafe : some ids has been detected to be out of [0,this->getNumberOfTuples) !");
   ret->copyStringInfoFrom(*this);
   return ret.retn();
 }
@@ -1393,7 +1453,6 @@ DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, cons
  *  \param [in] step - index increment to get index of the next tuple to copy.
  *  \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
  *          is to delete using decrRef() as it is no more needed.
- *  \throw If (\a end2 < \a bg) or (\a step <= 0).
  *  \sa DataArrayDouble::substr.
  */
 DataArrayDouble *DataArrayDouble::selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception)
@@ -1401,7 +1460,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleId2(int bg, int end2, int step) c
   checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
   int nbComp=getNumberOfComponents();
-  int newNbOfTuples=GetNumberOfItemGivenBES(bg,end2,step,"DataArrayDouble::selectByTupleId2 : ");
+  int newNbOfTuples=GetNumberOfItemGivenBESRelative(bg,end2,step,"DataArrayDouble::selectByTupleId2 : ");
   ret->alloc(newNbOfTuples,nbComp);
   double *pt=ret->getPointer();
   const double *srcPt=getConstPointer()+bg*nbComp;
@@ -1507,11 +1566,11 @@ DataArrayDouble *DataArrayDouble::substr(int tupleIdBg, int tupleIdEnd) const th
   else
     trueEnd=nbt;
   int nbComp=getNumberOfComponents();
-  DataArrayDouble *ret=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
   ret->alloc(trueEnd-tupleIdBg,nbComp);
   ret->copyStringInfoFrom(*this);
   std::copy(getConstPointer()+tupleIdBg*nbComp,getConstPointer()+trueEnd*nbComp,ret->getPointer());
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -1555,17 +1614,24 @@ DataArrayDouble *DataArrayDouble::changeNbOfComponents(int newNbOfComp, double d
 /*!
  * 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.
  *  \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();
@@ -1576,9 +1642,9 @@ void DataArrayDouble::rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception
  * of tuples, and inversely its number of tuples to become equal to its number of 
  * components. So that its raw data **does not** change, instead splitting this
  * data into tuples changes.
- *  \throw If \a this is not allocated.
  *  \warning This method erases all (name and unit) component info set before!
  *  \warning Do not confuse this method with fromNoInterlace() and toNoInterlace()!
+ *  \throw If \a this is not allocated.
  *  \sa rearrange()
  */
 void DataArrayDouble::transpose() throw(INTERP_KERNEL::Exception)
@@ -1673,10 +1739,10 @@ void DataArrayDouble::meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL
  *
  * This method is typically used by MEDCouplingPointSet::findCommonNodes() and
  * MEDCouplingUMesh::mergeNodes().
- *  \param [in] prec - minimal absolute distance between two tuples at which they are
+ *  \param [in] prec - minimal absolute distance between two tuples (infinite norm) at which they are
  *              considered not coincident.
- *  \param [in] limitTupleId - limit tuple id. Tuples with id strictly lower than \a 
- *              limitTupleId are not considered.
+ *  \param [in] limitTupleId - limit tuple id. If all tuples within a group of coincident
+ *              tuples have id strictly lower than \a limitTupleId then they are not returned.
  *  \param [out] comm - the array holding ids (== indices) of coincident tuples. 
  *               \a comm->getNumberOfComponents() == 1. 
  *               \a comm->getNumberOfTuples() == \a commIndex->back().
@@ -1703,19 +1769,17 @@ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayI
   
   int nbOfTuples=getNumberOfTuples();
   //
-  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox=computeBBoxPerTuple(prec);
-  //
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0);
   switch(nbOfCompo)
     {
     case 3:
-      findCommonTuplesAlg<3>(bbox->getConstPointer(),nbOfTuples,limitTupleId,prec,c,cI);
+      findCommonTuplesAlg<3>(begin(),nbOfTuples,limitTupleId,prec,c,cI);
       break;
     case 2:
-      findCommonTuplesAlg<2>(bbox->getConstPointer(),nbOfTuples,limitTupleId,prec,c,cI);
+      findCommonTuplesAlg<2>(begin(),nbOfTuples,limitTupleId,prec,c,cI);
       break;
     case 1:
-      findCommonTuplesAlg<1>(bbox->getConstPointer(),nbOfTuples,limitTupleId,prec,c,cI);
+      findCommonTuplesAlg<1>(begin(),nbOfTuples,limitTupleId,prec,c,cI);
       break;
     default:
       throw INTERP_KERNEL::Exception("DataArrayDouble::findCommonTuples : nb of components managed are 1,2 and 3 ! not implemented for other number of components !");
@@ -1848,8 +1912,8 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other)
  * that coincident tuples are excluded.
  *  \param [in] prec - minimal absolute distance between two tuples at which they are
  *              considered not coincident.
- *  \param [in] limitTupleId - limit tuple id. Tuples with id strictly lower than \a 
- *              limiTupleId are not considered and thus not excluded.
+ *  \param [in] limitTupleId - limit tuple id. If all tuples within a group of coincident
+ *              tuples have id strictly lower than \a limitTupleId then they are not excluded.
  *  \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
  *          is to delete using decrRef() as it is no more needed.
  *  \throw If \a this is not allocated.
@@ -1870,7 +1934,6 @@ DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, int limitTuple
 
 /*!
  * Copy all components in a specified order from another DataArrayDouble.
- * The specified components become the first ones in \a this array.
  * Both numerical and textual data is copied. The number of tuples in \a this and
  * the other array can be different.
  *  \param [in] a - the array to copy data from.
@@ -1946,7 +2009,7 @@ void DataArrayDouble::setPartOfValues1(const DataArrayDouble *a, int bgTuples, i
   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);
@@ -2063,7 +2126,7 @@ void DataArrayDouble::setPartOfValues2(const DataArrayDouble *a, const int *bgTu
   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);
@@ -2082,7 +2145,7 @@ void DataArrayDouble::setPartOfValues2(const DataArrayDouble *a, const int *bgTu
           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;
             }
         }
     }
@@ -2094,7 +2157,7 @@ void DataArrayDouble::setPartOfValues2(const DataArrayDouble *a, const int *bgTu
           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;
             }
         }
     }
@@ -2132,7 +2195,7 @@ void DataArrayDouble::setPartOfValuesSimple2(double a, const int *bgTuples, cons
     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;
       }
 }
 
@@ -2193,7 +2256,7 @@ void DataArrayDouble::setPartOfValues3(const DataArrayDouble *a, const int *bgTu
   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);
@@ -2211,7 +2274,7 @@ void DataArrayDouble::setPartOfValues3(const DataArrayDouble *a, const int *bgTu
         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
@@ -2222,7 +2285,7 @@ void DataArrayDouble::setPartOfValues3(const DataArrayDouble *a, const int *bgTu
           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;
             }
         }
     }
@@ -2265,7 +2328,7 @@ void DataArrayDouble::setPartOfValuesSimple3(double a, const int *bgTuples, cons
     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;
       }
 }
 
@@ -2318,7 +2381,7 @@ void DataArrayDouble::setPartOfValues4(const DataArrayDouble *a, int bgTuples, i
   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);
@@ -2554,7 +2617,7 @@ double DataArrayDouble::getIJSafe(int tupleId, int compoId) const throw(INTERP_K
       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];
 }
 
 /*!
@@ -2602,14 +2665,14 @@ void DataArrayDouble::SetArrayIn(DataArrayDouble *newArray, DataArrayDouble* &ar
 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();
 }
 
@@ -2621,7 +2684,7 @@ void DataArrayDouble::useExternalArrayWithRWAccess(const double *array, int nbOf
 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 !");
@@ -2700,7 +2763,7 @@ DataArrayDouble *DataArrayDouble::computeBBoxPerTuple(double epsilon)const throw
  * Two tuples are considered equal if the euclidian distance between the two tuples is lower than \a eps.
  * 
  * \param [in] other a DataArrayDouble having same number of components than \a this.
- * \param [in] eps absolute precision representing euclidian distance between 2 tuples behind which 2 tuples are considered equal.
+ * \param [in] eps absolute precision representing distance (using infinite norm) between 2 tuples behind which 2 tuples are considered equal.
  * \param [out] c will contain the set of tuple ids in \a this that are equal to to the tuple ids in \a other contiguously.
  *             \a cI allows to extract information in \a c.
  * \param [out] cI is an indirection array that allows to extract the data contained in \a c.
@@ -2718,7 +2781,6 @@ void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, do
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : input pointer other is null !");
   checkAllocated();
-  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox=computeBBoxPerTuple(eps);
   other->checkAllocated();
   int nbOfCompo=getNumberOfComponents();
   int otherNbOfCompo=other->getNumberOfComponents();
@@ -2730,19 +2792,19 @@ void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, do
     {
     case 3:
       {
-        BBTree<3,int> myTree(bbox->getConstPointer(),0,0,getNumberOfTuples(),eps/10);
+        BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
         FindTupleIdsNearTuplesAlg<3>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
         break;
       }
     case 2:
       {
-        BBTree<2,int> myTree(bbox->getConstPointer(),0,0,getNumberOfTuples(),eps/10);
+        BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
         FindTupleIdsNearTuplesAlg<2>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
         break;
       }
     case 1:
       {
-        BBTree<1,int> myTree(bbox->getConstPointer(),0,0,getNumberOfTuples(),eps/10);
+        BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),eps);
         FindTupleIdsNearTuplesAlg<1>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr);
         break;
       }
@@ -2907,9 +2969,9 @@ double DataArrayDouble::norm2() const throw(INTERP_KERNEL::Exception)
 {
   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);
 }
@@ -2924,9 +2986,9 @@ double DataArrayDouble::normMax() const throw(INTERP_KERNEL::Exception)
 {
   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)
@@ -3520,7 +3582,7 @@ void DataArrayDouble::abs() throw(INTERP_KERNEL::Exception)
 {
   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();
 }
@@ -3555,8 +3617,8 @@ void DataArrayDouble::applyLin(double a, double b) throw(INTERP_KERNEL::Exceptio
 {
   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();
 }
@@ -3564,19 +3626,19 @@ void DataArrayDouble::applyLin(double a, double b) throw(INTERP_KERNEL::Exceptio
 /*!
  * Modify all elements of \a this array, so that
  * an element _x_ becomes \f$ numerator / x \f$.
- *  \param [in] numerator - the numerator used to modify array elements.
- *  \throw If \a this is not allocated.
- *  \throw If there is an element equal to 0.0 in \a this array.
  *  \warning If an exception is thrown because of presence of 0.0 element in \a this 
  *           array, all elements processed before detection of the zero element remain
  *           modified.
+ *  \param [in] numerator - the numerator used to modify array elements.
+ *  \throw If \a this is not allocated.
+ *  \throw If there is an element equal to 0.0 in \a this array.
  */
 void DataArrayDouble::applyInv(double numerator) throw(INTERP_KERNEL::Exception)
 {
   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())
         {
@@ -3613,6 +3675,66 @@ DataArrayDouble *DataArrayDouble::negate() const throw(INTERP_KERNEL::Exception)
   return newArr;
 }
 
+/*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes <em> val ^ x </em>. Contrary to DataArrayInt::applyPow
+ * all values in \a this have to be >= 0 if val is \b not integer.
+ *  \param [in] val - the value used to apply pow on all array elements.
+ *  \throw If \a this is not allocated.
+ *  \warning If an exception is thrown because of presence of 0 element in \a this 
+ *           array and \a val is \b not integer, all elements processed before detection of the zero element remain
+ *           modified.
+ */
+void DataArrayDouble::applyPow(double val) throw(INTERP_KERNEL::Exception)
+{
+  checkAllocated();
+  double *ptr=getPointer();
+  std::size_t nbOfElems=getNbOfElems();
+  int val2=(int)val;
+  bool isInt=((double)val2)==val;
+  if(!isInt)
+    {
+      for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+        {
+          if(*ptr>=0)
+            *ptr=pow(*ptr,val);
+          else
+            {
+              std::ostringstream oss; oss << "DataArrayDouble::applyPow (double) : At elem # " << i << " value is " << *ptr << " ! must be >=0. !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+    }
+  else
+    {
+      for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+        *ptr=pow(*ptr,val2);
+    }
+  declareAsNew();
+}
+
+/*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes \f$ val ^ x \f$.
+ *  \param [in] val - the value used to apply pow on all array elements.
+ *  \throw If \a this is not allocated.
+ *  \throw If \a val < 0.
+ *  \warning If an exception is thrown because of presence of 0 element in \a this 
+ *           array, all elements processed before detection of the zero element remain
+ *           modified.
+ */
+void DataArrayDouble::applyRPow(double val) throw(INTERP_KERNEL::Exception)
+{
+  checkAllocated();
+  if(val<0.)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::applyRPow : the input value has to be >= 0 !");
+  double *ptr=getPointer();
+  std::size_t nbOfElems=getNbOfElems();
+  for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+    *ptr=pow(val,*ptr);
+  declareAsNew();
+}
+
 /*!
  * Returns a new DataArrayDouble created from \a this one by applying \a
  * FunctionToEvaluate to every tuple of \a this array. Textual data is not copied.
@@ -3910,13 +4032,12 @@ DataArrayDoubleIterator *DataArrayDouble::iterator() throw(INTERP_KERNEL::Except
  * array whose values are within a given range. Textual data is not copied.
  *  \param [in] vmin - a lowest acceptable value.
  *  \param [in] vmax - a greatest acceptable value.
- *  \return DataArrayDouble * - the new instance of DataArrayDouble.
+ *  \return DataArrayInt * - the new instance of DataArrayInt.
  *          The caller is to delete this result array using decrRef() as it is no more
  *          needed.
- *  \throw If \a this->getNumberOfComponents() != 1
- *
- *  \ref cpp_mcdataarraydouble_getidsinrange "Here is a C++ example".
+ *  \throw If \a this->getNumberOfComponents() != 1.
  *
+ *  \ref cpp_mcdataarraydouble_getidsinrange "Here is a C++ example".<br>
  *  \ref py_mcdataarraydouble_getidsinrange "Here is a Python example".
  */
 DataArrayInt *DataArrayDouble::getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception)
@@ -4533,7 +4654,7 @@ void DataArrayDouble::substractEqual(const DataArrayDouble *other) throw(INTERP_
  * valid cases.
  * 1.  The arrays have same number of tuples and components. Then each value of
  *   the result array (_a_) is a product of the corresponding values of \a a1 and
- *   \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, j ].
+ *   \a a2, i.e. _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, j ].
  * 2.  The arrays have same number of tuples and one array, say _a2_, has one
  *   component. Then
  *   _a_ [ i, j ] = _a1_ [ i, j ] * _a2_ [ i, 0 ].
@@ -4627,12 +4748,12 @@ DataArrayDouble *DataArrayDouble::Multiply(const DataArrayDouble *a1, const Data
  * Multiply values of another DataArrayDouble to values of \a this one. There are 3
  * valid cases.
  * 1.  The arrays have same number of tuples and components. Then each value of
- *   \a other array is multiplied to the corresponding value of \a this array, i.e.:
- *   _a_ [ i, j ] *= _other_ [ i, j ].
+ *   \a other array is multiplied to the corresponding value of \a this array, i.e.
+ *   _this_ [ i, j ] *= _other_ [ i, j ].
  * 2.  The arrays have same number of tuples and \a other array has one component. Then
- *   _a_ [ i, j ] *= _other_ [ i, 0 ].
+ *   _this_ [ i, j ] *= _other_ [ i, 0 ].
  * 3.  The arrays have same number of components and \a other array has one tuple. Then
- *   _a_ [ i, j ] *= _a2_ [ 0, j ].
+ *   _this_ [ i, j ] *= _a2_ [ 0, j ].
  *
  *  \param [in] other - an array to multiply to \a this one.
  *  \throw If \a other is NULL.
@@ -4699,6 +4820,7 @@ void DataArrayDouble::multiplyEqual(const DataArrayDouble *other) throw(INTERP_K
  *
  * Info on components is copied either from the first array (in the first case) or from
  * the array with maximal number of elements (getNbOfElems()).
+ *  \warning No check of division by zero is performed!
  *  \param [in] a1 - a numerator array.
  *  \param [in] a2 - a denominator array.
  *  \return DataArrayDouble * - the new instance of DataArrayDouble.
@@ -4708,7 +4830,6 @@ void DataArrayDouble::multiplyEqual(const DataArrayDouble *other) throw(INTERP_K
  *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
  *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
  *         none of them has number of tuples or components equal to 1.
- *  \warning No check of division by zero is performed!
  */
 DataArrayDouble *DataArrayDouble::Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
 {
@@ -4776,12 +4897,12 @@ DataArrayDouble *DataArrayDouble::Divide(const DataArrayDouble *a1, const DataAr
  * 3.  The arrays have same number of components and \a other array has one tuple. Then
  *   _a_ [ i, j ] /= _a2_ [ 0, j ].
  *
+ *  \warning No check of division by zero is performed!
  *  \param [in] other - an array to divide \a this one by.
  *  \throw If \a other is NULL.
  *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
  *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
  *         \a other has number of both tuples and components not equal to 1.
- *  \warning No check of division by zero is performed!
  */
 void DataArrayDouble::divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
 {
@@ -4827,6 +4948,86 @@ void DataArrayDouble::divideEqual(const DataArrayDouble *other) throw(INTERP_KER
   declareAsNew();
 }
 
+/*!
+ * Returns a new DataArrayDouble that is the result of pow of two given arrays. There are 3
+ * valid cases.
+ *
+ *  \param [in] a1 - an array to pow up.
+ *  \param [in] a2 - another array to sum up.
+ *  \return DataArrayDouble * - the new instance of DataArrayDouble.
+ *          The caller is to delete this result array using decrRef() as it is no more
+ *          needed.
+ *  \throw If either \a a1 or \a a2 is NULL.
+ *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
+ *  \throw If \a a1->getNumberOfComponents() != 1 or \a a2->getNumberOfComponents() != 1.
+ *  \throw If there is a negative value in \a a1.
+ */
+DataArrayDouble *DataArrayDouble::Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
+{
+  if(!a1 || !a2)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : at least one of input instances is null !");
+  int nbOfTuple=a1->getNumberOfTuples();
+  int nbOfTuple2=a2->getNumberOfTuples();
+  int nbOfComp=a1->getNumberOfComponents();
+  int nbOfComp2=a2->getNumberOfComponents();
+  if(nbOfTuple!=nbOfTuple2)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of tuples mismatches !");
+  if(nbOfComp!=1 || nbOfComp2!=1)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::Pow : number of components of both arrays must be equal to 1 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1);
+  const double *ptr1(a1->begin()),*ptr2(a2->begin());
+  double *ptr=ret->getPointer();
+  for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
+    {
+      if(*ptr1>=0)
+        {
+          *ptr=pow(*ptr1,*ptr2);
+        }
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayDouble::Pow : on tuple #" << i << " of a1 value is < 0 (" << *ptr1 << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  return ret.retn();
+}
+
+/*!
+ * Apply pow on values of another DataArrayDouble to values of \a this one.
+ *
+ *  \param [in] other - an array to pow to \a this one.
+ *  \throw If \a other is NULL.
+ *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples()
+ *  \throw If \a this->getNumberOfComponents() != 1 or \a other->getNumberOfComponents() != 1
+ *  \throw If there is a negative value in \a this.
+ */
+void DataArrayDouble::powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
+{
+  if(!other)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !");
+  int nbOfTuple=getNumberOfTuples();
+  int nbOfTuple2=other->getNumberOfTuples();
+  int nbOfComp=getNumberOfComponents();
+  int nbOfComp2=other->getNumberOfComponents();
+  if(nbOfTuple!=nbOfTuple2)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of tuples mismatches !");
+  if(nbOfComp!=1 || nbOfComp2!=1)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of components of both arrays must be equal to 1 !");
+  double *ptr=getPointer();
+  const double *ptrc=other->begin();
+  for(int i=0;i<nbOfTuple;i++,ptrc++,ptr++)
+    {
+      if(*ptr>=0)
+        *ptr=pow(*ptr,*ptrc);
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayDouble::powEqual : on tuple #" << i << " of this value is < 0 (" << *ptr << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  declareAsNew();
+}
+
 /*!
  * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
  * Server side.
@@ -5004,7 +5205,7 @@ void DataArrayInt::checkAllocated() const throw(INTERP_KERNEL::Exception)
 
 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;
 }
@@ -5065,14 +5266,14 @@ int DataArrayInt::intValue() const throw(INTERP_KERNEL::Exception)
 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;
 }
@@ -5128,10 +5329,10 @@ void DataArrayInt::cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Excep
   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);
 }
@@ -5144,7 +5345,7 @@ void DataArrayInt::cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Excep
  * 
  * \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)
@@ -5260,7 +5461,7 @@ void DataArrayInt::alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exce
   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();
 }
 
@@ -5378,6 +5579,64 @@ void DataArrayInt::reprCppStream(const char *varName, std::ostream& stream) cons
   stream << varName << "->setName(\"" << getName() << "\");" << std::endl;
 }
 
+/*!
+ * Method that gives a quick overvien of \a this for python.
+ */
+void DataArrayInt::reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+  static const std::size_t MAX_NB_OF_BYTE_IN_REPR=300;
+  stream << "DataArrayInt C++ instance at " << this << ". ";
+  if(isAllocated())
+    {
+      int nbOfCompo=(int)_info_on_compo.size();
+      if(nbOfCompo>=1)
+        {
+          int nbOfTuples=getNumberOfTuples();
+          stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl;
+          reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR);
+        }
+      else
+        stream << "Number of components : 0.";
+    }
+  else
+    stream << "*** No data allocated ****";
+}
+
+void DataArrayInt::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const throw(INTERP_KERNEL::Exception)
+{
+  const int *data=begin();
+  int nbOfTuples=getNumberOfTuples();
+  int nbOfCompo=(int)_info_on_compo.size();
+  std::ostringstream oss2; oss2 << "[";
+  std::string oss2Str(oss2.str());
+  bool isFinished=true;
+  for(int i=0;i<nbOfTuples && isFinished;i++)
+    {
+      if(nbOfCompo>1)
+        {
+          oss2 << "(";
+          for(int j=0;j<nbOfCompo;j++,data++)
+            {
+              oss2 << *data;
+              if(j!=nbOfCompo-1) oss2 << ", ";
+            }
+          oss2 << ")";
+        }
+      else
+        oss2 << *data++;
+      if(i!=nbOfTuples-1) oss2 << ", ";
+      std::string oss3Str(oss2.str());
+      if(oss3Str.length()<maxNbOfByteInRepr)
+        oss2Str=oss3Str;
+      else
+        isFinished=false;
+    }
+  stream << oss2Str;
+  if(!isFinished)
+    stream << "... ";
+  stream << "]";
+}
+
 /*!
  * Modifies \a this one-dimensional array so that each value \a v = \a indArrBg[ \a v ],
  * i.e. a current value is used as in index to get a new value from \a indArrBg.
@@ -5414,6 +5673,8 @@ void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd
  * Computes distribution of values of \a this one-dimensional array between given value
  * ranges (casts). This method is typically useful for entity number spliting by types,
  * for example. 
+ *  \warning The values contained in \a arrBg should be sorted ascendently. No
+ *           check of this is be done. If not, the result is not warranted. 
  *  \param [in] arrBg - the array of ascending values defining the value ranges. The i-th
  *         value of \a arrBg (\a arrBg[ i ]) gives the lowest value of the i-th range,
  *         and the greatest value of the i-th range equals to \a arrBg[ i+1 ] - 1. \a
@@ -5453,9 +5714,6 @@ void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd
  *  \throw If \a this->getNumberOfComponents() != 1.
  *  \throw If \a arrEnd - arrBg < 2.
  *  \throw If any value of \a this is not less than \a arrEnd[-1].
- *  \warning The values contained in \a arrBg should be sorted ascendently. No
- *           check of this is be done. If not, the result is not warranted. 
- * 
  */
 void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd,
                                      DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const throw(INTERP_KERNEL::Exception)
@@ -5692,19 +5950,19 @@ void DataArrayInt::sort(bool asc) throw(INTERP_KERNEL::Exception)
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::sort : only supported with 'this' array with ONE component !");
   _mem.sort(asc);
+  declareAsNew();
 }
 
 /*!
  * Reverse the array values.
- *  \throw If \a this->getNumberOfComponents() != 1.
+ *  \throw If \a this->getNumberOfComponents() < 1.
  *  \throw If \a this is not allocated.
  */
 void DataArrayInt::reverse() throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
-  if(getNumberOfComponents()!=1)
-    throw INTERP_KERNEL::Exception("DataArrayInt::reverse : only supported with 'this' array with ONE component !");
-  _mem.reverse();
+  _mem.reverse(getNumberOfComponents());
+  declareAsNew();
 }
 
 /*!
@@ -5898,10 +6156,10 @@ void DataArrayInt::useExternalArrayWithRWAccess(const int *array, int nbOfTuple,
  * arranged in memory. If \a this array holds 2 components of 3 values:
  * \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$, then the result array holds these values arranged
  * as follows: \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$.
+ *  \warning Do not confuse this method with transpose()!
  *  \return DataArrayInt * - the new instance of DataArrayInt that the caller
  *          is to delete using decrRef() as it is no more needed.
  *  \throw If \a this is not allocated.
- *  \warning Do not confuse this method with transpose()!
  */
 DataArrayInt *DataArrayInt::fromNoInterlace() const throw(INTERP_KERNEL::Exception)
 {
@@ -5919,10 +6177,10 @@ DataArrayInt *DataArrayInt::fromNoInterlace() const throw(INTERP_KERNEL::Excepti
  * arranged in memory. If \a this array holds 2 components of 3 values:
  * \f$ x_0,y_0,x_1,y_1,x_2,y_2 \f$, then the result array holds these values arranged
  * as follows: \f$ x_0,x_1,x_2,y_0,y_1,y_2 \f$.
+ *  \warning Do not confuse this method with transpose()!
  *  \return DataArrayInt * - the new instance of DataArrayInt that the caller
  *          is to delete using decrRef() as it is no more needed.
  *  \throw If \a this is not allocated.
- *  \warning Do not confuse this method with transpose()!
  */
 DataArrayInt *DataArrayInt::toNoInterlace() const throw(INTERP_KERNEL::Exception)
 {
@@ -6153,7 +6411,6 @@ DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int
  *  \param [in] step - index increment to get index of the next tuple to copy.
  *  \return DataArrayInt * - the new instance of DataArrayInt that the caller
  *          is to delete using decrRef() as it is no more needed.
- *  \throw If (\a end2 < \a bg) or (\a step <= 0).
  *  \sa DataArrayInt::substr.
  */
 DataArrayInt *DataArrayInt::selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception)
@@ -6161,7 +6418,7 @@ DataArrayInt *DataArrayInt::selectByTupleId2(int bg, int end2, int step) const t
   checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
   int nbComp=getNumberOfComponents();
-  int newNbOfTuples=GetNumberOfItemGivenBES(bg,end2,step,"DataArrayInt::selectByTupleId2 : ");
+  int newNbOfTuples=GetNumberOfItemGivenBESRelative(bg,end2,step,"DataArrayInt::selectByTupleId2 : ");
   ret->alloc(newNbOfTuples,nbComp);
   int *pt=ret->getPointer();
   const int *srcPt=getConstPointer()+bg*nbComp;
@@ -6504,7 +6761,7 @@ DataArrayDouble *DataArrayInt::convertToDblArr() const
   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);
@@ -6544,27 +6801,34 @@ DataArrayInt *DataArrayInt::substr(int tupleIdBg, int tupleIdEnd) const throw(IN
   else
     trueEnd=nbt;
   int nbComp=getNumberOfComponents();
-  DataArrayInt *ret=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
   ret->alloc(trueEnd-tupleIdBg,nbComp);
   ret->copyStringInfoFrom(*this);
   std::copy(getConstPointer()+tupleIdBg*nbComp,getConstPointer()+trueEnd*nbComp,ret->getPointer());
-  return ret;
+  return ret.retn();
 }
 
 /*!
  * 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.
  *  \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();
@@ -6575,9 +6839,9 @@ void DataArrayInt::rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception)
  * of tuples, and inversely its number of tuples to become equal to its number of 
  * components. So that its raw data **does not** change, instead splitting this
  * data into tuples changes.
- *  \throw If \a this is not allocated.
  *  \warning This method erases all (name and unit) component info set before!
  *  \warning Do not confuse this method with fromNoInterlace() and toNoInterlace()!
+ *  \throw If \a this is not allocated.
  *  \sa rearrange()
  */
 void DataArrayInt::transpose() throw(INTERP_KERNEL::Exception)
@@ -6634,7 +6898,7 @@ DataArrayInt *DataArrayInt::changeNbOfComponents(int newNbOfComp, int dftValue)
 void DataArrayInt::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
 {
   checkAllocated();
-  _mem.reAlloc(getNumberOfComponents()*nbOfTuples);
+  _mem.reAlloc(getNumberOfComponents()*(std::size_t)nbOfTuples);
   declareAsNew();
 }
 
@@ -6791,7 +7055,7 @@ void DataArrayInt::setPartOfValues1(const DataArrayInt *a, int bgTuples, int end
   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);
@@ -6909,7 +7173,7 @@ void DataArrayInt::setPartOfValues2(const DataArrayInt *a, const int *bgTuples,
   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);
@@ -6928,7 +7192,7 @@ void DataArrayInt::setPartOfValues2(const DataArrayInt *a, const int *bgTuples,
           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;
             }
         }
     }
@@ -6940,7 +7204,7 @@ void DataArrayInt::setPartOfValues2(const DataArrayInt *a, const int *bgTuples,
           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;
             }
         }
     }
@@ -6978,7 +7242,7 @@ void DataArrayInt::setPartOfValuesSimple2(int a, const int *bgTuples, const int
     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;
       }
 }
 
@@ -7039,7 +7303,7 @@ void DataArrayInt::setPartOfValues3(const DataArrayInt *a, const int *bgTuples,
   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);
@@ -7057,7 +7321,7 @@ void DataArrayInt::setPartOfValues3(const DataArrayInt *a, const int *bgTuples,
         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
@@ -7068,7 +7332,7 @@ void DataArrayInt::setPartOfValues3(const DataArrayInt *a, const int *bgTuples,
           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;
             }
         }
     }
@@ -7111,7 +7375,7 @@ void DataArrayInt::setPartOfValuesSimple3(int a, const int *bgTuples, const int
     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;
       }
 }
 
@@ -7130,7 +7394,7 @@ void DataArrayInt::setPartOfValues4(const DataArrayInt *a, int bgTuples, int end
   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);
@@ -7362,7 +7626,7 @@ int DataArrayInt::getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL:
       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];
 }
 
 /*!
@@ -7555,7 +7819,7 @@ int DataArrayInt::locateTuple(const std::vector<int>& tupl) const throw(INTERP_K
       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());
@@ -7583,7 +7847,7 @@ int DataArrayInt::search(const std::vector<int>& vals) const throw(INTERP_KERNEL
   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);
@@ -7848,7 +8112,7 @@ void DataArrayInt::abs() throw(INTERP_KERNEL::Exception)
 {
   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();
 }
@@ -7883,8 +8147,8 @@ void DataArrayInt::applyLin(int a, int b) throw(INTERP_KERNEL::Exception)
 {
   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();
 }
@@ -7913,19 +8177,19 @@ DataArrayInt *DataArrayInt::negate() const throw(INTERP_KERNEL::Exception)
 /*!
  * Modify all elements of \a this array, so that
  * an element _x_ becomes \f$ numerator / x \f$.
- *  \param [in] numerator - the numerator used to modify array elements.
- *  \throw If \a this is not allocated.
- *  \throw If there is an element equal to 0 in \a this array.
  *  \warning If an exception is thrown because of presence of 0 element in \a this 
  *           array, all elements processed before detection of the zero element remain
  *           modified.
+ *  \param [in] numerator - the numerator used to modify array elements.
+ *  \throw If \a this is not allocated.
+ *  \throw If there is an element equal to 0 in \a this array.
  */
 void DataArrayInt::applyInv(int numerator) throw(INTERP_KERNEL::Exception)
 {
   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)
         {
@@ -7954,7 +8218,7 @@ void DataArrayInt::applyDivideBy(int val) throw(INTERP_KERNEL::Exception)
     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();
 }
@@ -7972,7 +8236,7 @@ void DataArrayInt::applyModulus(int val) throw(INTERP_KERNEL::Exception)
     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();
 }
@@ -8003,19 +8267,19 @@ DataArrayInt *DataArrayInt::getIdsInRange(int vmin, int vmax) const throw(INTERP
 /*!
  * Modify all elements of \a this array, so that
  * an element _x_ becomes <em> val % x </em>.
- *  \param [in] val - the divident used to modify array elements.
- *  \throw If \a this is not allocated.
- *  \throw If there is an element equal to or less than 0 in \a this array.
  *  \warning If an exception is thrown because of presence of an element <= 0 in \a this 
  *           array, all elements processed before detection of the zero element remain
  *           modified.
+ *  \param [in] val - the divident used to modify array elements.
+ *  \throw If \a this is not allocated.
+ *  \throw If there is an element equal to or less than 0 in \a this array.
  */
 void DataArrayInt::applyRModulus(int val) throw(INTERP_KERNEL::Exception)
 {
   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)
         {
@@ -8031,6 +8295,69 @@ void DataArrayInt::applyRModulus(int val) throw(INTERP_KERNEL::Exception)
   declareAsNew();
 }
 
+/*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes <em> val ^ x </em>.
+ *  \param [in] val - the value used to apply pow on all array elements.
+ *  \throw If \a this is not allocated.
+ *  \throw If \a val < 0.
+ */
+void DataArrayInt::applyPow(int val) throw(INTERP_KERNEL::Exception)
+{
+  checkAllocated();
+  if(val<0)
+    throw INTERP_KERNEL::Exception("DataArrayInt::applyPow : input pow in < 0 !");
+  int *ptr=getPointer();
+  std::size_t nbOfElems=getNbOfElems();
+  if(val==0)
+    {
+      std::fill(ptr,ptr+nbOfElems,1.);
+      return ;
+    }
+  for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+    {
+      int tmp=1;
+      for(int j=0;j<val;j++)
+        tmp*=*ptr;
+      *ptr=tmp;
+    }
+  declareAsNew();
+}
+
+/*!
+ * Modify all elements of \a this array, so that
+ * an element _x_ becomes \f$ val ^ x \f$.
+ *  \param [in] val - the value used to apply pow on all array elements.
+ *  \throw If \a this is not allocated.
+ *  \throw If there is an element < 0 in \a this array.
+ *  \warning If an exception is thrown because of presence of 0 element in \a this 
+ *           array, all elements processed before detection of the zero element remain
+ *           modified.
+ */
+void DataArrayInt::applyRPow(int val) throw(INTERP_KERNEL::Exception)
+{
+  checkAllocated();
+  int *ptr=getPointer();
+  std::size_t nbOfElems=getNbOfElems();
+  for(std::size_t i=0;i<nbOfElems;i++,ptr++)
+    {
+      if(*ptr>=0)
+        {
+          int tmp=1;
+          for(int j=0;j<*ptr;j++)
+            tmp*=val;
+          *ptr=tmp;
+        }
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayInt::applyRPow : presence of negative value in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
+          oss << " !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  declareAsNew();
+}
+
 /*!
  * Returns a new DataArrayInt by aggregating two given arrays, so that (1) the number
  * of components in the result array is a sum of the number of components of given arrays
@@ -8148,12 +8475,12 @@ DataArrayInt *DataArrayInt::MakePartition(const std::vector<const DataArrayInt *
   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)
                 {
@@ -8181,7 +8508,7 @@ DataArrayInt *DataArrayInt::MakePartition(const std::vector<const DataArrayInt *
     {
       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());
@@ -8548,6 +8875,60 @@ void DataArrayInt::computeOffsets2() throw(INTERP_KERNEL::Exception)
   declareAsNew();
 }
 
+/*!
+ * Returns two new DataArrayInt instances whose contents is computed from that of \a this and \a listOfIds arrays as follows.
+ * \a this is expected to be an offset format ( as returned by DataArrayInt::computeOffsets2 ) that is to say with one component
+ * and ** sorted strictly increasingly **. \a listOfIds is expected to be sorted ascendingly (not strictly needed for \a listOfIds).
+ * This methods searches in \a this, considered as a set of contiguous \c this->getNumberOfComponents() ranges, all ids in \a listOfIds
+ * filling completely one of the ranges in \a this.
+ *
+ * \param [in] listOfIds a list of ids that has to be sorted ascendingly.
+ * \param [out] rangeIdsFetched the range ids fetched
+ * \param [out] idsInInputListThatFetch contains the list of ids in \a listOfIds that are \b fully included in a range in \a this. So
+ *              \a idsInInputListThatFetch is a part of input \a listOfIds.
+ *
+ * \sa DataArrayInt::computeOffsets2
+ *
+ *  \b Example: <br>
+ *          - \a this : [0,3,7,9,15,18]
+ *          - \a listOfIds contains  [0,1,2,3,7,8,15,16,17]
+ *          - \a rangeIdsFetched result array: [0,2,4]
+ *          - \a idsInInputListThatFetch result array: [0,1,2,7,8,15,16,17]
+ * In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch.
+ * <br>
+ */
+void DataArrayInt::searchRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const throw(INTERP_KERNEL::Exception)
+{
+  if(!listOfIds)
+    throw INTERP_KERNEL::Exception("DataArrayInt::searchRangesInListOfIds : input list of ids is null !");
+  listOfIds->checkAllocated(); checkAllocated();
+  if(listOfIds->getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::searchRangesInListOfIds : input list of ids must have exactly one component !");
+  if(getNumberOfComponents()!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::searchRangesInListOfIds : this must have exactly one component !");
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret0=DataArrayInt::New(); ret0->alloc(0,1);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc(0,1);
+  const int *tupEnd(listOfIds->end()),*offBg(begin()),*offEnd(end()-1);
+  const int *tupPtr(listOfIds->begin()),*offPtr(offBg);
+  while(tupPtr!=tupEnd && offPtr!=offEnd)
+    {
+      if(*tupPtr==*offPtr)
+        {
+          int i=offPtr[0];
+          while(i<offPtr[1] && *tupPtr==i && tupPtr!=tupEnd) { i++; tupPtr++; }
+          if(i==offPtr[1])
+            {
+              ret0->pushBackSilent((int)std::distance(offBg,offPtr));
+              ret1->pushBackValsSilent(tupPtr-(offPtr[1]-offPtr[0]),tupPtr);
+              offPtr++;
+            }
+        }
+      else
+        { if(*tupPtr<*offPtr) tupPtr++; else offPtr++; }
+    }
+  rangeIdsFetched=ret0.retn();
+  idsInInputListThatFetch=ret1.retn();
+}
 
 /*!
  * Returns a new DataArrayInt whose contents is computed from that of \a this and \a
@@ -9261,6 +9642,7 @@ void DataArrayInt::multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL:
  *
  * Info on components is copied either from the first array (in the first case) or from
  * the array with maximal number of elements (getNbOfElems()).
+ *  \warning No check of division by zero is performed!
  *  \param [in] a1 - a numerator array.
  *  \param [in] a2 - a denominator array.
  *  \return DataArrayInt * - the new instance of DataArrayInt.
@@ -9270,7 +9652,6 @@ void DataArrayInt::multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL:
  *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
  *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
  *         none of them has number of tuples or components equal to 1.
- *  \warning No check of division by zero is performed!
  */
 DataArrayInt *DataArrayInt::Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
 {
@@ -9338,12 +9719,12 @@ DataArrayInt *DataArrayInt::Divide(const DataArrayInt *a1, const DataArrayInt *a
  * 3.  The arrays have same number of components and \a other array has one tuple. Then
  *   _a_ [ i, j ] /= _a2_ [ 0, j ].
  *
+ *  \warning No check of division by zero is performed!
  *  \param [in] other - an array to divide \a this one by.
  *  \throw If \a other is NULL.
  *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
  *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
  *         \a other has number of both tuples and components not equal to 1.
- *  \warning No check of division by zero is performed!
  */
 void DataArrayInt::divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
 {
@@ -9404,6 +9785,7 @@ void DataArrayInt::divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::E
  *
  * Info on components is copied either from the first array (in the first case) or from
  * the array with maximal number of elements (getNbOfElems()).
+ *  \warning No check of division by zero is performed!
  *  \param [in] a1 - a dividend array.
  *  \param [in] a2 - a divisor array.
  *  \return DataArrayInt * - the new instance of DataArrayInt.
@@ -9413,7 +9795,6 @@ void DataArrayInt::divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::E
  *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and
  *         \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and
  *         none of them has number of tuples or components equal to 1.
- *  \warning No check of division by zero is performed!
  */
 DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
 {
@@ -9481,12 +9862,12 @@ DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt *
  * 3.  The arrays have same number of components and \a other array has one tuple. Then
  *   _a_ [ i, j ] %= _a2_ [ 0, j ].
  *
+ *  \warning No check of division by zero is performed!
  *  \param [in] other - a divisor array.
  *  \throw If \a other is NULL.
  *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and
  *         \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and
  *         \a other has number of both tuples and components not equal to 1.
- *  \warning No check of division by zero is performed!
  */
 void DataArrayInt::modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
 {
@@ -9531,6 +9912,94 @@ void DataArrayInt::modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::
   declareAsNew();
 }
 
+/*!
+ * Returns a new DataArrayInt that is the result of pow of two given arrays. There are 3
+ * valid cases.
+ *
+ *  \param [in] a1 - an array to pow up.
+ *  \param [in] a2 - another array to sum up.
+ *  \return DataArrayInt * - the new instance of DataArrayInt.
+ *          The caller is to delete this result array using decrRef() as it is no more
+ *          needed.
+ *  \throw If either \a a1 or \a a2 is NULL.
+ *  \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples()
+ *  \throw If \a a1->getNumberOfComponents() != 1 or \a a2->getNumberOfComponents() != 1.
+ *  \throw If there is a negative value in \a a2.
+ */
+DataArrayInt *DataArrayInt::Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
+{
+  if(!a1 || !a2)
+    throw INTERP_KERNEL::Exception("DataArrayInt::Pow : at least one of input instances is null !");
+  int nbOfTuple=a1->getNumberOfTuples();
+  int nbOfTuple2=a2->getNumberOfTuples();
+  int nbOfComp=a1->getNumberOfComponents();
+  int nbOfComp2=a2->getNumberOfComponents();
+  if(nbOfTuple!=nbOfTuple2)
+    throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of tuples mismatches !");
+  if(nbOfComp!=1 || nbOfComp2!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of components of both arrays must be equal to 1 !");
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1);
+  const int *ptr1(a1->begin()),*ptr2(a2->begin());
+  int *ptr=ret->getPointer();
+  for(int i=0;i<nbOfTuple;i++,ptr1++,ptr2++,ptr++)
+    {
+      if(*ptr2>=0)
+        {
+          int tmp=1;
+          for(int j=0;j<*ptr2;j++)
+            tmp*=*ptr1;
+          *ptr=tmp;
+        }
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayInt::Pow : on tuple #" << i << " of a2 value is < 0 (" << *ptr2 << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  return ret.retn();
+}
+
+/*!
+ * Apply pow on values of another DataArrayInt to values of \a this one.
+ *
+ *  \param [in] other - an array to pow to \a this one.
+ *  \throw If \a other is NULL.
+ *  \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples()
+ *  \throw If \a this->getNumberOfComponents() != 1 or \a other->getNumberOfComponents() != 1
+ *  \throw If there is a negative value in \a other.
+ */
+void DataArrayInt::powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
+{
+  if(!other)
+    throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : input instance is null !");
+  int nbOfTuple=getNumberOfTuples();
+  int nbOfTuple2=other->getNumberOfTuples();
+  int nbOfComp=getNumberOfComponents();
+  int nbOfComp2=other->getNumberOfComponents();
+  if(nbOfTuple!=nbOfTuple2)
+    throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of tuples mismatches !");
+  if(nbOfComp!=1 || nbOfComp2!=1)
+    throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of components of both arrays must be equal to 1 !");
+  int *ptr=getPointer();
+  const int *ptrc=other->begin();
+  for(int i=0;i<nbOfTuple;i++,ptrc++,ptr++)
+    {
+      if(*ptrc>=0)
+        {
+          int tmp=1;
+          for(int j=0;j<*ptrc;j++)
+            tmp*=*ptr;
+          *ptr=tmp;
+        }
+      else
+        {
+          std::ostringstream oss; oss << "DataArrayInt::powEqual : on tuple #" << i << " of other value is < 0 (" << *ptrc << ") !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  declareAsNew();
+}
+
 /*!
  * Returns a C array which is a renumbering map in "Old to New" mode for the input array.
  * This map, if applied to \a start array, would make it sorted. For example, if