Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

HeapDefinition.hh

00001 #ifndef HEAPDEFINITIONS_HH
00002 #define HEAPDEFINITIONS_HH
00003 
00004 //=============================================================================
00005 
00006 #include <ACG/Utils/HeapT.hh>
00007 
00008 //-----------------------------------------------------------------------------
00009 //                       Heap Definitions
00010 //-----------------------------------------------------------------------------
00011 
00012 class HeapEntry
00013 {
00014 
00015 public:
00016   
00017   void set_index(int  _i, int  _j, int  _k) {i_ = _i;j_ = _j;k_ = _k;};
00018   void get_index(int& _i, int& _j, int& _k) {_i = i_;_j = j_;_k = k_;};
00019 
00020 private:
00021   
00022   int i_,j_,k_;  //index in volume
00023 
00024 };
00025 
00026 // ----------------- Heap-Entry-Type-------------------------------------------
00027 
00028 template <class Volume, class HelperVolume>
00029 struct MyHeapInterfaceT : public ACG::HeapInterfaceT<HeapEntry>
00030 {
00031 
00032 public:
00033   
00034   MyHeapInterfaceT(Volume& _volume, HelperVolume& _helper) : volume_(_volume),
00035                                                              helper_(_helper)
00036   { };
00037 
00038   ~MyHeapInterfaceT() {};
00039 
00041   bool less(HeapEntry _e1, HeapEntry _e2)
00042   {
00043     int i1,i2,j1,j2,k1,k2;
00044     _e1.get_index(i1,j1,k1);
00045     _e2.get_index(i2,j2,k2);
00046 
00047     return (volume_(i1,j1,k1) < volume_(i2,j2,k2));
00048   };
00049 
00051   bool greater(HeapEntry _e1, const HeapEntry _e2)
00052   {
00053     int i1,i2,j1,j2,k1,k2;
00054     _e1.get_index(i1,j1,k1);
00055     _e2.get_index(i2,j2,k2);
00056     
00057     return (volume_(i1,j1,k1) > volume_(i2,j2,k2));
00058   };
00059 
00061   int  get_heap_position(HeapEntry _e)
00062   {
00063     int i,j,k;
00064     _e.get_index(i,j,k);
00065     
00066     return (helper_(i,j,k).position());
00067 
00068   };
00069   
00071   void set_heap_position(HeapEntry _e, int _i)
00072   {
00073     int i,j,k;
00074     _e.get_index(i,j,k);
00075 
00076     helper_(i,j,k).set_position(_i);
00077   };
00078  
00079 private:
00080   
00081   Volume& volume_;
00082   HelperVolume& helper_;
00083 
00084 };
00085 
00086 //=============================================================================
00087 #endif // HEAPDEFINITIONS

Generated on Mon Jul 5 18:07:08 2004 for IsoEx by doxygen 1.3.6-20040222