From 8397584c6f21632e8734f12e70255188608cd916 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 20 Jul 2007 11:11:03 +0000 Subject: [PATCH] PAL15881 New NETGEN capability: is it possible to do only a 2D mesh ? + * \brief Check if shape is a degenerated edge or it's vertex + bool IsDegenShape(const int subShape) const --- src/SMESH/SMESH_MesherHelper.cxx | 18 ++++++++++++++---- src/SMESH/SMESH_MesherHelper.hxx | 12 +++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 6afe18300..024a93e5d 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -73,6 +73,7 @@ bool SMESH_MesherHelper::IsQuadraticSubMesh(const TopoDS_Shape& aSh) // also we have to fill myNLinkNodeMap myCreateQuadratic = true; mySeamShapeIds.clear(); + myDegenShapeIds.clear(); TopAbs_ShapeEnum subType( aSh.ShapeType()==TopAbs_FACE ? TopAbs_EDGE : TopAbs_FACE ); SMDSAbs_ElementType elemType( subType==TopAbs_FACE ? SMDSAbs_Face : SMDSAbs_Edge ); @@ -150,6 +151,7 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh) myShape = aSh; mySeamShapeIds.clear(); + myDegenShapeIds.clear(); if ( myShape.IsNull() ) { myShapeID = -1; @@ -165,8 +167,9 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh) BRepAdaptor_Surface surface( face ); if ( surface.IsUPeriodic() || surface.IsVPeriodic() ) { - // look for a seam edge - for ( TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next()) { + for ( TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next()) + { + // look for a seam edge const TopoDS_Edge& edge = TopoDS::Edge( exp.Current() ); if ( BRep_Tool::IsClosed( edge, face )) { // initialize myPar1, myPar2 and myParIndex @@ -186,10 +189,17 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh) } } // 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( edge )); + for ( TopExp_Explorer v( edge, TopAbs_VERTEX ); v.More(); v.Next() ) mySeamShapeIds.insert( meshDS->ShapeToIndex( v.Current() )); } + + // look for a degenerated edge + if ( BRep_Tool::Degenerated( edge )) { + myDegenShapeIds.insert( meshDS->ShapeToIndex( edge )); + for ( TopExp_Explorer v( edge, TopAbs_VERTEX ); v.More(); v.Next() ) + myDegenShapeIds.insert( meshDS->ShapeToIndex( v.Current() )); + } } } } diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index 5ebdfc738..09f90f31d 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -242,6 +242,15 @@ public: */ bool GetNodeUVneedInFaceNode(const TopoDS_Face& F = TopoDS_Face()) const; + /*! + * \brief Check if shape is a degenerated edge or it's vertex + * \param subShape - edge or vertex index in SMESHDS + * \retval bool - true if subShape is a degenerated shape + * + * It works only if IsQuadraticSubMesh() or SetSubShape() has been called + */ + bool IsDegenShape(const int subShape) const + { return myDegenShapeIds.find( subShape ) != myDegenShapeIds.end(); } /*! * \brief Check if shape is a seam edge or it's vertex * \param subShape - edge or vertex index in SMESHDS @@ -310,9 +319,10 @@ protected: // Forbiden copy constructor SMESH_MesherHelper (const SMESH_MesherHelper& theOther) {}; - // special map for using during creation quadratic faces + // special map for using during creation of quadratic elements NLinkNodeMap myNLinkNodeMap; + std::set< int > myDegenShapeIds; std::set< int > mySeamShapeIds; double myPar1, myPar2; // bounds of a closed periodic surface int myParIndex; // bounds' index (1-U, 2-V) -- 2.30.2