From: admin Date: Tue, 10 Jan 2006 09:53:04 +0000 (+0000) Subject: This commit was generated by cvs2git to create tag 'V2_2_8'. X-Git-Tag: V2_2_8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8b5184857014c05685f1bf8e8c03a6bc8f0dc513;p=modules%2Fsmesh.git This commit was generated by cvs2git to create tag 'V2_2_8'. Sprout from V2_2_0_maintainance 2006-01-10 09:53:03 UTC vsr 'Update version number: 2.2.8' Cherrypick from V2_2_0_maintainance 2005-06-08 04:52:11 UTC mpv 'Porting to Mandrake 10.1 and new products:': src/Controls/SMESH_Controls.cxx --- diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 1dab406f4..0e73c4fc8 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -254,65 +254,38 @@ SMDSAbs_ElementType MinimumAngle::GetType() const */ double AspectRatio::GetValue( const TSequenceOfXYZ& P ) { - // According to "Mesh quality control" by Nadir Bouhamau referring to - // Pascal Jean Frey and Paul-Louis George. Maillages, applications aux elements finis. - // Hermes Science publications, Paris 1999 ISBN 2-7462-0024-4 - // See PAL10872 - int nbNodes = P.size(); - if ( nbNodes < 3 ) + if ( nbNodes != 3 && nbNodes != 4 ) return 0; // Compute lengths of the sides - vector< double > aLen (nbNodes); - + double aLen[ nbNodes ]; for ( int i = 0; i < nbNodes - 1; i++ ) aLen[ i ] = getDistance( P( i + 1 ), P( i + 2 ) ); aLen[ nbNodes - 1 ] = getDistance( P( 1 ), P( nbNodes ) ); // Compute aspect ratio - if ( nbNodes == 3 ) + if ( nbNodes == 3 ) { - // Q = alfa * h * p / S, where - // - // alfa = sqrt( 3 ) / 6 - // h - length of the longest edge - // p - half perimeter - // S - triangle surface - - const double alfa = sqrt( 3. ) / 6.; - double maxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) ); - double half_perimeter = ( aLen[0] + aLen[1] + aLen[2] ) / 2.; double anArea = getArea( P( 1 ), P( 2 ), P( 3 ) ); if ( anArea <= Precision::Confusion() ) return 0.; + double aMaxLen = Max( aLen[ 0 ], Max( aLen[ 1 ], aLen[ 2 ] ) ); + static double aCoef = sqrt( 3. ) / 4; - return alfa * maxLen * half_perimeter / anArea; + return aCoef * aMaxLen * aMaxLen / anArea; } else { - // return aspect ratio of the worst triange which can be built - // taking three nodes of the quadrangle - TSequenceOfXYZ triaPnts(3); - // triangle on nodes 1 3 2 - triaPnts(1) = P(1); - triaPnts(2) = P(3); - triaPnts(3) = P(2); - double ar = GetValue( triaPnts ); - // triangle on nodes 1 3 4 - triaPnts(3) = P(4); - ar = Max ( ar, GetValue( triaPnts )); - // triangle on nodes 1 2 4 - triaPnts(2) = P(2); - ar = Max ( ar, GetValue( triaPnts )); - // triangle on nodes 3 2 4 - triaPnts(1) = P(3); - ar = Max ( ar, GetValue( triaPnts )); - - return ar; + double aMinLen = Min( Min( aLen[ 0 ], aLen[ 1 ] ), Min( aLen[ 2 ], aLen[ 3 ] ) ); + if ( aMinLen <= Precision::Confusion() ) + return 0.; + double aMaxLen = Max( Max( aLen[ 0 ], aLen[ 1 ] ), Max( aLen[ 2 ], aLen[ 3 ] ) ); + + return aMaxLen / aMinLen; } } @@ -1143,7 +1116,7 @@ void MultiConnection2D::GetValues(MValues& theValues){ SMDS_FaceIteratorPtr anIter = myMesh->facesIterator(); for(; anIter->more(); ){ const SMDS_MeshFace* anElem = anIter->next(); - //long anElemId = anElem->GetID(); + long anElemId = anElem->GetID(); SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); long aNodeId[3];