本文整理汇总了C++中SiteList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ SiteList::count方法的具体用法?C++ SiteList::count怎么用?C++ SiteList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteList
的用法示例。
在下文中一共展示了SiteList::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invade_bond
bool invade_bond(Bond & inv_bond)
{
Site invSite = inv_bond.second.second;
if (invadedSites.count(invSite) > 0){
trapped.push_back(inv_bond);
return true;
}
double newStrength;
Site newNeighbor;
Bond newBond;
growth.push_back(inv_bond);
invadedSites.insert(invSite);
for (int dir=0; dir<6; dir++)
{
newNeighbor = get_neighbor(invSite, dir);
if (invadedSites.count(newNeighbor) == 0)
{
newStrength = drand48();
newBond = std::make_pair(newStrength, std::make_pair(invSite, newNeighbor));
accessibleBonds.insert(std::make_pair(newStrength, newBond));
}
}
return false;
}
示例2: invade_bond
bool invade_bond(Bond & inv_bond, double strength)
{
Site invSite = inv_bond.second;
if (invadedSites.count(invSite) > 0){
removed.push_back(std::make_pair(strength,inv_bond));
return true;
}
double newStrength;
Site newNeighbor;
Bond newBond;
growth.push_back(std::make_pair(strength,inv_bond));
invadedSites.insert(invSite);
for (int dir=0;dir<4;++dir)
{
newNeighbor = get_neighbor(invSite, dir);
if (invadedSites.count(newNeighbor) == 0)
{
newStrength = get_new_strength(dir);
if(newStrength < 1.0 || accessibleBonds.size() < 10000)
{
newBond = std::make_pair(invSite, newNeighbor);
accessibleBonds.insert(std::make_pair(newStrength, newBond));
}
}
}
return false;
}
示例3: invade_bond
void invade_bond(Bond & inv_bond)
{
Site invSite = inv_bond.second.second;
double newStrength;
double tempWeight = inv_bond.first;
Site newNeighbor;
Bond newBond;
growth.push_back(inv_bond);
std::deque<Bond> tempList;
for (int dir=0;dir<4;++dir)
{
newNeighbor = get_neighbor(invSite, dir);
if (invadedSites.count(newNeighbor) == 0)
{
newStrength = drand48();
tempWeight += newStrength;
newBond = std::make_pair(newStrength, std::make_pair(invSite, newNeighbor));
tempList.push_back(newBond);
}
}
invSite.weight = tempWeight;
invadedSites.insert(invSite);
if(invSite.weight < threshold)
{
while (!tempList.empty())
{
newBond = tempList.front();
tempList.pop_front();
accessibleBonds.insert(std::make_pair(newBond.first, newBond));
}
}
else
{
while (!tempList.empty())
{
newBond = tempList.front();
tempList.pop_front();
trapped.push_back(newBond);
}
};
}