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

A type that visits SPnodes to check if they meet a 'Reimann Difference' tolerance requirement. More...

+ Inheritance diagram for subpavings::ReimannDiffToleranceCheck:
+ Collaboration diagram for subpavings::ReimannDiffToleranceCheck:

List of all members.

Public Member Functions

 ReimannDiffToleranceCheck (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 a 'Reimann Difference' tolerance requirement.

The 'Reimann Difference' tolerance requirement is that the difference in the Reimann Integral taken to the top of the interval image of the box associated with the node against the Reimann Integral taken to the bottom of the interval image of the box associated should be less than or equal to the tolerance given by the constructor argument tol.

ie the Reimann Difference can also be seen as the 'area' represented by the interval image of the box associated with the node, or the volume of the box associated with the node multiplied by the diameter of the interval enclosure of the box associated with the node.

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 Reimann Difference 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(
        "ReimannDiffToleranceCheck::ReimannDiffToleranceCheck(MappedFobj&, cxsc::real) : tol < cxsc::MinReal");
  }

Member Function Documentation

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

The visit operation.

Checks the node pointed to by spn and stores the result true if the Reimann Difference tolerance requirement is met.

Parameters:
spna pointer to an SPnode to be visited.
Returns:
true if spn meets the Reimann Difference 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 ReimannDiffToleranceCheck::visit, for " << spn->getNodeName() << std::endl;
    #endif
      
    result = true;
    if (spn->isSplittableNode()) {
    
      ivector box = spn->getBox();
      
      #ifdef MYDEBUG
        std::cout << "this box is " << box << std::endl;
      #endif
      
      interval thisRange = fobj(box);
      
      #ifdef MYDEBUG
        std::cout << "this range is " << thisRange << std::endl;
      #endif
      
      #ifdef MYDEBUG
        std::cout << "this tolerance is " << tolerance << std::endl;
      #endif
      
      if ((realVolume(box) * cxsc::diam(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