From: eap Date: Tue, 2 May 2006 09:57:12 +0000 (+0000) Subject: Use SetSubShape() in IsQuadraticSubMesh(). Fix SIGSEGV in AddFace() on sphere and... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ae30e9e9e0c69396a5060343a8da7655ee33067e;p=modules%2Fsmesh.git Use SetSubShape() in IsQuadraticSubMesh(). Fix SIGSEGV in AddFace() on sphere and cone. --- diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 40046410f..6af07b616 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -7,7 +7,7 @@ #include "SMESH_MesherHelper.hxx" #include "SMDS_FacePosition.hxx" -#include "SMDS_EdgePosition.hxx".cxx +#include "SMDS_EdgePosition.hxx" #include "SMESH_MeshEditor.hxx" #include @@ -77,41 +77,58 @@ bool SMESH_MesherHelper::IsQuadraticSubMesh(const TopoDS_Shape& aSh) myNLinkNodeMap.clear(); } else { - // treatment of periodic faces - if ( aSh.ShapeType() == TopAbs_FACE ) { - const TopoDS_Face& face = TopoDS::Face( aSh ); - BRepAdaptor_Surface surface( face ); - if ( surface.IsUPeriodic() || surface.IsVPeriodic() ) { - // look for a seam edge - for ( exp.Init( face, TopAbs_EDGE ); exp.More(); exp.Next()) { - const TopoDS_Edge& edge = TopoDS::Edge( exp.Current() ); - if ( BRep_Tool::IsClosed( edge, face )) { - // initialize myPar1, myPar2 and myParIndex - if ( mySeamShapeIds.empty() ) { - gp_Pnt2d uv1, uv2; - BRep_Tool::UVPoints( edge, face, uv1, uv2 ); - if ( Abs( uv1.Coord(1) - uv2.Coord(1) ) < Abs( uv1.Coord(2) - uv2.Coord(2) )) - { - myParIndex = 1; // U periodic - myPar1 = surface.FirstUParameter(); - myPar2 = surface.LastUParameter(); - } - else { - myParIndex = 2; // V periodic - myPar1 = surface.FirstVParameter(); - myPar2 = surface.LastVParameter(); - } + SetSubShape( aSh ); + } + return myCreateQuadratic; +} + +//================================================================================ +/*! + * \brief Set geomerty to make elements on + * \param aSh - geomertic shape + */ +//================================================================================ + +void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh) +{ + myShape = aSh; + + // treatment of periodic faces + if ( aSh.ShapeType() == TopAbs_FACE ) + { + const TopoDS_Face& face = TopoDS::Face( aSh ); + BRepAdaptor_Surface surface( face ); + if ( surface.IsUPeriodic() || surface.IsVPeriodic() ) + { + SMESHDS_Mesh* meshDS = GetMesh()->GetMeshDS(); + // look for a seam edge + for ( TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next()) { + const TopoDS_Edge& edge = TopoDS::Edge( exp.Current() ); + if ( BRep_Tool::IsClosed( edge, face )) { + // initialize myPar1, myPar2 and myParIndex + if ( mySeamShapeIds.empty() ) { + gp_Pnt2d uv1, uv2; + BRep_Tool::UVPoints( edge, face, uv1, uv2 ); + if ( Abs( uv1.Coord(1) - uv2.Coord(1) ) < Abs( uv1.Coord(2) - uv2.Coord(2) )) + { + myParIndex = 1; // U periodic + myPar1 = surface.FirstUParameter(); + myPar2 = surface.LastUParameter(); + } + else { + myParIndex = 2; // V periodic + myPar1 = surface.FirstVParameter(); + myPar2 = surface.LastVParameter(); } - // store shapes indices - mySeamShapeIds.insert( meshDS->ShapeToIndex( exp.Current() )); - for ( TopExp_Explorer v( exp.Current(), TopAbs_VERTEX ); v.More(); v.Next() ) - mySeamShapeIds.insert( meshDS->ShapeToIndex( v.Current() )); } + // store shapes indices + mySeamShapeIds.insert( meshDS->ShapeToIndex( exp.Current() )); + for ( TopExp_Explorer v( exp.Current(), TopAbs_VERTEX ); v.More(); v.Next() ) + mySeamShapeIds.insert( meshDS->ShapeToIndex( v.Current() )); } } } } - return myCreateQuadratic; } @@ -257,8 +274,8 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1, const SMDS_MeshNode* n2, bool force3d) { -//cout<<"n1: "<-1 || myShape.ShapeType() == TopAbs_FACE) { + if(faceID>-1 || shapeType == TopAbs_FACE) { // obtaining a face and 2d points for nodes TopoDS_Face F; if( myShape.IsNull() ) @@ -335,7 +352,7 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1, myNLinkNodeMap.insert(NLinkNodeMap::value_type(link,n12)); return n12; } - if (edgeID>-1 || myShape.ShapeType() == TopAbs_EDGE) { + if (edgeID>-1 || shapeType == TopAbs_EDGE) { TopoDS_Edge E; if( myShape.IsNull() ) diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index 373fe0243..b287cd54a 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -182,8 +182,7 @@ class SMESH_MesherHelper void SetKeyIsQuadratic(const bool theKey) {myCreateQuadratic = theKey;}; - void SetSubShape(const TopoDS_Shape& subShape) - {myShape = subShape;}; + void SetSubShape(const TopoDS_Shape& subShape); protected: