mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-29 19:00:35 +05:00
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.
This commit is contained in:
parent
9f9b9d6ceb
commit
3f790d0220
@ -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()<<" "<<P.Y()<<" "<<P.Z());
|
||||
mefistoToDS[n] = node;
|
||||
//MESSAGE("NEW: "<<n<<" "<<mefistoToDS[n+1]);
|
||||
mefistoToDS[n] = _helper->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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user