1 // -*- c++ -*- 2 //***************************************************************************** 3 /** @file PairStatusSet.h 4 * 5 * @author Michael Brickenstein 6 * @date 2011-06-29 7 * 8 * This file includes the definition of the class @c PairStatusSet. 9 * 10 * @par Copyright: 11 * (c) 2006-2010 by The PolyBoRi Team 12 * 13 **/ 14 //***************************************************************************** 15 16 #ifndef polybori_groebner_PairStatusSet_h_ 17 #define polybori_groebner_PairStatusSet_h_ 18 19 // include basic definitions 20 #include "groebner_defs.h" 21 22 #include <boost/dynamic_bitset.hpp> 23 24 BEGIN_NAMESPACE_PBORIGB 25 26 /** @class PairStatusSet 27 * @brief This class defines PairStatusSet. 28 * 29 **/ 30 class PairStatusSet{ 31 public: 32 typedef boost::dynamic_bitset<> bitvector_type; hasTRep(int ia,int ja)33 bool hasTRep(int ia, int ja) const { 34 int i,j; 35 i=std::min(ia,ja); 36 j=std::max(ia,ja); 37 return table[j][i]==HAS_T_REP; 38 } setToHasTRep(int ia,int ja)39 void setToHasTRep(int ia, int ja){ 40 int i,j; 41 i=std::min(ia,ja); 42 j=std::max(ia,ja); 43 table[j][i]=HAS_T_REP; 44 } 45 46 template <class Iterator> setToHasTRep(Iterator start,Iterator finish,int ja)47 void setToHasTRep(Iterator start, Iterator finish, int ja){ 48 for (; start != finish; ++start) 49 setToHasTRep(*start, ja); 50 } setToUncalculated(int ia,int ja)51 void setToUncalculated(int ia, int ja){ 52 int i,j; 53 i=std::min(ia,ja); 54 j=std::max(ia,ja); 55 table[j][i]=UNCALCULATED; 56 } 57 58 template <class Iterator> setToUncalculated(Iterator start,Iterator finish,int ja)59 void setToUncalculated(Iterator start, Iterator finish, int ja){ 60 for (; start != finish; ++start) 61 setToUncalculated(*start, ja); 62 } 63 64 int prolong(bool value=UNCALCULATED){ 65 int s=table.size(); 66 table.push_back(bitvector_type(s, value)); 67 return s; 68 } 69 PairStatusSet(int size=0){ 70 int s=0; 71 for(s=0;s<size;s++){ 72 prolong(); 73 } 74 } 75 static const bool HAS_T_REP=true; 76 static const bool UNCALCULATED=false; 77 78 protected: 79 std::vector<bitvector_type> table; 80 }; 81 82 END_NAMESPACE_PBORIGB 83 84 #endif /* polybori_PairStatusSet_h_ */ 85