Regressions

2D_mesh_NETGEN_03/D2
 bugs_05/F2
 bugs_16/S8
This commit is contained in:
eap 2014-10-02 13:28:55 +04:00
parent d4270a3332
commit 48e88528c4
3 changed files with 85 additions and 2 deletions

View File

@ -39,6 +39,10 @@
<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>

View 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
// -------------------------

View 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() )
{