From bdb6d61f8cb19308482baeabc9c12917f5f39b55 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 21 Apr 2011 13:32:29 +0000 Subject: [PATCH] 0021223: EDF 1839 SMESH: Bug of convert to quadratic after pattern mapping Use Precision::Infinite() to mark UV of node on face as "not set" --- src/SMESH/SMESH_MesherHelper.cxx | 23 ++++++++++------------- src/SMESH/SMESH_Pattern.cxx | 5 ++++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 12232f0b3..6757fef90 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -473,7 +473,7 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F, if ( validU ) uv = C2d->Value( u ); else - uv.SetCoord(0.,0.); + uv.SetCoord( Precision::Infinite(),0.); if ( check || !validU ) uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), 10*MaxTolerance( F ),/*force=*/ !validU ); @@ -552,6 +552,10 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F, uv = GetUVOnSeam( uv, GetNodeUV( F, n2, 0 )); } } + else + { + uvOK = CheckNodeUV( F, n, uv.ChangeCoord(), 10*MaxTolerance( F )); + } if ( check ) *check = uvOK; @@ -572,18 +576,15 @@ bool SMESH_MesherHelper::CheckNodeUV(const TopoDS_Face& F, double distXYZ[4]) const { int shapeID = n->getshapeId(); - if ( force || toCheckPosOnShape( shapeID )) + bool infinit = ( Precision::IsInfinite( uv.X() ) || Precision::IsInfinite( uv.Y() )); + if ( force || toCheckPosOnShape( shapeID ) || infinit ) { - double toldis = tol; - double tolmin = 1.e-7*myMesh->GetMeshDS()->getMaxDim(); // nodes coordinates are stored in float format - if (toldis < tolmin) toldis = tolmin; // check that uv is correct TopLoc_Location loc; Handle(Geom_Surface) surface = BRep_Tool::Surface( F,loc ); gp_Pnt nodePnt = XYZ( n ), surfPnt(0,0,0); double dist = 0; if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() ); - bool infinit = ( Precision::IsInfinite( uv.X() ) || Precision::IsInfinite( uv.Y() )); if ( infinit || (dist = nodePnt.Distance( surfPnt = surface->Value( uv.X(), uv.Y() ))) > tol ) { @@ -776,10 +777,6 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E, int shapeID = n->getshapeId(); if ( force || toCheckPosOnShape( shapeID )) { - //double toldis = tol; - //double tolmin = 1.e-7*myMesh->GetMeshDS()->getMaxDim(); // nodes coordinates are stored in float format - //if (toldis < tolmin) toldis = tolmin; - // check that u is correct TopLoc_Location loc; double f,l; Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l ); if ( curve.IsNull() ) // degenerated edge @@ -801,7 +798,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E, distXYZ[0] = dist; distXYZ[1] = curvPnt.X(); distXYZ[2] = curvPnt.Y(); distXYZ[3]=curvPnt.Z(); } - if ( dist > tol /*toldis*/ ) + if ( dist > tol ) { setPosOnShapeValidity( shapeID, false ); // u incorrect, project the node to the curve @@ -830,10 +827,10 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E, distXYZ[0] = dist; distXYZ[1] = curvPnt.X(); distXYZ[2] = curvPnt.Y(); distXYZ[3]=curvPnt.Z(); } - if ( dist > tol /*toldis*/) + if ( dist > tol ) { MESSAGE( "SMESH_MesherHelper::CheckNodeU(), invalid projection" ); - MESSAGE("distance " << dist << " " << tol/*dis*/); + MESSAGE("distance " << dist << " " << tol ); return false; } // store the fixed U on the edge diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index 713c97602..289d1cd26 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -4121,7 +4122,9 @@ void SMESH_Pattern::createElements(SMESH_Mesh* theMes if (!node->getshapeId() && shellNodes.find( node ) == shellNodes.end() ) { if ( S.ShapeType() == TopAbs_FACE ) - aMeshDS->SetNodeOnFace( node, shapeID ); + aMeshDS->SetNodeOnFace( node, shapeID, + Precision::Infinite(),// <- it's a sign that UV is not set + Precision::Infinite()); else { aMeshDS->SetNodeInVolume( node, shapeID ); shellNodes.insert( node ); -- 2.30.2