From a8f9ca89487cd930c0151b579559cc3fdbd50e29 Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 29 Nov 2010 13:45:49 +0000 Subject: [PATCH] *** empty log message *** --- src/MEDCoupling/MEDCouplingUMesh.cxx | 51 +++++++++++++++------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 8b62afb68..1053b727f 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -572,7 +572,7 @@ void MEDCouplingUMesh::unPolyze() { checkFullyDefined(); if(getMeshDimension()<=1) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertDegeneratedCells works on umeshes with meshdim equals to 2 or 3 !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::unPolyze works on umeshes with meshdim equals to 2 or 3 !"); int nbOfCells=getNumberOfCells(); if(nbOfCells<1) return ; @@ -2237,7 +2237,7 @@ void MEDCouplingUMesh::convertDegeneratedCells() throw(INTERP_KERNEL::Exception) INTERP_KERNEL::NormalizedCellType newType=simplifyDegeneratedCell(type,conn+posOfCurCell+1,lgthOfCurCell-1, conn+newPos+1,newLgth); conn[newPos]=newType; - newPos=posOfCurCell+newLgth+1; + newPos+=newLgth+1; posOfCurCell=index[i+1]; index[i+1]=newPos; } @@ -3307,7 +3307,10 @@ int *MEDCouplingUMesh::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type if(std::find(tmp2,tmp2+newPos,work[k])==tmp2+newPos) tmp2[newPos++]=work[k]; if(newPos<3) - continue; + { + delete [] tmp2; + continue; + } int tmp3; faces.push_back(tryToUnPoly2D(tmp2,newPos,work,tmp3)); delete [] tmp2; @@ -3336,7 +3339,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::tryToUnPoly3D(const int *con { case 806: return tryToUnPolyHex8(conn,nbOfFaces,lgth,retConn,retLgth); - case 506: + case 605: return tryToUnPolyPenta6(conn,nbOfFaces,lgth,retConn,retLgth); case 505: return tryToUnPolyPyra5(conn,nbOfFaces,lgth,retConn,retLgth); @@ -3559,25 +3562,27 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::tryToUnPolyPyra5(const int * bool ok=true; int point=-1; for(int i=0;i<5 && ok;i++) - if(i!=quad4_pos) - { - std::vector tmp; - std::set conn2(w,w+3); - std::set_intersection(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector >(tmp)); - ok=tmp.size()==2; - tmp.clear(); - std::set_difference(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector >(tmp)); - ok=ok && tmp.size()==1; - if(ok) - { - if(point>=0) - ok=point==tmp[0]; - else - point=tmp[0]; - } - w=std::find(w,conn+lgth,-1); - w++; - } + { + if(i!=quad4_pos) + { + std::vector tmp; + std::set conn2(w,w+3); + std::set_intersection(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector >(tmp)); + ok=tmp.size()==2; + tmp.clear(); + std::set_difference(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector >(tmp)); + ok=ok && tmp.size()==1; + if(ok) + { + if(point>=0) + ok=point==tmp[0]; + else + point=tmp[0]; + } + } + w=std::find(w,conn+lgth,-1); + w++; + } if(ok && point>=0) { std::copy(quad4,quad4+4,retConn); -- 2.39.2