本文整理汇总了C++中boost::dynamic_bitset::set方法的典型用法代码示例。如果您正苦于以下问题:C++ dynamic_bitset::set方法的具体用法?C++ dynamic_bitset::set怎么用?C++ dynamic_bitset::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::dynamic_bitset
的用法示例。
在下文中一共展示了dynamic_bitset::set方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loopVisit
static bool loopVisit(const Block* b,
boost::dynamic_bitset<>& visited,
boost::dynamic_bitset<>& path) {
if (b == nullptr) return false;
auto const id = b->id();
// If we're revisiting a block in our current search, then we've
// found a backedge.
if (path.test(id)) return true;
// Otherwise if we're getting back to a block that's already been
// visited, but it hasn't been visited in this path, then we can
// prune this search.
if (visited.test(id)) return false;
visited.set(id);
path.set(id);
bool res = loopVisit(b->taken(), visited, path) ||
loopVisit(b->next(), visited, path);
path.set(id, false);
return res;
}
示例2: init_migrate_done_set
void table_manager::init_migrate_done_set(boost::dynamic_bitset<> &migrate_done_set, const vector<uint64_t> ¤t_state_table)
{
int bucket_number = 0;
for (size_t i=0; i<current_state_table.size(); i+=this->copy_count) {
bucket_number = (int)current_state_table[i++]; // skip the bucket_number
bool has_migrated = false;
for (size_t j=0; j<this->copy_count; ++j) {
if (current_state_table[i+j] != server_table[bucket_number + j * this->bucket_count]) {
has_migrated = true;
break;
}
}
if (has_migrated) {
migrate_done_set.set(bucket_number, true);
log_debug("bucket[%d] has migrated");
}
}
}
示例3: mark
bool mark (unsigned key)
{
if (flags_[key]) return false;
flags_.set(key);
return true;
}
示例4: setChildrenOnly
void setChildrenOnly(const uint vertex, const bool setting) { _childrenOnly.set(vertex, setting); }
示例5: if
std::vector<unsigned int> generateBondHashes(const ROMol &mol, boost::dynamic_bitset<>& atomsInPath,
const std::vector<const Bond *>& bondCache,
const std::vector<short>& isQueryBond,
const PATH_TYPE &path, bool useBondOrder,
std::vector<boost::uint32_t> *atomInvariants){
PRECONDITION(!atomInvariants || atomInvariants->size() >= mol.getNumAtoms(),
"bad atomInvariants size");
std::vector<unsigned int> bondHashes;
atomsInPath.reset();
bool queryInPath=false;
std::vector<unsigned int> atomDegrees(mol.getNumAtoms(),0);
for(unsigned int i=0;i<path.size() && !queryInPath;++i){
const Bond *bi = bondCache[path[i]];
atomDegrees[bi->getBeginAtomIdx()]++;
atomDegrees[bi->getEndAtomIdx()]++;
atomsInPath.set(bi->getBeginAtomIdx());
atomsInPath.set(bi->getEndAtomIdx());
if(isQueryBond[path[i]]) queryInPath=true;
}
if(queryInPath){
return bondHashes;
}
// -----------------
// calculate the bond hashes:
std::vector<unsigned int> bondNbrs(path.size(),0);
bondHashes.reserve(path.size()+1);
for(unsigned int i=0;i<path.size();++i){
const Bond *bi = bondCache[path[i]];
#ifdef REPORT_FP_STATS
if (std::find(atomsToUse.begin(), atomsToUse.end(),
bi->getBeginAtomIdx()) == atomsToUse.end()) {
atomsToUse.push_back(bi->getBeginAtomIdx());
}
if (std::find(atomsToUse.begin(), atomsToUse.end(),
bi->getEndAtomIdx()) == atomsToUse.end()) {
atomsToUse.push_back(bi->getEndAtomIdx());
}
#endif
for(unsigned int j=i+1;j<path.size();++j){
const Bond *bj = bondCache[path[j]];
if(bi->getBeginAtomIdx()==bj->getBeginAtomIdx() ||
bi->getBeginAtomIdx()==bj->getEndAtomIdx() ||
bi->getEndAtomIdx()==bj->getBeginAtomIdx() ||
bi->getEndAtomIdx()==bj->getEndAtomIdx() ){
++bondNbrs[i];
++bondNbrs[j];
}
}
#ifdef VERBOSE_FINGERPRINTING
std::cerr << " bond(" << i << "):" << bondNbrs[i] << std::endl;
#endif
// we have the count of neighbors for bond bi, compute its hash:
unsigned int a1Hash = (*atomInvariants)[bi->getBeginAtomIdx()];
unsigned int a2Hash = (*atomInvariants)[bi->getEndAtomIdx()];
unsigned int deg1=atomDegrees[bi->getBeginAtomIdx()];
unsigned int deg2=atomDegrees[bi->getEndAtomIdx()];
if(a1Hash<a2Hash){
std::swap(a1Hash,a2Hash);
std::swap(deg1,deg2);
}
else if(a1Hash==a2Hash && deg1<deg2){
std::swap(deg1,deg2);
}
unsigned int bondHash=1;
if(useBondOrder){
if(bi->getIsAromatic() || bi->getBondType()==Bond::AROMATIC){
// makes sure aromatic bonds always hash as aromatic
bondHash = Bond::AROMATIC;
}
else {
bondHash = bi->getBondType();
}
}
boost::uint32_t ourHash=bondNbrs[i];
gboost::hash_combine(ourHash,bondHash);
gboost::hash_combine(ourHash,a1Hash);
gboost::hash_combine(ourHash,deg1);
gboost::hash_combine(ourHash,a2Hash);
gboost::hash_combine(ourHash,deg2);
bondHashes.push_back(ourHash);
//std::cerr<<" "<<bi->getIdx()<<" "<<a1Hash<<"("<<deg1<<")"<<"-"<<a2Hash<<"("<<deg2<<")"<<" "<<bondHash<<" -> "<<ourHash<<std::endl;
}
return bondHashes;
}
示例6: filterParticles
/******************************************************************************
* Performs the actual rejection of particles.
******************************************************************************/
size_t SliceModifier::filterParticles(boost::dynamic_bitset<>& mask, TimePoint time, TimeInterval& validityInterval)
{
// Get the required input properties.
ParticlePropertyObject* const posProperty = expectStandardProperty(ParticleProperty::PositionProperty);
ParticlePropertyObject* const selProperty = applyToSelection() ? inputStandardProperty(ParticleProperty::SelectionProperty) : nullptr;
OVITO_ASSERT(posProperty->size() == mask.size());
OVITO_ASSERT(!selProperty || selProperty->size() == mask.size());
FloatType sliceWidth = 0;
if(_widthCtrl) sliceWidth = _widthCtrl->getFloatValue(time, validityInterval);
sliceWidth *= 0.5;
Plane3 plane = slicingPlane(time, validityInterval);
size_t na = 0;
boost::dynamic_bitset<>::size_type i = 0;
const Point3* p = posProperty->constDataPoint3();
const Point3* p_end = p + posProperty->size();
if(sliceWidth <= 0) {
if(selProperty) {
const int* s = selProperty->constDataInt();
for(; p != p_end; ++p, ++s, ++i) {
if(*s && plane.pointDistance(*p) > 0) {
mask.set(i);
na++;
}
else mask.reset(i);
}
}
else {
for(; p != p_end; ++p, ++i) {
if(plane.pointDistance(*p) > 0) {
mask.set(i);
na++;
}
else mask.reset(i);
}
}
}
else {
bool invert = inverse();
if(selProperty) {
const int* s = selProperty->constDataInt();
for(; p != p_end; ++p, ++s, ++i) {
if(*s && invert == (plane.classifyPoint(*p, sliceWidth) == 0)) {
mask.set(i);
na++;
}
else mask.reset(i);
}
}
else {
for(; p != p_end; ++p, ++i) {
if(invert == (plane.classifyPoint(*p, sliceWidth) == 0)) {
mask.set(i);
na++;
}
else mask.reset(i);
}
}
}
return na;
}