*/
//================================================================================
- bool projectVertices( SMESH_MesherHelper& theHelper,
- const SMESH_MAT2d::MedialAxis& theMA,
- const vector< SMESH_MAT2d::BranchPoint >& theDivPoints,
- const vector< std::size_t > & theEdgeIDs1,
- const vector< std::size_t > & theEdgeIDs2,
- const vector< bool >& theIsEdgeComputed,
- TMAPar2NPoints & thePointsOnE,
- SinuousFace& theSinuFace)
+ bool projectVertices( SMESH_MesherHelper& theHelper,
+ const SMESH_MAT2d::MedialAxis& theMA,
+ vector< SMESH_MAT2d::BranchPoint >& theDivPoints,
+ const vector< std::size_t > & theEdgeIDs1,
+ const vector< std::size_t > & theEdgeIDs2,
+ const vector< bool >& theIsEdgeComputed,
+ TMAPar2NPoints & thePointsOnE,
+ SinuousFace& theSinuFace)
{
SMESHDS_Mesh* meshDS = theHelper.GetMeshDS();
- const vector<TopoDS_Edge>& theSinuEdges = theSinuFace._sinuEdges;
+ const vector< TopoDS_Edge >& theSinuEdges = theSinuFace._sinuEdges;
const vector< Handle(Geom_Curve) >& theCurves = theSinuFace._sinuCurves;
double uMA;
SMESH_MAT2d::BoundaryPoint bp[2];
const SMESH_MAT2d::Branch& branch = *theMA.getBranch(0);
-
+ {
// add to thePointsOnE NodePoint's of ends of theSinuEdges
if ( !branch.getBoundaryPoints( 0., bp[0], bp[1] ) ||
!theMA.getBoundary().moveToClosestEdgeEnd( bp[0] )) return false;
findVertexAndNode( np0, theSinuEdges, meshDS );
findVertexAndNode( np1, theSinuEdges, meshDS );
thePointsOnE.insert( make_pair( -0.1, make_pair( np0, np1 )));
-
+ }
if ( !theSinuFace.IsRing() )
{
if ( !branch.getBoundaryPoints( 1., bp[0], bp[1] ) ||
!theMA.getBoundary().moveToClosestEdgeEnd( bp[0] ) ||
!theMA.getBoundary().moveToClosestEdgeEnd( bp[1] )) return false;
- np0 = bp[0]; np1 = bp[1];
+ NodePoint np0( bp[0] ), np1( bp[1] );
findVertexAndNode( np0, theSinuEdges, meshDS );
findVertexAndNode( np1, theSinuEdges, meshDS );
thePointsOnE.insert( make_pair( 1.1, make_pair( np0, np1)));
}
+
// project theDivPoints
if ( theDivPoints.empty() )
if ( isVertex[0] && isVertex[1] )
continue;
const size_t iVert = isVertex[0] ? 0 : 1;
- const size_t iNode = 1 - iVert;
+ const size_t iNode = 1 - iVert;
bool isOppComputed = theIsEdgeComputed[ np[ iNode ]._edgeInd ];
if ( !isOppComputed )
np = &get( u2NPnext->second, iSide );
u1 = getUOnEdgeByPoint( *edgeID, np, theSinuFace );
+ if ( u0 == u1 )
+ {
+ if ( np->_node ) --u2NPprev;
+ else ++u2NPnext;
+ np = &get( u2NPprev->second, iSide );
+ u0 = getUOnEdgeByPoint( *edgeID, np, theSinuFace );
+ np = &get( u2NPnext->second, iSide );
+ u1 = getUOnEdgeByPoint( *edgeID, np, theSinuFace );
+ }
+
// distribute points and create nodes
double du = ( u1 - u0 ) / ( sameU2NP.size() + 1 );
double u = u0 + du;
TMAPar2NPoints::const_iterator u2NPdist, u2NP = thePointsOnEdges.begin();
for ( ; u2NP != thePointsOnEdges.end(); ++u2NP )
{
- SMESH_TNodeXYZ xyz( u2NP->second.first._node );
- dist = xyz.SquareDistance( u2NP->second.second._node );
+ SMESH_TNodeXYZ xyz( u2NP->second.first._node ); // node out
+ dist = xyz.SquareDistance( u2NP->second.second._node );// node in
if ( dist > maxDist )
{
u2NPdist = u2NP;
theFace._quad->side[ 2 ] = theFace._quad->side[ 0 ];
// rotate the IN side if opposite nodes of IN and OUT sides don't match
+ if ( theFace._quad->side[ 1 ].GetUVPtStruct().empty() )
+ return false;
const SMDS_MeshNode * nIn0 = theFace._quad->side[ 1 ].First().node;
if ( nIn0 != nIn )
{
uvsNew.insert( uvsNew.end(), uvsIn.begin() + i, uvsIn.end() );
uvsNew.insert( uvsNew.end(), uvsIn.begin() + 1, uvsIn.begin() + i + 1);
theFace._quad->side[ 1 ] = StdMeshers_FaceSide::New( uvsNew );
+
+ if ( theFace._quad->side[ 1 ].NbPoints() !=
+ theFace._quad->side[ 3 ].NbPoints())
+ return false;
}
} // if ( theShortEdges[0].empty() )
// create quadrangles
bool ok;
+ theHelper.SetElementsOnShape( true );
if ( nbNodesShort0 == nbNodesShort1 )
ok = StdMeshers_Quadrangle_2D::computeQuadDominant( *theHelper.GetMesh(),
theQuad->face, theQuad );