Anaphe Home Page Reference Documentation

Main Page     Namespaces     Classes     Source Code    

I_Partition.h

Go to the documentation of this file.
00001 #ifndef _I_PARTITION_H_
00002 #define _I_PARTITION_H_ 1
00003 
00004 #include "HTL/H_Types.h"
00005 #include "HTL/Extra_Bin_Indexes.h"
00006 #include <math.h>
00007 
00009 class I_Partition
00010 {
00011 public:
00013   H_IID_IMPLEMENT( I_Partition );
00014 public:
00016     virtual Size bin_count() const = 0;
00017 
00022   Size extra_bin_count() const { return 3; }
00023 
00024 public:
00028   virtual double i_bin_width( Index i ) const = 0;
00029 
00031         virtual double i_lower_point() const = 0;
00032 
00034         virtual double i_upper_point() const = 0;
00035 
00037         virtual double i_lower_point( Index i ) const = 0;
00038 
00040         virtual double i_upper_point( Index i ) const = 0;
00041 
00043         virtual void map_point( double a_point, Index &an_index, 
00044                                 Extra_Index &an_extra_index ) = 0;
00045 public:
00047   virtual End_Point_Convention end_point_convention() const = 0;
00048 
00052   virtual bool is_compatible_with( I_Partition &other )
00053     {
00054       if( bin_count() != other.bin_count() )
00055         return false; /* Not compatible. */
00056       const double epsilon = 1e-08;
00057         double diff;
00058         for( Index i = 0; i<bin_count(); i++ ) {
00059           diff=fabs(i_lower_point(i) - other.i_lower_point(i));
00060           if (diff > epsilon )
00061             return false;
00062         }
00063         // Compatible.
00064         return true; 
00065     }
00066 protected:
00067         I_Partition() {}
00068         virtual ~I_Partition() {}
00069 };
00070 
00071 #endif // _I_PARTITION_H_
00072 


Anaphe documentation generated by Doxygen (www.doxygen.org)