X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_Delaunay.cxx;h=4771c6da890a3fd79abe7e32eb71e2b409b8cae3;hb=ad718f985481e242cb34b54e1b373066b1a5bda3;hp=8ae5f1761a41089737828165354d6c0d61d8311c;hpb=b9b6785c001e1a27369923a897992123ae10f492;p=modules%2Fsmesh.git diff --git a/src/SMESHUtils/SMESH_Delaunay.cxx b/src/SMESHUtils/SMESH_Delaunay.cxx index 8ae5f1761..4771c6da8 100644 --- a/src/SMESHUtils/SMESH_Delaunay.cxx +++ b/src/SMESHUtils/SMESH_Delaunay.cxx @@ -40,7 +40,6 @@ * \param [in] boundaryNodes - vector of nodes of a wire * \param [in] face - the face * \param [in] faceID - the face ID - * \param [in] nbNodesToVisit - nb of non-marked nodes on the face */ //================================================================================ @@ -56,6 +55,8 @@ SMESH_Delaunay::SMESH_Delaunay(const std::vector< const UVPtStructVec* > & bound const int nbDiv = 100; const double uRange = surf.LastUParameter() - surf.FirstUParameter(); const double vRange = surf.LastVParameter() - surf.FirstVParameter(); + const double uFixed = surf.FirstUParameter() + 0.5 * uRange; + const double vFixed = surf.FirstVParameter() + 0.5 * vRange; const double dU = uRange / nbDiv; const double dV = vRange / nbDiv; double u = surf.FirstUParameter(), v = surf.FirstVParameter(); @@ -63,10 +64,10 @@ SMESH_Delaunay::SMESH_Delaunay(const std::vector< const UVPtStructVec* > & bound double lenU = 0, lenV = 0; for ( ; u < surf.LastUParameter(); u += dU, v += dV ) { - gp_Pnt p1U = surf.Value( u, surf.FirstVParameter() ); + gp_Pnt p1U = surf.Value( u, vFixed ); lenU += p1U.Distance( p0U ); p0U = p1U; - gp_Pnt p1V = surf.Value( surf.FirstUParameter(), v ); + gp_Pnt p1V = surf.Value( uFixed, v ); lenV += p1V.Distance( p0V ); p0V = p1V; } @@ -270,15 +271,17 @@ const BRepMesh_Triangle* SMESH_Delaunay::FindTriangle( const gp_XY& const BRepMesh_Triangle* SMESH_Delaunay::GetTriangleNear( int iBndNode ) { + if ( iBndNode >= _triaDS->NbNodes() ) + return 0; int nodeIDs[3]; int nbNbNodes = _bndNodes.size(); #if OCC_VERSION_LARGE <= 0x07030000 - const BRepMesh::ListOfInteger & linkIds = _triaDS->LinksConnectedTo( iBndNode + 1 ); - BRepMesh::ListOfInteger::const_iterator iLink = linkIds.cbegin(); + typedef BRepMesh::ListOfInteger TLinkList; #else - const IMeshData::ListOfInteger & linkIds = _triaDS->LinksConnectedTo( iBndNode + 1 ); - IMeshData::ListOfInteger::const_iterator iLink = linkIds.cbegin(); + typedef IMeshData::ListOfInteger TLinkList; #endif + const TLinkList & linkIds = _triaDS->LinksConnectedTo( iBndNode + 1 ); + TLinkList::const_iterator iLink = linkIds.cbegin(); for ( ; iLink != linkIds.cend(); ++iLink ) { const BRepMesh_PairOfIndex & triaIds = _triaDS->ElementsConnectedTo( *iLink ); @@ -360,7 +363,7 @@ void SMESH_Delaunay::ToPython() const text << "import salome, SMESH\n"; text << "salome.salome_init()\n"; text << "from salome.smesh import smeshBuilder\n"; - text << "smesh = smeshBuilder.New(salome.myStudy)\n"; + text << "smesh = smeshBuilder.New()\n"; text << "mesh=smesh.Mesh()\n"; const char* endl = "\n"; @@ -385,5 +388,5 @@ void SMESH_Delaunay::ToPython() const file.remove(); file.openForWriting(); file.write( text.c_str(), text.size() ); - cout << "execfile( '" << fileName << "')" << endl; + std::cout << "exec(open('" << fileName << "', 'rb').read())"; }