From: eap Date: Mon, 28 Jan 2013 08:58:03 +0000 (+0000) Subject: 0022065: EDF 2514 SMESH : number of triangles with BLSURF X-Git-Tag: V6_main_FINAL~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b92ce5f56c81f8a663ef91c91ff15e0694c1969d;p=plugins%2Fblsurfplugin.git 0022065: EDF 2514 SMESH : number of triangles with BLSURF In SetParameters(), avoid "shadowing" of the user size by the default min or max size --- diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 1b034ff..dd80d2b 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -740,17 +740,23 @@ void BLSURFPlugin_BLSURF::SetParameters( MESSAGE("BLSURFPlugin_BLSURF::SetParameters"); _physicalMesh = (int) hyp->GetPhysicalMesh(); _geometricMesh = (int) hyp->GetGeometricMesh(); - if (hyp->GetPhySize() > 0) - _phySize = hyp->GetPhySize(); - _phySizeRel = hyp->IsPhySizeRel(); - if (hyp->GetMinSize() > 0) - _minSize = hyp->GetMinSize(); - _minSizeRel = hyp->IsMinSizeRel(); - if (hyp->GetMaxSize() > 0) - _maxSize = hyp->GetMaxSize(); - _maxSizeRel = hyp->IsMaxSizeRel(); - if (hyp->GetGradation() > 0) - _gradation = hyp->GetGradation(); + if (hyp->GetPhySize() > 0) { + _phySize = hyp->GetPhySize(); + // if user size is not explicitly specified, "relative" flag is ignored + _phySizeRel = hyp->IsPhySizeRel(); + } + if (hyp->GetMinSize() > 0) { + _minSize = hyp->GetMinSize(); + // if min size is not explicitly specified, "relative" flag is ignored + _minSizeRel = hyp->IsMinSizeRel(); + } + if (hyp->GetMaxSize() > 0) { + _maxSize = hyp->GetMaxSize(); + // if max size is not explicitly specified, "relative" flag is ignored + _maxSizeRel = hyp->IsMaxSizeRel(); + } + if (hyp->GetGradation() > 0) + _gradation = hyp->GetGradation(); _quadAllowed = hyp->GetQuadAllowed(); if (hyp->GetAngleMesh() > 0) _angleMesh = hyp->GetAngleMesh(); @@ -846,9 +852,33 @@ void BLSURFPlugin_BLSURF::SetParameters( set_param(css, "geometric_size_mode", "none"); } - set_param(css, "min_size", _minSizeRel ? to_string_rel(_minSize).c_str() : to_string(_minSize).c_str()); - set_param(css, "max_size", _maxSizeRel ? to_string_rel(_maxSize).c_str() : to_string(_maxSize).c_str()); - if ( useGradation ) + if ( hyp && hyp->GetPhySize() > 0 ) { + // user size is explicitly specified via hypothesis parameters + // min and max sizes should be compared with explicitly specified user size + // - compute absolute min size + double mins = _minSizeRel ? _minSize * diagonal : _minSize; + // - min size should not be greater than user size + if ( _phySize < mins ) + set_param(css, "min_size", _phySizeRel ? to_string_rel(_phySize).c_str() : to_string(_phySize).c_str()); + else + set_param(css, "min_size", _minSizeRel ? to_string_rel(_minSize).c_str() : to_string(_minSize).c_str()); + // - compute absolute max size + double maxs = _maxSizeRel ? _maxSize * diagonal : _maxSize; + // - max size should not be less than user size + if ( _phySize > maxs ) + set_param(css, "max_size", _phySizeRel ? to_string_rel(_phySize).c_str() : to_string(_phySize).c_str()); + else + set_param(css, "max_size", _maxSizeRel ? to_string_rel(_maxSize).c_str() : to_string(_maxSize).c_str()); + } + else { + // user size is not explicitly specified + // - if minsize is not explicitly specified, we pass default value computed automatically, in this case "relative" flag is ignored + set_param(css, "min_size", _minSizeRel ? to_string_rel(_minSize).c_str() : to_string(_minSize).c_str()); + // - if maxsize is not explicitly specified, we pass default value computed automatically, in this case "relative" flag is ignored + set_param(css, "max_size", _maxSizeRel ? to_string_rel(_maxSize).c_str() : to_string(_maxSize).c_str()); + } + + if ( useGradation ) set_param(css, "gradation", to_string(_gradation).c_str()); set_param(css, "element_generation", _quadAllowed ? "quad_dominant" : "triangle");