Salome HOME
Regressions
authoreap <eap@opencascade.com>
Thu, 2 Oct 2014 09:28:55 +0000 (13:28 +0400)
committereap <eap@opencascade.com>
Thu, 2 Oct 2014 09:28:55 +0000 (13:28 +0400)
 2D_mesh_NETGEN_03/D2
 bugs_05/F2
 bugs_16/S8

src/GUI/NETGENPlugin_images.ts
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx

index 1f9a4e29e79b2b09dd42f8257acda61dea86bb7d..a399bc6d85970cb5da66bdbb3e9e553a0231c80b 100644 (file)
             <source>ICON_SMESH_TREE_HYPO_NETGEN_Parameters</source>
             <translation>mesh_tree_hypo_netgen.png</translation>
         </message>
+        <message>
+            <source>ICON_SMESH_TREE_HYPO_NETGEN_Parameters_3D</source>
+            <translation>mesh_tree_hypo_netgen.png</translation>
+        </message>
         <message>
             <source>ICON_SMESH_TREE_HYPO_NETGEN_Parameters_2D</source>
             <translation>mesh_tree_hypo_netgen_2d.png</translation>
index 8795625b74de29f4da84ad0670bed1981c496c6a..d2b6d166415238e022537de555e014abde08a4d1 100644 (file)
@@ -184,6 +184,42 @@ bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh&         aMesh,
   return ( aStatus == HYP_OK );
 }
 
+namespace
+{
+  void limitSize( netgen::Mesh* ngMesh,
+                  const double  maxh )
+  {
+    // get bnd box
+    netgen::Point3d pmin, pmax;
+    ngMesh->GetBox( pmin, pmax, 0 );
+    const double dx = pmax.X() - pmin.X();
+    const double dy = pmax.Y() - pmin.Y();
+    const double dz = pmax.Z() - pmin.Z();
+
+    const int nbX = Max( 2, int( dx / maxh * 3 ));
+    const int nbY = Max( 2, int( dy / maxh * 3 ));
+    const int nbZ = Max( 2, int( dz / maxh * 3 ));
+
+    if ( ! & ngMesh->LocalHFunction() )
+      ngMesh->SetLocalH( pmin, pmax, 0.1 );
+
+    netgen::Point3d p;
+    for ( int i = 0; i <= nbX; ++i )
+    {
+      p.X() = pmin.X() +  i * dx / nbX;
+      for ( int j = 0; j <= nbY; ++j )
+      {
+        p.Y() = pmin.Y() +  j * dy / nbY;
+        for ( int k = 0; k <= nbZ; ++k )
+        {
+          p.Z() = pmin.Z() +  k * dz / nbZ;
+          ngMesh->RestrictLocalH( p, maxh );
+        }
+      }
+    }
+  }
+}
+
 //=============================================================================
 /*!
  *Here we are going to use the NETGEN mesher
@@ -227,9 +263,11 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
   {
     netgen::mparam.maxh = sqrt( 2. * _hypMaxElementArea->GetMaxArea() / sqrt(3.0) );
   }
+  if ( _hypQuadranglePreference )
+    netgen::mparam.quad = true;
 
   // local size is common for all FACEs in aShape?
-  const bool isCommonLocalSize = ( !_hypLengthFromEdges && netgen::mparam.uselocalh );
+  const bool isCommonLocalSize = ( !_hypLengthFromEdges && !_hypMaxElementArea && netgen::mparam.uselocalh );
   const bool isDefaultHyp = ( !_hypLengthFromEdges && !_hypMaxElementArea && !_hypParameters );
 
   if ( isCommonLocalSize ) // compute common local size in ngMeshes[0]
@@ -241,7 +279,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
     // minh, face_maxh, grading and curvaturesafety; find minh if not set by the user
     if ( !_hypParameters || netgen::mparam.minh < DBL_MIN )
     {
-      if ( !_hypMaxElementArea )
+      if ( !_hypParameters )
         netgen::mparam.maxh = occgeoComm.GetBoundingBox().Diam() / 3.;
       netgen::mparam.minh = aMesher.GetDefaultMinSize( aShape, netgen::mparam.maxh );
     }
@@ -417,6 +455,9 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
       if ( faceErr && !faceErr->IsOK() )
         break;
 
+      //if ( !isCommonLocalSize )
+      //limitSize( ngMesh, mparam.maxh * 0.8);
+
       // -------------------------
       // Generate surface mesh
       // -------------------------
index 1a5ad5cf78be6d8eb1fef7b0bacd27ff89fd84f5..9137887c571b472be7227913f02eeea9bfe7ab28 100644 (file)
@@ -339,6 +339,43 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh&         aMesh,
   return ( ngLib._isComputeOk = compute( aMesh, helper, nodeVec, Netgen_mesh));
 }
 
+namespace
+{
+  void limitVolumeSize( netgen::Mesh* ngMesh,
+                        const double  maxh )
+  {
+    // get bnd box
+    netgen::Point3d pmin, pmax;
+    ngMesh->GetBox( pmin, pmax, 0 );
+    const double dx = pmax.X() - pmin.X();
+    const double dy = pmax.Y() - pmin.Y();
+    const double dz = pmax.Z() - pmin.Z();
+
+    // adjusted by SALOME_TESTS/Grids/smesh/bugs_08/I8
+    const int nbX = Max( 2, int( dx / maxh * 2 ));
+    const int nbY = Max( 2, int( dy / maxh * 2 ));
+    const int nbZ = Max( 2, int( dz / maxh * 2 ));
+
+    if ( ! & ngMesh->LocalHFunction() )
+      ngMesh->SetLocalH( pmin, pmax, 0.1 );
+
+    netgen::Point3d p;
+    for ( int i = 0; i <= nbX; ++i )
+    {
+      p.X() = pmin.X() +  i * dx / nbX;
+      for ( int j = 0; j <= nbY; ++j )
+      {
+        p.Y() = pmin.Y() +  j * dy / nbY;
+        for ( int k = 0; k <= nbZ; ++k )
+        {
+          p.Z() = pmin.Z() +  k * dz / nbZ;
+          ngMesh->RestrictLocalH( p, maxh );
+        }
+      }
+    }
+  }
+}
+
 //================================================================================
 /*!
  * \brief set parameters and generate the volume mesh
@@ -374,6 +411,7 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh&                     aMesh,
   else if ( _hypMaxElementVolume )
   {
     netgen::mparam.maxh = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. );
+    limitVolumeSize( ngMesh, netgen::mparam.maxh * 0.8 );
   }
   else if ( aMesh.HasShapeToMesh() )
   {