X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_MesherHelper.cxx;h=913362e11fb3ac64601543b9a2e45161bf9f4e77;hp=3703a7215de3c4d0e89733d5da826d9c539f0615;hb=bc95c31002da130977f9cdbb0a5482741c529104;hpb=5482b99d07dd144fd5be299e722f39a81de3b5be diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 3703a7215..913362e11 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -308,11 +308,18 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh) { double f,l, r = 0.2345; Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface( edge, face, f, l ); - uv2 = C2d->Value( f * r + l * ( 1.-r )); - if ( du < Precision::PConfusion() ) - isSeam = ( Abs( uv1.Coord(1) - uv2.Coord(1) ) < Precision::PConfusion() ); + if ( C2d.IsNull() ) + { + isSeam = false; + } else - isSeam = ( Abs( uv1.Coord(2) - uv2.Coord(2) ) < Precision::PConfusion() ); + { + uv2 = C2d->Value( f * r + l * ( 1.-r )); + if ( du < Precision::PConfusion() ) + isSeam = ( Abs( uv1.Coord(1) - uv2.Coord(1) ) < Precision::PConfusion() ); + else + isSeam = ( Abs( uv1.Coord(2) - uv2.Coord(2) ) < Precision::PConfusion() ); + } } } if ( isSeam ) @@ -653,8 +660,7 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F, { if ( !IsSubShape( V, F )) { - MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID - << " not in face " << GetMeshDS()->ShapeToIndex( F ) ); + MESSAGE("GetNodeUV() Vertex "<< vertexID <<" not in face "<< GetMeshDS()->ShapeToIndex(F)); // get UV of a vertex closest to the node double dist = 1e100; gp_Pnt pn = XYZ( n ); @@ -1073,7 +1079,6 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E, } Quantity_Parameter U = projector->LowerDistanceParameter(); u = double( U ); - MESSAGE(" f " << f << " l " << l << " u " << u); curvPnt = curve->Value( u ); dist = nodePnt.Distance( curvPnt ); if ( distXYZ ) { @@ -1083,8 +1088,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E, } if ( dist > tol ) { - MESSAGE( "SMESH_MesherHelper::CheckNodeU(), invalid projection" ); - MESSAGE("distance " << dist << " " << tol ); + MESSAGE( "CheckNodeU(), invalid projection; distance " << dist << "; tol " << tol ); return false; } // store the fixed U on the edge @@ -2904,6 +2908,10 @@ bool SMESH_MesherHelper::IsReversedSubMesh (const TopoDS_Face& theFace) bool ok = true; double u0 = GetNodeU( TopoDS::Edge( E ), nn[0], nn[1], &ok ); double u1 = GetNodeU( TopoDS::Edge( E ), nn[1], nn[0], &ok ); + // check that the 2 nodes are connected with a segment (IPAL53055) + if ( SMESHDS_SubMesh* sm = GetMeshDS()->MeshElements( E )) + if ( sm->NbElements() > 0 && !GetMeshDS()->FindEdge( nn[0], nn[1] )) + ok = false; if ( ok ) { isReversed = ( u0 > u1 ); @@ -3045,8 +3053,6 @@ bool SMESH_MesherHelper::IsSubShape( const TopoDS_Shape& shape, if ( shape.IsSame( exp.Current() )) return true; } - SCRUTE((shape.IsNull())); - SCRUTE((mainShape.IsNull())); return false; } @@ -5320,3 +5326,19 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError, } } } + +//================================================================================ +/*! + * \brief DEBUG + */ +//================================================================================ + +void SMESH_MesherHelper::WriteShape(const TopoDS_Shape& s) +{ + const char* name = "/tmp/shape.brep"; + BRepTools::Write( s, name ); +#ifdef _DEBUG_ + std::cout << name << std::endl; +#endif +} +