Generated on Mon Jun 23 16:24:56 2008 for BIU-1.7.0 by doxygen 1.5.1

src/biu/LatticeDescriptorCUB.cc

Go to the documentation of this file.
00001 #include <biu/LatticeDescriptorCUB.hh>
00002 #include <cstdlib>
00003 
00004 namespace biu
00005 {
00006     
00007     LatticeDescriptorCUB::LatticeDescriptorCUB() 
00008         : LatticeDescriptor("cub")
00009     {
00010         
00011         // gitterbasis
00012         latBase.push_back(IntPoint(1,0,0)); // x
00013         latBase.push_back(IntPoint(0,1,0)); // y
00014         latBase.push_back(IntPoint(0,0,1)); // z
00015         
00016         initNeighborhood();
00017         initAutomorphisms();
00018         
00019             // for faster "isElement" call use special neighborhood class
00020         assert(latNeighborhood != NULL);
00021         LatticeNeighborhood * tmp = new LatticeNeighborhoodCUB(*latNeighborhood);
00022         delete latNeighborhood;
00023         latNeighborhood = tmp;
00024     }
00025 
00026     LatticeDescriptorCUB::LatticeDescriptorCUB(const LatticeDescriptorCUB& toCopy)
00027         : LatticeDescriptor(toCopy)
00028     {
00029             // for faster "isElement" call use special neighborhood class
00030         assert(latNeighborhood != NULL);
00031         LatticeNeighborhood * tmp = new LatticeNeighborhoodCUB(*latNeighborhood);
00032         delete latNeighborhood;
00033         latNeighborhood = tmp;
00034     }
00035     
00036     LatticeDescriptorCUB::~LatticeDescriptorCUB() {
00037         // NOTE: automatically calls destructor of ancestor LatticeDescriptor 
00038     }
00039     
00040     unsigned int 
00041     LatticeDescriptorCUB::getNeighborDataSize() const {
00042         return 6;
00043     }
00044     
00045     const LatticeDescriptor::NeighborData *
00046     LatticeDescriptorCUB::getNeighborData() const {
00047         static const NeighborData cubicNeighborData[] = {
00048             {"F",{ 1, 0, 0},
00049              {{1,0,0},{0,1,0},{0,0,1}},  {{1,0,0},{0,1,0},{0,0,1}}},
00050             {"L",{ 0, 1, 0},
00051              {{0,-1,0},{1,0,0},{0,0,1}}, {{0,1,0},{-1,0,0},{0,0,1}}},
00052             {"U",{ 0, 0, 1},
00053              {{0,0,-1},{0,1,0},{1,0,0}}, {{0,0,1},{0,1,0},{-1,0,0}}},
00054             {"B",{-1, 0, 0},
00055              {{-1,0,0},{0,-1,0},{0,0,1}},{{-1,0,0},{0,-1,0},{0,0,1}}},
00056             {"R",{ 0,-1, 0},
00057              {{0,1,0},{-1,0,0},{0,0,1}}, {{0,-1,0},{1,0,0},{0,0,1}}},
00058             {"D",{ 0, 0,-1},
00059              {{0,0,1},{0,1,0},{-1,0,0}}, {{0,0,-1},{0,1,0},{1,0,0}}}
00060         };
00061         return cubicNeighborData;
00062     }
00063 
00064 
00065     unsigned int LatticeDescriptorCUB::getAutomorphismDataSize() const {
00066         return 48;
00067     }
00068 
00069     const LatticeDescriptorCUB::AutomorphismData *
00070     LatticeDescriptorCUB::getAutomorphismData() const {
00071         static const AutomorphismData data[] = 
00072             {{{1,0,0},{0,1,0},{0,0,1}}, {{0,0,1},{0,1,0},{1,0,0}},
00073              {{0,0,1},{0,1,0},{-1,0,0}}, {{0,0,1},{0,-1,0},{1,0,0}},
00074              {{0,0,1},{0,-1,0},{-1,0,0}}, {{0,0,1},{1,0,0},{0,1,0}},
00075              {{0,0,1},{1,0,0},{0,-1,0}}, {{0,0,1},{-1,0,0},{0,1,0}},
00076              {{0,0,1},{-1,0,0},{0,-1,0}}, {{0,0,-1},{0,1,0},{1,0,0}},
00077              {{0,0,-1},{0,1,0},{-1,0,0}}, {{0,0,-1},{0,-1,0},{1,0,0}},
00078              {{0,0,-1},{0,-1,0},{-1,0,0}}, {{0,0,-1},{1,0,0},{0,1,0}},
00079              {{0,0,-1},{1,0,0},{0,-1,0}}, {{0,0,-1},{-1,0,0},{0,1,0}},
00080              {{0,0,-1},{-1,0,0},{0,-1,0}}, {{0,1,0},{0,0,1},{1,0,0}},
00081              {{0,1,0},{0,0,1},{-1,0,0}}, {{0,1,0},{0,0,-1},{1,0,0}},
00082              {{0,1,0},{0,0,-1},{-1,0,0}}, {{0,1,0},{1,0,0},{0,0,1}},
00083              {{0,1,0},{1,0,0},{0,0,-1}}, {{0,1,0},{-1,0,0},{0,0,1}},
00084              {{0,1,0},{-1,0,0},{0,0,-1}}, {{0,-1,0},{0,0,1},{1,0,0}},
00085              {{0,-1,0},{0,0,1},{-1,0,0}}, {{0,-1,0},{0,0,-1},{1,0,0}},
00086              {{0,-1,0},{0,0,-1},{-1,0,0}}, {{0,-1,0},{1,0,0},{0,0,1}},
00087              {{0,-1,0},{1,0,0},{0,0,-1}}, {{0,-1,0},{-1,0,0},{0,0,1}},
00088              {{0,-1,0},{-1,0,0},{0,0,-1}}, {{1,0,0},{0,0,1},{0,1,0}},
00089              {{1,0,0},{0,0,1},{0,-1,0}}, {{1,0,0},{0,0,-1},{0,1,0}},
00090              {{1,0,0},{0,0,-1},{0,-1,0}}, {{1,0,0},{0,1,0},{0,0,-1}},
00091              {{1,0,0},{0,-1,0},{0,0,1}}, {{1,0,0},{0,-1,0},{0,0,-1}},
00092              {{-1,0,0},{0,0,1},{0,1,0}}, {{-1,0,0},{0,0,1},{0,-1,0}},
00093              {{-1,0,0},{0,0,-1},{0,1,0}}, {{-1,0,0},{0,0,-1},{0,-1,0}},
00094              {{-1,0,0},{0,1,0},{0,0,1}}, {{-1,0,0},{0,1,0},{0,0,-1}},
00095              {{-1,0,0},{0,-1,0},{0,0,1}}, {{-1,0,0},{0,-1,0},{0,0,-1}}};
00096         return data;
00097     }
00098     
00099 
00100     bool 
00101     LatticeDescriptorCUB::areNeighbored( const IntPoint &first, 
00102                                 const IntPoint &second ) const
00103     {
00104         int sum = abs(second.getX()-first.getX());
00105         return  sum < 2 
00106                 && (sum+=abs(second.getY()-first.getY())) < 2 
00107                 && (sum+=abs(second.getZ()-first.getZ())) == 1;
00108     }
00109     
00110 }