Public Member Functions | |
BooleanValueImageExpanderEstimator (const MappedFobj &f, const cxsc::interval &crit, cxsc::real tol) | |
Constructor. | |
BooleanMappedValue | visit (SPnode *spn) const |
The visit operation. |
subpavings::BooleanValueImageExpanderEstimator::BooleanValueImageExpanderEstimator | ( | const MappedFobj & | f, |
const cxsc::interval & | crit, | ||
cxsc::real | tol | ||
) |
Constructor.
f | describes a function to be estimated. |
tol | describes the tolerance to be used in making the estimate. |
: fobj(f), supCriterion(Sup(crit)), infCriterion(Inf(crit)), tolerance(tol) { if (tolerance < cxsc::MinReal) throw std::invalid_argument( "BooleanValueImageExpanderEstimator::BooleanValueImageExpanderEstimator(MappedFobj&, cxsc::real) : tol < cxsc::MinReal"); }
BooleanMappedValue subpavings::BooleanValueImageExpanderEstimator::visit | ( | SPnode * | spn | ) | const [virtual] |
The visit operation.
Checks whether the interval image under the function whose boolean image is to be estimated of the box of spn is contained in, overlaps with, or is completely outside the interval criterion of this.
If the image is outside, returns false; If the image is inside, returns true; If the image is not completely inside or outside but the maximum width of the box of spn is < the tolerance of this, returns true; Else (the image is not completely inside or outside and the maximum width of the box of spn is >= the tolerance of this), splits spn and returns true.
spn | a pointer to an SPnode to be visited. |
Implements subpavings::SPExpandVisitor< BooleanMappedValue >.
{ #ifdef MYDEBUG std::cout << "in BooleanValueImageExpanderEstimator::visit, for " << spn->getNodeName() << std::endl; #endif // check if we need to split ivector box = spn->getBox(); #ifdef MYDEBUG std::cout << "this box is " << box << std::endl; #endif #ifdef MYDEBUG std::cout << "this tolerance is " << tolerance << std::endl; #endif interval thisRange = fobj(box); #ifdef MYDEBUG std::cout << "this range is " << thisRange << std::endl; #endif bool retValue = false; if ( !(Sup(thisRange) < infCriterion) && !(Inf(thisRange) > supCriterion) ) { // overlap retValue = true; #ifdef MYDEBUG_MIN std::cout << "overlap, returning true" << std::endl; #endif if ( (Sup(thisRange) > supCriterion) || (Inf(thisRange) < infCriterion) ) { //indet int maxdiamcomp; double maxDiam = MaxDiam (box, maxdiamcomp); // check if box max width is < tolerance, expand if not if (!(maxDiam < tolerance)) { spn->nodeExpand(); #ifdef MYDEBUG_MIN std::cout << "and max width >= tolerance " << std::endl; #endif } } // else thisRange is inside criterion } return BooleanMappedValue(retValue); }