23487: EDF 15571 - Mesh with quadratic algo 1D

Update medium nodes after smoothing
This commit is contained in:
eap 2017-10-04 15:33:47 +03:00 committed by vsr
parent 7e498745c6
commit ce117a7861

View File

@ -64,17 +64,15 @@
#include "utilities.h"
#include "Utils_ExceptHandlers.hxx"
#ifndef StdMeshers_Array2OfNode_HeaderFile
#define StdMeshers_Array2OfNode_HeaderFile
typedef const SMDS_MeshNode* SMDS_MeshNodePtr;
typedef NCollection_Array2<SMDS_MeshNodePtr> StdMeshers_Array2OfNode;
#endif
#include <boost/container/flat_set.hpp>
using namespace std;
typedef NCollection_Array2<const SMDS_MeshNode*> StdMeshers_Array2OfNode;
typedef gp_XY gp_UV;
typedef SMESH_Comment TComm;
using namespace std;
//=============================================================================
/*!
*
@ -1010,14 +1008,14 @@ bool StdMeshers_Quadrangle_2D::IsApplicable( const TopoDS_Shape & aShape, bool t
continue;
}
int nbNoDegenEdges = 0;
int nbNoDegenEdges = 0, totalNbEdges = 0;
TopExp_Explorer eExp( aFace, TopAbs_EDGE );
for ( ; eExp.More() && nbNoDegenEdges < 3; eExp.Next() ) {
for ( ; eExp.More() && nbNoDegenEdges < 3; eExp.Next(), ++totalNbEdges ) {
if ( !SMESH_Algo::isDegenerated( TopoDS::Edge( eExp.Current() )))
++nbNoDegenEdges;
}
if ( toCheckAll && nbNoDegenEdges < 3 ) return false;
if ( !toCheckAll && nbNoDegenEdges >= 3 ) return true;
if ( toCheckAll && ( totalNbEdges < 4 && nbNoDegenEdges < 3 )) return false;
if ( !toCheckAll && ( totalNbEdges >= 4 || nbNoDegenEdges >= 3 )) return true;
}
return ( toCheckAll && nbFoundFaces != 0 );
}
@ -1139,7 +1137,7 @@ FaceQuadStruct::Ptr StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh &
}
}
}
else
else //if ( !myHelper || !myHelper->IsRealSeam( edge ))
{
sideEdges.push_back( edge );
}
@ -3895,6 +3893,10 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
{
// "smooth" by computing node positions using 3D TFI and further projection
list< FaceQuadStruct::Ptr >::iterator q = myQuadList.begin();
for ( ; q != myQuadList.end() ; ++q )
{
quad = *q;
int nbhoriz = quad->iSize;
int nbvertic = quad->jSize;
@ -3923,16 +3925,17 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
uvp.v = uv.Y();
}
}
return;
}
}
else
{
// Get nodes to smooth
typedef map< const SMDS_MeshNode*, TSmoothNode, TIDCompare > TNo2SmooNoMap;
TNo2SmooNoMap smooNoMap;
// fixed nodes
set< const SMDS_MeshNode* > fixedNodes;
boost::container::flat_set< const SMDS_MeshNode* > fixedNodes;
for ( size_t i = 0; i < myForcedPnts.size(); ++i )
{
fixedNodes.insert( myForcedPnts[i].node );
@ -4061,6 +4064,7 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
// store the new UV
node->SetPosition( SMDS_PositionPtr( new SMDS_FacePosition( sNode._uv.X(), sNode._uv.Y() )));
}
}
// Move medium nodes in quadratic mesh
if ( _quadraticMesh )
@ -4085,6 +4089,7 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
meshDS->MoveNode( node, xyz.X(), xyz.Y(), xyz.Z() );
}
}
return;
}
//================================================================================
@ -4180,12 +4185,18 @@ bool StdMeshers_Quadrangle_2D::check()
if ( myHelper->HasSeam() )
for ( int i = 0; i < nbN && !nInFace; ++i )
if ( !myHelper->IsSeamShape( nn[i]->getshapeId() ))
{
nInFace = nn[i];
gp_XY uv = myHelper->GetNodeUV( geomFace, nInFace );
if ( myHelper->IsOnSeam( uv ))
nInFace = NULL;
}
toCheckUV = true;
for ( int i = 0; i < nbN; ++i )
uv[ i ] = myHelper->GetNodeUV( geomFace, nn[i], nInFace, &toCheckUV );
bool isBad = false;
switch ( nbN ) {
case 4:
{
@ -4198,19 +4209,34 @@ bool StdMeshers_Quadrangle_2D::check()
if ( sign1 * sign2 < 0 )
continue; // this should not happen
}
if ( sign1 * okSign < 0 )
badFaces.push_back ( f );
isBad = ( sign1 * okSign < 0 );
break;
}
case 3:
{
double sign = getArea( uv[0], uv[1], uv[2] );
if ( sign * okSign < 0 )
badFaces.push_back ( f );
isBad = ( sign * okSign < 0 );
break;
}
default:;
}
// if ( isBad && myHelper->HasRealSeam() )
// {
// // detect a case where a face intersects the seam
// for ( int iPar = 1; iPar < 3; ++iPar )
// if ( iPar & myHelper->GetPeriodicIndex() )
// {
// double min = uv[0].Coord( iPar ), max = uv[0].Coord( iPar );
// for ( int i = 1; i < nbN; ++i )
// {
// min = Min( min, uv[i].Coord( iPar ));
// max = Max( max, uv[i].Coord( iPar ));
// }
// }
// }
if ( isBad )
badFaces.push_back ( f );
}
if ( !badFaces.empty() )
@ -4264,7 +4290,7 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace,
if ( SMESH_Algo::isDegenerated( prevE ))
{
list<TopoDS_Edge>::reverse_iterator edge = ++theWire.rbegin();
while ( SMESH_Algo::isDegenerated( *edge ))
while ( SMESH_Algo::isDegenerated( *edge ) /*|| helper.IsRealSeam( *edge )*/)
++edge;
if ( edge == theWire.rend() )
return false;
@ -4273,7 +4299,7 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace,
list<TopoDS_Edge>::iterator edge = theWire.begin();
for ( int iE = 0; edge != theWire.end(); ++edge, ++iE )
{
if ( SMESH_Algo::isDegenerated( *edge ))
if ( SMESH_Algo::isDegenerated( *edge ) /*|| helper.IsRealSeam( *edge )*/)
{
++theNbDegenEdges;
continue;