Salome HOME
PAL15881 New NETGEN capability: is it possible to do only a 2D mesh ?
authoreap <eap@opencascade.com>
Fri, 20 Jul 2007 11:11:03 +0000 (11:11 +0000)
committereap <eap@opencascade.com>
Fri, 20 Jul 2007 11:11:03 +0000 (11:11 +0000)
+   * \brief Check if shape is a degenerated edge or it's vertex
+  bool IsDegenShape(const int subShape) const

src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_MesherHelper.hxx

index 6afe18300eeaf0505a3d6c92cef1a36a0f3d11b1..024a93e5d6de6aea4636dc0c3f9b538baaa34a7c 100644 (file)
@@ -73,6 +73,7 @@ bool SMESH_MesherHelper::IsQuadraticSubMesh(const TopoDS_Shape& aSh)
   // also we have to fill myNLinkNodeMap
   myCreateQuadratic = true;
   mySeamShapeIds.clear();
   // 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 );
 
   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();
 
   myShape = aSh;
   mySeamShapeIds.clear();
+  myDegenShapeIds.clear();
 
   if ( myShape.IsNull() ) {
     myShapeID  = -1;
 
   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() )
     {
     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
         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
             }
           }
           // 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() ));
         }
             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() ));
+        }
       }
     }
   }
       }
     }
   }
index 5ebdfc738cf85fa00b881111d8c8a8a1940aa978..09f90f31de691fc1dd762281c3964422b8338bb5 100644 (file)
@@ -242,6 +242,15 @@ public:
    */
   bool GetNodeUVneedInFaceNode(const TopoDS_Face& F = TopoDS_Face()) const;
 
    */
   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
   /*!
    * \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) {};
 
   // 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;
 
   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)
   std::set< int > mySeamShapeIds;
   double          myPar1, myPar2; // bounds of a closed periodic surface
   int             myParIndex;     // bounds' index (1-U, 2-V)