From: eap Date: Fri, 1 Mar 2013 14:37:03 +0000 (+0000) Subject: fix failure of non-regression test SMESH_TEST/Grids/smesh/mesh_Projection_2D/A1 X-Git-Tag: pluginMGCleaner~90 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3f790d0220f93d1c1b2d2c0b363e9a2d6d2f5f39;p=modules%2Fsmesh.git fix failure of non-regression test SMESH_TEST/Grids/smesh/mesh_Projection_2D/A1 Let the helper set nodes on shape to avoid the pb with a medium nodes set by mistake to EDGE instead of 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. --- diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index 55091c7f9..150197a51 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -780,8 +780,7 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust, vector< const SMDS_MeshNode*>&mefistoToDS, double scalex, double scaley) { - SMESHDS_Mesh * meshDS = _helper->GetMeshDS(); - int faceID = _helper->GetSubShapeID(); + _helper->SetElementsOnShape( true ); TopoDS_Face F = TopoDS::Face( _helper->GetSubShape() ); Handle(Geom_Surface) S = BRep_Tool::Surface( F ); @@ -796,12 +795,7 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust, double v = uvst[n][1] / scaley; gp_Pnt P = S->Value(u, v); - SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); - meshDS->SetNodeOnFace(node, faceID, u, v); - - //MESSAGE(P.X()<<" "<AddNode( P.X(), P.Y(), P.Z(), 0, u, v ); } } @@ -810,26 +804,23 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust, // triangle points must be in trigonometric order if face is Forward // else they must be put clockwise - bool triangleIsWellOriented = ( F.Orientation() == TopAbs_FORWARD ); + int i1 = 1, i2 = 2; + if ( F.Orientation() != TopAbs_FORWARD ) + std::swap( i1, i2 ); + const SMDS_MeshNode * nn[3]; for (n = 1; n <= nbt; n++) { - const SMDS_MeshNode * n1 = mefistoToDS[ nust[m++] - 1 ]; - const SMDS_MeshNode * n2 = mefistoToDS[ nust[m++] - 1 ]; - const SMDS_MeshNode * n3 = mefistoToDS[ nust[m++] - 1 ]; + nn[ 0 ] = mefistoToDS[ nust[m++] - 1 ]; + nn[ 1 ] = mefistoToDS[ nust[m++] - 1 ]; + nn[ 2 ] = mefistoToDS[ nust[m++] - 1 ]; + m++; // avoid creating degenetrated faces - bool isDegen = ( _helper->HasDegeneratedEdges() && ( n1 == n2 || n1 == n3 || n2 == n3 )); + bool isDegen = ( _helper->HasDegeneratedEdges() && + ( nn[0] == nn[1] || nn[1] == nn[2] || nn[2] == nn[0] )); if ( !isDegen ) - { - SMDS_MeshElement * elt; - if (triangleIsWellOriented) - elt = _helper->AddFace(n1, n2, n3); - else - elt = _helper->AddFace(n1, n3, n2); - meshDS->SetMeshElementOnShape(elt, faceID); - } - m++; + _helper->AddFace( nn[0], nn[i1], nn[i2] ); } // remove bad elements built on vertices shared by wires @@ -849,7 +840,7 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust, nbSame++; if (nbSame > 1) { MESSAGE( "RM bad element " << elem->GetID()); - meshDS->RemoveElement( elem ); + _helper->GetMeshDS()->RemoveElement( elem ); } } }