Esempio n. 1
0
  INT_VECT GetBitFuncGroupIds(const FragCatalog *self,unsigned int idx){
    if(idx > self->getFPLength())
      throw_index_error(idx);
    INT_VECT res;
    INT_INT_VECT_MAP gps = self->getEntryWithBitId(idx)->getFuncGroupMap();
    for(INT_INT_VECT_MAP::const_iterator i=gps.begin();i!=gps.end();i++){
      for(INT_VECT_CI ivci=i->second.begin();ivci!=i->second.end();ivci++){
	res.push_back(*ivci);
      }
    }
    return res;
  }
Esempio n. 2
0
void pickFusedRings(int curr, const INT_INT_VECT_MAP &neighMap, INT_VECT &res,
                    boost::dynamic_bitset<> &done, int depth) {
  INT_INT_VECT_MAP::const_iterator pos = neighMap.find(curr);
  PRECONDITION(pos != neighMap.end(), "bad argument");
  done[curr] = 1;
  res.push_back(curr);

  const INT_VECT &neighs = pos->second;
#if 0
    std::cerr<<"depth: "<<depth<<" ring: "<<curr<<" size: "<<res.size()<<" neighs: "<<neighs.size()<<std::endl;
    std::cerr<<"   ";
    std::copy(neighs.begin(),neighs.end(),std::ostream_iterator<int>(std::cerr," "));
    std::cerr<<"\n";
#endif
  for (INT_VECT_CI ni = neighs.begin(); ni != neighs.end(); ++ni) {
    if (!done[*ni]) {
      pickFusedRings((*ni), neighMap, res, done, depth + 1);
    }
  }
}
Esempio n. 3
0
bool checkFused(const INT_VECT &rids, INT_INT_VECT_MAP &ringNeighs) {
  INT_INT_VECT_MAP_CI nci;
  int nrings = rdcast<int>(ringNeighs.size());
  boost::dynamic_bitset<> done(nrings);
  int rid;
  INT_VECT fused;

  // mark all rings in the system other than those in rids as done
  for (nci = ringNeighs.begin(); nci != ringNeighs.end(); nci++) {
    rid = (*nci).first;
    if (std::find(rids.begin(), rids.end(), rid) == rids.end()) {
      done[rid] = 1;
    }
  }

  // then pick a fused system from the remaining (i.e. rids)
  // If the rings in rids are fused we should get back all of them
  // in fused
  // if we get a smaller number in fused then rids are not fused
  pickFusedRings(rids.front(), ringNeighs, fused, done);

  CHECK_INVARIANT(fused.size() <= rids.size(), "");
  return (fused.size() == rids.size());
}