Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

HashedPatternSet.cpp

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 /** @file
00003  */
00004 //----------------------------------------------------------------------------
00005 
00006 #include "HashedPatternSet.hpp"
00007 
00008 using namespace benzene;
00009 
00010 //----------------------------------------------------------------------------
00011 
00012 HashedPatternSet::HashedPatternSet()
00013     : m_godel_list(RingGodel::ValidGodels().size())
00014 {
00015 }
00016 
00017 HashedPatternSet::~HashedPatternSet()
00018 {
00019 }
00020 
00021 const RotatedPatternList& 
00022 HashedPatternSet::ListForGodel(const RingGodel& godel) const
00023 {
00024     return m_godel_list[godel.Index()];
00025 }
00026 
00027 void HashedPatternSet::hash(const PatternSet& patterns)
00028 {
00029     const std::vector<RingGodel>& valid_godels = RingGodel::ValidGodels();
00030 
00031     // hash each pattern rotation into the proper list
00032     for (unsigned i=0; i<patterns.size(); ++i) {
00033         const Pattern* pat = &patterns[i];
00034 
00035         for (int angle=0; angle<Pattern::NUM_SLICES; ++angle) {
00036             RotatedPattern rot(pat, angle);
00037 
00038             for (int h=0; h<(int)valid_godels.size(); ++h) {
00039                 RingGodel godel = valid_godels[h];
00040                 if (pat->RingGodel(angle).MatchesGodel(godel)) {
00041                     m_godel_list[h].push_back(rot);
00042                 }
00043             }
00044         }
00045     }
00046 }
00047 
00048 //----------------------------------------------------------------------------


6 Jan 2011 Doxygen 1.6.3