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<int, TopAbs_ShapeEnum> GetMediumPos(const SMDS_MeshNode* n1,
                                               const SMDS_MeshNode* n2,
+                                              const bool           useCurSubShape=false);
This commit is contained in:
eap 2013-03-01 14:32:53 +00:00
parent 6444728ac0
commit 9f9b9d6ceb
2 changed files with 11 additions and 4 deletions

View 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 )

View 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
*/