]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Bug correction.
authorageay <ageay>
Tue, 3 Jul 2012 14:34:16 +0000 (14:34 +0000)
committerageay <ageay>
Tue, 3 Jul 2012 14:34:16 +0000 (14:34 +0000)
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling/MEDCouplingUMesh.cxx

index 0e7fac3d4ed8290fb37c675deba46ee3d580cd35..0eae4e12b710f34dde464d76a65b72b1fa8996e0 100644 (file)
@@ -375,7 +375,7 @@ int DataArray::GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end
     {
       if(step>0)
         {
-          if(begin<=value && end<value)
+          if(begin<=value && value<end)
             {
               if((value-begin)%step==0)
                 return (value-begin)/step;
@@ -387,7 +387,7 @@ int DataArray::GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end
         }
       else
         {
-          if(begin>=value && end>value)
+          if(begin>=value && value>end)
             {
               if((begin-value)%(-step)==0)
                 return (begin-value)/(-step);
index 8f8de1c6fd67f9261185db3e16dc4338aaece722..212e882b8fae669a5829e55fd7e37a2d0625d21a 100644 (file)
@@ -1746,6 +1746,7 @@ void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsE
       DataArrayInt *arrOut=0,*arrIOut=0;
       MEDCouplingUMesh::SetPartOfIndexedArrays(cellIdsBg,cellIdsEnd,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
                                                arrOut,arrIOut);
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
       setConnectivity(arrOut,arrIOut,true);
     }
 }
@@ -1796,7 +1797,8 @@ void MEDCouplingUMesh::setPartOfMySelf2(int start, int end, int step, const MEDC
     {
       DataArrayInt *arrOut=0,*arrIOut=0;
       MEDCouplingUMesh::SetPartOfIndexedArrays2(start,end,step,_nodal_connec,_nodal_connec_index,otherOnSameCoordsThanThis._nodal_connec,otherOnSameCoordsThanThis._nodal_connec_index,
-                                               arrOut,arrIOut);
+                                                arrOut,arrIOut);
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrOutAuto(arrOut),arrIOutAuto(arrIOut);
       setConnectivity(arrOut,arrIOut,true);
     }
 }                      
@@ -7140,6 +7142,7 @@ void MEDCouplingUMesh::SetPartOfIndexedArrays(const int *idsOfSelectBg, const in
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
+  srcArrIndexPtr=srcArrIndex->getConstPointer();
   arrIo->alloc(nbOfTuples+1,1);
   arro->alloc(arrIn->getNumberOfTuples()+offset,1);
   const int *arrInPtr=arrIn->getConstPointer();
@@ -7297,6 +7300,7 @@ void MEDCouplingUMesh::SetPartOfIndexedArrays2(int start, int end, int step, con
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
+  srcArrIndexPtr=srcArrIndex->getConstPointer();
   arrIo->alloc(nbOfTuples+1,1);
   arro->alloc(arrIn->getNumberOfTuples()+offset,1);
   const int *arrInPtr=arrIn->getConstPointer();