]> SALOME platform Git repositories - plugins/netgenplugin.git/commitdiff
Salome HOME
IPAL22804 TC6.4.0: Netgen1D-2D performance regression
authoreap <eap@opencascade.com>
Tue, 15 Nov 2011 07:52:00 +0000 (07:52 +0000)
committereap <eap@opencascade.com>
Tue, 15 Nov 2011 07:52:00 +0000 (07:52 +0000)
   1) prevent GetDefaultMinSize() from returning zero
   2) in updateTriangulation(), rely on BRepMesh_IncrementalMesh to
   update triangulation only if necessary

src/NETGENPlugin/NETGENPlugin_Mesher.cxx

index 5e14144a55035fed3be2e6f537cf59537151b6a2..3d5fe26d41ce5c9a8cb01a533400b694496d82ec 100644 (file)
@@ -413,30 +413,33 @@ namespace
 
   void updateTriangulation( const TopoDS_Shape& shape )
   {
-    static set< Poly_Triangulation* > updated;
-
-    TopLoc_Location loc;
-    TopExp_Explorer fExp( shape, TopAbs_FACE );
-    for ( ; fExp.More(); fExp.Next() )
-    {
-      Handle(Poly_Triangulation) triangulation =
-        BRep_Tool::Triangulation ( TopoDS::Face( fExp.Current() ), loc);
-      if ( triangulation.IsNull() ||
-           updated.insert( triangulation.operator->() ).second )
-      {
-        BRepTools::Clean (shape);
+    // static set< Poly_Triangulation* > updated;
+
+    // TopLoc_Location loc;
+    // TopExp_Explorer fExp( shape, TopAbs_FACE );
+    // for ( ; fExp.More(); fExp.Next() )
+    // {
+    //   Handle(Poly_Triangulation) triangulation =
+    //     BRep_Tool::Triangulation ( TopoDS::Face( fExp.Current() ), loc);
+    //   if ( triangulation.IsNull() ||
+    //        updated.insert( triangulation.operator->() ).second )
+    //   {
+    //     BRepTools::Clean (shape);
         try {
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
           OCC_CATCH_SIGNALS;
 #endif
           BRepMesh_IncrementalMesh e(shape, 0.01, true);
+
         }
         catch (Standard_Failure)
         {
-          updated.erase( triangulation.operator->() );
         }
-      }
-    }
+  //       updated.erase( triangulation.operator->() );
+  //       triangulation = BRep_Tool::Triangulation ( TopoDS::Face( fExp.Current() ), loc);
+  //       updated.insert( triangulation.operator->() );
+  //     }
+  //   }
   }
 }
 
@@ -549,6 +552,7 @@ double NETGENPlugin_Mesher::GetDefaultMinSize(const TopoDS_Shape& geom,
     Handle(Poly_Triangulation) triangulation =
       BRep_Tool::Triangulation ( TopoDS::Face( fExp.Current() ), loc);
     if ( triangulation.IsNull() ) continue;
+    const double fTol = BRep_Tool::Tolerance( TopoDS::Face( fExp.Current() ));
     const TColgp_Array1OfPnt&   points = triangulation->Nodes();
     const Poly_Array1OfTriangle& trias = triangulation->Triangles();
     for ( int iT = trias.Lower(); iT <= trias.Upper(); ++iT )
@@ -557,7 +561,7 @@ double NETGENPlugin_Mesher::GetDefaultMinSize(const TopoDS_Shape& geom,
       for ( int j = 0; j < 3; ++j )
       {
         double dist2 = points(*pi[j]).SquareDistance( points( *pi[j+1] ));
-        if ( dist2 < minh )
+        if ( dist2 < minh && fTol*fTol < dist2 )
           minh = dist2;
         bb.Add( points(*pi[j]));
       }