From 1507943ce3ddf5c8a20651e6a256d8ce0a627a41 Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 20 Jun 2013 06:28:32 +0000 Subject: [PATCH] More checks in profiles computation --- src/MEDCoupling/MEDCouplingUMesh.cxx | 55 ++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index d416da071..754a7d797 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -6300,6 +6300,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code size is NOT %3 !"); std::vector types; int nb=0; + bool isNoPflUsed=true; for(std::size_t i=0;i ret=DataArrayInt::New(); ret->alloc(nb,1); int *retPtr=ret->getPointer(); const int *connI=_nodal_connec_index->getConstPointer(); @@ -6329,21 +6331,50 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< { i=std::find_if(i,connI+nbOfCells,ParaMEDMEMImpl::ConnReader2(conn,(int)(*it))); int offset=(int)std::distance(connI,i); + const int *j=std::find_if(i+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,(int)(*it))); + int nbOfCellsOfCurType=(int)std::distance(i,j); if(code[3*kk+2]==-1) - { - const int *j=std::find_if(i+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,(int)(*it))); - std::size_t pos2=std::distance(i,j); - for(std::size_t k=0;kgetConstPointer(),idsPerType[code[3*kk+2]]->getConstPointer()+idsPerType[code[3*kk+2]]->getNbOfElems(), - retPtr,std::bind2nd(std::plus(),offset)); + int idInIdsPerType=code[3*kk+2]; + if(idInIdsPerType>=0 && idInIdsPerType<(int)idsPerType.size()) + { + const DataArrayInt *zePfl=idsPerType[idInIdsPerType]; + if(zePfl) + { + zePfl->checkAllocated(); + if(zePfl->getNumberOfComponents()==1) + { + for(const int *k=zePfl->begin();k!=zePfl->end();k++,retPtr++) + { + if(*k>=0 && *k