Salome HOME
fix failure of non-regression test SMESH_TEST/Grids/smesh/mesh_Projection_2D/A1
authoreap <eap@opencascade.com>
Fri, 1 Mar 2013 14:32:53 +0000 (14:32 +0000)
committereap <eap@opencascade.com>
Fri, 1 Mar 2013 14:32:53 +0000 (14:32 +0000)
 Avoid returning EDGE position for 2 nodes on the same EDGE, while the
 medium node should be on FACE. The case is a triangle whose 3 nodes are on
 the same EDGE. The worst is that in this case the medium node which
 is logically on FACE falls to a straight EDGE, as the triangle is of
 zero area (thanks to MEFISTO)

 std::pair<int, TopAbs_ShapeEnum> GetMediumPos(const SMDS_MeshNode* n1,
                                               const SMDS_MeshNode* n2,
+                                              const bool           useCurSubShape=false);

src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_MesherHelper.hxx

index 021a385e14372b451e929793e4ae1f9d8ab01525..76bd0576c53a0b8c0dce665242def79789398257 100644 (file)
@@ -934,11 +934,17 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge&   E,
 //function : GetMediumPos
 //purpose  : Return index and type of the shape  (EDGE or FACE only) to
 //          set a medium node on
+//param useCurSubShape: if true, returns the shape set via SetSubShape()
 //=======================================================================
 
-std::pair<int, TopAbs_ShapeEnum> SMESH_MesherHelper::GetMediumPos(const SMDS_MeshNode* n1,
-                                                                  const SMDS_MeshNode* n2)
+std::pair<int, TopAbs_ShapeEnum>
+SMESH_MesherHelper::GetMediumPos(const SMDS_MeshNode* n1,
+                                 const SMDS_MeshNode* n2,
+                                 const bool           useCurSubShape)
 {
+  if ( useCurSubShape && !myShape.IsNull() )
+    return std::make_pair( myShapeID, myShape.ShapeType() );
+
   TopAbs_ShapeEnum shapeType = TopAbs_SHAPE;
   int              shapeID = -1;
   TopoDS_Shape     shape;
@@ -1041,7 +1047,7 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
   TopoDS_Face F; gp_XY  uv[2];
   bool uvOK[2] = { false, false };
 
-  pair<int, TopAbs_ShapeEnum> pos = GetMediumPos( n1, n2 );
+  pair<int, TopAbs_ShapeEnum> pos = GetMediumPos( n1, n2, mySetElemOnShape );
 
   // get positions of the given nodes on shapes
   if ( pos.second == TopAbs_FACE )
index cf515dfba0566992d3684e5c80759bcdbf893238..4b4ffdb750b53ba7301658886b02671bf202c51d 100644 (file)
@@ -529,7 +529,8 @@ public:
    * \brief Return index and type of the shape (EDGE or FACE only) to set a medium node on
    */
   std::pair<int, TopAbs_ShapeEnum> GetMediumPos(const SMDS_MeshNode* n1,
-                                                const SMDS_MeshNode* n2);
+                                                const SMDS_MeshNode* n2,
+                                                const bool           useCurSubShape=false);
   /*!
    * \brief Add a link in my data structure
    */