From: eap Date: Fri, 1 Mar 2013 14:32:53 +0000 (+0000) Subject: fix failure of non-regression test SMESH_TEST/Grids/smesh/mesh_Projection_2D/A1 X-Git-Tag: pluginMGCleaner~91 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9f9b9d6ceb9972d38e65bcadadbbade14c2f04ea;p=modules%2Fsmesh.git fix failure of non-regression test SMESH_TEST/Grids/smesh/mesh_Projection_2D/A1 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 GetMediumPos(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2, + const bool useCurSubShape=false); --- diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 021a385e1..76bd0576c 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -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 SMESH_MesherHelper::GetMediumPos(const SMDS_MeshNode* n1, - const SMDS_MeshNode* n2) +std::pair +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 pos = GetMediumPos( n1, n2 ); + pair pos = GetMediumPos( n1, n2, mySetElemOnShape ); // get positions of the given nodes on shapes if ( pos.second == TopAbs_FACE ) diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index cf515dfba..4b4ffdb75 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -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 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 */