Salome HOME
020461: EDF 1102 GHS3DPLUGIN: Bad detection of volumes with Ghs3d mesh
authoreap <eap@opencascade.com>
Fri, 2 Oct 2009 11:17:45 +0000 (11:17 +0000)
committereap <eap@opencascade.com>
Fri, 2 Oct 2009 11:17:45 +0000 (11:17 +0000)
 in findShapeID(), check UV validity using tolerance of shape the node
 is on rather than tolerance of face

src/GHS3DPlugin_GHS3D.cxx

index 413602fc35f91477b23ba0b0b27658038fa914f4..a7bc2873d9eb25b255b0207e18808394854407cf 100644 (file)
@@ -613,18 +613,20 @@ static int findShapeID(SMESH_Mesh&          mesh,
   bool checkUV = true;
   gp_XY uv = helper.GetNodeUV( geomFace, node1, nNotOnSeamEdge, &checkUV );
   // check that uv is correct
+  double tol = 1e-6;
+  TopoDS_Shape nodeShape = helper.GetSubShapeByNode( node1, meshDS );
+  if ( !nodeShape.IsNull() )
+    switch ( nodeShape.ShapeType() )
+    {
+    case TopAbs_FACE:   tol = BRep_Tool::Tolerance( TopoDS::Face( nodeShape )); break;
+    case TopAbs_EDGE:   tol = BRep_Tool::Tolerance( TopoDS::Edge( nodeShape )); break;
+    case TopAbs_VERTEX: tol = BRep_Tool::Tolerance( TopoDS::Vertex( nodeShape )); break;
+    default:;
+    }
   BRepAdaptor_Surface surface( geomFace );
-  double tol = BRep_Tool::Tolerance( geomFace );
-  if ( checkUV && node1Pnt.Distance( surface.Value( uv.X(), uv.Y() )) > 2 * tol ) {
-//     GeomAPI_ProjectPointOnSurf projector( node1Pnt, surface.Surface().Surface(), 2 * tol );
-//     if ( !projector.IsDone() || projector.NbPoints() < 1 || projector.LowerDistance() > 2 * tol)
+  if ( checkUV && node1Pnt.Distance( surface.Value( uv.X(), uv.Y() )) > 2 * tol )
       return invalidID;
-//     Quantity_Parameter U,V;
-//     projector.LowerDistanceParameters(U,V);
-//     if ( node1Pnt.Distance( surface.Value( U, V )) > 2 * tol )
-//       return invalidID;
-//     uv.SetCoord( U,V );
-  }
+
   // normale to geomFace at UV
   gp_Vec du, dv;
   surface.D1( uv.X(), uv.Y(), node1Pnt, du, dv );
@@ -1125,9 +1127,9 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
       _hyp ? _hyp->GetToMeshHoles(true) : GHS3DPlugin_Hypothesis::DefaultMeshHoles();
     Ok = readResultFile( fileOpen,
 #ifdef WNT
-                        aResultFileName.ToCString(),
+                         aResultFileName.ToCString(),
 #endif
-                        theMesh, tabShape, tabBox, _nbShape, aGhs3dIdToNodeMap,
+                         theMesh, tabShape, tabBox, _nbShape, aGhs3dIdToNodeMap,
                          toMeshHoles );
   }
 
@@ -1256,9 +1258,9 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh&         theMesh,
   else {
     Ok = readResultFile( fileOpen,
 #ifdef WNT
-                        aResultFileName.ToCString(),
+                         aResultFileName.ToCString(),
 #endif
-                        meshDS, theShape ,aNodeByGhs3dId );
+                         meshDS, theShape ,aNodeByGhs3dId );
   }
   
   // ---------------------