From: ageay Date: Tue, 19 Feb 2013 16:46:31 +0000 (+0000) Subject: Extension of DataArray*::setPartOfValues1 X-Git-Tag: V6_main_FINAL~349 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ac9b844109996bc637eb8124fdc153d28d750969;p=tools%2Fmedcoupling.git Extension of DataArray*::setPartOfValues1 --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 75eb31a15..a0153c596 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -1339,14 +1339,34 @@ void DataArrayDouble::setPartOfValues1(const DataArrayDouble *a, int bgTuples, i int nbOfTuples=getNumberOfTuples(); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); - a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg); - if(strictCompoCompare) - a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); - double *pt=getPointer()+bgTuples*nbComp+bgComp; + bool assignTech=true; + if(a->getNbOfElems()==newNbOfTuples*newNbOfComp) + { + if(strictCompoCompare) + a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); + } + else + { + a->checkNbOfTuplesAndComp(1,newNbOfComp,msg); + assignTech=false; + } const double *srcPt=a->getConstPointer(); - for(int i=0;icheckNbOfElems(newNbOfTuples*newNbOfComp,msg); - if(strictCompoCompare) - a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); + bool assignTech=true; + if(a->getNbOfElems()==newNbOfTuples*newNbOfComp) + { + if(strictCompoCompare) + a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); + } + else + { + a->checkNbOfTuplesAndComp(1,newNbOfComp,msg); + assignTech=false; + } int *pt=getPointer()+bgTuples*nbComp+bgComp; const int *srcPt=a->getConstPointer(); - for(int i=0;i