From: eap Date: Thu, 5 Dec 2013 13:06:52 +0000 (+0000) Subject: W/o hypotheses, behave more similar to LengthFromEdges hyp: set maxh X-Git-Tag: V7_3_0b1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3465fc3fed30d02f26ab9c9b3d13aba7518af042;p=plugins%2Fnetgenplugin.git W/o hypotheses, behave more similar to LengthFromEdges hyp: set maxh by the maximal segment length --- diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx index 81a2280..2a4d95d 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx @@ -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;