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();
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");