From 673cb5c9670d6dbda5113ad673b18f50b97c49d5 Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 3 Jul 2012 14:34:16 +0000 Subject: [PATCH] Bug correction. --- src/MEDCoupling/MEDCouplingMemArray.cxx | 4 ++-- src/MEDCoupling/MEDCouplingUMesh.cxx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 0e7fac3d4..0eae4e12b 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -375,7 +375,7 @@ int DataArray::GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end { if(step>0) { - if(begin<=value && end=value && end>value) + if(begin>=value && value>end) { if((begin-value)%(-step)==0) return (begin-value)/(-step); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 8f8de1c6f..212e882b8 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -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 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 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(); -- 2.39.2