22401: [CEA 992] Regression on SMESH using NETGEN 2D

In AddSegmentsToMesh() do not take into account length of degenerated segments
This commit is contained in:
eap 2013-11-21 08:23:01 +00:00
parent 82cf5f8207
commit 65e846d888

View File

@ -1665,9 +1665,10 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh,
SMESH_TNodeXYZ np1( n ), np2( uvPtVec[ i+1 ].node );
// get an average size of adjacent segments to avoid sharp change of
// element size (regression on issue 0020452, note 0010898)
int iPrev = SMESH_MesherHelper::WrapIndex( i-1, nbSegments );
int iNext = SMESH_MesherHelper::WrapIndex( i+1, nbSegments );
double avgH = ( segLen[ iPrev ] + segLen[ i ] + segLen[ iNext ]) / 3;
int iPrev = SMESH_MesherHelper::WrapIndex( i-1, nbSegments );
int iNext = SMESH_MesherHelper::WrapIndex( i+1, nbSegments );
int nbSeg = 1 + ( segLen[ iPrev ] > 1e-20 ) + ( segLen[ iNext ] > 1e-20 );
double avgH = ( segLen[ iPrev ] + segLen[ i ] + segLen[ iNext ]) / nbSeg;
RestrictLocalSize( ngMesh, 0.5*(np1+np2), avgH );
}