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

src/biu/LatticeDescriptorSQR.cc

Go to the documentation of this file.
00001 #include <biu/LatticeDescriptorSQR.hh>
00002 #include <cstdlib>
00003 
00004 namespace biu
00005 {
00006 
00007     LatticeDescriptorSQR::LatticeDescriptorSQR() 
00008         : LatticeDescriptor("sqr")
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     
00020     LatticeDescriptorSQR::~LatticeDescriptorSQR() {
00021     }
00022 
00023     unsigned int 
00024     LatticeDescriptorSQR::getNeighborDataSize() const {
00025         return 4;
00026     }
00027     
00028     const LatticeDescriptor::NeighborData *
00029     LatticeDescriptorSQR::getNeighborData() const {
00030             // init
00031         static const NeighborData squareNeighborData[] = {
00032             {"F",{ 1, 0, 0},
00033              {{1,0,0},{0,1,0},{0,0,1}},  {{1,0,0},{0,1,0},{0,0,1}}},
00034             {"L",{ 0, 1, 0},
00035              {{0,-1,0},{1,0,0},{0,0,1}}, {{0,1,0},{-1,0,0},{0,0,1}}},
00036             {"B",{-1, 0, 0},
00037              {{-1,0,0},{0,-1,0},{0,0,1}},{{-1,0,0},{0,-1,0},{0,0,1}}},
00038             {"R",{ 0,-1, 0},
00039              {{0,1,0},{-1,0,0},{0,0,1}}, {{0,-1,0},{1,0,0},{0,0,1}}},
00040         };
00041         
00042         return squareNeighborData;
00043     }
00044 
00045     unsigned int LatticeDescriptorSQR::getAutomorphismDataSize() const {
00046         return 8;
00047     }
00048 
00049     const LatticeDescriptorSQR::AutomorphismData *
00050     LatticeDescriptorSQR::getAutomorphismData() const {
00051         static const AutomorphismData data[] = {
00052             /* rotations */
00053             {{1,0,0},{0,1,0},{0,0,1}},
00054             {{0,1,0},{1,0,0},{0,0,1}},
00055             {{-1,0,0},{0,-1,0},{0,0,1}},
00056             {{0,-1,0},{-1,0,0},{0,0,1}},
00057             /* reflections */
00058             {{-1,0,0},{0,-1,0},{0,0,1}},
00059             {{0,-1,0},{1,0,0},{0,0,1}},
00060             {{0,1,0},{-1,0,0},{0,0,1}},
00061             {{1,0,0},{0,-1,0},{0,0,1}},         
00062         };
00063         return data;
00064     }
00065 
00066     bool 
00067     LatticeDescriptorSQR::areNeighbored( const IntPoint &first, 
00068                                 const IntPoint &second ) const
00069     {
00070         int sum = abs(second.getX()-first.getX());
00071         return  sum < 2 
00072                 && (sum+=abs(second.getY()-first.getY())) < 2 
00073                 && (sum+=abs(second.getZ()-first.getZ())) == 1;
00074     }
00075     
00076 }   // namespace biu