mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
Fix unstable failure of SALOME_TESTS/Grids/smesh/bugs_05/F0
This commit is contained in:
parent
fb4363102c
commit
020e13d9f1
@ -553,28 +553,35 @@ bool SMESH_Algo::IsStraight( const TopoDS_Edge & E,
|
|||||||
case GeomAbs_Hyperbola:
|
case GeomAbs_Hyperbola:
|
||||||
case GeomAbs_Parabola:
|
case GeomAbs_Parabola:
|
||||||
return false;
|
return false;
|
||||||
// case GeomAbs_BezierCurve:
|
// case GeomAbs_BezierCurve:
|
||||||
// case GeomAbs_BSplineCurve:
|
// case GeomAbs_BSplineCurve:
|
||||||
// case GeomAbs_OtherCurve:
|
// case GeomAbs_OtherCurve:
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
const double f = curve.FirstParameter();
|
|
||||||
const double l = curve.LastParameter();
|
// evaluate how far from a straight line connecting the curve ends
|
||||||
const gp_Pnt pf = curve.Value( f );
|
// stand internal points of the curve
|
||||||
const gp_Pnt pl = curve.Value( l );
|
double f = curve.FirstParameter();
|
||||||
const gp_Vec v1( pf, pl );
|
double l = curve.LastParameter();
|
||||||
const double v1Len = v1.Magnitude();
|
gp_Pnt pf = curve.Value( f );
|
||||||
if ( v1Len < std::numeric_limits< double >::min() )
|
gp_Pnt pl = curve.Value( l );
|
||||||
|
gp_Vec lineVec( pf, pl );
|
||||||
|
double lineLen2 = lineVec.SquareMagnitude();
|
||||||
|
if ( lineLen2 < std::numeric_limits< double >::min() )
|
||||||
return false; // E seems closed
|
return false; // E seems closed
|
||||||
const double tol = Min( 10 * curve.Tolerance(), v1Len * 1e-2 );
|
|
||||||
|
double edgeTol = 10 * curve.Tolerance();
|
||||||
|
double lenTol2 = lineLen2 * 1e-4;
|
||||||
|
double tol2 = Min( edgeTol * edgeTol, lenTol2 );
|
||||||
|
|
||||||
const double nbSamples = 7;
|
const double nbSamples = 7;
|
||||||
for ( int i = 0; i < nbSamples; ++i )
|
for ( int i = 0; i < nbSamples; ++i )
|
||||||
{
|
{
|
||||||
const double r = ( i + 1 ) / nbSamples;
|
double r = ( i + 1 ) / nbSamples;
|
||||||
const gp_Pnt pi = curve.Value( f * r + l * ( 1 - r ));
|
gp_Pnt pi = curve.Value( f * r + l * ( 1 - r ));
|
||||||
const gp_Vec vi( pf, pi );
|
gp_Vec vi( pf, pi );
|
||||||
const double h = 0.5 * v1.Crossed( vi ).Magnitude() / v1Len;
|
double h2 = lineVec.Crossed( vi ).SquareMagnitude() / lineLen2;
|
||||||
if ( h > tol )
|
if ( h2 > tol2 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -7482,8 +7482,8 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove bad elements, then equal nodes (order important)
|
// Remove bad elements, then equal nodes (order important)
|
||||||
Remove( rmElemIds, false );
|
Remove( rmElemIds, /*isNodes=*/false );
|
||||||
Remove( rmNodeIds, true );
|
Remove( rmNodeIds, /*isNodes=*/true );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7553,14 +7553,14 @@ bool SMESH_MeshEditor::applyMerge( const SMDS_MeshElement* elem,
|
|||||||
toRemove = true;
|
toRemove = true;
|
||||||
nbResElems = 0;
|
nbResElems = 0;
|
||||||
|
|
||||||
if ( elem->IsQuadratic() && newElemDefs[0].myType == SMDSAbs_Face && nbNodes > 6 )
|
if ( newElemDefs[0].myIsQuad && newElemDefs[0].myType == SMDSAbs_Face && nbNodes > 6 )
|
||||||
{
|
{
|
||||||
// if corner nodes stick, remove medium nodes between them from uniqueNodes
|
// if corner nodes stick, remove medium nodes between them from uniqueNodes
|
||||||
int nbCorners = nbNodes / 2;
|
int nbCorners = nbNodes / 2;
|
||||||
for ( int iCur = 0; iCur < nbCorners; ++iCur )
|
for ( int iCur = 0; iCur < nbCorners; ++iCur )
|
||||||
{
|
{
|
||||||
int iPrev = ( iCur + 1 ) % nbCorners;
|
int iNext = ( iCur + 1 ) % nbCorners;
|
||||||
if ( curNodes[ iCur ] == curNodes[ iPrev ] ) // corners stick
|
if ( curNodes[ iCur ] == curNodes[ iNext ] ) // corners stick
|
||||||
{
|
{
|
||||||
int iMedium = iCur + nbCorners;
|
int iMedium = iCur + nbCorners;
|
||||||
vector< const SMDS_MeshNode* >::iterator i =
|
vector< const SMDS_MeshNode* >::iterator i =
|
||||||
@ -7711,11 +7711,9 @@ bool SMESH_MeshEditor::applyMerge( const SMDS_MeshElement* elem,
|
|||||||
// | |
|
// | |
|
||||||
// +---+---+
|
// +---+---+
|
||||||
// 0 7 3
|
// 0 7 3
|
||||||
if (( nbUniqueNodes == 7 && nbRepl == 2 && iRepl[1] != 8 ) &&
|
if ( nbUniqueNodes == 7 &&
|
||||||
(( iRepl[0] == 1 && iRepl[1] == 4 && curNodes[1] == curNodes[0] ) ||
|
iRepl[0] < 4 &&
|
||||||
( iRepl[0] == 2 && iRepl[1] == 5 && curNodes[2] == curNodes[1] ) ||
|
( nbRepl == 1 || iRepl[1] != 8 ))
|
||||||
( iRepl[0] == 3 && iRepl[1] == 6 && curNodes[3] == curNodes[2] ) ||
|
|
||||||
( iRepl[0] == 3 && iRepl[1] == 7 && curNodes[3] == curNodes[0] )))
|
|
||||||
{
|
{
|
||||||
toRemove = false;
|
toRemove = false;
|
||||||
}
|
}
|
||||||
|
@ -193,16 +193,21 @@ const BRepMesh_Triangle* SMESH_Delaunay::FindTriangle( const gp_XY&
|
|||||||
nodeUVs[1] = _triaDS->GetNode( nodeIDs[1] ).Coord();
|
nodeUVs[1] = _triaDS->GetNode( nodeIDs[1] ).Coord();
|
||||||
nodeUVs[2] = _triaDS->GetNode( nodeIDs[2] ).Coord();
|
nodeUVs[2] = _triaDS->GetNode( nodeIDs[2] ).Coord();
|
||||||
|
|
||||||
SMESH_MeshAlgos::GetBarycentricCoords( uv,
|
if ( _triaDS->GetNode( nodeIDs[0] ).Movability() == BRepMesh_Frontier &&
|
||||||
nodeUVs[0], nodeUVs[1], nodeUVs[2],
|
_triaDS->GetNode( nodeIDs[1] ).Movability() == BRepMesh_Frontier &&
|
||||||
bc[0], bc[1] );
|
_triaDS->GetNode( nodeIDs[2] ).Movability() == BRepMesh_Frontier )
|
||||||
if ( bc[0] >= 0 && bc[1] >= 0 && bc[0] + bc[1] <= 1 )
|
|
||||||
{
|
{
|
||||||
bc[2] = 1 - bc[0] - bc[1];
|
SMESH_MeshAlgos::GetBarycentricCoords( uv,
|
||||||
triaNodes[0] = nodeIDs[0] - 1;
|
nodeUVs[0], nodeUVs[1], nodeUVs[2],
|
||||||
triaNodes[1] = nodeIDs[1] - 1;
|
bc[0], bc[1] );
|
||||||
triaNodes[2] = nodeIDs[2] - 1;
|
if ( bc[0] >= 0 && bc[1] >= 0 && bc[0] + bc[1] <= 1 )
|
||||||
return tria;
|
{
|
||||||
|
bc[2] = 1 - bc[0] - bc[1];
|
||||||
|
triaNodes[0] = nodeIDs[0] - 1;
|
||||||
|
triaNodes[1] = nodeIDs[1] - 1;
|
||||||
|
triaNodes[2] = nodeIDs[2] - 1;
|
||||||
|
return tria;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for a neighbor triangle, which is adjacent to a link intersected
|
// look for a neighbor triangle, which is adjacent to a link intersected
|
||||||
|
@ -1251,7 +1251,7 @@ gp_Pnt StdMeshers_FaceSide::Value3d(double U) const
|
|||||||
// check parametrization of curve
|
// check parametrization of curve
|
||||||
if( !myIsUniform[i] )
|
if( !myIsUniform[i] )
|
||||||
{
|
{
|
||||||
double aLen3dU = r * myEdgeLength[i] * ( myFirst[i]>myLast[i] ? -1. : 1.);
|
double aLen3dU = r * myEdgeLength[i] * ( myFirst[i] > myLast[i] ? -1. : 1. );
|
||||||
GCPnts_AbscissaPoint AbPnt
|
GCPnts_AbscissaPoint AbPnt
|
||||||
( const_cast<GeomAdaptor_Curve&>( myC3dAdaptor[i]), aLen3dU, myFirst[i] );
|
( const_cast<GeomAdaptor_Curve&>( myC3dAdaptor[i]), aLen3dU, myFirst[i] );
|
||||||
if( AbPnt.IsDone() ) {
|
if( AbPnt.IsDone() ) {
|
||||||
|
@ -4962,7 +4962,8 @@ bool StdMeshers_Sweeper::ComputeNodesByTrsf( const double tol,
|
|||||||
|
|
||||||
// for each internal column find boundary nodes whose error to use for correction
|
// for each internal column find boundary nodes whose error to use for correction
|
||||||
prepareTopBotDelaunay();
|
prepareTopBotDelaunay();
|
||||||
findDelaunayTriangles();
|
if ( !findDelaunayTriangles())
|
||||||
|
return false;
|
||||||
|
|
||||||
// compute coordinates of internal nodes by projecting (transfroming) src and tgt
|
// compute coordinates of internal nodes by projecting (transfroming) src and tgt
|
||||||
// nodes towards the central layer
|
// nodes towards the central layer
|
||||||
@ -5390,11 +5391,11 @@ void StdMeshers_Sweeper::prepareTopBotDelaunay()
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief For each internal node column, find Delaunay triangles including it
|
* \brief For each internal node column, find Delaunay triangles including it
|
||||||
* and Barycentric Coordinates withing the triangles. Fill in myTopBotTriangles
|
* and Barycentric Coordinates within the triangles. Fill in myTopBotTriangles
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void StdMeshers_Sweeper::findDelaunayTriangles()
|
bool StdMeshers_Sweeper::findDelaunayTriangles()
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode *botNode, *topNode;
|
const SMDS_MeshNode *botNode, *topNode;
|
||||||
const BRepMesh_Triangle *topTria;
|
const BRepMesh_Triangle *topTria;
|
||||||
@ -5424,14 +5425,14 @@ void StdMeshers_Sweeper::findDelaunayTriangles()
|
|||||||
myTopBotTriangles[ colID ] = tbTrias;
|
myTopBotTriangles[ colID ] = tbTrias;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG_
|
|
||||||
if ( myBotDelaunay->NbVisitedNodes() < nbInternalNodes )
|
if ( myBotDelaunay->NbVisitedNodes() < nbInternalNodes )
|
||||||
throw SALOME_Exception(LOCALIZED("Not all internal nodes found by Delaunay"));
|
return false;
|
||||||
#endif
|
|
||||||
|
|
||||||
myBotDelaunay.reset();
|
myBotDelaunay.reset();
|
||||||
myTopDelaunay.reset();
|
myTopDelaunay.reset();
|
||||||
myNodeID2ColID.Clear();
|
myNodeID2ColID.Clear();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -453,7 +453,7 @@ private:
|
|||||||
TNodeColumn& nodes );
|
TNodeColumn& nodes );
|
||||||
|
|
||||||
void prepareTopBotDelaunay();
|
void prepareTopBotDelaunay();
|
||||||
void findDelaunayTriangles();
|
bool findDelaunayTriangles();
|
||||||
|
|
||||||
std::vector< TZColumn > myZColumns; // Z distribution of boundary nodes
|
std::vector< TZColumn > myZColumns; // Z distribution of boundary nodes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user