From: eap Date: Wed, 16 May 2012 08:35:56 +0000 (+0000) Subject: for reduced type, enable 4->2 "tree" reducing disabled by mistake X-Git-Tag: V6_5_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=25a1a467fe1ed67dd7493ed400b7c73f6ac92c68;p=modules%2Fsmesh.git for reduced type, enable 4->2 "tree" reducing disabled by mistake --- diff --git a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx index c7db7dde1..57640ac0b 100644 --- a/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx +++ b/src/StdMeshers/StdMeshers_Quadrangle_2D.cxx @@ -2545,22 +2545,19 @@ bool StdMeshers_Quadrangle_2D::ComputeReduced (SMESH_Mesh & aMesh, // maximum number of bottom elements for "tree" simple reduce 4->2 int max_tree42 = 0; // number of rows needed to reduce ncol_bot to ncol_top using simple 4->2 "tree" -#ifdef WIN32 - // of the MSVC doesn't contain log2 - int nrows_tree42 = int( log( (double)(ncol_bot / ncol_top) )/log((double)2) ); // needed to avoid overflow at pow(2) -#else - int nrows_tree42 = int( log2( ncol_bot / ncol_top )); // needed to avoid overflow at pow(2) -#endif - - if (ncol_top > npair_top * 2 && nrows_tree42 < nrows) { + int nrows_tree42 = int( log( (double)(ncol_bot / ncol_top) )/log((double)2) ); // needed to avoid overflow at pow(2) while computing max_tree42 + if ( nrows_tree42 < nrows) { max_tree42 = npair_top * pow(2.0, nrows + 1); - int delta = ncol_bot - int( max_tree42 ); - for (int irow = 1; irow < nrows; irow++) { - int nfour = delta / 4; - delta -= nfour * 2; + if (ncol_top > npair_top * 2 ) + { + int delta = ncol_bot - int( max_tree42 ); + for (int irow = 1; irow < nrows; irow++) { + int nfour = delta / 4; + delta -= nfour * 2; + } + if (delta <= (ncol_top - npair_top * 2)) + max_tree42 = ncol_bot; } - if (delta <= (ncol_top - npair_top * 2)) - max_tree42 = ncol_bot; } // maximum number of bottom elements for "tree" simple reduce 3->1 //int max_tree31 = ncol_top * pow(3.0, nrows);