W/o hypotheses, behave more similar to LengthFromEdges hyp: set maxh

by the maximal segment length
This commit is contained in:
eap 2013-12-05 13:06:52 +00:00
parent 292f07b784
commit 3465fc3fed

View File

@ -244,18 +244,35 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
if ( nbSegments )
edgeLength /= nbSegments;
}
if ( _hypMaxElementArea )
else if ( _hypMaxElementArea )
{
double maxArea = _hypMaxElementArea->GetMaxArea();
edgeLength = sqrt(2. * maxArea/sqrt(3.0));
}
else
{
// set edgeLength by a longest segment
double maxSeg2 = occgeo.GetBoundingBox().Diam();
for ( int iW = 0; iW < nbWires; ++iW )
{
const UVPtStructVec& points = wires[ iW ]->GetUVPtStruct();
gp_Pnt pPrev = SMESH_TNodeXYZ( points[0].node );
for ( size_t i = 1; i < points.size(); ++i )
{
gp_Pnt p = SMESH_TNodeXYZ( points[i].node );
maxSeg2 = Max( maxSeg2, p.SquareDistance( pPrev ));
pPrev = p;
}
}
edgeLength = sqrt( maxSeg2 ) * 1.05;
}
if ( edgeLength < DBL_MIN )
edgeLength = occgeo.GetBoundingBox().Diam();
netgen::mparam.maxh = edgeLength;
netgen::mparam.minh = aMesher.GetDefaultMinSize( aShape, netgen::mparam.maxh );
netgen::mparam.quad = _hypQuadranglePreference ? 1 : 0;
netgen::mparam.grading = 0.7; // very coarse mesh by default
netgen::mparam.grading = 0.4; // Moderate fineness by default
}
occgeo.face_maxh = netgen::mparam.maxh;
@ -383,6 +400,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
netgen::mparam.maxh = Max( netgen::mparam.maxh, size );
}
}
//cerr << "min " << netgen::mparam.minh << " max " << netgen::mparam.maxh << endl;
netgen::mparam.minh *= 0.9;
netgen::mparam.maxh *= 1.1;