src/biu/LatticeDescriptorCUB.hh
Go to the documentation of this file.00001 #ifndef LATTICEDESCRIPTORCUB_HH_ 00002 #define LATTICEDESCRIPTORCUB_HH_ 00003 00004 00005 #include "LatticeDescriptor.hh" 00006 #include <cstdlib> 00007 00008 namespace biu 00009 { 00010 00016 class LatticeDescriptorCUB : public LatticeDescriptor 00017 { 00018 protected: 00019 00020 // abstract function implementation 00021 virtual unsigned int getNeighborDataSize() const; 00022 virtual const NeighborData *getNeighborData() const; 00023 virtual unsigned int getAutomorphismDataSize() const; 00024 virtual const AutomorphismData *getAutomorphismData() const; 00025 public: 00026 00027 LatticeDescriptorCUB(); 00028 LatticeDescriptorCUB(const LatticeDescriptorCUB& toCopy); 00029 virtual ~LatticeDescriptorCUB(); 00036 virtual bool areNeighbored( const IntPoint &first, 00037 const IntPoint &second ) const; 00038 }; 00039 00040 } 00041 00042 00043 namespace biu 00044 { 00050 class LatticeNeighborhoodCUB : public LatticeNeighborhood 00051 { 00052 public: 00053 LatticeNeighborhoodCUB( const MoveAlphabet* moveAlph, 00054 const NeighSet& neighbors) 00055 : LatticeNeighborhood(moveAlph, neighbors) 00056 { 00057 } 00058 00059 LatticeNeighborhoodCUB( const LatticeNeighborhood& nh ) 00060 : LatticeNeighborhood( nh ) 00061 { 00062 } 00063 00064 00065 virtual ~LatticeNeighborhoodCUB() 00066 {} 00068 virtual bool isElement( const IntPoint& v) const { 00069 int sum = abs(v.getX()); 00070 return sum < 2 00071 && (sum+=abs(v.getY())) < 2 00072 && (sum+=abs(v.getZ())) == 1; 00073 /* 00074 return (v.getX()* v.getX() + v.getY()*v.getY() + v.getZ()*v.getZ()) 00075 == 1; 00076 return (abs( v.getX() + v.getY() + v.getZ() ) == 1) && 00077 ((abs(v.getX()) == 1 && v.getY() == 0 && v.getZ() == 0) || 00078 (v.getX() == 0 && 00079 ((abs(v.getY()) == 1 && v.getZ() == 0) || 00080 (v.getY() == 0 && abs(v.getZ()) == 1))) 00081 ); 00082 */ 00083 } 00084 }; 00085 00086 } // namespace biu 00087 00088 00089 #endif /*LATTICEDESCRIPTORCUB_HH_*/