From: ageay Date: Wed, 25 Apr 2012 16:07:59 +0000 (+0000) Subject: Bug in checkButterfly. X-Git-Tag: TRIPOLI_323~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9ff2abf05eecba40edce0bae2f2a0ca714158911;p=tools%2Fmedcoupling.git Bug in checkButterfly. --- diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index f66834967..11db59d65 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -912,7 +912,7 @@ void MEDCouplingPointSet::project2DCellOnXY(const int *startConn, const int *end /*! * low level method that checks that the 2D cell is not a butterfly cell. */ -bool MEDCouplingPointSet::isButterfly2DCell(const std::vector& res, bool isQuad) +bool MEDCouplingPointSet::isButterfly2DCell(const std::vector& res, bool isQuad, double eps) { std::size_t nbOfNodes=res.size()/2; std::vector nodes(nbOfNodes); @@ -921,12 +921,14 @@ bool MEDCouplingPointSet::isButterfly2DCell(const std::vector& res, bool INTERP_KERNEL::Node *tmp=new INTERP_KERNEL::Node(res[2*i],res[2*i+1]); nodes[i]=tmp; } + INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps; + INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps; INTERP_KERNEL::QuadraticPolygon *pol=0; if(isQuad) pol=INTERP_KERNEL::QuadraticPolygon::BuildArcCirclePolygon(nodes); else pol=INTERP_KERNEL::QuadraticPolygon::BuildLinearPolygon(nodes); - bool ret=pol->isButterfly(); + bool ret=pol->isButterflyAbs(); delete pol; return ret; } diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 8e0561959..257af5247 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -115,7 +115,7 @@ namespace ParaMEDMEM void rotate2D(const double *center, double angle); void rotate3D(const double *center, const double *vect, double angle); void project2DCellOnXY(const int *startConn, const int *endConn, std::vector& res) const; - static bool isButterfly2DCell(const std::vector& res, bool isQuad); + static bool isButterfly2DCell(const std::vector& res, bool isQuad, double eps); template void findNodeIdsNearPointAlg(std::vector& bbox, const double *pos, int nbNodes, double eps, std::vector& c, std::vector& cI) const; diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index a4d6e6868..58b63bddc 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -2987,7 +2987,7 @@ void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoint * A 2D cell is considered to be butterfly if it exists at least one pair of distinct edges of it that intersect each other * anywhere excepted their extremities. An INTERP_KERNEL::NORM_NORI3 could \b not be butterfly. */ -void MEDCouplingUMesh::checkButterflyCells(std::vector& cells) const +void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double eps) const { const char msg[]="Butterfly detection work only for 2D cells with spaceDim==2 or 3!"; if(getMeshDimension()!=2) @@ -3007,7 +3007,7 @@ void MEDCouplingUMesh::checkButterflyCells(std::vector& cells) const continue; bool isQuad=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[offset]).isQuadratic(); project2DCellOnXY(conn+offset+1,conn+connI[i+1],cell2DinS2); - if(isButterfly2DCell(cell2DinS2,isQuad)) + if(isButterfly2DCell(cell2DinS2,isQuad,eps)) cells.push_back(i); cell2DinS2.clear(); } diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index b2f81b1bf..163a8ccf9 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -137,7 +137,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, std::vector& elts, std::vector& eltsIndex) const; - MEDCOUPLING_EXPORT void checkButterflyCells(std::vector& cells) const; + MEDCOUPLING_EXPORT void checkButterflyCells(std::vector& cells, double eps=1e-12) const; MEDCOUPLING_EXPORT void findAndCorrectBadOriented3DExtrudedCells(std::vector& cells) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void getBoundingBoxForBBTree(std::vector& bbox) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);