Salome HOME
0020958: EDF 1529 SMESH : If some faces have been meshed with small
authoreap <eap@opencascade.com>
Thu, 19 Aug 2010 09:19:49 +0000 (09:19 +0000)
committereap <eap@opencascade.com>
Thu, 19 Aug 2010 09:19:49 +0000 (09:19 +0000)
quadrangles Netgen 3D creates pyramids with volume zero and fails

struct SMESH_ElementSearcher
{
+  /*!
+   * \brief Return elements possibly intersecting the line
+   */
+  virtual void GetElementsNearLine( const gp_Ax1&                           line,
+                                    SMDSAbs_ElementType                     type,
+                                    std::vector< const SMDS_MeshElement* >& foundElems)=0;

src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MeshEditor.hxx

index 8d9f81972a87646e39784877ffedfb5ce9958105..a4772e2da9273d6e071ebc523da2f5b40f515b8d 100644 (file)
@@ -6271,6 +6271,9 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
                                   vector< const SMDS_MeshElement* >& foundElements);
   virtual TopAbs_State GetPointState(const gp_Pnt& point);
 
+  void GetElementsNearLine( const gp_Ax1&                      line,
+                            SMDSAbs_ElementType                type,
+                            vector< const SMDS_MeshElement* >& foundElems);
   double getTolerance();
   bool getIntersParamOnLine(const gp_Lin& line, const SMDS_MeshElement* face,
                             const double tolerance, double & param);
@@ -6279,7 +6282,7 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
   {
     return _outerFaces.empty() || _outerFaces.count(face);
   }
-  struct TInters //!< data of intersection of the line and the mesh face used in GetPointState()
+  struct TInters //!< data of intersection of the line and the mesh face (used in GetPointState())
   {
     const SMDS_MeshElement* _face;
     gp_Vec                  _faceNorm;
@@ -6780,6 +6783,26 @@ TopAbs_State SMESH_ElementSearcherImpl::GetPointState(const gp_Pnt& point)
   return TopAbs_UNKNOWN;
 }
 
+//=======================================================================
+/*!
+ * \brief Return elements possibly intersecting the line
+ */
+//=======================================================================
+
+void SMESH_ElementSearcherImpl::GetElementsNearLine( const gp_Ax1&                      line,
+                                                     SMDSAbs_ElementType                type,
+                                                     vector< const SMDS_MeshElement* >& foundElems)
+{
+  if ( !_ebbTree || _elementType != type )
+  {
+    if ( _ebbTree ) delete _ebbTree;
+    _ebbTree = new ElementBndBoxTree( *_mesh, _elementType = type );
+  }
+  TIDSortedElemSet suspectFaces; // elements possibly intersecting the line
+  _ebbTree->getElementsNearLine( line, suspectFaces );
+  foundElems.assign( suspectFaces.begin(), suspectFaces.end());
+}
+
 //=======================================================================
 /*!
  * \brief Return SMESH_ElementSearcher
index ee8703eccd185d2543a745659b96f3639eb9368c..10f5be34a7aeeb09e856646c41d5cc1916b0050a 100644 (file)
@@ -92,6 +92,13 @@ struct SMESH_ElementSearcher
                                   std::vector< const SMDS_MeshElement* >& foundElems)=0;
 
   virtual TopAbs_State GetPointState(const gp_Pnt& point) = 0;
+
+  /*!
+   * \brief Return elements possibly intersecting the line
+   */
+  virtual void GetElementsNearLine( const gp_Ax1&                           line,
+                                    SMDSAbs_ElementType                     type,
+                                    std::vector< const SMDS_MeshElement* >& foundElems)=0;
 };
 
 //=======================================================================
@@ -408,12 +415,12 @@ public:
   // Search among theNodes or in the whole mesh if theNodes is empty.
 
   /*!
-   * \brief Return SMESH_NodeSearcher
+   * \brief Return SMESH_NodeSearcher. The caller is responsible for deleteing it
    */
   SMESH_NodeSearcher* GetNodeSearcher();
 
   /*!
-   * \brief Return SMESH_ElementSearcher
+   * \brief Return SMESH_ElementSearcher. The caller is responsible for deleteing it
    */
   SMESH_ElementSearcher* GetElementSearcher();
   /*!