MRS  1.0
A C++ Class Library for Statistical Set Processing
subpavings::IntervalImageToleranceCheck Class Reference

A type that visits SPnodes to check if they meet an interval image tolerance requirement. More...

+ Inheritance diagram for subpavings::IntervalImageToleranceCheck:
+ Collaboration diagram for subpavings::IntervalImageToleranceCheck:

List of all members.

Public Member Functions

 IntervalImageToleranceCheck (const MappedFobj &f, cxsc::real tol)
 Constructor.
void visit (const SPnode *const spn) const
 The visit operation.
bool getResult () const
 Get the result of the visit operation.

Detailed Description

A type that visits SPnodes to check if they meet an interval image tolerance requirement.

The interval image tolerance requirement is that the maximum distance between the real image of the mid point of the box associated with the node and the ends of the interval image of the box associated with the node should be less than or equal to the tolerance given by the constructor argument tol.

A node may not meet the requirement but not be splittable: in this case the result of the visit should be true (ie the node is deemed to meet the requirement because it is as close as it can be to meeting it).

The visit operation should return true if either the the node visited meets the interval image tolerance requirement or the node does not meet the requirement but is not splittable. Return false otherwise.


Constructor & Destructor Documentation

Constructor.

Parameters:
fdescribes a function against which to check the interval image tolerance requirement.
toldescribes the tolerance to be used in the check.
Precondition:
tol >= cxsc::MinReal.
                : fobj(f), tolerance(tol) 
  {
    if (tolerance < cxsc::MinReal) 
      throw std::invalid_argument(
        "IntervalImageToleranceCheck::IntervalImageToleranceCheck(MappedFobj&, cxsc::real) : tol < cxsc::MinReal");
  }

Member Function Documentation

void subpavings::IntervalImageToleranceCheck::visit ( const SPnode *const  spn) const [virtual]

The visit operation.

Checks the node pointed to by spn and records the result true if the interval image tolerance requirement is met.

Parameters:
spna pointer to an SPnode to be visited.
Returns:
true if spn meets the interval image tolerance requirement or the node does not meet the requirement but is not splittable. Return false otherwise.

Implements subpavings::SPCheckVisitor.

    {
    #ifdef MYDEBUG
      std::cout << "in IntervalImageToleranceCheck::visit, for " << spn->getNodeName() << std::endl;
    #endif
    
    if (spn->isSplittableNode()) {
    
      ivector box = spn->getBox();
      
      #ifdef MYDEBUG
        std::cout << "this box is " << box << std::endl;
      #endif
      
      interval thisRange = fobj(box);
      real thisMidImage = fobj.imageMid(box);
      
      #ifdef MYDEBUG
        std::cout << "this midImage is " << thisMidImage << std::endl;
      #endif
      
      #ifdef MYDEBUG
        std::cout << "this range is " << thisRange << std::endl;
      #endif
      
      #ifdef MYDEBUG
        std::cout << "this tolerance is " << tolerance << std::endl;
      #endif
      
      result = true;
      if (max(Sup(thisRange) - thisMidImage, 
        thisMidImage - Inf(thisRange) )
              > tolerance) {
        result = false;

      }
      
    }
    #ifdef MYDEBUG_MIN
      std::cout << "conclusion " << result << std::endl;
    
    #endif
    
    }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends